Skip to main content
isGeneratorFunction - node__util--types.d.ts - Node documentation
function isGeneratorFunction

Usage in Deno

```typescript import { isGeneratorFunction } from "node:node__util--types.d.ts"; ```
isGeneratorFunction(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. ```js util.types.isGeneratorFunction(function foo() {}); // Returns false util.types.isGeneratorFunction(function* foo() {}); // Returns true ```

Parameters

object: unknown

Return Type

object is GeneratorFunction