diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/arr-diff | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) | |
download | wallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz |
node_modules
Diffstat (limited to 'node_modules/arr-diff')
-rwxr-xr-x | node_modules/arr-diff/LICENSE | 2 | ||||
-rw-r--r-- | node_modules/arr-diff/README.md | 118 | ||||
-rw-r--r-- | node_modules/arr-diff/index.js | 75 | ||||
-rw-r--r-- | node_modules/arr-diff/package.json | 40 |
4 files changed, 150 insertions, 85 deletions
diff --git a/node_modules/arr-diff/LICENSE b/node_modules/arr-diff/LICENSE index fa30c4cb3..d734237bd 100755 --- a/node_modules/arr-diff/LICENSE +++ b/node_modules/arr-diff/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2015, Jon Schlinkert. +Copyright (c) 2014-2017, Jon Schlinkert Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/arr-diff/README.md b/node_modules/arr-diff/README.md index 7705c6cd5..961f5c3f1 100644 --- a/node_modules/arr-diff/README.md +++ b/node_modules/arr-diff/README.md @@ -1,33 +1,30 @@ -# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg)](https://www.npmjs.com/package/arr-diff) [![Build Status](https://img.shields.io/travis/jonschlinkert/base.svg)](https://travis-ci.org/jonschlinkert/base) +# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg?style=flat)](https://www.npmjs.com/package/arr-diff) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-diff.svg?style=flat)](https://npmjs.org/package/arr-diff) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-diff.svg?style=flat&label=Travis)](https://travis-ci.org/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. ## Install -Install with [npm](https://www.npmjs.com/) +Install with [npm](https://www.npmjs.com/): ```sh -$ npm i arr-diff --save +$ npm install --save arr-diff ``` -Install with [bower](http://bower.io/) + +Install with [yarn](https://yarnpkg.com): ```sh -$ bower install arr-diff --save +$ yarn add arr-diff ``` -## API - -### [diff](index.js#L33) - -Return the difference between the first array and additional arrays. +Install with [bower](https://bower.io/) -**Params** +```sh +$ bower install arr-diff --save +``` -* `a` **{Array}** -* `b` **{Array}** -* `returns` **{Array}** +## Usage -**Example** +Returns the difference between the first array and additional arrays. ```js var diff = require('arr-diff'); @@ -39,36 +36,95 @@ console.log(diff(a, b)) //=> ['a', 'd'] ``` -## Related projects +## Benchmarks -* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) -* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter) -* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://www.npmjs.com/package/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection) +This library versus [array-differ](https://github.com/sindresorhus/array-differ), on April 14, 2017: -## Running tests +``` +Benchmarking: (4 of 4) + · long-dupes + · long + · med + · short -Install dev dependencies: +# benchmark/fixtures/long-dupes.js (100804 bytes) + arr-diff-3.0.0 x 822 ops/sec ±0.67% (86 runs sampled) + arr-diff-4.0.0 x 2,141 ops/sec ±0.42% (89 runs sampled) + array-differ x 708 ops/sec ±0.70% (89 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/long.js (94529 bytes) + arr-diff-3.0.0 x 882 ops/sec ±0.60% (87 runs sampled) + arr-diff-4.0.0 x 2,329 ops/sec ±0.97% (83 runs sampled) + array-differ x 769 ops/sec ±0.61% (90 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/med.js (708 bytes) + arr-diff-3.0.0 x 856,150 ops/sec ±0.42% (89 runs sampled) + arr-diff-4.0.0 x 4,665,249 ops/sec ±1.06% (89 runs sampled) + array-differ x 653,888 ops/sec ±1.02% (86 runs sampled) + + fastest is arr-diff-4.0.0 + +# benchmark/fixtures/short.js (60 bytes) + arr-diff-3.0.0 x 3,078,467 ops/sec ±0.77% (93 runs sampled) + arr-diff-4.0.0 x 9,213,296 ops/sec ±0.65% (89 runs sampled) + array-differ x 1,337,051 ops/sec ±0.91% (92 runs sampled) + + fastest is arr-diff-4.0.0 +``` + +## About + +### Related projects + +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") +* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter "Array#filter for older browsers.") +* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://github.com/jonschlinkert/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection "Return an array with the unique values present in _all_ given arrays using strict equality for comparisons.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 33 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [paulmillr](https://github.com/paulmillr) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: ```sh -$ npm i -d && npm test +$ npm install -g verbose/verb#dev verb-generate-readme && verb ``` -## Contributing +### Running tests -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-diff/issues/new). +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` -## Author +### Author **Jon Schlinkert** -+ [github/jonschlinkert](https://github.com/jonschlinkert) -+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) -## License +### License -Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) -Released under the MIT license. +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). *** -_This file was generated by [verb](https://github.com/verbose/verb) on Sat Dec 05 2015 23:24:53 GMT-0500 (EST)._ +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 14, 2017._
\ No newline at end of file diff --git a/node_modules/arr-diff/index.js b/node_modules/arr-diff/index.js index bc7200d8e..90f280772 100644 --- a/node_modules/arr-diff/index.js +++ b/node_modules/arr-diff/index.js @@ -1,58 +1,47 @@ /*! * arr-diff <https://github.com/jonschlinkert/arr-diff> * - * Copyright (c) 2014 Jon Schlinkert, contributors. - * Licensed under the MIT License + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. */ 'use strict'; -var flatten = require('arr-flatten'); -var slice = [].slice; +module.exports = function diff(arr/*, arrays*/) { + var len = arguments.length; + var idx = 0; + while (++idx < len) { + arr = diffArray(arr, arguments[idx]); + } + return arr; +}; -/** - * Return the difference between the first array and - * additional arrays. - * - * ```js - * var diff = require('{%= name %}'); - * - * var a = ['a', 'b', 'c', 'd']; - * var b = ['b', 'c']; - * - * console.log(diff(a, b)) - * //=> ['a', 'd'] - * ``` - * - * @param {Array} `a` - * @param {Array} `b` - * @return {Array} - * @api public - */ +function diffArray(one, two) { + if (!Array.isArray(two)) { + return one.slice(); + } -function diff(arr, arrays) { - var argsLen = arguments.length; - var len = arr.length, i = -1; - var res = [], arrays; + var tlen = two.length + var olen = one.length; + var idx = -1; + var arr = []; - if (argsLen === 1) { - return arr; - } + while (++idx < olen) { + var ele = one[idx]; - if (argsLen > 2) { - arrays = flatten(slice.call(arguments, 1)); - } + var hasEle = false; + for (var i = 0; i < tlen; i++) { + var val = two[i]; + + if (ele === val) { + hasEle = true; + break; + } + } - while (++i < len) { - if (!~arrays.indexOf(arr[i])) { - res.push(arr[i]); + if (hasEle === false) { + arr.push(ele); } } - return res; + return arr; } - -/** - * Expose `diff` - */ - -module.exports = diff; diff --git a/node_modules/arr-diff/package.json b/node_modules/arr-diff/package.json index d40c21030..c106813be 100644 --- a/node_modules/arr-diff/package.json +++ b/node_modules/arr-diff/package.json @@ -1,9 +1,13 @@ { "name": "arr-diff", "description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.", - "version": "2.0.0", + "version": "4.0.0", "homepage": "https://github.com/jonschlinkert/arr-diff", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert <jon.schlinkert@sellside.com> (http://twitter.com/jonschlinkert)", + "Paul Miller <paul+gh@paulmillr.com> (paulmillr.com)" + ], "repository": "jonschlinkert/arr-diff", "bugs": { "url": "https://github.com/jonschlinkert/arr-diff/issues" @@ -19,31 +23,47 @@ "scripts": { "test": "mocha" }, - "dependencies": { - "arr-flatten": "^1.0.1" - }, + "dependencies": {}, "devDependencies": { + "ansi-bold": "^0.1.1", + "arr-flatten": "^1.0.1", "array-differ": "^1.0.0", - "array-slice": "^0.2.3", - "benchmarked": "^0.1.4", - "chalk": "^1.1.1", - "mocha": "*", - "should": "*" + "benchmarked": "^0.2.4", + "gulp-format-md": "^0.1.9", + "minimist": "^1.2.0", + "mocha": "^2.4.5" }, "keywords": [ "arr", "array", + "array differ", + "array-differ", "diff", "differ", "difference" ], "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], "related": { "list": [ "arr-flatten", "array-filter", "array-intersection" ] + }, + "reflinks": [ + "array-differ", + "verb" + ], + "lint": { + "reflinks": true } } -}
\ No newline at end of file +} |