Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-generator-fn

sindresorhus102.6mMIT3.0.0TypeScript support: included

Check if something is a generator function

generator, function, func, fn, is, check, detect, yield, type

readme

is-generator-fn

Check if something is a generator function

Install

$ npm install is-generator-fn

Usage

import isGeneratorFunction from 'is-generator-fn';

isGeneratorFunction(function * () {});
//=> true

isGeneratorFunction(function () {});
//=> false
  • is - Type check values