GraphReFlyTS

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

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.

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