Skip to content

uniqueArray()

uniqueArray<T>(array): T[]

Defined in: src/utils/arrayUtils.ts:48

Removes duplicate elements from an array.

Type Parameters

T

The type of elements in the array.

Parameters

array

T[]

The array to process.

Returns

T[]

A new array with all duplicates removed.

Example

typescript
const data = [1, 2, 2, 3, 4, 4, 5];
const unique = uniqueArray(data);
console.log(unique); // [1, 2, 3, 4, 5]

Released under the MIT License.