UNPKG

foop

Version:

interfaces that describe their intentions.

23 lines (21 loc) 499 B
const toS = require('./toS') /** * @desc is generator function * @since 4.0.0-beta.2 * @param {*} x value to check * @return {boolean} x isGenerator * * @alternate fn.constructor.name === 'GeneratorFunction' * * {@link https://github.com/jonschlinkert/kind-of/blob/master/index.js#L66} * @see {@link kind-of} * * @example * * isGenerator(*function() {}) * //=> true * isGenerator(function() {}) * //=> false * */ module.exports = x => toS(x) === '[object GeneratorFunction]'