GraphReFlyTS

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

ParameterTypeDescription
eq(a: S, b: S) => booleanEquality 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