Skip to main content

isGeneratorFunction

function isGeneratorFunction
Jump to headingisGeneratorFunction(object: unknown): object is GeneratorFunction

Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used.

util.types.isGeneratorFunction(function foo() {});  // Returns false
util.types.isGeneratorFunction(function* foo() {});  // Returns true

Parameters Jump to heading

Jump to headingobject: unknown

Return Type Jump to heading

object is GeneratorFunction
Back to top