Wondering what’s next for npm?Check out our public roadmap! »

    @goa/is-generator-function

    1.0.2 • Public • Published

    @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


    Art Deco © Art Deco for Idio 2019 Idio Tech Nation Visa Tech Nation Visa Sucks

    Install

    npm i @goa/is-generator-function

    DownloadsWeekly Downloads

    7

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    7.9 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar