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

Usage in Deno

```typescript import { isGeneratorObject } from "node:node__util--types.d.ts"; ```
isGeneratorObject(object: unknown): object is Generator
Returns `true` if the value is a generator object as returned from a built-in 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 function* foo() {} const generator = foo(); util.types.isGeneratorObject(generator); // Returns true ```

Parameters

object: unknown

Return Type

object is Generator