@epikodelabs/streamix / src/public-api / distinctUntilChanged
Function: distinctUntilChanged()
distinctUntilChanged<
T>(comparator?):Operator<T,T>
Defined in: projects/libraries/streamix/src/lib/operators/distinctUntilChanged.ts:15
Creates a stream operator that emits values from the source stream only if they are different from the previous value.
Consecutive duplicate values are simply not emitted downstream.
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.