sensordb2 e64a8defe5 3.17 | 1 год назад | |
---|---|---|
.. | ||
LICENSE | 1 год назад | |
README.md | 1 год назад | |
index.js | 1 год назад | |
package.json | 1 год назад |
Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.
This library is 15-20 times faster and more performant (scales better) than array-union, which just uses [].concat.apply([], arguments)
.
See the benchmarks.
#1: five-arrays.js
array-union.js x 245,487 ops/sec ±0.99% (96 runs sampled)
current.js x 5,267,661 ops/sec ±0.63% (98 runs sampled)
#2: ten-arrays.js
array-union.js x 134,784 ops/sec ±0.51% (94 runs sampled)
current.js x 1,919,143 ops/sec ±0.45% (100 runs sampled)
#3: two-arrays.js
array-union.js x 308,374 ops/sec ±0.75% (96 runs sampled)
current.js x 7,361,915 ops/sec ±0.67% (95 runs sampled)
Install with npm
$ npm i arr-union --save
var union = require('arr-union');
union(['a'], ['b', 'c'], ['d', 'e', 'f']);
//=> ['a', 'b', 'c', 'd', 'e', 'f']
Returns only unique elements:
union(['a', 'a'], ['b', 'c']);
//=> ['a', 'b', 'c']
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on June 15, 2015.