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