From 9903fcac4d1f79594a6bb2637fc6c7531fd3e83a Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 25 May 2015 16:54:01 -0700 Subject: [PATCH] Bump to v3.8.0. --- README.md | 2 +- lodash._basepullat/LICENSE.txt | 22 ++++++++++ lodash._basepullat/README.md | 20 +++++++++ lodash._basepullat/index.js | 57 +++++++++++++++++++++++++ lodash._basepullat/package.json | 18 ++++++++ lodash._topath/README.md | 4 +- lodash._topath/index.js | 22 ++++++++-- lodash._topath/package.json | 3 +- lodash.mapkeys/LICENSE.txt | 22 ++++++++++ lodash.mapkeys/README.md | 20 +++++++++ lodash.mapkeys/index.js | 70 +++++++++++++++++++++++++++++++ lodash.mapkeys/package.json | 24 +++++++++++ lodash.unzipwith/LICENSE.txt | 22 ++++++++++ lodash.unzipwith/README.md | 20 +++++++++ lodash.unzipwith/index.js | 73 +++++++++++++++++++++++++++++++++ lodash.unzipwith/package.json | 24 +++++++++++ lodash.zipwith/LICENSE.txt | 22 ++++++++++ lodash.zipwith/README.md | 20 +++++++++ lodash.zipwith/index.js | 44 ++++++++++++++++++++ lodash.zipwith/package.json | 23 +++++++++++ 20 files changed, 523 insertions(+), 9 deletions(-) create mode 100644 lodash._basepullat/LICENSE.txt create mode 100644 lodash._basepullat/README.md create mode 100644 lodash._basepullat/index.js create mode 100644 lodash._basepullat/package.json create mode 100644 lodash.mapkeys/LICENSE.txt create mode 100644 lodash.mapkeys/README.md create mode 100644 lodash.mapkeys/index.js create mode 100644 lodash.mapkeys/package.json create mode 100644 lodash.unzipwith/LICENSE.txt create mode 100644 lodash.unzipwith/README.md create mode 100644 lodash.unzipwith/index.js create mode 100644 lodash.unzipwith/package.json create mode 100644 lodash.zipwith/LICENSE.txt create mode 100644 lodash.zipwith/README.md create mode 100644 lodash.zipwith/index.js create mode 100644 lodash.zipwith/package.json diff --git a/README.md b/README.md index 714a6cc00..8c02c7fcf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.7.4 +# lodash v3.8.0 The [lodash](https://lodash.com/) library exported as [npm packages](https://www.npmjs.com/browse/keyword/lodash-modularized) per method. diff --git a/lodash._basepullat/LICENSE.txt b/lodash._basepullat/LICENSE.txt new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash._basepullat/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash._basepullat/README.md b/lodash._basepullat/README.md new file mode 100644 index 000000000..316ab9190 --- /dev/null +++ b/lodash._basepullat/README.md @@ -0,0 +1,20 @@ +# lodash._basepullat v3.8.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `basePullAt` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash._basepullat +``` + +In Node.js/io.js: + +```js +var basePullAt = require('lodash._basepullat'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.8.0-npm-packages/lodash._basepullat) for more details. diff --git a/lodash._basepullat/index.js b/lodash._basepullat/index.js new file mode 100644 index 000000000..78c3abc38 --- /dev/null +++ b/lodash._basepullat/index.js @@ -0,0 +1,57 @@ +/** + * lodash 3.8.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used for native method references. */ +var arrayProto = Array.prototype; + +/** Native method references. */ +var splice = arrayProto.splice; + +/** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ +var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + +/** + * The base implementation of `_.pullAt` without support for individual + * index arguments and capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ +function basePullAt(array, indexes) { + var length = array ? indexes.length : 0; + while (length--) { + var index = parseFloat(indexes[length]); + if (index != previous && isIndex(index)) { + var previous = index; + splice.call(array, index, 1); + } + } + return array; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + value = +value; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; +} + +module.exports = basePullAt; diff --git a/lodash._basepullat/package.json b/lodash._basepullat/package.json new file mode 100644 index 000000000..09864e6a6 --- /dev/null +++ b/lodash._basepullat/package.json @@ -0,0 +1,18 @@ +{ + "name": "lodash._basepullat", + "version": "3.8.0", + "description": "The modern build of lodash’s internal `basePullAt` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "author": "John-David Dalton (http://allyoucanleet.com/)", + "contributors": [ + "John-David Dalton (http://allyoucanleet.com/)", + "Benjamin Tan (https://d10.github.io/)", + "Blaine Bublitz (http://www.iceddev.com/)", + "Kit Cambridge (http://kitcambridge.be/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } +} diff --git a/lodash._topath/README.md b/lodash._topath/README.md index 027a8dcd8..ee95d99e7 100644 --- a/lodash._topath/README.md +++ b/lodash._topath/README.md @@ -1,4 +1,4 @@ -# lodash._topath v3.7.0 +# lodash._topath v3.8.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `toPath` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var toPath = require('lodash._topath'); ``` -See the [package source](https://github.com/lodash/lodash/blob/3.7.0-npm-packages/lodash._topath) for more details. +See the [package source](https://github.com/lodash/lodash/blob/3.8.0-npm-packages/lodash._topath) for more details. diff --git a/lodash._topath/index.js b/lodash._topath/index.js index 19a217a44..c8a5ce593 100644 --- a/lodash._topath/index.js +++ b/lodash._topath/index.js @@ -1,13 +1,12 @@ /** - * lodash 3.7.0 (Custom Build) + * lodash 3.8.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license */ -var baseToString = require('lodash._basetostring'), - isArray = require('lodash.isarray'); +var isArray = require('lodash.isarray'); /** Used to match property names within property paths. */ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; @@ -16,7 +15,22 @@ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*? var reEscapeChar = /\\(\\)?/g; /** - * Converts `value` to property path array if it is not one. + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); +} + +/** + * Converts `value` to property path array if it's not one. * * @private * @param {*} value The value to process. diff --git a/lodash._topath/package.json b/lodash._topath/package.json index b34625bbe..5fee9a5c1 100644 --- a/lodash._topath/package.json +++ b/lodash._topath/package.json @@ -1,6 +1,6 @@ { "name": "lodash._topath", - "version": "3.7.0", + "version": "3.8.0", "description": "The modern build of lodash’s internal `toPath` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -16,7 +16,6 @@ "repository": "lodash/lodash", "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, "dependencies": { - "lodash._basetostring": "^3.0.0", "lodash.isarray": "^3.0.0" } } diff --git a/lodash.mapkeys/LICENSE.txt b/lodash.mapkeys/LICENSE.txt new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.mapkeys/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash.mapkeys/README.md b/lodash.mapkeys/README.md new file mode 100644 index 000000000..75d033184 --- /dev/null +++ b/lodash.mapkeys/README.md @@ -0,0 +1,20 @@ +# lodash.mapkeys v3.8.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.mapKeys` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.mapkeys +``` + +In Node.js/io.js: + +```js +var mapKeys = require('lodash.mapkeys'); +``` + +See the [documentation](https://lodash.com/docs#mapKeys) or [package source](https://github.com/lodash/lodash/blob/3.8.0-npm-packages/lodash.mapkeys) for more details. diff --git a/lodash.mapkeys/index.js b/lodash.mapkeys/index.js new file mode 100644 index 000000000..89b95b8c4 --- /dev/null +++ b/lodash.mapkeys/index.js @@ -0,0 +1,70 @@ +/** + * lodash 3.8.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseCallback = require('lodash._basecallback'), + baseFor = require('lodash._basefor'), + keys = require('lodash.keys'); + +/** + * The base implementation of `_.forOwn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return baseFor(object, iteratee, keys); +} + +/** + * Creates a function for `_.mapKeys` or `_.mapValues`. + * + * @private + * @param {boolean} [isMapKeys] Specify mapping keys instead of values. + * @returns {Function} Returns the new map function. + */ +function createObjectMapper(isMapKeys) { + return function(object, iteratee, thisArg) { + var result = {}; + iteratee = baseCallback(iteratee, thisArg, 3); + + baseForOwn(object, function(value, key, object) { + var mapped = iteratee(value, key, object); + key = isMapKeys ? mapped : key; + value = isMapKeys ? value : mapped; + result[key] = value; + }); + return result; + }; +} + +/** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * property of `object` through `iteratee`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ +var mapKeys = createObjectMapper(true); + +module.exports = mapKeys; diff --git a/lodash.mapkeys/package.json b/lodash.mapkeys/package.json new file mode 100644 index 000000000..1ef9ab996 --- /dev/null +++ b/lodash.mapkeys/package.json @@ -0,0 +1,24 @@ +{ + "name": "lodash.mapkeys", + "version": "3.8.0", + "description": "The modern build of lodash’s `_.mapKeys` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": "lodash, lodash-modularized, stdlib, util", + "author": "John-David Dalton (http://allyoucanleet.com/)", + "contributors": [ + "John-David Dalton (http://allyoucanleet.com/)", + "Benjamin Tan (https://d10.github.io/)", + "Blaine Bublitz (http://www.iceddev.com/)", + "Kit Cambridge (http://kitcambridge.be/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._basecallback": "^3.0.0", + "lodash._basefor": "^3.0.0", + "lodash.keys": "^3.0.0" + } +} diff --git a/lodash.unzipwith/LICENSE.txt b/lodash.unzipwith/LICENSE.txt new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.unzipwith/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash.unzipwith/README.md b/lodash.unzipwith/README.md new file mode 100644 index 000000000..8396df4ed --- /dev/null +++ b/lodash.unzipwith/README.md @@ -0,0 +1,20 @@ +# lodash.unzipwith v3.8.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.unzipWith` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.unzipwith +``` + +In Node.js/io.js: + +```js +var unzipWith = require('lodash.unzipwith'); +``` + +See the [documentation](https://lodash.com/docs#unzipWith) or [package source](https://github.com/lodash/lodash/blob/3.8.0-npm-packages/lodash.unzipwith) for more details. diff --git a/lodash.unzipwith/index.js b/lodash.unzipwith/index.js new file mode 100644 index 000000000..2ac9aa093 --- /dev/null +++ b/lodash.unzipwith/index.js @@ -0,0 +1,73 @@ +/** + * lodash 3.8.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var arrayMap = require('lodash._arraymap'), + bindCallback = require('lodash._bindcallback'), + unzip = require('lodash.unzip'); + +/** + * A specialized version of `_.reduce` for arrays without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initFromArray] Specify using the first element of `array` + * as the initial value. + * @returns {*} Returns the accumulated value. + */ +function arrayReduce(array, iteratee, accumulator, initFromArray) { + var index = -1, + length = array.length; + + if (initFromArray && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; +} + +/** + * This method is like `_.unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee] The function to combine regrouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ +function unzipWith(array, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(result, function(group) { + return arrayReduce(group, iteratee, undefined, true); + }); +} + +module.exports = unzipWith; diff --git a/lodash.unzipwith/package.json b/lodash.unzipwith/package.json new file mode 100644 index 000000000..54db9d158 --- /dev/null +++ b/lodash.unzipwith/package.json @@ -0,0 +1,24 @@ +{ + "name": "lodash.unzipwith", + "version": "3.8.0", + "description": "The modern build of lodash’s `_.unzipWith` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": "lodash, lodash-modularized, stdlib, util", + "author": "John-David Dalton (http://allyoucanleet.com/)", + "contributors": [ + "John-David Dalton (http://allyoucanleet.com/)", + "Benjamin Tan (https://d10.github.io/)", + "Blaine Bublitz (http://www.iceddev.com/)", + "Kit Cambridge (http://kitcambridge.be/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash._arraymap": "^3.0.0", + "lodash._bindcallback": "^3.0.0", + "lodash.unzip": "^3.0.0" + } +} diff --git a/lodash.zipwith/LICENSE.txt b/lodash.zipwith/LICENSE.txt new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.zipwith/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lodash.zipwith/README.md b/lodash.zipwith/README.md new file mode 100644 index 000000000..47cc9a792 --- /dev/null +++ b/lodash.zipwith/README.md @@ -0,0 +1,20 @@ +# lodash.zipwith v3.8.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. + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.zipwith +``` + +In Node.js/io.js: + +```js +var zipWith = require('lodash.zipwith'); +``` + +See the [documentation](https://lodash.com/docs#zipWith) or [package source](https://github.com/lodash/lodash/blob/3.8.0-npm-packages/lodash.zipwith) for more details. diff --git a/lodash.zipwith/index.js b/lodash.zipwith/index.js new file mode 100644 index 000000000..cbf37ad8d --- /dev/null +++ b/lodash.zipwith/index.js @@ -0,0 +1,44 @@ +/** + * lodash 3.8.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var restParam = require('lodash.restparam'), + 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). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], _.add); + * // => [111, 222] + */ +var zipWith = restParam(function(arrays) { + var length = arrays.length, + iteratee = arrays[length - 2], + thisArg = arrays[length - 1]; + + 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); +}); + +module.exports = zipWith; diff --git a/lodash.zipwith/package.json b/lodash.zipwith/package.json new file mode 100644 index 000000000..b543b63ae --- /dev/null +++ b/lodash.zipwith/package.json @@ -0,0 +1,23 @@ +{ + "name": "lodash.zipwith", + "version": "3.8.0", + "description": "The modern build of lodash’s `_.zipWith` as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "license": "MIT", + "keywords": "lodash, lodash-modularized, stdlib, util", + "author": "John-David Dalton (http://allyoucanleet.com/)", + "contributors": [ + "John-David Dalton (http://allyoucanleet.com/)", + "Benjamin Tan (https://d10.github.io/)", + "Blaine Bublitz (http://www.iceddev.com/)", + "Kit Cambridge (http://kitcambridge.be/)", + "Mathias Bynens (https://mathiasbynens.be/)" + ], + "repository": "lodash/lodash", + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, + "dependencies": { + "lodash.restparam": "^3.0.0", + "lodash.unzipwith": "^3.0.0" + } +}