/is-generator

Tests whether a function is an generator.

Primary LanguageJavaScriptMIT LicenseMIT

is-generator

Tests whether a function is an generator.

Install

npm i @urban/is-generator

Usage

import isGenerator from '@urban/is-generator'

function * gen () {}
function noop () {}

isGenerator(gen) // => true
isGenerator(noop) // => false

License

The MIT License (MIT). Copyright (c) Urban Faubion.