Function: unique()
unique<
T>(array):T[]
Defined in: collection.ts:67
Returns a new array containing only the unique values from the given array, preserving order.
Type Parameters
T
T
Parameters
array
T[]
The array to filter.
Returns
T[]
A new array with duplicate values removed.
Example
ts
unique([1, 2, 2, 3, 1]) // [1, 2, 3]
unique(['a', 'b', 'a', 'c']) // ['a', 'b', 'c']
unique([]) // []