|
há 1 ano atrás | |
---|---|---|
.. | ||
.npmignore | há 1 ano atrás | |
.travis.yml | há 1 ano atrás | |
LICENSE | há 1 ano atrás | |
README.md | há 1 ano atrás | |
is-generator.js | há 1 ano atrás | |
package.json | há 1 ano atrás | |
test.js | há 1 ano atrás |
Check whether a value is a generator or generator function.
Generator: A specific type of iterator object. Reference.
Generator Function: A function*
declaration, returns a generator object. Reference.
npm install is-generator --save
var isGenerator = require('is-generator')
var isGeneratorFn = require('is-generator').fn
isGenerator(null) //=> false
isGenerator(function * () {}) //=> false
isGenerator((function * () {})()) //=> true
isGeneratorFn(null) //=> false
isGeneratorFn(function () {}) //=> false
isGeneratorFn(function * () {}) //=> true
MIT