array-union
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Array-union is a handy npm package specifically designed to create an array of unique values from the given input arrays. This ensures that the output array is in order and does not contain any duplicate entries.
Array-union is extremely straightforward to use. After installing with npm by typing npm install array-union
, you can start to use it in your JavaScript file. Consider the examples below:
import arrayUnion from 'array-union';
arrayUnion([1, 1, 2, 3], [2, 3]);
// Output will be [1, 2, 3]
arrayUnion(['foo', 'foo', 'bar']);
// Output will be ['foo', 'bar']
arrayUnion(['π±', 'π¦', 'π»'], ['π¦', 'π']);
// Output will be ['π±', 'π¦', 'π»', 'π']
arrayUnion(['π±', 'π¦'], ['π»', 'π¦'], ['πΆ', 'π', 'π']);
// Output will be ['π±', 'π¦', 'π»', 'πΆ', 'π']
It's worth noting that array-union function can take any number of arrays as arguments and even supports arrays of different data types.
The array-union package documentation is available in the readme file found on the package's GitHub page: git+https://github.com/sindresorhus/array-union.git
. It offers a comprehensive overview of how to install and use the package, complete with relevant examples of array-union in action.