Needful Program Management
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

is-generator

1.0.3 • Public • Published

Is Generator

NPM version NPM downloads Build status Test coverage

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

install

npm i is-generator

Downloadsweekly downloads

53,093

version

1.0.3

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar