|
|
il y a 2 ans | |
|---|---|---|
| .. | ||
| .npmignore | il y a 2 ans | |
| .travis.yml | il y a 2 ans | |
| LICENSE | il y a 2 ans | |
| README.md | il y a 2 ans | |
| is-generator.js | il y a 2 ans | |
| package.json | il y a 2 ans | |
| test.js | il y a 2 ans | |
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