@goa/is-generator-function
v1.0.2
Published
[fork] Checks If The Function Is An ES6 Generator.
Downloads
32
Maintainers
Readme
@goa/is-generator-function
@goa/is-generator-function
is a fork that Checks If The Function Is An ES6 Generator written in ES6 modules.
The original module has been updated to be used in @goa/koa
: Koa web server compiled with Google Closure Compiler using Depack into a single file library (0 dependencies).
yarn add @goa/is-generator-function
Table Of Contents
API
The package is available by importing its default function:
import isGeneratorFunction from '@goa/is-generator-function'
isGeneratorFunction(
fn: function,
): boolean
Checks if the function is a generator function.
import isGeneratorFunction from '@goa/is-generator-function'
console.log(isGeneratorFunction(function * generator() {} ))
console.log(isGeneratorFunction({ * generator() {} }.generator))
console.log(isGeneratorFunction(() => console.log('example')))
true
true
false
Copyright
Original Author: Jordan Harband