sortedUniqBy
arrayThis method is like uniqBy except that it's designed and optimized for sorted arrays.
Signature
sortedUniqBy<T, U>(array: T[], iteratee: (value: T) => U): U[]Parameters
| Name | Type | Description |
|---|---|---|
array | T[] | The sorted array to inspect |
iteratee | (value: T) => U | The iteratee invoked per element |
Returns
U[] - Returns the new duplicate free array
Examples
With iteratee
import { sortedUniqBy } from 'dashlite'
const result = sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor)
console.log(result)Output:
[1, 2]Available since version 1.0.0