sortedUniq
arrayThis method is like uniq except that it's designed and optimized for sorted arrays.
Signature
sortedUniq<T>(array: T[]): T[]Parameters
| Name | Type | Description |
|---|---|---|
array | T[] | The sorted array to inspect |
Returns
T[] - Returns the new duplicate free array
Examples
Remove duplicates from sorted array
import { sortedUniq } from 'dashlite'
const result = sortedUniq([1, 1, 2])
console.log(result)Output:
[1, 2]Available since version 1.0.0