All Projects → blakeembrey → is-generator

blakeembrey / is-generator

Licence: MIT license
Check whether a given value is a generator function

Programming Languages

javascript
184084 projects - #8 most used programming language

Is Generator

NPM version NPM downloads Build status Test coverage Greenkeeper badge

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].