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
Section titled “Import”import { first } from "@graphrefly/ts/operators";Signature
Section titled “Signature”function first(pred?: (v: S) => boolean): Operator<S, S>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
pred | (v: S) => boolean | pred value used by the helper. |
Returns
Section titled “Returns”A Operator<S, S> value.
Example
Section titled “Example”import { first } from "@graphrefly/ts/operators";Source
Section titled “Source”packages/ts/src/graph/operators.ts