Socket
Socket
Sign inDemoInstall

arr-union

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

10

index.js

@@ -5,3 +5,3 @@ /*!

* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT license.
* Licensed under the MIT License.
*/

@@ -16,9 +16,9 @@

var len = arguments.length;
var res = [];
var res = [], i = 0;
while (len--) {
var arg = arguments[len];
var arg = arguments[i++];
for (var i = 0; i < arg.length; i++) {
var ele = arg[i];
for (var j = 0; j < arg.length; j++) {
var ele = arg[j];

@@ -25,0 +25,0 @@ if (res.indexOf(ele) === -1) {

{
"name": "arr-union",
"description": "Returns an array of unique values using strict equality for comparisons.",
"version": "2.0.0",
"description": "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.",
"version": "2.0.1",
"homepage": "https://github.com/jonschlinkert/arr-union",

@@ -19,4 +19,7 @@ "author": {

"type": "MIT",
"url": "https://github.com/jonschlinkert/arr-union/blob/master/LICENSE-MIT"
"url": "https://github.com/jonschlinkert/arr-union/blob/master/LICENSE"
},
"files": [
"index.js"
],
"main": "index.js",

@@ -27,12 +30,12 @@ "engines": {

"scripts": {
"test": "mocha -R spec"
"test": "mocha"
},
"devDependencies": {
"array-union": "^1.0.1",
"array-unique": "^0.1.1",
"array-unique": "^0.2.1",
"benchmarked": "^0.1.3",
"chalk": "^0.5.1",
"minimist": "^1.1.0",
"mocha": "*",
"should": "^4.3.1"
"chalk": "^1.0.0",
"minimist": "^1.1.1",
"mocha": "^2.2.1",
"should": "^5.2.0"
},

@@ -39,0 +42,0 @@ "keywords": [

@@ -1,5 +0,25 @@

# arr-union [![NPM version](https://badge.fury.io/js/arr-union.svg)](http://badge.fury.io/js/arr-union)
# arr-union [![NPM version](https://badge.fury.io/js/arr-union.svg)](http://badge.fury.io/js/arr-union) [![Build Status](https://travis-ci.org/jonschlinkert/arr-union.svg)](https://travis-ci.org/jonschlinkert/arr-union)
> Returns an array of unique values using strict equality for comparisons, maintaining the same order as the provided arrays .
> Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.
You can do this with just `[].concat.apply([], arguments)`, like [array-union](https://github.com/sindresorhus/array-union) but this implementation is much faster and more peformant.
For the most common use cases, this library is **20 times faster** than array-union.
```bash
#1: five-arrays.js
array-union.js x 289,891 ops/sec ±0.70% (97 runs sampled)
current.js x 5,429,077 ops/sec ±0.81% (93 runs sampled)
#2: ten-arrays.js
array-union.js x 161,132 ops/sec ±0.72% (98 runs sampled)
current.js x 1,725,939 ops/sec ±0.61% (97 runs sampled)
#3: two-arrays.js
array-union.js x 376,238 ops/sec ±0.83% (95 runs sampled)
current.js x 6,817,593 ops/sec ±0.63% (94 runs sampled)
```
See the [benchmarks](./benchmark).
## Install with [npm](npmjs.org)

@@ -27,2 +47,21 @@

## Other array utilities
* [arr-diff](https://github.com/jonschlinkert/arr-diff): Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
* [arr-flatten](https://github.com/jonschlinkert/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
* [arr-filter](https://github.com/jonschlinkert/arr-filter): Faster alternative to javascript's native filter method.
* [arr-map](https://github.com/jonschlinkert/arr-map): Faster, node.js focused alternative to JavaScript's native array map.
* [arr-pluck](https://github.com/jonschlinkert/arr-pluck): Retrieves the value of a specified property from all elements in the collection.
* [arr-reduce](https://github.com/jonschlinkert/arr-reduce): Fast array reduce that also loops over sparse elements.
* [array-unique](https://github.com/jonschlinkert/array-unique): Return an array free of duplicate values. Fastest ES5 implementation.
## Running tests
Install dev dependencies.
```bash
npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-union/issues)
## Author

@@ -36,3 +75,3 @@

## License
Copyright (c) 2014-2015, Jon Schlinkert.
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license

@@ -42,2 +81,2 @@

_This file was generated by [verb](https://github.com/assemble/verb) on December 12, 2014. To update, run `npm i -g verb && verb`._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 25, 2015._

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc