Skip to main content
Module

x/structurae/sorted-array.ts>SortedArray.getUnique

Data structures for high-performance JavaScript applications.
Latest
method SortedArray.getUnique
import { SortedArray } from "https://deno.land/x/structurae@4.0.1/sorted-array.ts";

Returns an array of unique elements from a sorted array.

Examples

SortedArray.getUnique([1, 1, 2, 2, 3, 4]); //=> [ 1, 2, 3, 4 ]

Parameters

the sorted array

optional
comparator: Comparator<T> = [UNSUPPORTED]
optional
container: U = [UNSUPPORTED]

Returns

container

the sorted array without duplicates