Skip to content
PACKAGES

first()

first: emit the first value matching pred (or simply the first value), then COMPLETE. EDGE (RxJS divergence, flagged — same class as last/find/elementAt): if the source COMPLETEs with no matching value, the substrate auto-cascades a bare COMPLETE (no value); RxJS first() throws EmptyError. Could align to [[ERROR, EmptyError]] (expressible) if strict RxJS parity is wanted.

import { first } from "@graphrefly/ts/operators";
function first(pred?: (v: S) => boolean): Operator<S, S>
ParameterTypeDescription
pred(v: S) => booleanpred value used by the helper.

A Operator<S, S> value.

import { first } from "@graphrefly/ts/operators";

packages/ts/src/graph/operators.ts