array-uniq-x

Creates a duplicate-free version of an array, using SameValueZero for equality comparisons.

Usage no npm install needed!

<script type="module">
  import arrayUniqX from 'https://cdn.skypack.dev/array-uniq-x';
</script>

README

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

array-uniq-x

Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is determined by the order they occur in the array.

module.exports*

This method is just a placeholder.

Kind: Exported member
Returns: Array - Returns the new duplicate free array.

Param Type Description
array Array The array to inspect.
[useSameValue] Boolean Alternative comparison.

Example

import uniq from 'array-uniq-x';

console.log(uniq([2, 1, 2])); // [2, 1]
console.log(uniq([-0, 0])); // [0]
console.log(uniq([-0, 0], true)); // [-0, 0]