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