Skip to content
PACKAGES

distinctUntilChanged()

Suppress consecutive duplicate values.

import { distinctUntilChanged } from "@graphrefly/ts/operators";
function distinctUntilChanged(eq: (a: S, b: S) => boolean = Object.is): Operator<S, S>
ParameterTypeDescription
eq(a: S, b: S) => booleanEquality predicate; defaults to Object.is.

An operator that emits only when the next value differs from the previous emitted value.

import { graph } from "@graphrefly/ts/graph";
import { distinctUntilChanged } from "@graphrefly/ts/operators";
const stable = graph().initNode(distinctUntilChanged<number>(), [source]);

packages/ts/src/graph/operators.ts