array-uniq-x
v1.0.2
Published
Creates a duplicate-free version of an array, using SameValueZero for equality comparisons.
Downloads
6
Maintainers
Readme
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]