index.js 275 B

123456789101112
  1. 'use strict';
  2. var toString = Object.prototype.toString;
  3. module.exports = function (fn) {
  4. if (typeof fn !== 'function') {
  5. return false;
  6. }
  7. return (fn.constructor && fn.constructor.name === 'GeneratorFunction') ||
  8. toString.call(fn) === '[object GeneratorFunction]';
  9. };