You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
3 years ago | |
|---|---|---|
| .. | ||
| .npmignore | 3 years ago | |
| .travis.yml | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| is-generator.js | 3 years ago | |
| package.json | 3 years ago | |
| test.js | 3 years ago | |
README.md
Is Generator
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.
Installation
npm install is-generator --save
Usage
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
License
MIT