Array
/ API Reference
Array
/ API Reference

unique

Creates a duplicate-free version of an array.

The Gist

import { unique } from '@weser/array'

const uniqueArray = unique([1, 2, 2, 3, 1])

// => [1, 2, 3]
console.log(uniqueArray)

Parameters

ParameterTypeDescription
arrArray<T>The array to inspect.

Returns

(Array<T>) Returns the new duplicate-free array.

On this page