GitHub 6248★

Check if a value is a generator function

JavaScript version

const isGeneratorFunction = (v) => Object.prototype.toString.call(v) === '[object GeneratorFunction]';

Examples

isGeneratorFunction(function () {}); // false
isGeneratorFunction(function* () {}); // true
Follow me on and to get more useful contents.