2022-01-21 08:28:41 +00:00
|
|
|
# array-union [![Build Status](https://travis-ci.org/sindresorhus/array-union.svg?branch=master)](https://travis-ci.org/sindresorhus/array-union)
|
|
|
|
|
|
|
|
> Create an array of unique values, in order, from the input arrays
|
|
|
|
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
```
|
2023-08-17 09:47:40 +00:00
|
|
|
$ npm install array-union
|
2022-01-21 08:28:41 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```js
|
|
|
|
const arrayUnion = require('array-union');
|
|
|
|
|
|
|
|
arrayUnion([1, 1, 2, 3], [2, 3]);
|
|
|
|
//=> [1, 2, 3]
|
|
|
|
|
2023-08-17 09:47:40 +00:00
|
|
|
arrayUnion(['foo', 'foo', 'bar']);
|
2022-01-21 08:28:41 +00:00
|
|
|
//=> ['foo', 'bar']
|
2023-08-17 09:47:40 +00:00
|
|
|
|
|
|
|
arrayUnion(['🐱', '🦄', '🐻'], ['🦄', '🌈']);
|
|
|
|
//=> ['🐱', '🦄', '🐻', '🌈']
|
|
|
|
|
|
|
|
arrayUnion(['🐱', '🦄'], ['🐻', '🦄'], ['🐶', '🌈', '🌈']);
|
|
|
|
//=> ['🐱', '🦄', '🐻', '🐶', '🌈']
|
2022-01-21 08:28:41 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|