API Reference
distinctUntilChanged()
Suppress consecutive duplicate values.
Import
import { distinctUntilChanged } from "@graphrefly/ts/operators";
Signature
function distinctUntilChanged(eq: (a: S, b: S) => boolean = Object.is): Operator<S, S>
Parameters
| Parameter | Type | Description |
|---|---|---|
eq | (a: S, b: S) => boolean | Equality predicate; defaults to Object.is. |
Returns
An operator that emits only when the next value differs from the previous emitted value.
Example
import { graph } from "@graphrefly/ts/graph";
import { distinctUntilChanged } from "@graphrefly/ts/operators";
const stable = graph().initNode(distinctUntilChanged<number>(), [source]);
Source
packages/ts/src/graph/operators.ts