$ cnpm install is-es6-generators
Check whether a value is a
GeneratororGeneratorFunction. The co() way, more strict checking. Always return boolean true or false, never null or undefined.
npm i is-es6-generators --save
npm test
For more use-cases see the tests
var isGenerator = require('is-es6-generators')
var isGeneratorFunction = require('is-es6-generators').fn
var generator = (function * () {})()
var generatorFunction = function * () {yield 42}
isGenerator(null) //=> false
isGenerator(undefined) //=> false
isGenerator([1, 2, 3]) //=> false
isGenerator({name: 'GeneratorFunction'}) //=> false
isGenerator(25) //=> false
isGenerator('test') //=> false
isGenerator(generatorFunction) //=> false
isGenerator(generator), true)
isGeneratorFunction(null) //=> false
isGeneratorFunction(generatorFunction) //=> true
isGeneratorFunction(generator) //=> false
GeneratorGeneratorFunctionGeneratorFunction name… more.name or user/repo exists in npm registry or in github as… morekind-of module.helper-related for generating a list of links to the… morePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.
Copyright 2013 - present © cnpmjs.org | Home |