take()
Emit the first n upstream values, then complete.
Import
Section titled “Import”import { take } from "@graphrefly/ts/operators";Signature
Section titled “Signature”function take(n: number): Operator<S, S>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
n | number | Number of DATA values to pass before completion. |
Returns
Section titled “Returns”An operator that forwards at most n values and then emits COMPLETE.
Example
Section titled “Example”import { graph } from "@graphrefly/ts/graph";import { take } from "@graphrefly/ts/operators";
const firstThree = graph().initNode(take<number>(3), [source]);Source
Section titled “Source”packages/ts/src/graph/operators.ts