From 8813a1ee096442e56de3a1244140dd2aec40727d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 24 Jul 2016 22:37:48 -0700 Subject: [PATCH] Bump to v3.4.0. --- README.md | 2 +- .../LICENSE.txt | 0 lodash._basesortbyorder/README.md | 20 + lodash._basesortbyorder/index.js | 105 +++++ lodash._basesortbyorder/package.json | 23 + .../LICENSE.txt | 0 lodash._createcomposer/README.md | 20 + lodash._createcomposer/index.js | 48 +++ lodash._createcomposer/package.json | 18 + lodash.add/LICENSE.txt | 22 + lodash.add/README.md | 20 + lodash.add/index.js | 28 ++ lodash.add/package.json | 19 + lodash.fill/README.md | 4 +- lodash.fill/index.js | 50 +-- lodash.fill/package.json | 2 +- lodash.flow/README.md | 4 +- lodash.flow/index.js | 408 +++++++++++++++++- lodash.flow/package.json | 8 +- lodash.flowright/README.md | 4 +- lodash.flowright/index.js | 408 +++++++++++++++++- lodash.flowright/package.json | 8 +- lodash.max/LICENSE | 22 + lodash.max/README.md | 4 +- lodash.max/index.js | 11 +- lodash.max/package.json | 3 +- lodash.min/LICENSE | 22 + lodash.min/README.md | 4 +- lodash.min/index.js | 9 +- lodash.min/package.json | 3 +- lodash.sortbyorder/LICENSE.txt | 22 + lodash.sortbyorder/README.md | 20 + lodash.sortbyorder/index.js | 90 ++++ lodash.sortbyorder/package.json | 25 ++ lodash.sum/LICENSE.txt | 22 + lodash.sum/README.md | 20 + lodash.sum/index.js | 41 ++ lodash.sum/package.json | 23 + lodash.template/README.md | 4 +- lodash.template/index.js | 35 +- lodash.template/package.json | 3 +- lodash.unzip/README.md | 4 +- lodash.unzip/index.js | 29 +- lodash.unzip/package.json | 2 +- 44 files changed, 1505 insertions(+), 134 deletions(-) rename {lodash.max => lodash._basesortbyorder}/LICENSE.txt (100%) create mode 100644 lodash._basesortbyorder/README.md create mode 100644 lodash._basesortbyorder/index.js create mode 100644 lodash._basesortbyorder/package.json rename {lodash.min => lodash._createcomposer}/LICENSE.txt (100%) create mode 100644 lodash._createcomposer/README.md create mode 100644 lodash._createcomposer/index.js create mode 100644 lodash._createcomposer/package.json create mode 100644 lodash.add/LICENSE.txt create mode 100644 lodash.add/README.md create mode 100644 lodash.add/index.js create mode 100644 lodash.add/package.json create mode 100644 lodash.max/LICENSE create mode 100644 lodash.min/LICENSE create mode 100644 lodash.sortbyorder/LICENSE.txt create mode 100644 lodash.sortbyorder/README.md create mode 100644 lodash.sortbyorder/index.js create mode 100644 lodash.sortbyorder/package.json create mode 100644 lodash.sum/LICENSE.txt create mode 100644 lodash.sum/README.md create mode 100644 lodash.sum/index.js create mode 100644 lodash.sum/package.json diff --git a/README.md b/README.md index 8c4cf6078..15a126184 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.3.7 +# lodash v3.4.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.max/LICENSE.txt b/lodash._basesortbyorder/LICENSE.txt similarity index 100% rename from lodash.max/LICENSE.txt rename to lodash._basesortbyorder/LICENSE.txt diff --git a/lodash._basesortbyorder/README.md b/lodash._basesortbyorder/README.md new file mode 100644 index 000000000..36898d01b --- /dev/null +++ b/lodash._basesortbyorder/README.md @@ -0,0 +1,20 @@ +# lodash._basesortbyorder v3.4.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `baseSortByOrder` 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._basesortbyorder +``` + +In Node.js/io.js: + +```js +var baseSortByOrder = require('lodash._basesortbyorder'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash._basesortbyorder) for more details. diff --git a/lodash._basesortbyorder/index.js b/lodash._basesortbyorder/index.js new file mode 100644 index 000000000..e2ba883f0 --- /dev/null +++ b/lodash._basesortbyorder/index.js @@ -0,0 +1,105 @@ +/** + * lodash 3.4.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseCompareAscending = require('lodash._basecompareascending'), + baseEach = require('lodash._baseeach'), + baseSortBy = require('lodash._basesortby'); + +/** + * Used by `_.sortByOrder` to compare multiple properties of each element + * in a collection and stable sort them in the following order: + * + * If orders is unspecified, sort in ascending order for all properties. + * Otherwise, for each property, sort in ascending order if its corresponding value in + * orders is true, and descending order if false. + * + * @private + * @param {Object} object The object to compare to `other`. + * @param {Object} other The object to compare to `object`. + * @param {boolean[]} orders The order to sort by for each property. + * @returns {number} Returns the sort order indicator for `object`. + */ +function compareMultiple(object, other, orders) { + var index = -1, + objCriteria = object.criteria, + othCriteria = other.criteria, + length = objCriteria.length, + ordersLength = orders.length; + + while (++index < length) { + var result = baseCompareAscending(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } else { + return orders[index] ? result : result * -1; + } + } + } + // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications + // that causes it, under certain circumstances, to provide the same value for + // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 + // for more details. + // + // This also ensures a stable sort in V8 and other engines. + // See https://code.google.com/p/v8/issues/detail?id=90 for more details. + return object.index - other.index; +} + +/** + * Used as the maximum length of an array-like value. + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * for more details. + */ +var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + +/** + * The base implementation of `_.sortByOrder` without param guards. + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {string[]} props The property names to sort by. + * @param {boolean[]} orders The sort orders of `props`. + * @returns {Array} Returns the new sorted array. + */ +function baseSortByOrder(collection, props, orders) { + var index = -1, + length = collection.length, + result = isLength(length) ? Array(length) : []; + + baseEach(collection, function(value) { + var length = props.length, + criteria = Array(length); + + while (length--) { + criteria[length] = value == null ? undefined : value[props[length]]; + } + result[++index] = { 'criteria': criteria, 'index': index, 'value': value }; + }); + + return baseSortBy(result, function(object, other) { + return compareMultiple(object, other, orders); + }); +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on ES `ToLength`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +module.exports = baseSortByOrder; diff --git a/lodash._basesortbyorder/package.json b/lodash._basesortbyorder/package.json new file mode 100644 index 000000000..b515b524d --- /dev/null +++ b/lodash._basesortbyorder/package.json @@ -0,0 +1,23 @@ +{ + "name": "lodash._basesortbyorder", + "version": "3.4.0", + "description": "The modern build of lodash’s internal `baseSortByOrder` 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.\"" }, + "dependencies": { + "lodash._basecompareascending": "^3.0.0", + "lodash._baseeach": "^3.0.0", + "lodash._basesortby": "^3.0.0" + } +} diff --git a/lodash.min/LICENSE.txt b/lodash._createcomposer/LICENSE.txt similarity index 100% rename from lodash.min/LICENSE.txt rename to lodash._createcomposer/LICENSE.txt diff --git a/lodash._createcomposer/README.md b/lodash._createcomposer/README.md new file mode 100644 index 000000000..4f6b77bfc --- /dev/null +++ b/lodash._createcomposer/README.md @@ -0,0 +1,20 @@ +# lodash._createcomposer v3.4.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) internal `createComposer` 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._createcomposer +``` + +In Node.js/io.js: + +```js +var createComposer = require('lodash._createcomposer'); +``` + +See the [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash._createcomposer) for more details. diff --git a/lodash._createcomposer/index.js b/lodash._createcomposer/index.js new file mode 100644 index 000000000..d794b884c --- /dev/null +++ b/lodash._createcomposer/index.js @@ -0,0 +1,48 @@ +/** + * lodash 3.4.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/** + * Creates a function to compose other functions into a single function. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new composer function. + */ +function createComposer(fromRight) { + return function() { + var length = arguments.length, + index = length, + fromIndex = fromRight ? length - 1 : 0; + + if (!length) { + return function() { return arguments[0]; }; + } + var funcs = Array(length); + while (index--) { + funcs[index] = arguments[index]; + if (typeof funcs[index] != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + } + return function() { + var index = fromIndex, + result = funcs[index].apply(this, arguments); + + while ((fromRight ? index-- : ++index < length)) { + result = funcs[index].call(this, result); + } + return result; + }; + }; +} + +module.exports = createComposer; diff --git a/lodash._createcomposer/package.json b/lodash._createcomposer/package.json new file mode 100644 index 000000000..62a91ff4b --- /dev/null +++ b/lodash._createcomposer/package.json @@ -0,0 +1,18 @@ +{ + "name": "lodash._createcomposer", + "version": "3.4.0", + "description": "The modern build of lodash’s internal `createComposer` 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.add/LICENSE.txt b/lodash.add/LICENSE.txt new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.add/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.add/README.md b/lodash.add/README.md new file mode 100644 index 000000000..cf8c8c0ab --- /dev/null +++ b/lodash.add/README.md @@ -0,0 +1,20 @@ +# lodash.add v3.4.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.add` 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.add +``` + +In Node.js/io.js: + +```js +var add = require('lodash.add'); +``` + +See the [documentation](https://lodash.com/docs#add) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.add) for more details. diff --git a/lodash.add/index.js b/lodash.add/index.js new file mode 100644 index 000000000..654629e52 --- /dev/null +++ b/lodash.add/index.js @@ -0,0 +1,28 @@ +/** + * lodash 3.4.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + +/** + * Adds two numbers. + * + * @static + * @memberOf _ + * @category Math + * @param {number} augend The first number to add. + * @param {number} addend The second number to add. + * @returns {number} Returns the sum. + * @example + * + * _.add(6, 4); + * // => 10 + */ +function add(augend, addend) { + return augend + addend; +} + +module.exports = add; diff --git a/lodash.add/package.json b/lodash.add/package.json new file mode 100644 index 000000000..1e46aac14 --- /dev/null +++ b/lodash.add/package.json @@ -0,0 +1,19 @@ +{ + "name": "lodash.add", + "version": "3.4.0", + "description": "The modern build of lodash’s `_.add` 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.\"" } +} diff --git a/lodash.fill/README.md b/lodash.fill/README.md index f51dddc62..1fe74f1fa 100644 --- a/lodash.fill/README.md +++ b/lodash.fill/README.md @@ -1,4 +1,4 @@ -# lodash.fill v3.3.7 +# lodash.fill v3.4.0 The [lodash](https://lodash.com/) method `_.fill` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var fill = require('lodash.fill'); ``` -See the [documentation](https://lodash.com/docs#fill) or [package source](https://github.com/lodash/lodash/blob/3.3.7-npm-packages/lodash.fill) for more details. +See the [documentation](https://lodash.com/docs#fill) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.fill) for more details. diff --git a/lodash.fill/index.js b/lodash.fill/index.js index dfa2ee8c6..71c474f18 100644 --- a/lodash.fill/index.js +++ b/lodash.fill/index.js @@ -39,25 +39,12 @@ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -111,19 +98,6 @@ function baseFill(array, value, start, end) { return array; } -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * Checks if `value` is a valid array-like index. * @@ -206,7 +180,7 @@ function fill(array, value, start, end) { /** * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static @@ -266,7 +240,7 @@ function eq(value, other) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -288,8 +262,7 @@ function isArrayLike(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -297,16 +270,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -328,7 +300,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static @@ -445,7 +417,7 @@ function toFinite(value) { * Converts `value` to an integer. * * **Note:** This method is loosely based on - * [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger). + * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ @@ -479,7 +451,7 @@ function toInteger(value) { * array-like object. * * **Note:** This method is based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ @@ -536,7 +508,7 @@ function toNumber(value) { return NAN; } if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject(other) ? (other + '') : other; } if (typeof value != 'string') { diff --git a/lodash.fill/package.json b/lodash.fill/package.json index 5f5aa7bc8..48c6bc328 100644 --- a/lodash.fill/package.json +++ b/lodash.fill/package.json @@ -1,6 +1,6 @@ { "name": "lodash.fill", - "version": "3.3.7", + "version": "3.4.0", "description": "The lodash method `_.fill` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", diff --git a/lodash.flow/README.md b/lodash.flow/README.md index 7d9451740..de5f58426 100644 --- a/lodash.flow/README.md +++ b/lodash.flow/README.md @@ -1,4 +1,4 @@ -# lodash.flow v3.3.0 +# lodash.flow v3.4.0 The [lodash](https://lodash.com/) method `_.flow` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flow = require('lodash.flow'); ``` -See the [documentation](https://lodash.com/docs#flow) or [package source](https://github.com/lodash/lodash/blob/3.3.0-npm-packages/lodash.flow) for more details. +See the [documentation](https://lodash.com/docs#flow) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.flow) for more details. diff --git a/lodash.flow/index.js b/lodash.flow/index.js index 6b9e9c8f7..8fa20fc4d 100644 --- a/lodash.flow/index.js +++ b/lodash.flow/index.js @@ -6,12 +6,163 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseFlatten = require('lodash._baseflatten'), - rest = require('lodash.rest'); /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + /** * Creates a `_.flow` or `_.flowRight` function. * @@ -20,7 +171,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { - return rest(function(funcs) { + return baseRest(function(funcs) { funcs = baseFlatten(funcs, 1); var length = funcs.length, @@ -46,6 +197,253 @@ function createFlow(fromRight) { }); } +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + /** * Creates a function that returns the result of invoking the given functions * with the `this` binding of the created function, where each successive @@ -55,7 +453,7 @@ function createFlow(fromRight) { * @memberOf _ * @since 3.0.0 * @category Util - * @param {...(Function|Function[])} [funcs] Functions to invoke. + * @param {...(Function|Function[])} [funcs] The functions to invoke. * @returns {Function} Returns the new composite function. * @see _.flowRight * @example @@ -64,7 +462,7 @@ function createFlow(fromRight) { * return n * n; * } * - * var addSquare = _.flow(_.add, square); + * var addSquare = _.flow([_.add, square]); * addSquare(1, 2); * // => 9 */ diff --git a/lodash.flow/package.json b/lodash.flow/package.json index 9147102c7..5b4353c92 100644 --- a/lodash.flow/package.json +++ b/lodash.flow/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flow", - "version": "3.3.0", + "version": "3.4.0", "description": "The lodash method `_.flow` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._baseflatten": "~4.2.0", - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.flowright/README.md b/lodash.flowright/README.md index 0ddf880f2..be7a5f55f 100644 --- a/lodash.flowright/README.md +++ b/lodash.flowright/README.md @@ -1,4 +1,4 @@ -# lodash.flowright v3.3.0 +# lodash.flowright v3.4.0 The [lodash](https://lodash.com/) method `_.flowRight` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var flowRight = require('lodash.flowright'); ``` -See the [documentation](https://lodash.com/docs#flowRight) or [package source](https://github.com/lodash/lodash/blob/3.3.0-npm-packages/lodash.flowright) for more details. +See the [documentation](https://lodash.com/docs#flowRight) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.flowright) for more details. diff --git a/lodash.flowright/index.js b/lodash.flowright/index.js index a52740d5b..f7209529f 100644 --- a/lodash.flowright/index.js +++ b/lodash.flowright/index.js @@ -6,12 +6,163 @@ * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -var baseFlatten = require('lodash._baseflatten'), - rest = require('lodash.rest'); /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); +} + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * The base implementation of `_.flatten` with support for restricting flattening. + * + * @private + * @param {Array} array The array to flatten. + * @param {number} depth The maximum recursion depth. + * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. + * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. + * @param {Array} [result=[]] The initial result value. + * @returns {Array} Returns the new flattened array. + */ +function baseFlatten(array, depth, predicate, isStrict, result) { + var index = -1, + length = array.length; + + predicate || (predicate = isFlattenable); + result || (result = []); + + while (++index < length) { + var value = array[index]; + if (depth > 0 && predicate(value)) { + if (depth > 1) { + // Recursively flatten arrays (susceptible to call stack limits). + baseFlatten(value, depth - 1, predicate, isStrict, result); + } else { + arrayPush(result, value); + } + } else if (!isStrict) { + result[result.length] = value; + } + } + return result; +} + +/** + * The base implementation of `_.rest` which doesn't validate or coerce arguments. + * + * @private + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + */ +function baseRest(func, start) { + start = nativeMax(start === undefined ? (func.length - 1) : start, 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + array = Array(length); + + while (++index < length) { + array[index] = args[start + index]; + } + index = -1; + var otherArgs = Array(start + 1); + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = array; + return apply(func, this, otherArgs); + }; +} + /** * Creates a `_.flow` or `_.flowRight` function. * @@ -20,7 +171,7 @@ var FUNC_ERROR_TEXT = 'Expected a function'; * @returns {Function} Returns the new flow function. */ function createFlow(fromRight) { - return rest(function(funcs) { + return baseRest(function(funcs) { funcs = baseFlatten(funcs, 1); var length = funcs.length, @@ -46,6 +197,253 @@ function createFlow(fromRight) { }); } +/** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a + * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects + * Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ +var getLength = baseProperty('length'); + +/** + * Checks if `value` is a flattenable `arguments` object or array. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. + */ +function isFlattenable(value) { + return isArray(value) || isArguments(value) || + !!(spreadableSymbol && value && value[spreadableSymbol]); +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +} + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(getLength(value)) && !isFunction(value); +} + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, + * else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + /** * This method is like `_.flow` except that it creates a function that * invokes the given functions from right to left. @@ -54,7 +452,7 @@ function createFlow(fromRight) { * @since 3.0.0 * @memberOf _ * @category Util - * @param {...(Function|Function[])} [funcs] Functions to invoke. + * @param {...(Function|Function[])} [funcs] The functions to invoke. * @returns {Function} Returns the new composite function. * @see _.flow * @example @@ -63,7 +461,7 @@ function createFlow(fromRight) { * return n * n; * } * - * var addSquare = _.flowRight(square, _.add); + * var addSquare = _.flowRight([square, _.add]); * addSquare(1, 2); * // => 9 */ diff --git a/lodash.flowright/package.json b/lodash.flowright/package.json index 96150ce01..6ba744eff 100644 --- a/lodash.flowright/package.json +++ b/lodash.flowright/package.json @@ -1,6 +1,6 @@ { "name": "lodash.flowright", - "version": "3.3.0", + "version": "3.4.0", "description": "The lodash method `_.flowRight` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -13,9 +13,5 @@ "Mathias Bynens (https://mathiasbynens.be/)" ], "repository": "lodash/lodash", - "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }, - "dependencies": { - "lodash._baseflatten": "~4.2.0", - "lodash.rest": "^4.0.0" - } + "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" } } diff --git a/lodash.max/LICENSE b/lodash.max/LICENSE new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.max/LICENSE @@ -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.max/README.md b/lodash.max/README.md index f99b3e078..b233af702 100644 --- a/lodash.max/README.md +++ b/lodash.max/README.md @@ -1,4 +1,4 @@ -# lodash.max v3.3.1 +# lodash.max v3.4.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.max` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var max = require('lodash.max'); ``` -See the [documentation](https://lodash.com/docs#max) or [package source](https://github.com/lodash/lodash/blob/3.3.1-npm-packages/lodash.max) for more details. +See the [documentation](https://lodash.com/docs#max) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.max) for more details. diff --git a/lodash.max/index.js b/lodash.max/index.js index 23ce046af..1c0352f42 100644 --- a/lodash.max/index.js +++ b/lodash.max/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.3.1 (Custom Build) + * lodash 3.4.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -10,7 +10,8 @@ var baseCallback = require('lodash._basecallback'), baseEach = require('lodash._baseeach'), isIterateeCall = require('lodash._isiterateecall'), toIterable = require('lodash._toiterable'), - gt = require('lodash.gt'); + gt = require('lodash.gt'), + isArray = require('lodash.isarray'); /** Used as references for `-Infinity` and `Infinity`. */ var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY; @@ -81,11 +82,11 @@ function baseExtremum(collection, iteratee, comparator, exValue) { function createExtremum(comparator, exValue) { return function(collection, iteratee, thisArg) { if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } iteratee = baseCallback(iteratee, thisArg, 3); if (iteratee.length == 1) { - collection = toIterable(collection); + collection = isArray(collection) ? collection : toIterable(collection); var result = arrayExtremum(collection, iteratee, comparator, exValue); if (!(collection.length && result === exValue)) { return result; @@ -97,7 +98,7 @@ function createExtremum(comparator, exValue) { /** * Gets the maximum value of `collection`. If `collection` is empty or falsey - * `-Infinity` is returned. If an iteratee function is provided it is invoked + * `-Infinity` is returned. If an iteratee function is provided it's invoked * for each value in `collection` to generate the criterion by which the value * is ranked. The `iteratee` is bound to `thisArg` and invoked with three * arguments: (value, index, collection). diff --git a/lodash.max/package.json b/lodash.max/package.json index d885aba36..1f9e38fbf 100644 --- a/lodash.max/package.json +++ b/lodash.max/package.json @@ -1,6 +1,6 @@ { "name": "lodash.max", - "version": "3.3.1", + "version": "3.4.0", "description": "The modern build of lodash’s `_.max` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -22,6 +22,7 @@ "lodash._isiterateecall": "^3.0.0", "lodash._toiterable": "^3.0.0", "lodash.gt": "^3.0.0", + "lodash.isarray": "^3.0.0", "lodash.keys": "^3.0.0" } } diff --git a/lodash.min/LICENSE b/lodash.min/LICENSE new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.min/LICENSE @@ -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.min/README.md b/lodash.min/README.md index d9998bb77..662969e84 100644 --- a/lodash.min/README.md +++ b/lodash.min/README.md @@ -1,4 +1,4 @@ -# lodash.min v3.3.1 +# lodash.min v3.4.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.min` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var min = require('lodash.min'); ``` -See the [documentation](https://lodash.com/docs#min) or [package source](https://github.com/lodash/lodash/blob/3.3.1-npm-packages/lodash.min) for more details. +See the [documentation](https://lodash.com/docs#min) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.min) for more details. diff --git a/lodash.min/index.js b/lodash.min/index.js index dbc19ed66..9746a3569 100644 --- a/lodash.min/index.js +++ b/lodash.min/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.3.1 (Custom Build) + * lodash 3.4.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -10,6 +10,7 @@ var baseCallback = require('lodash._basecallback'), baseEach = require('lodash._baseeach'), isIterateeCall = require('lodash._isiterateecall'), toIterable = require('lodash._toiterable'), + isArray = require('lodash.isarray'), lt = require('lodash.lt'); /** Used as references for `-Infinity` and `Infinity`. */ @@ -81,11 +82,11 @@ function baseExtremum(collection, iteratee, comparator, exValue) { function createExtremum(comparator, exValue) { return function(collection, iteratee, thisArg) { if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } iteratee = baseCallback(iteratee, thisArg, 3); if (iteratee.length == 1) { - collection = toIterable(collection); + collection = isArray(collection) ? collection : toIterable(collection); var result = arrayExtremum(collection, iteratee, comparator, exValue); if (!(collection.length && result === exValue)) { return result; @@ -97,7 +98,7 @@ function createExtremum(comparator, exValue) { /** * Gets the minimum value of `collection`. If `collection` is empty or falsey - * `Infinity` is returned. If an iteratee function is provided it is invoked + * `Infinity` is returned. If an iteratee function is provided it's invoked * for each value in `collection` to generate the criterion by which the value * is ranked. The `iteratee` is bound to `thisArg` and invoked with three * arguments: (value, index, collection). diff --git a/lodash.min/package.json b/lodash.min/package.json index 0a9d55ce5..c67c33719 100644 --- a/lodash.min/package.json +++ b/lodash.min/package.json @@ -1,6 +1,6 @@ { "name": "lodash.min", - "version": "3.3.1", + "version": "3.4.0", "description": "The modern build of lodash’s `_.min` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -21,6 +21,7 @@ "lodash._baseeach": "^3.0.0", "lodash._isiterateecall": "^3.0.0", "lodash._toiterable": "^3.0.0", + "lodash.isarray": "^3.0.0", "lodash.keys": "^3.0.0", "lodash.lt": "^3.0.0" } diff --git a/lodash.sortbyorder/LICENSE.txt b/lodash.sortbyorder/LICENSE.txt new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.sortbyorder/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.sortbyorder/README.md b/lodash.sortbyorder/README.md new file mode 100644 index 000000000..217fb3ff6 --- /dev/null +++ b/lodash.sortbyorder/README.md @@ -0,0 +1,20 @@ +# lodash.sortbyorder v3.4.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sortByOrder` 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.sortbyorder +``` + +In Node.js/io.js: + +```js +var sortByOrder = require('lodash.sortbyorder'); +``` + +See the [documentation](https://lodash.com/docs#sortByOrder) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.sortbyorder) for more details. diff --git a/lodash.sortbyorder/index.js b/lodash.sortbyorder/index.js new file mode 100644 index 000000000..550493f4f --- /dev/null +++ b/lodash.sortbyorder/index.js @@ -0,0 +1,90 @@ +/** + * lodash 3.4.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var baseEach = require('lodash._baseeach'), + baseSortByOrder = require('lodash._basesortbyorder'), + isIterateeCall = require('lodash._isiterateecall'), + isArray = require('lodash.isarray'); + +/** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ +function isObjectLike(value) { + return (value && typeof value == 'object') || false; +} + +/** + * Used as the maximum length of an array-like value. + * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * for more details. + */ +var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on ES `ToLength`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) + * for more details. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ +function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * This method is like `_.sortByAll` except that it allows specifying the + * sort orders of the property names to sort by. A truthy value in `orders` + * will sort the corresponding property name in ascending order while a + * falsey value will sort it in descending order. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {string[]} props The property names to sort by. + * @param {boolean[]} orders The sort orders of `props`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 26 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 30 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); + * // => [['barney', 36], ['barney', 26], ['fred', 40], ['fred', 30]] + */ +function sortByOrder(collection, props, orders, guard) { + if (collection == null) { + return []; + } + if (guard && isIterateeCall(props, orders, guard)) { + orders = null; + } + if (!isArray(props)) { + props = props == null ? [] : [props]; + } + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseSortByOrder(collection, props, orders); +} + +module.exports = sortByOrder; diff --git a/lodash.sortbyorder/package.json b/lodash.sortbyorder/package.json new file mode 100644 index 000000000..05bb5fb81 --- /dev/null +++ b/lodash.sortbyorder/package.json @@ -0,0 +1,25 @@ +{ + "name": "lodash.sortbyorder", + "version": "3.4.0", + "description": "The modern build of lodash’s `_.sortByOrder` 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._baseeach": "^3.0.0", + "lodash._basesortbyorder": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash.isarray": "^3.0.0" + } +} diff --git a/lodash.sum/LICENSE.txt b/lodash.sum/LICENSE.txt new file mode 100644 index 000000000..9cd87e5dc --- /dev/null +++ b/lodash.sum/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.sum/README.md b/lodash.sum/README.md new file mode 100644 index 000000000..cf9beeb0b --- /dev/null +++ b/lodash.sum/README.md @@ -0,0 +1,20 @@ +# lodash.sum v3.4.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sum` 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.sum +``` + +In Node.js/io.js: + +```js +var sum = require('lodash.sum'); +``` + +See the [documentation](https://lodash.com/docs#sum) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.sum) for more details. diff --git a/lodash.sum/index.js b/lodash.sum/index.js new file mode 100644 index 000000000..b19b23e97 --- /dev/null +++ b/lodash.sum/index.js @@ -0,0 +1,41 @@ +/** + * lodash 3.4.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +var toIterable = require('lodash._toiterable'), + isArray = require('lodash.isarray'); + +/** + * Gets the sum of the values in `collection`. + * + * @static + * @memberOf _ + * @category Math + * @param {Array|Object|string} collection The collection to iterate over. + * @returns {number} Returns the sum. + * @example + * + * _.sum([4, 6, 2]); + * // => 12 + * + * _.sum({ 'a': 4, 'b': 6, 'c': 2 }); + * // => 12 + */ +function sum(collection) { + if (!isArray(collection)) { + collection = toIterable(collection); + } + var length = collection.length, + result = 0; + + while (length--) { + result += +collection[length] || 0; + } + return result; +} + +module.exports = sum; diff --git a/lodash.sum/package.json b/lodash.sum/package.json new file mode 100644 index 000000000..5baebe651 --- /dev/null +++ b/lodash.sum/package.json @@ -0,0 +1,23 @@ +{ + "name": "lodash.sum", + "version": "3.4.0", + "description": "The modern build of lodash’s `_.sum` 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._toiterable": "^3.0.0", + "lodash.isarray": "^3.0.0" + } +} diff --git a/lodash.template/README.md b/lodash.template/README.md index ea115223c..2bd884413 100644 --- a/lodash.template/README.md +++ b/lodash.template/README.md @@ -1,4 +1,4 @@ -# lodash.template v3.3.2 +# lodash.template v3.4.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.template` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. @@ -17,4 +17,4 @@ In Node.js/io.js: var template = require('lodash.template'); ``` -See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/3.3.2-npm-packages/lodash.template) for more details. +See the [documentation](https://lodash.com/docs#template) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.template) for more details. diff --git a/lodash.template/index.js b/lodash.template/index.js index 6c3607c8e..1642e04dc 100644 --- a/lodash.template/index.js +++ b/lodash.template/index.js @@ -1,5 +1,5 @@ /** - * lodash 3.3.2 (Custom Build) + * lodash 3.4.0 (Custom Build) * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.2 @@ -13,6 +13,7 @@ var baseCopy = require('lodash._basecopy'), reInterpolate = require('lodash._reinterpolate'), escape = require('lodash.escape'), keys = require('lodash.keys'), + restParam = require('lodash.restparam'), templateSettings = require('lodash.templatesettings'); /** `Object#toString` result references. */ @@ -24,9 +25,7 @@ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; /** - * Used to match ES template delimiters. - * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) - * for more details. + * Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; @@ -66,7 +65,7 @@ function escapeStringChar(chr) { * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { - return (value && typeof value == 'object') || false; + return !!value && typeof value == 'object'; } /** Used for native method references. */ @@ -76,9 +75,8 @@ var objectProto = Object.prototype; var hasOwnProperty = objectProto.hasOwnProperty; /** - * Used to resolve the `toStringTag` of values. - * See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) - * for more details. + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. */ var objToString = objectProto.toString; @@ -150,7 +148,7 @@ function baseAssign(object, source, customizer) { * // => false */ function isError(value) { - return (isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag) || false; + return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag; } /** @@ -160,9 +158,9 @@ function isError(value) { * properties may be accessed as free variables in the template. If a setting * object is provided it takes precedence over `_.templateSettings` values. * - * **Note:** In the development build `_.template` utilizes sourceURLs for easier debugging. - * See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) - * for more details. + * **Note:** In the development build `_.template` utilizes + * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * for easier debugging. * * For more information on precompiling templates see * [lodash's custom builds documentation](https://lodash.com/custom-builds). @@ -358,7 +356,7 @@ function template(string, options, otherOptions) { * @static * @memberOf _ * @category Utility - * @param {*} func The function to attempt. + * @param {Function} func The function to attempt. * @returns {*} Returns the `func` result or error object. * @example * @@ -371,19 +369,12 @@ function template(string, options, otherOptions) { * elements = []; * } */ -function attempt() { - var func = arguments[0], - length = arguments.length, - args = Array(length ? (length - 1) : 0); - - while (--length > 0) { - args[length - 1] = arguments[length]; - } +var attempt = restParam(function(func, args) { try { return func.apply(undefined, args); } catch(e) { return isError(e) ? e : new Error(e); } -} +}); module.exports = template; diff --git a/lodash.template/package.json b/lodash.template/package.json index d75451591..c1fd1f9cf 100644 --- a/lodash.template/package.json +++ b/lodash.template/package.json @@ -1,6 +1,6 @@ { "name": "lodash.template", - "version": "3.3.2", + "version": "3.4.0", "description": "The modern build of lodash’s `_.template` as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg", @@ -24,6 +24,7 @@ "lodash._reinterpolate": "^3.0.0", "lodash.escape": "^3.0.0", "lodash.keys": "^3.0.0", + "lodash.restparam": "^3.0.0", "lodash.templatesettings": "^3.0.0" } } diff --git a/lodash.unzip/README.md b/lodash.unzip/README.md index a13723726..4bc262151 100644 --- a/lodash.unzip/README.md +++ b/lodash.unzip/README.md @@ -1,4 +1,4 @@ -# lodash.unzip v3.3.2 +# lodash.unzip v3.4.0 The [lodash](https://lodash.com/) method `_.unzip` exported as a [Node.js](https://nodejs.org/) module. @@ -15,4 +15,4 @@ In Node.js: var unzip = require('lodash.unzip'); ``` -See the [documentation](https://lodash.com/docs#unzip) or [package source](https://github.com/lodash/lodash/blob/3.3.2-npm-packages/lodash.unzip) for more details. +See the [documentation](https://lodash.com/docs#unzip) or [package source](https://github.com/lodash/lodash/blob/3.4.0-npm-packages/lodash.unzip) for more details. diff --git a/lodash.unzip/index.js b/lodash.unzip/index.js index 9a7081412..87dd56044 100644 --- a/lodash.unzip/index.js +++ b/lodash.unzip/index.js @@ -95,7 +95,7 @@ var objectProto = Object.prototype; /** * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; @@ -103,19 +103,6 @@ var objectToString = objectProto.toString; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; -/** - * Gets the "length" property value of `object`. - * - * **Note:** This function is used to avoid a - * [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects - * Safari on at least iOS 8.1-8.3 ARM64. - * - * @private - * @param {Object} object The object to query. - * @returns {*} Returns the "length" value. - */ -var getLength = baseProperty('length'); - /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip @@ -177,7 +164,7 @@ function unzip(array) { * // => false */ function isArrayLike(value) { - return value != null && isLength(getLength(value)) && !isFunction(value); + return value != null && isLength(value.length) && !isFunction(value); } /** @@ -228,8 +215,7 @@ function isArrayLikeObject(value) { */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } @@ -237,16 +223,15 @@ function isFunction(value) { /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, - * else `false`. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); @@ -268,7 +253,7 @@ function isLength(value) { /** * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static diff --git a/lodash.unzip/package.json b/lodash.unzip/package.json index 2aacb2db1..ce5446bca 100644 --- a/lodash.unzip/package.json +++ b/lodash.unzip/package.json @@ -1,6 +1,6 @@ { "name": "lodash.unzip", - "version": "3.3.2", + "version": "3.4.0", "description": "The lodash method `_.unzip` exported as a module.", "homepage": "https://lodash.com/", "icon": "https://lodash.com/icon.svg",