diff --git a/README.md b/README.md
index a1936ed43..63cedb139 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash v3.4.4
+# lodash v3.5.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._basesortbyorder/README.md b/lodash._basesortbyorder/README.md
index e202828fa..ecde71705 100644
--- a/lodash._basesortbyorder/README.md
+++ b/lodash._basesortbyorder/README.md
@@ -1,4 +1,4 @@
-# lodash._basesortbyorder v3.4.1
+# lodash._basesortbyorder v3.5.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.
@@ -17,4 +17,4 @@ In Node.js/io.js:
var baseSortByOrder = require('lodash._basesortbyorder');
```
-See the [package source](https://github.com/lodash/lodash/blob/3.4.1-npm-packages/lodash._basesortbyorder) for more details.
+See the [package source](https://github.com/lodash/lodash/blob/3.5.0-npm-packages/lodash._basesortbyorder) for more details.
diff --git a/lodash._basesortbyorder/index.js b/lodash._basesortbyorder/index.js
index 2c9c27712..10b049979 100644
--- a/lodash._basesortbyorder/index.js
+++ b/lodash._basesortbyorder/index.js
@@ -1,12 +1,14 @@
/**
- * lodash 3.4.1 (Custom Build)
+ * lodash 3.5.0 (Custom Build)
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation
- * Based on Underscore.js 1.8.2
+ * Based on Underscore.js 1.8.3
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license
*/
-var baseCompareAscending = require('lodash._basecompareascending'),
+var arrayMap = require('lodash._arraymap'),
+ baseCallback = require('lodash._basecallback'),
+ baseCompareAscending = require('lodash._basecompareascending'),
baseEach = require('lodash._baseeach'),
baseSortBy = require('lodash._basesortby');
@@ -14,7 +16,7 @@ var baseCompareAscending = require('lodash._basecompareascending'),
* 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.
+ * 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.
*
@@ -56,28 +58,56 @@ function compareMultiple(object, other, orders) {
*/
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;
+/**
+ * The base implementation of `_.map` without support for callback shorthands
+ * and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {Array} Returns the new mapped array.
+ */
+function baseMap(collection, iteratee) {
+ var index = -1,
+ length = getLength(collection),
+ result = isLength(length) ? Array(length) : [];
+
+ baseEach(collection, function(value, key, collection) {
+ result[++index] = iteratee(value, key, collection);
+ });
+ return result;
+}
+
+/**
+ * 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 function.
+ */
+function baseProperty(key) {
+ return function(object) {
+ return object == null ? undefined : object[key];
+ };
+}
+
/**
* 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`.
+ * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
+ * @param {boolean[]} orders The sort orders of `iteratees`.
* @returns {Array} Returns the new sorted array.
*/
-function baseSortByOrder(collection, props, orders) {
- var index = -1,
- length = collection.length,
- result = isLength(length) ? Array(length) : [];
+function baseSortByOrder(collection, iteratees, orders) {
+ var index = -1;
- baseEach(collection, function(value) {
- var length = props.length,
- criteria = Array(length);
+ iteratees = arrayMap(iteratees, function(iteratee) { return baseCallback(iteratee); });
- while (length--) {
- criteria[length] = value == null ? undefined : value[props[length]];
- }
- result[++index] = { 'criteria': criteria, 'index': index, 'value': value };
+ var result = baseMap(collection, function(value) {
+ var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
+ return { 'criteria': criteria, 'index': ++index, 'value': value };
});
return baseSortBy(result, function(object, other) {
@@ -85,6 +115,18 @@ function baseSortByOrder(collection, props, orders) {
});
}
+/**
+ * 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)
+ * in Safari on iOS 8.1 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 length.
*
diff --git a/lodash._basesortbyorder/package.json b/lodash._basesortbyorder/package.json
index 7de981a98..0224ef3d2 100644
--- a/lodash._basesortbyorder/package.json
+++ b/lodash._basesortbyorder/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash._basesortbyorder",
- "version": "3.4.1",
+ "version": "3.5.0",
"description": "The modern build of lodash’s internal `baseSortByOrder` as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
@@ -16,6 +16,8 @@
"repository": "lodash/lodash",
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
"dependencies": {
+ "lodash._arraymap": "^3.0.0",
+ "lodash._basecallback": "^3.0.0",
"lodash._basecompareascending": "^3.0.0",
"lodash._baseeach": "^3.0.0",
"lodash._basesortby": "^3.0.0"
diff --git a/lodash._createcomposer/LICENSE.txt b/lodash._createcomposer/LICENSE.txt
deleted file mode 100644
index 9cd87e5dc..000000000
--- a/lodash._createcomposer/LICENSE.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-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._createcomposer/README.md b/lodash._createcomposer/README.md
deleted file mode 100644
index 3c9afcf10..000000000
--- a/lodash._createcomposer/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# lodash._createcomposer v3.4.1
-
-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.1-npm-packages/lodash._createcomposer) for more details.
diff --git a/lodash._createcomposer/index.js b/lodash._createcomposer/index.js
deleted file mode 100644
index e695518c0..000000000
--- a/lodash._createcomposer/index.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * lodash 3.4.1 (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
deleted file mode 100644
index 0722432a4..000000000
--- a/lodash._createcomposer/package.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "name": "lodash._createcomposer",
- "version": "3.4.1",
- "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/README.md b/lodash.add/README.md
index da5fec342..3b7281486 100644
--- a/lodash.add/README.md
+++ b/lodash.add/README.md
@@ -1,4 +1,4 @@
-# lodash.add v3.4.4
+# lodash.add v3.5.0
The [lodash](https://lodash.com/) method `_.add` exported as a [Node.js](https://nodejs.org/) module.
@@ -15,4 +15,4 @@ In Node.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.4-npm-packages/lodash.add) for more details.
+See the [documentation](https://lodash.com/docs#add) or [package source](https://github.com/lodash/lodash/blob/3.5.0-npm-packages/lodash.add) for more details.
diff --git a/lodash.add/index.js b/lodash.add/index.js
index 589fea035..038f8786b 100644
--- a/lodash.add/index.js
+++ b/lodash.add/index.js
@@ -1,11 +1,13 @@
/**
- * lodash 3.4.4 (Custom Build)
+ * lodash 3.5.0 (Custom Build)
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
+var baseToNumber = require('lodash._basetonumber'),
+ baseToString = require('lodash._basetostring');
/**
* Creates a function that performs a mathematical operation on two values.
@@ -24,7 +26,17 @@ function createMathOperation(operator) {
result = value;
}
if (other !== undefined) {
- result = result === undefined ? other : operator(result, other);
+ if (result === undefined) {
+ return other;
+ }
+ if (typeof value == 'string' || typeof other == 'string') {
+ value = baseToString(value);
+ other = baseToString(other);
+ } else {
+ value = baseToNumber(value);
+ other = baseToNumber(other);
+ }
+ result = operator(value, other);
}
return result;
};
diff --git a/lodash.add/package.json b/lodash.add/package.json
index 1fdddbfb5..778f05e97 100644
--- a/lodash.add/package.json
+++ b/lodash.add/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash.add",
- "version": "3.4.4",
+ "version": "3.5.0",
"description": "The lodash method `_.add` exported as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
@@ -13,5 +13,9 @@
"Mathias Bynens (https://mathiasbynens.be/)"
],
"repository": "lodash/lodash",
- "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
+ "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
+ "dependencies": {
+ "lodash._basetonumber": "~4.11.0",
+ "lodash._basetostring": "~4.11.0"
+ }
}
diff --git a/lodash.flow/README.md b/lodash.flow/README.md
index de5f58426..c8cffca99 100644
--- a/lodash.flow/README.md
+++ b/lodash.flow/README.md
@@ -1,4 +1,4 @@
-# lodash.flow v3.4.0
+# lodash.flow v3.5.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.4.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.5.0-npm-packages/lodash.flow) for more details.
diff --git a/lodash.flow/index.js b/lodash.flow/index.js
index 8fa20fc4d..9bfb773fa 100644
--- a/lodash.flow/index.js
+++ b/lodash.flow/index.js
@@ -66,19 +66,6 @@ function arrayPush(array, values) {
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;
@@ -87,7 +74,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
/**
* 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;
@@ -197,19 +184,6 @@ 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.
*
@@ -241,7 +215,7 @@ function isFlattenable(value) {
* // => false
*/
function isArguments(value) {
- // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
@@ -297,7 +271,7 @@ var isArray = Array.isArray;
* // => false
*/
function isArrayLike(value) {
- return value != null && isLength(getLength(value)) && !isFunction(value);
+ return value != null && isLength(value.length) && !isFunction(value);
}
/**
@@ -348,8 +322,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;
}
@@ -357,16 +330,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);
@@ -388,7 +360,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.flow/package.json b/lodash.flow/package.json
index 5b4353c92..748283c20 100644
--- a/lodash.flow/package.json
+++ b/lodash.flow/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash.flow",
- "version": "3.4.0",
+ "version": "3.5.0",
"description": "The lodash method `_.flow` exported as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
diff --git a/lodash.flowright/README.md b/lodash.flowright/README.md
index be7a5f55f..04e20c894 100644
--- a/lodash.flowright/README.md
+++ b/lodash.flowright/README.md
@@ -1,4 +1,4 @@
-# lodash.flowright v3.4.0
+# lodash.flowright v3.5.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.4.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.5.0-npm-packages/lodash.flowright) for more details.
diff --git a/lodash.flowright/index.js b/lodash.flowright/index.js
index f7209529f..2dfa57d21 100644
--- a/lodash.flowright/index.js
+++ b/lodash.flowright/index.js
@@ -66,19 +66,6 @@ function arrayPush(array, values) {
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;
@@ -87,7 +74,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
/**
* 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;
@@ -197,19 +184,6 @@ 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.
*
@@ -241,7 +215,7 @@ function isFlattenable(value) {
* // => false
*/
function isArguments(value) {
- // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
@@ -297,7 +271,7 @@ var isArray = Array.isArray;
* // => false
*/
function isArrayLike(value) {
- return value != null && isLength(getLength(value)) && !isFunction(value);
+ return value != null && isLength(value.length) && !isFunction(value);
}
/**
@@ -348,8 +322,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;
}
@@ -357,16 +330,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);
@@ -388,7 +360,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.flowright/package.json b/lodash.flowright/package.json
index 6ba744eff..757123fff 100644
--- a/lodash.flowright/package.json
+++ b/lodash.flowright/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash.flowright",
- "version": "3.4.0",
+ "version": "3.5.0",
"description": "The lodash method `_.flowRight` exported as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
diff --git a/lodash.sum/README.md b/lodash.sum/README.md
index cf9beeb0b..560a54d73 100644
--- a/lodash.sum/README.md
+++ b/lodash.sum/README.md
@@ -1,4 +1,4 @@
-# lodash.sum v3.4.0
+# lodash.sum v3.5.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.
@@ -17,4 +17,4 @@ In Node.js/io.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.
+See the [documentation](https://lodash.com/docs#sum) or [package source](https://github.com/lodash/lodash/blob/3.5.0-npm-packages/lodash.sum) for more details.
diff --git a/lodash.sum/index.js b/lodash.sum/index.js
index b19b23e97..09c8e82ac 100644
--- a/lodash.sum/index.js
+++ b/lodash.sum/index.js
@@ -1,14 +1,51 @@
/**
- * lodash 3.4.0 (Custom Build)
+ * lodash 3.5.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'),
+var baseCallback = require('lodash._basecallback'),
+ baseEach = require('lodash._baseeach'),
+ isIterateeCall = require('lodash._isiterateecall'),
+ toIterable = require('lodash._toiterable'),
isArray = require('lodash.isarray');
+/**
+ * A specialized version of `_.sum` for arrays without support for iteratees.
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @returns {number} Returns the sum.
+ */
+function arraySum(array) {
+ var length = array.length,
+ result = 0;
+
+ while (length--) {
+ result += +array[length] || 0;
+ }
+ return result;
+}
+
+/**
+ * The base implementation of `_.sum` without support for callback shorthands
+ * and `this` binding.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @returns {number} Returns the sum.
+ */
+function baseSum(collection, iteratee) {
+ var result = 0;
+ baseEach(collection, function(value, index, collection) {
+ result += +iteratee(value, index, collection) || 0;
+ });
+ return result;
+}
+
/**
* Gets the sum of the values in `collection`.
*
@@ -16,26 +53,41 @@ var toIterable = require('lodash._toiterable'),
* @memberOf _
* @category Math
* @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [iteratee] The function invoked per iteration.
+ * @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {number} Returns the sum.
* @example
*
- * _.sum([4, 6, 2]);
- * // => 12
+ * _.sum([4, 6]);
+ * // => 10
*
- * _.sum({ 'a': 4, 'b': 6, 'c': 2 });
- * // => 12
+ * _.sum({ 'a': 4, 'b': 6 });
+ * // => 10
+ *
+ * var objects = [
+ * { 'n': 4 },
+ * { 'n': 6 }
+ * ];
+ *
+ * _.sum(objects, function(object) {
+ * return object.n;
+ * });
+ * // => 10
+ *
+ * // using the `_.property` callback shorthand
+ * _.sum(objects, 'n');
+ * // => 10
*/
-function sum(collection) {
- if (!isArray(collection)) {
- collection = toIterable(collection);
+function sum(collection, iteratee, thisArg) {
+ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
+ iteratee = null;
}
- var length = collection.length,
- result = 0;
+ var noIteratee = iteratee == null;
- while (length--) {
- result += +collection[length] || 0;
- }
- return result;
+ iteratee = noIteratee ? iteratee : baseCallback(iteratee, thisArg, 3);
+ return noIteratee
+ ? arraySum(isArray(collection) ? collection : toIterable(collection))
+ : baseSum(collection, iteratee);
}
module.exports = sum;
diff --git a/lodash.sum/package.json b/lodash.sum/package.json
index 5baebe651..82e9d2aa7 100644
--- a/lodash.sum/package.json
+++ b/lodash.sum/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash.sum",
- "version": "3.4.0",
+ "version": "3.5.0",
"description": "The modern build of lodash’s `_.sum` as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
@@ -17,6 +17,9 @@
"repository": "lodash/lodash",
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
"dependencies": {
+ "lodash._basecallback": "^3.0.0",
+ "lodash._baseeach": "^3.0.0",
+ "lodash._isiterateecall": "^3.0.0",
"lodash._toiterable": "^3.0.0",
"lodash.isarray": "^3.0.0"
}
diff --git a/lodash.template/README.md b/lodash.template/README.md
index 2bd884413..6c927c16a 100644
--- a/lodash.template/README.md
+++ b/lodash.template/README.md
@@ -1,4 +1,4 @@
-# lodash.template v3.4.0
+# lodash.template v3.5.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.4.0-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.5.0-npm-packages/lodash.template) for more details.
diff --git a/lodash.template/index.js b/lodash.template/index.js
index 1642e04dc..a2b644f84 100644
--- a/lodash.template/index.js
+++ b/lodash.template/index.js
@@ -1,8 +1,8 @@
/**
- * lodash 3.4.0 (Custom Build)
+ * lodash 3.5.0 (Custom Build)
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation
- * Based on Underscore.js 1.8.2
+ * Based on Underscore.js 1.8.3
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license
*/
@@ -12,6 +12,7 @@ var baseCopy = require('lodash._basecopy'),
isIterateeCall = require('lodash._isiterateecall'),
reInterpolate = require('lodash._reinterpolate'),
escape = require('lodash.escape'),
+ isNative = require('lodash.isnative'),
keys = require('lodash.keys'),
restParam = require('lodash.restparam'),
templateSettings = require('lodash.templatesettings');
@@ -24,9 +25,7 @@ var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
-/**
- * Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components).
- */
+/** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to ensure capturing order of template delimiters. */
@@ -69,7 +68,8 @@ function isObjectLike(value) {
}
/** Used for native method references. */
-var objectProto = Object.prototype;
+var arrayProto = Array.prototype,
+ objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
@@ -80,10 +80,31 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*/
var objToString = objectProto.toString;
+/** Native method references. */
+var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols,
+ push = arrayProto.push,
+ preventExtensions = isNative(Object.preventExtensions = Object.preventExtensions) && preventExtensions;
+
+/** Used as `baseAssign`. */
+var nativeAssign = (function() {
+ // Avoid `Object.assign` in Firefox 34-37 which have an early implementation
+ // with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344
+ // for more details.
+ //
+ // Use `Object.preventExtensions` on a plain object instead of simply using
+ // `Object('x')` because Chrome and IE fail to throw an error when attempting
+ // to assign values to readonly indexes of strings in strict mode.
+ var object = { '1': 0 },
+ func = preventExtensions && isNative(func = Object.assign) && func;
+
+ try { func(preventExtensions(object), 'xo'); } catch(e) {}
+ return !object[1] && func;
+}());
+
/**
* Used by `_.template` to customize its `_.assign` use.
*
- * **Note:** This method is like `assignDefaults` except that it ignores
+ * **Note:** This function is like `assignDefaults` except that it ignores
* inherited property values when checking if a property is `undefined`.
*
* @private
@@ -94,26 +115,26 @@ var objToString = objectProto.toString;
* @returns {*} Returns the value to assign to the destination object.
*/
function assignOwnDefaults(objectValue, sourceValue, key, object) {
- return (typeof objectValue == 'undefined' || !hasOwnProperty.call(object, key))
+ return (objectValue === undefined || !hasOwnProperty.call(object, key))
? sourceValue
: objectValue;
}
/**
- * The base implementation of `_.assign` without support for argument juggling,
- * multiple sources, and `this` binding `customizer` functions.
+ * A specialized version of `_.assign` for customizing assigned values without
+ * support for argument juggling, multiple sources, and `this` binding `customizer`
+ * functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
- * @param {Function} [customizer] The function to customize assigning values.
- * @returns {Object} Returns the destination object.
+ * @param {Function} customizer The function to customize assigned values.
+ * @returns {Object} Returns `object`.
*/
-function baseAssign(object, source, customizer) {
+function assignWith(object, source, customizer) {
var props = keys(source);
- if (!customizer) {
- return baseCopy(source, object, props);
- }
+ push.apply(props, getSymbols(source));
+
var index = -1,
length = props.length;
@@ -123,13 +144,50 @@ function baseAssign(object, source, customizer) {
result = customizer(value, source[key], key, object, source);
if ((result === result ? (result !== value) : (value === value)) ||
- (typeof value == 'undefined' && !(key in object))) {
+ (value === undefined && !(key in object))) {
object[key] = result;
}
}
return object;
}
+/**
+ * The base implementation of `_.assign` without support for argument juggling,
+ * multiple sources, and `customizer` functions.
+ *
+ * @private
+ * @param {Object} object The destination object.
+ * @param {Object} source The source object.
+ * @returns {Object} Returns `object`.
+ */
+var baseAssign = nativeAssign || function(object, source) {
+ return source == null
+ ? object
+ : baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object));
+};
+
+/**
+ * Creates an array of the own symbols of `object`.
+ *
+ * @private
+ * @param {Object} object The object to query.
+ * @returns {Array} Returns the array of symbols.
+ */
+var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) {
+ return getOwnPropertySymbols(toObject(object));
+};
+
+/**
+ * Converts `value` to an object if it is not one.
+ *
+ * @private
+ * @param {*} value The value to process.
+ * @returns {Object} Returns the object.
+ */
+function toObject(value) {
+ return isObject(value) ? value : Object(value);
+}
+
/**
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
* `SyntaxError`, `TypeError`, or `URIError` object.
@@ -151,6 +209,33 @@ function isError(value) {
return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
}
+/**
+ * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
+ * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @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(1);
+ * // => false
+ */
+function isObject(value) {
+ // Avoid a V8 JIT bug in Chrome 19-20.
+ // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
+ var type = typeof value;
+ return type == 'function' || (!!value && type == 'object');
+}
+
/**
* Creates a compiled template function that can interpolate data properties
* in "interpolate" delimiters, HTML-escape interpolated data properties in
@@ -256,9 +341,9 @@ function template(string, options, otherOptions) {
options = otherOptions = null;
}
string = baseToString(string);
- options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
+ options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
- var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
+ var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
importsKeys = keys(imports),
importsValues = baseValues(imports, importsKeys);
@@ -377,4 +462,26 @@ var attempt = restParam(function(func, args) {
}
});
+/**
+ * Creates a function that returns `value`.
+ *
+ * @static
+ * @memberOf _
+ * @category Utility
+ * @param {*} value The value to return from the new function.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var object = { 'user': 'fred' };
+ * var getter = _.constant(object);
+ *
+ * getter() === object;
+ * // => true
+ */
+function constant(value) {
+ return function() {
+ return value;
+ };
+}
+
module.exports = template;
diff --git a/lodash.template/package.json b/lodash.template/package.json
index c1fd1f9cf..86636d607 100644
--- a/lodash.template/package.json
+++ b/lodash.template/package.json
@@ -1,6 +1,6 @@
{
"name": "lodash.template",
- "version": "3.4.0",
+ "version": "3.5.0",
"description": "The modern build of lodash’s `_.template` as a module.",
"homepage": "https://lodash.com/",
"icon": "https://lodash.com/icon.svg",
@@ -23,6 +23,7 @@
"lodash._isiterateecall": "^3.0.0",
"lodash._reinterpolate": "^3.0.0",
"lodash.escape": "^3.0.0",
+ "lodash.isnative": "^3.0.0",
"lodash.keys": "^3.0.0",
"lodash.restparam": "^3.0.0",
"lodash.templatesettings": "^3.0.0"