Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 387 Bytes

check-if-a-value-is-a-generator-function.mdx

File metadata and controls

18 lines (14 loc) · 387 Bytes
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