array-unique
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The array-unique npm package is a highly efficient ES5 implementation primarily used for removing duplicate values from an array. When you consider the fact that handling large data sets frequently involves managing arrays, the ability to swiftly and effectively eliminate duplicate values becomes paramount. array-unique offers precisely this capability, improving productivity and enhancing efficiency.
To begin using the array-unique package, start by installing it via npm with the following command:
$ npm install --save array-unique
Next, require the array-unique package in your JavaScript file:
var unique = require('array-unique');
Now, you should be able to apply the package to remove duplicates from any array. For example:
var arr = ['a', 'b', 'c', 'c'];
console.log(unique(arr)) // Output: ['a', 'b', 'c']
Note that by default, array-unique modifies the input array. To retain the original array unchanged (at a slight cost to performance), use the immutable version:
var unique = require("array-unique").immutable;
Here, the original array remains intact:
var arr = ['a', 'b', 'c', 'c'];
console.log(unique(arr)) // Output: ['a', 'b', 'c']
console.log(arr) // Output: ['a', 'b', 'c', 'c']
The documentation for array-unique can be found on its GitHub page here. This readme provides robust details on the package, including installation instructions, usage examples, and a description of the package’s primary function. For those who wish to contribute to the package, the readme also provides clear guidance, making it an all-inclusive resource for both new and existing users of array-unique.