Returns an OperationFunction that yields elements from the source that are distinct from the previous element based on the key.
Type of items in the source.
Key to compare elements.
Optional
Function to compare elements.
An OperationFunction that yields elements from the source that are distinct from the previous element based on the key.
const result = distinctUntilKeyChanged('a')([{ a: 1 }, { a: 1 }, { a: 2 }, { a: 2 }, { a: 3 }, { a: 3 }]);console.log([...result]); // [{ a: 1 }, { a: 2 }, { a: 3 }] Copy
const result = distinctUntilKeyChanged('a')([{ a: 1 }, { a: 1 }, { a: 2 }, { a: 2 }, { a: 3 }, { a: 3 }]);console.log([...result]); // [{ a: 1 }, { a: 2 }, { a: 3 }]
Returns an OperationFunction that yields elements from the source that are distinct from the previous element based on the key.