Creates a unique array by removing all duplicate values from the given array.
It uses isEql for deep comparison of values.
Syntax
import { uniq } from '@opentf/std';
uniq<T>(
arr: T[] = [],
by?: (val: T) => unknown
): Partial<T[]>
Examples
const arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5];
uniq(arr) //=> [1, 2, 3, 4, 5]
const arr = [2.1, 1.2, 2.3];
uniq(a, Math.floor) //=> [2.1, 1.2]