Saltar al contenido principal

Function: useUnique()

useUnique<T>(array): T[]

Defined in: src/core/services/utils.service.ts:14

Returns a new array with duplicate values removed, preserving first-seen order.

Type Parameters

T

T

Element type.

Parameters

array

T[]

The input array.

Returns

T[]

A new array with unique values.

Example

useUnique([1, 2, 2, 3, 1]); // [1, 2, 3]
useUnique(["a", "b", "a"]); // ["a", "b"]