category | created | title |
---|---|---|
Function |
2020-05-15 |
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