lodash.zipwith
Advanced tools
Comparing version 3.8.1 to 4.0.0
38
index.js
/** | ||
* lodash 3.8.1 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* lodash 4.0.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
*/ | ||
var restParam = require('lodash.restparam'), | ||
var rest = require('lodash.rest'), | ||
unzipWith = require('lodash.unzipwith'); | ||
/** | ||
* This method is like `_.zip` except that it accepts an iteratee to specify | ||
* how grouped values should be combined. The `iteratee` is bound to `thisArg` | ||
* and invoked with four arguments: (accumulator, value, index, group). | ||
* This method is like `_.zip` except that it accepts `iteratee` to specify | ||
* how grouped values should be combined. The iteratee is invoked with the | ||
* elements of each group: (...group). | ||
* | ||
@@ -21,25 +21,19 @@ * @static | ||
* @param {...Array} [arrays] The arrays to process. | ||
* @param {Function} [iteratee] The function to combine grouped values. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
* @param {Function} [iteratee=_.identity] The function to combine grouped values. | ||
* @returns {Array} Returns the new array of grouped elements. | ||
* @example | ||
* | ||
* _.zipWith([1, 2], [10, 20], [100, 200], _.add); | ||
* _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) { | ||
* return a + b + c; | ||
* }); | ||
* // => [111, 222] | ||
*/ | ||
var zipWith = restParam(function(arrays) { | ||
var zipWith = rest(function(arrays) { | ||
var length = arrays.length, | ||
iteratee = length > 2 ? arrays[length - 2] : undefined, | ||
thisArg = length > 1 ? arrays[length - 1] : undefined; | ||
iteratee = length > 1 ? arrays[length - 1] : undefined; | ||
if (length > 2 && typeof iteratee == 'function') { | ||
length -= 2; | ||
} else { | ||
iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined; | ||
thisArg = undefined; | ||
} | ||
arrays.length = length; | ||
return unzipWith(arrays, iteratee, thisArg); | ||
iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined; | ||
return unzipWith(arrays, iteratee); | ||
}); | ||
module.exports = zipWith; |
{ | ||
"name": "lodash.zipwith", | ||
"version": "3.8.1", | ||
"description": "The modern build of lodash’s `_.zipWith` as a module.", | ||
"version": "4.0.0", | ||
"description": "The lodash method `_.zipWith` exported as a module.", | ||
"homepage": "https://lodash.com/", | ||
"icon": "https://lodash.com/icon.svg", | ||
"license": "MIT", | ||
"keywords": "lodash, lodash-modularized, stdlib, util", | ||
"keywords": "lodash, lodash-modularized, stdlib, util, zipwith", | ||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"contributors": [ | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)", | ||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -20,5 +18,5 @@ ], | ||
"dependencies": { | ||
"lodash.restparam": "^3.0.0", | ||
"lodash.unzipwith": "^3.0.0" | ||
"lodash.rest": "^4.0.0", | ||
"lodash.unzipwith": "^4.0.0" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# lodash.zipwith v3.8.1 | ||
# lodash.zipwith v4.0.0 | ||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.zipWith` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
The [lodash](https://lodash.com/) method `_.zipWith` exported as a [Node.js](https://nodejs.org/) module. | ||
@@ -8,3 +8,2 @@ ## Installation | ||
Using npm: | ||
```bash | ||
@@ -15,4 +14,3 @@ $ {sudo -H} npm i -g npm | ||
In Node.js/io.js: | ||
In Node.js: | ||
```js | ||
@@ -22,2 +20,2 @@ var zipWith = require('lodash.zipwith'); | ||
See the [documentation](https://lodash.com/docs#zipWith) or [package source](https://github.com/lodash/lodash/blob/3.8.1-npm-packages/lodash.zipwith) for more details. | ||
See the [documentation](https://lodash.com/docs#zipWith) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.zipwith) for more details. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3880
35
19
+ Addedlodash.rest@^4.0.0
+ Addedlodash.rest@4.0.5(transitive)
+ Addedlodash.unzipwith@4.3.0(transitive)
- Removedlodash.restparam@^3.0.0
- Removedlodash._arraymap@3.0.0(transitive)
- Removedlodash._bindcallback@3.0.1(transitive)
- Removedlodash.restparam@3.6.1(transitive)
- Removedlodash.unzip@3.4.0(transitive)
- Removedlodash.unzipwith@3.8.0(transitive)
Updatedlodash.unzipwith@^4.0.0