API Reference
pipe()
Compose unary operator factories into a graph-registered chain.
Import
import { pipe } from "@graphrefly/ts/composition";
Signature
function pipe(
g: Graph,
source: Node<unknown>,
...ops: readonly PipeOperator<unknown, unknown>[],
): Node<unknown>
Parameters
| Parameter | Type | Description |
|---|---|---|
g | Graph | Graph that owns the registered operator nodes. |
source | Node<unknown> | Upstream node to start from. |
ops | readonly PipeOperator<unknown, unknown>[] | Unary operator factories to apply in order. |
Returns
The node produced by the last operator in the chain.
Example
const doubled = pipe(g, source, map((value: number) => value * 2));
Source
packages/ts/src/graph/composition.ts