@epikodelabs/streamix / distinctUntilChanged
Function: distinctUntilChanged()
distinctUntilChanged<
T>(comparator?):Operator<T,T>
Defined in: projects/libraries/streamix/src/lib/operators/distinctUntilChanged.ts:17
Creates a stream operator that emits values from the source stream only if they are different from the previous value.
Consecutive duplicate values are yielded with dropped: true so that backpressure is released and downstream operators can observe the suppressed emissions without treating them as real values.
Type Parameters
T
T = any
The type of the values in the stream.
Parameters
comparator?
(prev, curr) => MaybePromise<boolean>
An optional function that compares the previous and current values. It should return true if they are considered the same, and false otherwise. If not provided, a strict equality check (===) is used.
Returns
Operator<T, T>
An Operator<T, T> instance that can be used in a stream's pipe method.