1.0.0 • Published 5 years ago

is-gen-func v1.0.0

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

is-gen-func

CircleCI NPM Downloads node License MIT

Check if value is a generator function or an async generator function

Highlights

  • Written in Typescript

  • Supports async and sync generator functions

Installation

npm:

$ npm install is-gen-func

yarn:

$ yarn add is-gen-func

Usage

Check if value is a generator function

  const { isGenFunc } = require('is-gen-func');

  isGenFunc(function *() {
    return 'hello world';
  });
  //=> true

  isGenFunc(function () {
    return 'hello world';
  });
  //=> false

  isGenFunc(async function *() {
    return 'hello world';
  });
  //=> true

  isGenFunc(async function () {
    return 'hello world';
  });
  //=> false

License

MIT © Nivrith