Only emit values of an Iterable that have not been emitted yet.
The values are by default compared by identity (===). An optional Mapper function can be used to map the values to a different representation for the comparison.
===
Distinct by value
const distinctByValue = distinct();const distinctValues = distinctByValue([1,2,1,3]);console.log(distinctValues); // [1,2,3]
Distinct by keyMapper Function
keyMapper
const distinctByValue = distinct(isEven);const distinctValues = distinctByValue([1,2,1,3]);console.log(distinctValues); // [1,2]
filter for similar operations.
an Iterable containing only unique values
the Iterable value type
Optional
a Function that maps an element into a key
Generated using TypeDoc
Only emit values of an Iterable that have not been emitted yet.
The values are by default compared by identity (
===). An optional Mapper function can be used to map the values to a different representation for the comparison.Example
Distinct by value
Example
Distinct by
keyMapperFunctionSee
filter for similar operations.
Returns
an Iterable containing only unique values