@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
© Art Deco for Idio 2019 | Tech Nation Visa Sucks |
---|