Skip to content
PACKAGES

pipe()

Compose unary operator factories into a graph-registered chain.

import { pipe } from "@graphrefly/ts/composition";
function pipe(
g: Graph,
source: Node<unknown>,
...ops: readonly PipeOperator<unknown, unknown>[],
): Node<unknown>
ParameterTypeDescription
gGraphGraph that owns the registered operator nodes.
sourceNode<unknown>Upstream node to start from.
opsreadonly PipeOperator<unknown, unknown>[]Unary operator factories to apply in order.

The node produced by the last operator in the chain.

const doubled = pipe(g, source, map((value: number) => value * 2));

packages/ts/src/graph/composition.ts