Socket
Socket
Sign inDemoInstall

arr-diff

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

8

bower.json
{
"name": "arr-diff",
"version": "0.1.0",
"version": "0.2.2",
"main": [
"index.js"
],
"authors": [
{
"name": "Jon Schlinkert",
"homepage": "https://github.com/jonschlinkert"
}
]
}

14

index.js

@@ -34,15 +34,9 @@ /*!

function diff(a, b) {
var alen = a.length - 1;
var blen = b.length;
var len = a.length;
var arr = [];
if (alen === 0) {
return [];
}
if (blen === 0) {
if (b == null || b.length === 0) {
return a;
}
var len = a.length;
var arr = [];
while (len--) {

@@ -54,2 +48,2 @@ if (b.indexOf(a[len]) === -1) {

return arr;
}
}
{
"name": "arr-diff",
"description": "Return an array with only the unique values present in all given arrays using strict equality for comparisons.",
"version": "0.2.1",
"description": "Returns an array with only the unique values from the first array, by excluding all values from the second array. Uses strict equality for comparisons.",
"version": "0.2.2",
"homepage": "https://github.com/jonschlinkert/arr-diff",

@@ -6,0 +6,0 @@ "author": {

# arr-diff [![NPM version](https://badge.fury.io/js/arr-diff.svg)](http://badge.fury.io/js/arr-diff) [![Build Status](https://travis-ci.org/jonschlinkert/arr-diff.svg)](https://travis-ci.org/jonschlinkert/arr-diff)
> Return an array with only the unique values present in all given arrays using strict equality for comparisons.
> Returns an array with only the unique values from the first array, by excluding all values from the second array. Uses strict equality for comparisons.

@@ -85,2 +85,2 @@ Why another array `difference` lib? I wanted the [fastest, correct implementation](./benchmark) I could find.

_This file was generated by [verb](https://github.com/assemble/verb) on December 01, 2014._
_This file was generated by [verb](https://github.com/assemble/verb) on December 02, 2014._

@@ -16,10 +16,19 @@ /*!

diff(['a', 'b', 'c'], ['b', 'c', 'e']).should.eql(['a']);
diff(['foo', 'b', 'c', 'e', 'bar'], ['b', 'foo', 'e']).should.eql(['bar', 'c']);
diff(['foo', 'foo'], ['a', 'b', 'c']).should.eql(['foo', 'foo']);
diff(['foo'], ['a', 'b', 'c']).should.eql([]);
diff(['x', 'b', 'c', 'e', 'y'], ['b', 'x', 'e']).should.eql(['y', 'c']);
diff(['x', 'x'], ['a', 'b', 'c']).should.eql(['x', 'x']);
diff(['x'], ['a', 'b', 'c']).should.eql(['x']);
});
it('should return an empty array if no unique elements are in the first array:', function () {
diff(['foo'], ['a', 'b', 'c', 'foo']).should.eql([]);
diff(['a'], ['a', 'b', 'c']).should.eql([]);
});
it('should return the first array if the second array is empty:', function () {
diff(['a', 'b', 'c'], []).should.eql(['a', 'b', 'c']);
});
it('should return the first array if the second array is null or undefined:', function () {
diff(['a', 'b', 'c'], null).should.eql(['a', 'b', 'c']);
diff(['a', 'b', 'c']).should.eql(['a', 'b', 'c']);
});
});
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