1.0.2 • Published 5 years ago

@goa/is-generator-function v1.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

@goa/is-generator-function

npm version

@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