From 9f3f0a76aa318138422fe05d0eecedb3930502cc Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 16 Apr 2015 20:07:48 -0700 Subject: [PATCH 01/43] Ensure `baseGet` returns `undefined` and not `null`. [closes #1136] --- lodash.src.js | 4 ++-- test/test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 26b9c85c0c..279df41e71 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -2305,9 +2305,9 @@ length = path.length; while (object != null && ++index < length) { - var result = object = toObject(object)[path[index]]; + object = toObject(object)[path[index]]; } - return result; + return (index && index == length) ? object : undefined; } /** diff --git a/test/test.js b/test/test.js index 35367f0357..2d32f8afc4 100644 --- a/test/test.js +++ b/test/test.js @@ -13222,7 +13222,7 @@ }); test('`_.' + methodName + '` should return `undefined` if parts of `path` are missing', 2, function() { - var object = {}; + var object = { 'a': [, null] }; _.each(['a[1].b.c', ['a', '1', 'b', 'c']], function(path) { strictEqual(func(object, path), undefined); From f2dae588aa21975f173a0b5973123817f16fcace Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 17 Apr 2015 08:27:14 -0700 Subject: [PATCH 02/43] Add test labels to help track down odd false fail. --- test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index 2d32f8afc4..9714b76957 100644 --- a/test/test.js +++ b/test/test.js @@ -13440,11 +13440,11 @@ var oldId = (_.uniqueId(), _.uniqueId()), lodash = _.runInContext(); - ok(_.uniqueId() > oldId); + ok(_.uniqueId() > oldId, '_.uniqueId() > oldId'); var id = lodash.uniqueId(); strictEqual(id, '1'); - ok(id < oldId); + ok(id < oldId, 'id < oldId'); } else { skipTest(3); From 746f9bb7783ce6e95d02232f1f12adb7bd9e49ab Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 17 Apr 2015 08:35:41 -0700 Subject: [PATCH 03/43] Add `_.mapKeys`. [closes #169] --- lodash.src.js | 55 ++++++++++++++++++++---- test/test.js | 113 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 134 insertions(+), 34 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 279df41e71..002e958046 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3600,6 +3600,28 @@ }; } + /** + * Creates a function for `_.mapKeys` or `_.mapValues`. + * + * @private + * @param {boolean} [isMapKeys] Specify mapping keys instead of values. + * @returns {Function} Returns the new map function. + */ + function createObjectMapper(isMapKeys) { + return function(object, iteratee, thisArg) { + var result = {}; + iteratee = getCallback(iteratee, thisArg, 3); + + baseForOwn(object, function(value, key, object) { + var mapped = iteratee(value, key, object); + key = isMapKeys ? mapped : key; + value = isMapKeys ? value : mapped; + result[key] = value; + }); + return result; + }; + } + /** * Creates a function for `_.padLeft` or `_.padRight`. * @@ -9782,6 +9804,28 @@ return result; } + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * property of `object` through `iteratee`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + var mapKeys = createObjectMapper(true); + /** * Creates an object with the same keys as `object` and values generated by * running each own enumerable property of `object` through `iteratee`. The @@ -9823,15 +9867,7 @@ * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ - function mapValues(object, iteratee, thisArg) { - var result = {}; - iteratee = getCallback(iteratee, thisArg, 3); - - baseForOwn(object, function(value, key, object) { - result[key] = iteratee(value, key, object); - }); - return result; - } + var mapValues = createObjectMapper(); /** * Recursively merges own enumerable properties of the source object(s), that @@ -11931,6 +11967,7 @@ lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; + lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; diff --git a/test/test.js b/test/test.js index 9714b76957..37a2cc76e4 100644 --- a/test/test.js +++ b/test/test.js @@ -2883,6 +2883,17 @@ } }); + test('`_.mapKeys` should use `_.callback` internally', 1, function() { + if (!isModularize) { + _.callback = getPropB; + deepEqual(_.mapKeys({ 'a': { 'b': 1 } }), { '1': { 'b': 1 } }); + _.callback = callback; + } + else { + skipTest(); + } + }); + test('`_.mapValues` should use `_.callback` internally', 1, function() { if (!isModularize) { _.callback = getPropB; @@ -5345,6 +5356,7 @@ 'groupBy', 'indexBy', 'map', + 'mapKeys', 'mapValues', 'max', 'min', @@ -5405,6 +5417,7 @@ 'forInRight', 'forOwn', 'forOwnRight', + 'mapKeys', 'mapValues', 'omit', 'pick' @@ -9428,6 +9441,46 @@ strictEqual(_.collect, _.map); }); }()); + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.mapKeys'); + + (function() { + var array = [1, 2], + object = { 'a': 1, 'b': 2, 'c': 3 }; + + test('should map keys in `object` to a new object', 1, function() { + var actual = _.mapKeys(object, String); + deepEqual(actual, { '1': 1, '2': 2, '3': 3 }); + }); + + test('should treat arrays like objects', 1, function() { + var actual = _.mapKeys(array, String); + deepEqual(actual, { '1': 1, '2': 2 }); + }); + + test('should support the `thisArg` argument', 2, function() { + function callback(num, key) { + return this[key] + num + } + + var actual = _.mapKeys({ 'a': 1 }, callback, { 'a': 2 }); + deepEqual(actual, { '3': 1 }); + + actual = _.mapKeys([2], callback, [1]); + deepEqual(actual, { '3': 2 }); + }); + + test('should work with a "_.property" style `iteratee`', 1, function() { + var actual = _.mapKeys({ 'a': { 'b': 'c' } }, 'b'); + deepEqual(actual, { 'c': { 'b': 'c' } }); + }); + + test('should work on an object with no `iteratee`', 1, function() { + var actual = _.mapKeys({ 'a': 1, 'b': 2, 'c': 3 }); + deepEqual(actual, { '1': 1, '2': 2, '3': 3 }); + }); + }()); /*--------------------------------------------------------------------------*/ @@ -9447,18 +9500,6 @@ deepEqual(actual, { '0': '1', '1': '2' }); }); - test('should provide the correct `iteratee` arguments', 2, function() { - _.each([object, array], function(value, index) { - var args; - - _.mapValues(value, function() { - args || (args = slice.call(arguments)); - }); - - deepEqual(args, [1, index ? '0' : 'a', value]); - }); - }); - test('should support the `thisArg` argument', 2, function() { function callback(num, key) { return this[key] + num; @@ -9467,7 +9508,7 @@ var actual = _.mapValues({ 'a': 1 }, callback, { 'a': 2 }); deepEqual(actual, { 'a': 3 }); - actual = _.mapValues([1], callback, [2]); + actual = _.mapValues([2], callback, [1]); deepEqual(actual, { '0': 3 }); }); @@ -9476,41 +9517,63 @@ deepEqual(actual, { 'a': 1 }); }); - test('should iterate over own properties of objects', 1, function() { - function Foo() { this.a = 1; } - Foo.prototype.b = 2; - - var actual = _.mapValues(new Foo, function(value, key) { return key; }); - deepEqual(actual, { 'a': 'a' }); - }); - test('should work on an object with no `iteratee`', 2, function() { var actual = _.mapValues({ 'a': 1, 'b': 2, 'c': 3 }); deepEqual(actual, object); notStrictEqual(actual, object); }); + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.mapKeys and lodash.mapValues'); + + _.each(['mapKeys', 'mapValues'], function(methodName) { + var array = [1, 2], + func = _[methodName], + object = { 'a': 1, 'b': 2, 'c': 3 }; + + test('should iterate over own properties of objects', 1, function() { + function Foo() { this.a = 'a'; } + Foo.prototype.b = 'b'; + + var actual = func(new Foo, function(value, key) { return key; }); + deepEqual(actual, { 'a': 'a' }); + }); test('should accept a falsey `object` argument', 1, function() { var expected = _.map(falsey, _.constant({})); var actual = _.map(falsey, function(value, index) { try { - return index ? _.mapValues(value) : _.mapValues(); + return index ? func(value) : func(); } catch(e) {} }); deepEqual(actual, expected); }); + test('should provide the correct `iteratee` arguments', 2, function() { + _.each([object, array], function(value, index) { + var args; + + _.mapValues(value, function() { + args || (args = slice.call(arguments)); + }); + + deepEqual(args, [1, index ? '0' : 'a', value]); + }); + }); + test('should return a wrapped value when chaining', 1, function() { if (!isNpm) { - ok(_(object).mapValues(_.noop) instanceof _); + ok(_(object)[methodName](_.noop) instanceof _); } else { skipTest(); } }); - }()); + }); /*--------------------------------------------------------------------------*/ @@ -17451,7 +17514,7 @@ var acceptFalsey = _.difference(allMethods, rejectFalsey); - test('should accept falsey arguments', 217, function() { + test('should accept falsey arguments', 218, function() { var emptyArrays = _.map(falsey, _.constant([])), isExposed = '_' in root, oldDash = root._; From 9749ac56baf7419d47a6a518728421aede0288e5 Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 17 Apr 2015 08:37:55 -0700 Subject: [PATCH 04/43] Remove extraneous docs for methods that reference others. [ci skip] --- lodash.src.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 002e958046..166da80791 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -7065,17 +7065,6 @@ * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * - * If a property name is provided for `predicate` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `predicate` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * * @static * @memberOf _ * @category Collection @@ -9922,11 +9911,6 @@ /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable properties of `object` that are not omitted. - * Property names may be specified as individual arguments or as arrays of - * property names. If `predicate` is provided it is invoked for each property - * of `object` omitting the properties `predicate` returns truthy for. The - * predicate is bound to `thisArg` and invoked with three arguments: - * (value, key, object). * * @static * @memberOf _ From 75ce6b82e802f843dc6d3bf9fe67ec45d3a78f81 Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 17 Apr 2015 09:04:22 -0700 Subject: [PATCH 05/43] Add `sum` to guarded doc note in `_.map`. [ci skip] --- lodash.src.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 166da80791..ee8f8ec648 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -6868,10 +6868,11 @@ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: - * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, - * `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, - * `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, - * `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` * * @static * @memberOf _ From 20ba0bd1dcadb79389860fd9acddce6fa84d0ff4 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sat, 18 Apr 2015 09:31:30 -0700 Subject: [PATCH 06/43] Fix `_.uniqueId` test to properly compare values. --- test/test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test.js b/test/test.js index 37a2cc76e4..8bcf80dbf7 100644 --- a/test/test.js +++ b/test/test.js @@ -13500,14 +13500,16 @@ test('should use a zeroed `_.uniqueId` counter', 3, function() { if (!isModularize) { - var oldId = (_.uniqueId(), _.uniqueId()), + _.times(2, _.uniqueId); + + var oldId = Number(_.uniqueId()), lodash = _.runInContext(); - ok(_.uniqueId() > oldId, '_.uniqueId() > oldId'); + ok(_.uniqueId() > oldId); var id = lodash.uniqueId(); strictEqual(id, '1'); - ok(id < oldId, 'id < oldId'); + ok(id < oldId); } else { skipTest(3); From 82be40eace8546e7485b889a038459537db3a62d Mon Sep 17 00:00:00 2001 From: thirdcreed Date: Mon, 13 Apr 2015 19:24:25 -0500 Subject: [PATCH 07/43] Add `_.zipWith`. --- lodash.src.js | 23 +++++++++++++++++++++++ test/test.js | 16 +++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index ee8f8ec648..53af8d086d 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -6061,6 +6061,28 @@ return result; } + /** + * Combines elements of given arrays, like `_.zip` but with a function + * specifying how they should be combined. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] Arrays to be zipped with accumulator. + * @param {Function} accumulator Function used to reduce zipped elements. + * @returns {Array} Returns new array of accumulated groups. + * @example + * + * _.zipWith([1, 2, 3], [10, 20 , 30], _.add); + * // => [11, 22, 33] + */ + var zipWith = restParam(function(arrays) { + var iteratee = arrays.pop(); + return arrayMap(unzip(arrays), function(array) { + return arrayReduce(array, iteratee, undefined, true); + }); + }); + /*------------------------------------------------------------------------*/ /** @@ -12009,6 +12031,7 @@ lodash.xor = xor; lodash.zip = zip; lodash.zipObject = zipObject; + lodash.zipWith = zipWith; // Add aliases. lodash.backflow = flowRight; diff --git a/test/test.js b/test/test.js index 8bcf80dbf7..ca5b19ae89 100644 --- a/test/test.js +++ b/test/test.js @@ -16718,6 +16718,20 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.zipWith'); + + (function() { + test('should combine values in lists with given function', 2, function() { + var array1 = [1, 2, 3], + array2 = [1, 2, 3]; + + deepEqual(_.zipWith(array1, array2, _.add), [2, 4, 6]); + deepEqual(_.zipWith(array1, [], _.add), [1, 2, 3]); + }); + }()) + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash(...).commit'); (function() { @@ -17516,7 +17530,7 @@ var acceptFalsey = _.difference(allMethods, rejectFalsey); - test('should accept falsey arguments', 218, function() { + test('should accept falsey arguments', 219, function() { var emptyArrays = _.map(falsey, _.constant([])), isExposed = '_' in root, oldDash = root._; From a08a3c6096b46a431bf1a5360f1974ad65cf5ca1 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sat, 18 Apr 2015 14:16:52 -0700 Subject: [PATCH 08/43] Cleanup tests. --- test/test.js | 92 ++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/test/test.js b/test/test.js index ca5b19ae89..c9428ad266 100644 --- a/test/test.js +++ b/test/test.js @@ -2406,6 +2406,11 @@ deepEqual(actual, { '4': 1, '6': 2 }); }); + test('should work with a "_.property" style `iteratee`', 1, function() { + var actual = _.countBy(['one', 'two', 'three'], 'length'); + deepEqual(actual, { '3': 2, '5': 1 }); + }); + test('should only add values to own, not inherited, properties', 2, function() { var actual = _.countBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; @@ -2415,11 +2420,6 @@ deepEqual(actual.hasOwnProperty, 2); }); - test('should work with a "_.property" style `iteratee`', 1, function() { - var actual = _.countBy(['one', 'two', 'three'], 'length'); - deepEqual(actual, { '3': 2, '5': 1 }); - }); - test('should work with a number for `iteratee`', 2, function() { var array = [ [1, 'a'], @@ -4332,18 +4332,6 @@ strictEqual(_.every([undefined, undefined, undefined], _.identity), false); }); - test('should work with a "_.property" style `predicate`', 2, function() { - var objects = [{ 'a': 0, 'b': 1 }, { 'a': 1, 'b': 2 }]; - strictEqual(_.every(objects, 'a'), false); - strictEqual(_.every(objects, 'b'), true); - }); - - test('should work with a "_where" style `predicate`', 2, function() { - var objects = [{ 'a': 0, 'b': 0 }, { 'a': 0, 'b': 1 }]; - strictEqual(_.every(objects, { 'a': 0 }), true); - strictEqual(_.every(objects, { 'b': 1 }), false); - }); - test('should use `_.identity` when `predicate` is nullish', 2, function() { var values = [, null, undefined], expected = _.map(values, _.constant(false)); @@ -4364,6 +4352,18 @@ deepEqual(actual, expected); }); + test('should work with a "_.property" style `predicate`', 2, function() { + var objects = [{ 'a': 0, 'b': 1 }, { 'a': 1, 'b': 2 }]; + strictEqual(_.every(objects, 'a'), false); + strictEqual(_.every(objects, 'b'), true); + }); + + test('should work with a "_.matches" style `predicate`', 2, function() { + var objects = [{ 'a': 0, 'b': 0 }, { 'a': 0, 'b': 1 }]; + strictEqual(_.every(objects, { 'a': 0 }), true); + strictEqual(_.every(objects, { 'b': 1 }), false); + }); + test('should work as an iteratee for methods like `_.map`', 1, function() { var actual = _.map([[1]], _.every); deepEqual(actual, [true]); @@ -6105,6 +6105,11 @@ deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] }); }); + test('should work with a "_.property" style `iteratee`', 1, function() { + var actual = _.groupBy(['one', 'two', 'three'], 'length'); + deepEqual(actual, { '3': ['one', 'two'], '5': ['three'] }); + }); + test('should only add values to own, not inherited, properties', 2, function() { var actual = _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; @@ -6114,11 +6119,6 @@ deepEqual(actual.hasOwnProperty, [6.1, 6.4]); }); - test('should work with a "_.property" style `iteratee`', 1, function() { - var actual = _.groupBy(['one', 'two', 'three'], 'length'); - deepEqual(actual, { '3': ['one', 'two'], '5': ['three'] }); - }); - test('should work with a number for `iteratee`', 2, function() { var array = [ [1, 'a'], @@ -6427,6 +6427,11 @@ deepEqual(actual, { '4': 4.2, '6': 6.4 }); }); + test('should work with a "_.property" style `iteratee`', 1, function() { + var actual = _.indexBy(['one', 'two', 'three'], 'length'); + deepEqual(actual, { '3': 'two', '5': 'three' }); + }); + test('should only add values to own, not inherited, properties', 2, function() { var actual = _.indexBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; @@ -6436,11 +6441,6 @@ deepEqual(actual.hasOwnProperty, 6.4); }); - test('should work with a "_.property" style `iteratee`', 1, function() { - var actual = _.indexBy(['one', 'two', 'three'], 'length'); - deepEqual(actual, { '3': 'two', '5': 'three' }); - }); - test('should work with a number for `iteratee`', 2, function() { var array = [ [1, 'a'], @@ -12972,7 +12972,7 @@ deepEqual(func(objects, 'a'), [objects[isFilter ? 1 : 0]]); }); - test('`_.' + methodName + '` should work with a "_where" style `predicate`', 1, function() { + test('`_.' + methodName + '` should work with a "_.matches" style `predicate`', 1, function() { deepEqual(func(objects, objects[1]), [objects[isFilter ? 1 : 0]]); }); @@ -14072,7 +14072,7 @@ strictEqual(_.some(objects, 'b'), true); }); - test('should work with a "_where" style `predicate`', 2, function() { + test('should work with a "_.matches" style `predicate`', 2, function() { var objects = [{ 'a': 0, 'b': 0 }, { 'a': 1, 'b': 1}]; strictEqual(_.some(objects, { 'a': 0 }), true); strictEqual(_.some(objects, { 'b': 2 }), false); @@ -14159,23 +14159,6 @@ }); }); - test('should use `_.identity` when `iteratee` is nullish', 1, function() { - var array = [3, 2, 1], - values = [, null, undefined], - expected = _.map(values, _.constant([1, 2, 3])); - - var actual = _.map(values, function(value, index) { - return index ? _.sortBy(array, value) : _.sortBy(array); - }); - - deepEqual(actual, expected); - }); - - test('should move `undefined` and `NaN` values to the end', 1, function() { - var array = [NaN, undefined, 4, 1, undefined, 3, NaN, 2]; - deepEqual(_.sortBy(array), [1, 2, 3, 4, undefined, undefined, NaN, NaN]); - }); - test('should provide the correct `iteratee` arguments', 1, function() { var args; @@ -14194,6 +14177,18 @@ deepEqual(actual, [3, 1, 2]); }); + test('should use `_.identity` when `iteratee` is nullish', 1, function() { + var array = [3, 2, 1], + values = [, null, undefined], + expected = _.map(values, _.constant([1, 2, 3])); + + var actual = _.map(values, function(value, index) { + return index ? _.sortBy(array, value) : _.sortBy(array); + }); + + deepEqual(actual, expected); + }); + test('should work with a "_.property" style `iteratee`', 1, function() { var actual = _.pluck(_.sortBy(objects.concat(undefined), 'b'), 'b'); deepEqual(actual, [1, 2, 3, 4, undefined]); @@ -14207,6 +14202,11 @@ deepEqual(actual, [3, 1, 2]); }); + test('should move `undefined` and `NaN` values to the end', 1, function() { + var array = [NaN, undefined, 4, 1, undefined, 3, NaN, 2]; + deepEqual(_.sortBy(array), [1, 2, 3, 4, undefined, undefined, NaN, NaN]); + }); + test('should treat number values for `collection` as empty', 1, function() { deepEqual(_.sortBy(1), []); }); From 936a1c27646451844f4ebbb00b28ca13d01bd037 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sat, 18 Apr 2015 11:24:11 -0700 Subject: [PATCH 09/43] Add support for `thisArg` in `zipWith`. --- lodash.src.js | 17 +++++++++++++++-- test/test.js | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 53af8d086d..8452b86177 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -6069,7 +6069,9 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] Arrays to be zipped with accumulator. - * @param {Function} accumulator Function used to reduce zipped elements. + * @param {Function|Object|string} [iteratee=_.identity] The function used + * to reduce zipped elements. + * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns new array of accumulated groups. * @example * @@ -6077,7 +6079,18 @@ * // => [11, 22, 33] */ var zipWith = restParam(function(arrays) { - var iteratee = arrays.pop(); + var length = arrays.length, + iteratee = arrays[length - 2], + thisArg = arrays[length - 1]; + + if (length > 2 && !isArray(iteratee)) { + length -= 2; + } else { + iteratee = (length > 1 && !isArray(thisArg)) ? (--length, thisArg) : undefined; + thisArg = undefined; + } + arrays.length = length; + iteratee = getCallback(iteratee, thisArg, 4); return arrayMap(unzip(arrays), function(array) { return arrayReduce(array, iteratee, undefined, true); }); diff --git a/test/test.js b/test/test.js index c9428ad266..50952fe4d7 100644 --- a/test/test.js +++ b/test/test.js @@ -16721,13 +16721,44 @@ QUnit.module('lodash.zipWith'); (function() { - test('should combine values in lists with given function', 2, function() { + test('should zip arrays combining their elements with `iteratee`', 2, function() { var array1 = [1, 2, 3], array2 = [1, 2, 3]; deepEqual(_.zipWith(array1, array2, _.add), [2, 4, 6]); deepEqual(_.zipWith(array1, [], _.add), [1, 2, 3]); }); + + test('should provide the correct `iteratee` arguments', 1, function() { + var args; + + _.zipWith([1, 2], [3, 4], [5, 6], function() { + args || (args = slice.call(arguments)); + }); + + deepEqual(args, [1, 3, 1, [1, 3, 5]]); + }); + + test('should support the `thisArg` argument', 1, function() { + var actual = _.zipWith([1.2, 2.3], [3.4, 4.5], function(a, b) { + return this.floor(a) + this.floor(b); + }, Math); + + deepEqual(actual, [4, 6]); + }); + + test('should use `_.identity` when `iteratee` is nullish', 1, function() { + var array1 = [1, 2], + array2 = [3, 4], + values = [, null, undefined], + expected = _.map(values, _.constant([1, 2])); + + var actual = _.map(values, function(value, index) { + return index ? _.zipWith(array1, array2, value) : _.zipWith(array1, array2); + }); + + deepEqual(actual, expected); + }); }()) /*--------------------------------------------------------------------------*/ From 4d6e57a5e698b7b9c69ac9a16b472bce795ab981 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 19 Apr 2015 10:32:27 -0700 Subject: [PATCH 10/43] Make `_.zipWith` act like `_.zip` when no `iteratee` is provided and make `_.unzip` ignore non array or `arguments` object values. --- lodash.src.js | 31 ++++++++++++++++++++++--------- test/test.js | 9 +++++++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 8452b86177..760ee31166 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -5940,12 +5940,21 @@ * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { + if (!(array && array.length)) { + return []; + } var index = -1, - length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, - result = Array(length); + length = 0; + var groups = arrayFilter(array, function(value) { + if (isArray(value) || isArguments(value)) { + length = nativeMax(value.length, length); + return true; + } + }); + var result = Array(length); while (++index < length) { - result[index] = arrayMap(array, baseProperty(index)); + result[index] = arrayMap(groups, baseProperty(index)); } return result; } @@ -6069,8 +6078,8 @@ * @memberOf _ * @category Array * @param {...Array} [arrays] Arrays to be zipped with accumulator. - * @param {Function|Object|string} [iteratee=_.identity] The function used - * to reduce zipped elements. + * @param {Function|Object|string} [iteratee] The function used to reduce + * zipped elements. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns new array of accumulated groups. * @example @@ -6083,15 +6092,19 @@ iteratee = arrays[length - 2], thisArg = arrays[length - 1]; - if (length > 2 && !isArray(iteratee)) { + if (length > 2 && typeof iteratee == 'function') { length -= 2; } else { - iteratee = (length > 1 && !isArray(thisArg)) ? (--length, thisArg) : undefined; + iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined; thisArg = undefined; } arrays.length = length; - iteratee = getCallback(iteratee, thisArg, 4); - return arrayMap(unzip(arrays), function(array) { + arrays = unzip(arrays); + if (!iteratee) { + return arrays; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(arrays, function(array) { return arrayReduce(array, iteratee, undefined, true); }); }); diff --git a/test/test.js b/test/test.js index 50952fe4d7..04b0327fe3 100644 --- a/test/test.js +++ b/test/test.js @@ -16644,6 +16644,11 @@ deepEqual(actual, expected); }); + test('`_.' + methodName + '` should ignore values that are not arrays or `arguments` objects', 1, function() { + var array = [[1, 2], [3, 4], null, undefined, { '0': 1 }]; + deepEqual(func(array), [[1, 3], [2, 4]]); + }); + test('`_.' + methodName + '` should support consuming its return value', 1, function() { var expected = [['barney', 'fred'], [36, 40]]; deepEqual(func(func(func(func(expected)))), expected); @@ -16747,11 +16752,11 @@ deepEqual(actual, [4, 6]); }); - test('should use `_.identity` when `iteratee` is nullish', 1, function() { + test('should perform a basic zip when `iteratee` is nullish', 1, function() { var array1 = [1, 2], array2 = [3, 4], values = [, null, undefined], - expected = _.map(values, _.constant([1, 2])); + expected = _.map(values, _.constant(_.zip(array1, array2))); var actual = _.map(values, function(value, index) { return index ? _.zipWith(array1, array2, value) : _.zipWith(array1, array2); From 92dee72b10cfbdcdcf003e4e6e50e2eff008d9cf Mon Sep 17 00:00:00 2001 From: Ray Hammond Date: Sun, 19 Apr 2015 20:59:26 +0100 Subject: [PATCH 11/43] Added two missing semicolons. --- lodash.src.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 760ee31166..09a0d5deaa 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3464,7 +3464,7 @@ return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, eachFunc); - } + }; } /** @@ -11425,7 +11425,7 @@ var method = restParam(function(path, args) { return function(object) { return invokePath(object, path, args); - } + }; }); /** From e6c5a0e848e583ad86377bdd5630e769c333e6b9 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 19 Apr 2015 20:01:27 -0700 Subject: [PATCH 12/43] Update iOS comment on `getLength`. [ci skip] --- lodash.src.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index 09a0d5deaa..d3f97582b1 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -4159,7 +4159,7 @@ * 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. + * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. From 85a7df3d276e9a75590d6dd7cf190a88f635f98d Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 19 Apr 2015 23:16:54 -0700 Subject: [PATCH 13/43] Add `_.unzipWith`. --- lodash.src.js | 67 +++++++++++++----- test/test.js | 193 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 165 insertions(+), 95 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index d3f97582b1..e56eabda90 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -5923,7 +5923,7 @@ /** * 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` + * elements and creates an array regrouping the elements to their pre-zipped * configuration. * * @static @@ -5946,7 +5946,7 @@ var index = -1, length = 0; - var groups = arrayFilter(array, function(value) { + array = arrayFilter(array, function(value) { if (isArray(value) || isArguments(value)) { length = nativeMax(value.length, length); return true; @@ -5954,11 +5954,46 @@ }); var result = Array(length); while (++index < length) { - result[index] = arrayMap(groups, baseProperty(index)); + result[index] = arrayMap(array, baseProperty(index)); } return result; } + /** + * This method is like `_.unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, array). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee] The function to combine regrouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(result, function(other) { + return arrayReduce(other, iteratee, undefined, true); + }); + } + /** * Creates an array excluding all provided values using `SameValueZero` for * equality comparisons. @@ -6071,21 +6106,21 @@ } /** - * Combines elements of given arrays, like `_.zip` but with a function - * specifying how they should be combined. + * This method is like `_.zip` except that it accepts an iteratee to specify + * how grouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, array). * * @static * @memberOf _ * @category Array - * @param {...Array} [arrays] Arrays to be zipped with accumulator. - * @param {Function|Object|string} [iteratee] The function used to reduce - * zipped elements. + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. * @param {*} [thisArg] The `this` binding of `iteratee`. - * @returns {Array} Returns new array of accumulated groups. + * @returns {Array} Returns the new array of grouped elements. * @example * - * _.zipWith([1, 2, 3], [10, 20 , 30], _.add); - * // => [11, 22, 33] + * _.zipWith([1, 2], [10, 20], [100, 200], _.add); + * // => [111, 222] */ var zipWith = restParam(function(arrays) { var length = arrays.length, @@ -6099,14 +6134,7 @@ thisArg = undefined; } arrays.length = length; - arrays = unzip(arrays); - if (!iteratee) { - return arrays; - } - iteratee = bindCallback(iteratee, thisArg, 4); - return arrayMap(arrays, function(array) { - return arrayReduce(array, iteratee, undefined, true); - }); + return unzipWith(arrays, iteratee, thisArg); }); /*------------------------------------------------------------------------*/ @@ -12049,6 +12077,7 @@ lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; + lodash.unzipWith = unzipWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.where = where; diff --git a/test/test.js b/test/test.js index 04b0327fe3..0680b6e476 100644 --- a/test/test.js +++ b/test/test.js @@ -16330,6 +16330,47 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.unzipWith'); + + (function() { + test('should unzip arrays combining regrouped elements with `iteratee`', 1, function() { + var array = [[1, 4], [2, 5], [3, 6]]; + deepEqual(_.unzipWith(array, _.add), [6, 15]); + }); + + test('should provide the correct `iteratee` arguments', 1, function() { + var args; + + _.unzipWith([[1, 3, 5], [2, 4, 6]], function() { + args || (args = slice.call(arguments)); + }); + + deepEqual(args, [1, 2, 1, [1, 2]]); + }); + + test('should support the `thisArg` argument', 1, function() { + var actual = _.unzipWith([[1.2, 3.4], [2.3, 4.5]], function(a, b) { + return this.floor(a) + this.floor(b); + }, Math); + + deepEqual(actual, [3, 7]); + }); + + test('should perform a basic unzip when `iteratee` is nullish', 1, function() { + var array = [[1, 3], [2, 4]], + values = [, null, undefined], + expected = _.map(values, _.constant(_.unzip(array))); + + var actual = _.map(values, function(value, index) { + return index ? _.unzipWith(array, value) : _.unzipWith(array); + }); + + deepEqual(actual, expected); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.values'); (function() { @@ -16586,77 +16627,6 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.unzip and lodash.zip'); - - _.each(['unzip', 'zip'], function(methodName, index) { - var func = _[methodName]; - func = _.bind(index ? func.apply : func.call, func, null); - - var object = { - 'an empty array': [ - [], - [] - ], - '0-tuples': [ - [[], []], - [] - ], - '2-tuples': [ - [['barney', 'fred'], [36, 40]], - [['barney', 36], ['fred', 40]] - ], - '3-tuples': [ - [['barney', 'fred'], [36, 40], [true, false]], - [['barney', 36, true], ['fred', 40, false]] - ] - }; - - _.forOwn(object, function(pair, key) { - test('`_.' + methodName + '` should work with ' + key, 2, function() { - var actual = func(pair[0]); - deepEqual(actual, pair[1]); - deepEqual(func(actual), actual.length ? pair[0] : []); - }); - }); - - test('`_.' + methodName + '` should work with tuples of different lengths', 4, function() { - var pair = [ - [['barney', 36], ['fred', 40, false]], - [['barney', 'fred'], [36, 40], [undefined, false]] - ]; - - var actual = func(pair[0]); - ok('0' in actual[2]); - deepEqual(actual, pair[1]); - - actual = func(actual); - ok('2' in actual[0]); - deepEqual(actual, [['barney', 36, undefined], ['fred', 40, false]]); - }); - - test('`_.' + methodName + '` should treat falsey values as empty arrays', 1, function() { - var expected = _.map(falsey, _.constant([])); - - var actual = _.map(falsey, function(value) { - return func([value, value, value]); - }); - - deepEqual(actual, expected); - }); - - test('`_.' + methodName + '` should ignore values that are not arrays or `arguments` objects', 1, function() { - var array = [[1, 2], [3, 4], null, undefined, { '0': 1 }]; - deepEqual(func(array), [[1, 3], [2, 4]]); - }); - - test('`_.' + methodName + '` should support consuming its return value', 1, function() { - var expected = [['barney', 'fred'], [36, 40]]; - deepEqual(func(func(func(func(expected)))), expected); - }); - }); - - /*--------------------------------------------------------------------------*/ - QUnit.module('lodash.zipObject'); (function() { @@ -16726,11 +16696,11 @@ QUnit.module('lodash.zipWith'); (function() { - test('should zip arrays combining their elements with `iteratee`', 2, function() { + test('should zip arrays combining grouped elements with `iteratee`', 2, function() { var array1 = [1, 2, 3], - array2 = [1, 2, 3]; + array2 = [4, 5, 6]; - deepEqual(_.zipWith(array1, array2, _.add), [2, 4, 6]); + deepEqual(_.zipWith(array1, array2, _.add), [5, 7, 9]); deepEqual(_.zipWith(array1, [], _.add), [1, 2, 3]); }); @@ -16764,7 +16734,78 @@ deepEqual(actual, expected); }); - }()) + }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.unzip and lodash.zip'); + + _.each(['unzip', 'zip'], function(methodName, index) { + var func = _[methodName]; + func = _.bind(index ? func.apply : func.call, func, null); + + var object = { + 'an empty array': [ + [], + [] + ], + '0-tuples': [ + [[], []], + [] + ], + '2-tuples': [ + [['barney', 'fred'], [36, 40]], + [['barney', 36], ['fred', 40]] + ], + '3-tuples': [ + [['barney', 'fred'], [36, 40], [true, false]], + [['barney', 36, true], ['fred', 40, false]] + ] + }; + + _.forOwn(object, function(pair, key) { + test('`_.' + methodName + '` should work with ' + key, 2, function() { + var actual = func(pair[0]); + deepEqual(actual, pair[1]); + deepEqual(func(actual), actual.length ? pair[0] : []); + }); + }); + + test('`_.' + methodName + '` should work with tuples of different lengths', 4, function() { + var pair = [ + [['barney', 36], ['fred', 40, false]], + [['barney', 'fred'], [36, 40], [undefined, false]] + ]; + + var actual = func(pair[0]); + ok('0' in actual[2]); + deepEqual(actual, pair[1]); + + actual = func(actual); + ok('2' in actual[0]); + deepEqual(actual, [['barney', 36, undefined], ['fred', 40, false]]); + }); + + test('`_.' + methodName + '` should treat falsey values as empty arrays', 1, function() { + var expected = _.map(falsey, _.constant([])); + + var actual = _.map(falsey, function(value) { + return func([value, value, value]); + }); + + deepEqual(actual, expected); + }); + + test('`_.' + methodName + '` should ignore values that are not arrays or `arguments` objects', 1, function() { + var array = [[1, 2], [3, 4], null, undefined, { '0': 1 }]; + deepEqual(func(array), [[1, 3], [2, 4]]); + }); + + test('`_.' + methodName + '` should support consuming its return value', 1, function() { + var expected = [['barney', 'fred'], [36, 40]]; + deepEqual(func(func(func(func(expected)))), expected); + }); + }); /*--------------------------------------------------------------------------*/ @@ -17566,7 +17607,7 @@ var acceptFalsey = _.difference(allMethods, rejectFalsey); - test('should accept falsey arguments', 219, function() { + test('should accept falsey arguments', 220, function() { var emptyArrays = _.map(falsey, _.constant([])), isExposed = '_' in root, oldDash = root._; From 5929f7d23b39b3f1cd8d410005596ff3bbcbe8ce Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 20 Apr 2015 00:35:41 -0700 Subject: [PATCH 14/43] Newline nit in `_.assign` doc. [ci skip] --- lodash.src.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index e56eabda90..f3ac19027c 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -9307,7 +9307,6 @@ * **Note:** This method mutates `object` and is based on * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). * - * * @static * @memberOf _ * @alias extend From c8314b215bfd5e467fec24c5ccdb4ceea1a075f1 Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 20 Apr 2015 08:55:25 -0700 Subject: [PATCH 15/43] Doc and var name tweaks to `_.unzip`, `_.unzipWith`, and `_.zipWith`. --- lodash.src.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index f3ac19027c..6dcfa43d1d 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -5923,7 +5923,7 @@ /** * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-zipped + * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static @@ -5946,9 +5946,9 @@ var index = -1, length = 0; - array = arrayFilter(array, function(value) { - if (isArray(value) || isArguments(value)) { - length = nativeMax(value.length, length); + array = arrayFilter(array, function(group) { + if (isArray(group) || isArguments(group)) { + length = nativeMax(group.length, length); return true; } }); @@ -5962,7 +5962,7 @@ /** * This method is like `_.unzip` except that it accepts an iteratee to specify * how regrouped values should be combined. The `iteratee` is bound to `thisArg` - * and invoked with four arguments: (accumulator, value, index, array). + * and invoked with four arguments: (accumulator, value, index, group). * * @static * @memberOf _ @@ -5989,8 +5989,8 @@ return result; } iteratee = bindCallback(iteratee, thisArg, 4); - return arrayMap(result, function(other) { - return arrayReduce(other, iteratee, undefined, true); + return arrayMap(result, function(group) { + return arrayReduce(group, iteratee, undefined, true); }); } @@ -6108,7 +6108,7 @@ /** * This method is like `_.zip` except that it accepts an iteratee to specify * how grouped values should be combined. The `iteratee` is bound to `thisArg` - * and invoked with four arguments: (accumulator, value, index, array). + * and invoked with four arguments: (accumulator, value, index, group). * * @static * @memberOf _ From 3429b5d66184d9e1d555282d40f24eaa9e1efb14 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 21 Apr 2015 00:02:28 -0700 Subject: [PATCH 16/43] Ensure empty brackets are ignored by `_.get` and `_.set`. --- lodash.src.js | 2 +- test/test.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index 6dcfa43d1d..b11162c843 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -88,7 +88,7 @@ reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]+|(["'])(?:(?!\1)[^\n\\]|\\.)*?)\1\]/, + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; diff --git a/test/test.js b/test/test.js index 0680b6e476..59f9e3575a 100644 --- a/test/test.js +++ b/test/test.js @@ -13249,6 +13249,11 @@ strictEqual(func(object, ['a', 'b', 'c']), 3); }); + test('`_.' + methodName + '` should ignore empty brackets', 1, function() { + var object = { 'a': 1 }; + strictEqual(func(object, 'a[]'), 1); + }); + test('`_.' + methodName + '` should handle empty paths', 4, function() { _.each([['', ''], [[], ['']]], function(paths) { strictEqual(func({}, paths[0]), undefined); @@ -13712,11 +13717,19 @@ deepEqual(object, { 'a,b,c': 4, 'a': { 'b': { 'c': 3 } } }); }); + test('should ignore empty brackets', 1, function() { + var object = {}; + _.set(object, 'a[]', 1); + deepEqual(object, { 'a': 1 }); + }); + test('should handle empty paths', 4, function() { _.each([['', ''], [[], ['']]], function(paths, index) { var object = {}; + _.set(object, paths[0], 1); deepEqual(object, index ? {} : { '': 1 }); + _.set(object, paths[1], 2); deepEqual(object, { '': 2 }); }); From a551348b401bd53aa221f524f6211ed63c9950b3 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 21 Apr 2015 07:56:15 -0700 Subject: [PATCH 17/43] Fix `preventExtensions` definition typo. [closes #1153] --- lodash.src.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index b11162c843..5c30c178f4 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -776,7 +776,7 @@ getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, push = arrayProto.push, - preventExtensions = isNative(Object.preventExtensions = Object.preventExtensions) && preventExtensions, + preventExtensions = isNative(preventExtensions = Object.preventExtensions) && preventExtensions, propertyIsEnumerable = objectProto.propertyIsEnumerable, Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, From 150ea2639a914b74772175edfd64215e3697e8f6 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 21 Apr 2015 07:52:52 -0700 Subject: [PATCH 18/43] Add complex tests for unquoted bracketed property names. --- test/test.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/test/test.js b/test/test.js index 59f9e3575a..f4c786c3f6 100644 --- a/test/test.js +++ b/test/test.js @@ -13262,10 +13262,15 @@ }); test('`_.' + methodName + '` should handle complex paths', 2, function() { - var object = { 'a': { '-1.23': { '["b"]': { 'c': { "['d']": { 'e': 5 } } } } } }; + var object = { 'a': { '-1.23': { '["b"]': { 'c': { "['d']": { 'e': { 'f': 6 } } } } } } }; - _.each(['a[-1.23]["[\\"b\\"]"].c[\'[\\\'d\\\']\'].e', ['a', '-1.23', '["b"]', 'c', "['d']", 'e']], function(path) { - strictEqual(func(object, path), 5); + var paths = [ + 'a[-1.23]["[\\"b\\"]"].c[\'[\\\'d\\\']\'][e].f', + ['a', '-1.23', '["b"]', 'c', "['d']", 'e', 'f'] + ]; + + _.each(paths, function(path) { + strictEqual(func(object, path), 6); }); }); @@ -13736,12 +13741,17 @@ }); test('should handle complex paths', 2, function() { - var object = { 'a': { '1.23': { '["b"]': { 'c': { "['d']": { 'e': 5 } } } } } }; + var object = { 'a': { '1.23': { '["b"]': { 'c': { "['d']": { 'e': { 'f': 6 } } } } } } }; + + var paths = [ + 'a[-1.23]["[\\"b\\"]"].c[\'[\\\'d\\\']\'][e].f', + ['a', '-1.23', '["b"]', 'c', "['d']", 'e', 'f'] + ]; - _.each(['a[-1.23]["[\\"b\\"]"].c[\'[\\\'d\\\']\'].e', ['a', '-1.23', '["b"]', 'c', "['d']", 'e']], function(path) { - _.set(object, path, 6); - strictEqual(object.a[-1.23]['["b"]'].c["['d']"].e, 6); - object.a[-1.23]['["b"]'].c["['d']"].e = 5; + _.each(paths, function(path) { + _.set(object, path, 7); + strictEqual(object.a[-1.23]['["b"]'].c["['d']"].e.f, 7); + object.a[-1.23]['["b"]'].c["['d']"].e.f = 6; }); }); From e317fdfa3db55058bb0a7f4757a04890de962f4c Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 21 Apr 2015 08:03:55 -0700 Subject: [PATCH 19/43] Cleanup deep path tests. --- test/test.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/test.js b/test/test.js index f4c786c3f6..10ceb8068b 100644 --- a/test/test.js +++ b/test/test.js @@ -13255,9 +13255,9 @@ }); test('`_.' + methodName + '` should handle empty paths', 4, function() { - _.each([['', ''], [[], ['']]], function(paths) { - strictEqual(func({}, paths[0]), undefined); - strictEqual(func({ '': 3 }, paths[1]), 3); + _.each([['', ''], [[], ['']]], function(pair) { + strictEqual(func({}, pair[0]), undefined); + strictEqual(func({ '': 3 }, pair[1]), 3); }); }); @@ -13283,9 +13283,10 @@ test('`_.' + methodName + '` should return `undefined` with deep paths when `object` is nullish', 2, function() { var values = [null, undefined], - expected = _.map(values, _.constant(undefined)); + expected = _.map(values, _.constant(undefined)), + paths = ['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']]; - _.each(['constructor.prototype.valueOf', ['constructor', 'prototype', 'valueOf']], function(path) { + _.each(paths, function(path) { var actual = _.map(values, function(value) { return func(value, path); }); @@ -13303,9 +13304,10 @@ }); test('`_.' + methodName + '` should follow `path` over non-plain objects', 4, function() { - var object = { 'a': '' }; + var object = { 'a': '' }, + paths = ['constructor.prototype.a', ['constructor', 'prototype', 'a']]; - _.each(['constructor.prototype.a', ['constructor', 'prototype', 'a']], function(path) { + _.each(paths, function(path) { numberProto.a = 1; var actual = func(0, path); strictEqual(actual, 1); @@ -13729,13 +13731,13 @@ }); test('should handle empty paths', 4, function() { - _.each([['', ''], [[], ['']]], function(paths, index) { + _.each([['', ''], [[], ['']]], function(pair, index) { var object = {}; - _.set(object, paths[0], 1); + _.set(object, pair[0], 1); deepEqual(object, index ? {} : { '': 1 }); - _.set(object, paths[1], 2); + _.set(object, pair[1], 2); deepEqual(object, { '': 2 }); }); }); @@ -13783,9 +13785,10 @@ }); test('should follow `path` over non-plain objects', 4, function() { - var object = { 'a': '' }; + var object = { 'a': '' }, + paths = ['constructor.prototype.a', ['constructor', 'prototype', 'a']]; - _.each(['constructor.prototype.a', ['constructor', 'prototype', 'a']], function(path) { + _.each(paths, function(path) { _.set(0, path, 1); strictEqual(0..a, 1); delete numberProto.a; From d5a9b4344bc212a9949bec58e7d7c52e63558e00 Mon Sep 17 00:00:00 2001 From: Ray Hammond Date: Tue, 21 Apr 2015 21:18:25 +0100 Subject: [PATCH 20/43] Removed unused variables identified by JSHint. --- lodash.src.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 5c30c178f4..92f502f78b 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -36,8 +36,7 @@ /** Used to indicate the type of lazy iteratees. */ var LAZY_DROP_WHILE_FLAG = 0, LAZY_FILTER_FLAG = 1, - LAZY_MAP_FLAG = 2, - LAZY_TAKE_WHILE_FLAG = 3; + LAZY_MAP_FLAG = 2; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; @@ -12359,7 +12358,6 @@ lodash.prototype[methodName] = function() { var args = arguments, - length = args.length, chainAll = this.__chain__, value = this.__wrapped__, isHybrid = !!this.__actions__.length, From d97276404ca8af3f1b7bf78dd4bc48aa8c291b35 Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 22 Apr 2015 07:09:52 -0700 Subject: [PATCH 21/43] Update excused Underscore tests. --- test/underscore.html | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/underscore.html b/test/underscore.html index 98e3032239..3a2ce3a3e3 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -63,9 +63,7 @@ 'initial works on arguments object' ], 'intersection': [ - 'can perform an OO-style intersection', - 'returns an empty array when passed null as first argument', - 'returns an empty array when passed null as argument beyond the first' + 'can perform an OO-style intersection' ], 'last': [ 'can pass an index to last', @@ -149,9 +147,6 @@ ] }, 'Utility': { - '_.templateSettings.variable': [ - '"x"' - ], 'times': [ 'works as a wrapper' ] From ce180cf2bff7fa44a83622c11c762d9a7b810107 Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 22 Apr 2015 07:18:14 -0700 Subject: [PATCH 22/43] Excuse Underscore _.now test to avoid occasional false fail in sauce andrioid. --- test/underscore.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/underscore.html b/test/underscore.html index 3a2ce3a3e3..d07910906d 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -147,6 +147,9 @@ ] }, 'Utility': { + 'now': [ + 'Produces the correct time in milliseconds' + ], 'times': [ 'works as a wrapper' ] @@ -159,6 +162,7 @@ delete QUnit.config.excused.Functions['more throttle does not trigger leading call when leading is set to false']; delete QUnit.config.excused.Functions['throttle does not trigger trailing call when trailing is set to false']; delete QUnit.config.excused.Functions['debounce asap']; + delete QUnit.config.excused.Utility.now; } // load test scripts document.write(ui.urlParams.loader != 'none' From 0b907a3efa0ac8879bbed20a106c2616147563ba Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 22 Apr 2015 20:16:43 -0700 Subject: [PATCH 23/43] Make tests work in Phantom 2. --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index 10ceb8068b..83df6c3bc9 100644 --- a/test/test.js +++ b/test/test.js @@ -80,7 +80,7 @@ result = []; if (phantom) { - result = params = phantom.args; + result = params = phantom.args || require('system').args; } else if (system) { min = 1; result = params = system.args; From 641cd63462855299e52c652cd0c0ad7cebd49bce Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 22 Apr 2015 20:17:39 -0700 Subject: [PATCH 24/43] Fix old V8 JIT bug that has cropped up again. --- lodash.src.js | 5 +++-- test/test.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 92f502f78b..e43613f62b 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -1016,6 +1016,7 @@ (function(x) { var Ctor = function() { this.x = x; }, + args = arguments, object = { '0': x, 'length': x }, props = []; @@ -1029,7 +1030,7 @@ * @memberOf _.support * @type boolean */ - support.argsTag = objToString.call(arguments) == argsTag; + support.argsTag = objToString.call(args) == argsTag; /** * Detect if `name` or `message` properties of `Error.prototype` are @@ -1158,7 +1159,7 @@ * @type boolean */ try { - support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1); + support.nonEnumArgs = !propertyIsEnumerable.call(args, 1); } catch(e) { support.nonEnumArgs = true; } diff --git a/test/test.js b/test/test.js index 83df6c3bc9..bc5e869c46 100644 --- a/test/test.js +++ b/test/test.js @@ -8973,7 +8973,7 @@ }); test('`_.' + methodName + '` should work with `arguments` objects (test in IE < 9)', 1, function() { - if (!(isPhantom || isStrict)) { + if (!isStrict) { deepEqual(func(args).sort(), ['0', '1', '2']); } else { @@ -8982,7 +8982,7 @@ }); test('`_.' + methodName + '` should return keys for custom properties on `arguments` objects', 1, function() { - if (!(isPhantom || isStrict)) { + if (!isStrict) { args.a = 1; deepEqual(func(args).sort(), ['0', '1', '2', 'a']); delete args.a; @@ -8993,7 +8993,7 @@ }); test('`_.' + methodName + '` should ' + (isKeys ? 'not' : '') + ' include inherited properties of `arguments` objects', 1, function() { - if (!(isPhantom || isStrict)) { + if (!isStrict) { var expected = isKeys ? ['0', '1', '2'] : ['0', '1', '2', 'a']; objectProto.a = 1; From fcc0608cf220b60c1d62b4e7e2f04213a1c2677a Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 22 Apr 2015 20:23:30 -0700 Subject: [PATCH 25/43] Only use built-in Object.assign when in strict mode. --- lodash.src.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index e43613f62b..c22ae76782 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -803,12 +803,19 @@ // // 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; + // to assign values to readonly indexes of strings. + var func = preventExtensions && isNative(func = Object.assign) && func; + try { + if (func) { + var object = preventExtensions({ '1': 0 }); + object[0] = 1; + } + } catch(e) { + // Only attempt in strict mode. + try { func(object, 'xo'); } catch(e) {} + return !object[1] && func; + } + return false; }()); /* Native method references for those with the same name as other `lodash` methods. */ From ae346f564f9f5afbe5e7c25c4f7d380f5231b8bd Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 22 Apr 2015 20:44:56 -0700 Subject: [PATCH 26/43] Avoid lazy eval optimization in `createFlow` if metadata has placeholder arguments. [closes #1160] --- lodash.src.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index c22ae76782..f56d6e81e2 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3537,7 +3537,8 @@ funcName = getFuncName(func); var data = funcName == 'wrapper' ? getData(func) : null; - if (data && isLaziable(data[0])) { + if (data && isLaziable(data[0]) && + !((data[4] && data[4].length) || (data[6] && data[6].length))) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); From 231c8a468eb5a6bfc17e89d59b4ef4dd3a176e7a Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 22 Apr 2015 23:10:17 -0700 Subject: [PATCH 27/43] Replace "that" with "which" in `pickByArray` and `pickByCallback` docs. [ci skip] --- lodash.src.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index f56d6e81e2..cdb8ec34f8 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -4479,7 +4479,7 @@ } /** - * A specialized version of `_.pick` that picks `object` properties specified + * A specialized version of `_.pick` which picks `object` properties specified * by `props`. * * @private @@ -4504,7 +4504,7 @@ } /** - * A specialized version of `_.pick` that picks `object` properties `predicate` + * A specialized version of `_.pick` which picks `object` properties `predicate` * returns truthy for. * * @private From 31e25f88a0366486dedce953ec186f6bf9e23840 Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 23 Apr 2015 08:06:51 -0700 Subject: [PATCH 28/43] Narrow bitmask check in `createFlow`. --- lodash.src.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index cdb8ec34f8..dcf2603565 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3537,8 +3537,7 @@ funcName = getFuncName(func); var data = funcName == 'wrapper' ? getData(func) : null; - if (data && isLaziable(data[0]) && - !((data[4] && data[4].length) || (data[6] && data[6].length))) { + if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); From 02b920f259aa310a42dfe6e6c6d2731f73acd22f Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 23 Apr 2015 08:38:58 -0700 Subject: [PATCH 29/43] Add `_.flow` and `_.flowRight` tests for curried functions with placeholders. --- test/test.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index bc5e869c46..92857d8b5e 100644 --- a/test/test.js +++ b/test/test.js @@ -2301,6 +2301,18 @@ } }); + test('`_.' + methodName + '` should work with curried functions with placeholders', 1, function() { + var curried = _.curry(_.pluck), + getProp = curried(curried.placeholder, 'a'), + objects = [{ 'a': 1 }, { 'a': 2 }, { 'a': 1 }]; + + var combined = isFlow + ? func(getProp, _.uniq) + : func(_.uniq, getProp); + + deepEqual(combined(objects), [1, 2]); + }); + test('`_.' + methodName + '` should return a wrapped value when chaining', 1, function() { if (!isNpm) { var wrapped = _(_.noop)[methodName](); @@ -11662,7 +11674,7 @@ strictEqual(par3(), isPartial ? 'hi pebbles' : 'pebbles hi'); }); - test('`_.' + methodName + '` should work with curried methods', 2, function() { + test('`_.' + methodName + '` should work with curried functions', 2, function() { var fn = function(a, b, c) { return a + b + c; }, curried = _.curry(func(fn, 1), 2); @@ -11670,7 +11682,7 @@ strictEqual(curried(2)(3), 6); }); - test('should work with placeholders and curried methods', 1, function() { + test('should work with placeholders and curried functions', 1, function() { var fn = function() { return slice.call(arguments); }, curried = _.curry(fn), par = func(curried, ph, 'b', ph, 'd'); From 37786b76edd0b086184a0162778d91315f6088b7 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 26 Apr 2015 00:46:33 -0700 Subject: [PATCH 30/43] Minor whitespace nits. [ci skip] --- lodash.src.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index dcf2603565..79697ab0f9 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -836,7 +836,7 @@ /** Used as references for the maximum length and index of an array. */ var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; /** Used as the size, in bytes, of each `Float64Array` element. */ @@ -7143,7 +7143,7 @@ * }, []); * // => [4, 5, 2, 3, 0, 1] */ - var reduceRight = createReduce(arrayReduceRight, baseEachRight); + var reduceRight = createReduce(arrayReduceRight, baseEachRight); /** * The opposite of `_.filter`; this method returns the elements of `collection` From 141a32d388d93a306c5ba515196fc51b8299904b Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 26 Apr 2015 10:59:29 -0700 Subject: [PATCH 31/43] Add `_.callback` test for augmenting `source` objects. --- test/test.js | 81 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 24 deletions(-) diff --git a/test/test.js b/test/test.js index 92857d8b5e..e07d59ea97 100644 --- a/test/test.js +++ b/test/test.js @@ -2573,11 +2573,11 @@ test('should return `_.identity` when `func` is nullish', 1, function() { var object = {}, values = [, null, undefined], - expected = _.map(values, _.constant(object)); + expected = _.map(values, _.constant([_.identity, object])); var actual = _.map(values, function(value, index) { - var callback = index ? _.callback(value) : _.callback(); - return callback(object); + var identity = index ? _.callback(value) : _.callback(); + return [identity, identity(object)]; }); deepEqual(actual, expected); @@ -2616,52 +2616,79 @@ }); test('should return a callback created by `_.matches` when `func` is an object', 2, function() { - var callback = _.callback({ 'a': 1, 'b': 2 }); - strictEqual(callback({ 'a': 1, 'b': 2, 'c': 3 }), true); - strictEqual(callback({ 'b': 2 }), false); + var matches = _.callback({ 'a': 1, 'b': 2 }); + strictEqual(matches({ 'a': 1, 'b': 2, 'c': 3 }), true); + strictEqual(matches({ 'b': 2 }), false); }); test('should return a callback created by `_.matches` when `func` is an array', 2, function() { - var callback = _.callback(['a', 'b']); - strictEqual(callback({ '0': 'a', '1': 'b', '2': 'c' }), true); - strictEqual(callback({ '1': 'b' }), false); + var matches = _.callback(['a', 'b']); + strictEqual(matches({ '0': 'a', '1': 'b', '2': 'c' }), true); + strictEqual(matches({ '1': 'b' }), false); + }); + + test('should not change match behavior if `source` is augmented', 9, function() { + var sources = [ + { 'a': { 'b': 2, 'c': 3 } }, + { 'a': 1, 'b': 2 }, + { 'a': 1 } + ]; + + _.each(sources, function(source, index) { + var object = _.cloneDeep(source), + matches = _.callback(source); + + strictEqual(matches(object), true); + + if (index) { + source.a = 2; + source.b = 1; + source.c = 3; + } else { + source.a.b = 1; + source.a.c = 2; + source.a.d = 3; + } + strictEqual(matches(object), true); + strictEqual(matches(source), false); + }); }); test('should return a callback created by `_.matchesProperty` when `func` is a number or string and `thisArg` is not `undefined`', 3, function() { var array = ['a'], - callback = _.callback(0, 'a'); + matches = _.callback(0, 'a'); - strictEqual(callback(array), true); + strictEqual(matches(array), true); - callback = _.callback('0', 'a'); - strictEqual(callback(array), true); + matches = _.callback('0', 'a'); + strictEqual(matches(array), true); - callback = _.callback(1, undefined); - strictEqual(callback(array), undefined); + matches = _.callback(1, undefined); + strictEqual(matches(array), undefined); }); test('should support deep paths for `_.matchesProperty` shorthands', 1, function() { var object = { 'a': { 'b': { 'c': { 'd': 1, 'e': 2 } } } }, - callback = _.callback('a.b.c', { 'e': 2 }); + matches = _.callback('a.b.c', { 'e': 2 }); - strictEqual(callback(object), true); + strictEqual(matches(object), true); }); test('should return a callback created by `_.property` when `func` is a number or string', 2, function() { var array = ['a'], - callback = _.callback(0); + prop = _.callback(0); - strictEqual(callback(array), 'a'); + strictEqual(prop(array), 'a'); - callback = _.callback('0'); - strictEqual(callback(array), 'a'); + prop = _.callback('0'); + strictEqual(prop(array), 'a'); }); test('should support deep paths for `_.property` shorthands', 1, function() { var object = { 'a': { 'b': { 'c': 3 } } }, - callback = _.callback('a.b.c'); + prop = _.callback('a.b.c'); - strictEqual(callback(object), 3); + strictEqual(prop(object), 3); }); test('should work with functions created by `_.partial` and `_.partialRight`', 2, function() { @@ -9684,7 +9711,13 @@ }); test('should not change match behavior if `source` is augmented', 9, function() { - _.each([{ 'a': { 'b': 2, 'c': 3 } }, { 'a': 1, 'b': 2 }, { 'a': 1 }], function(source, index) { + var sources = [ + { 'a': { 'b': 2, 'c': 3 } }, + { 'a': 1, 'b': 2 }, + { 'a': 1 } + ]; + + _.each(sources, function(source, index) { var object = _.cloneDeep(source), matches = _.matches(source); From df176dfe8ad62293daa0777549509ff2db9e8c9f Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 26 Apr 2015 14:22:46 -0700 Subject: [PATCH 32/43] Fix modularized npm build tests. --- test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index e07d59ea97..a7601c7d78 100644 --- a/test/test.js +++ b/test/test.js @@ -2573,11 +2573,11 @@ test('should return `_.identity` when `func` is nullish', 1, function() { var object = {}, values = [, null, undefined], - expected = _.map(values, _.constant([_.identity, object])); + expected = _.map(values, _.constant([!isNpm && _.identity, object])); var actual = _.map(values, function(value, index) { var identity = index ? _.callback(value) : _.callback(); - return [identity, identity(object)]; + return [!isNpm && identity, identity(object)]; }); deepEqual(actual, expected); From bf89287c569db23cc303fcaad490acb733f78ba9 Mon Sep 17 00:00:00 2001 From: jdalton Date: Mon, 27 Apr 2015 23:11:58 -0700 Subject: [PATCH 33/43] Optimize lazy `slice` for `start` of `0` and an `end` value. --- lodash.src.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index 79697ab0f9..3464edb661 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -12342,8 +12342,13 @@ LazyWrapper.prototype.slice = function(start, end) { start = start == null ? 0 : (+start || 0); - var result = start < 0 ? this.takeRight(-start) : this.drop(start); + var result = this; + if (start < 0) { + result = this.takeRight(-start); + } else if (start) { + result = this.drop(start); + } if (end !== undefined) { end = (+end || 0); result = end < 0 ? result.dropRight(-end) : result.take(end - start); From 2c6d8805425b5d36470fdfb2a0aee3cf1554b3d3 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 28 Apr 2015 09:18:32 -0700 Subject: [PATCH 34/43] Loosen restrictions of `_.intersection` and others to accept array-like objects and add `isArrayLike` helper. [closes #1163] --- lodash.src.js | 84 +++++++++++++++++++++++++-------------------------- test/test.js | 7 +---- 2 files changed, 42 insertions(+), 49 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 3464edb661..4d6d9edb25 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -1829,8 +1829,8 @@ */ function baseAt(collection, props) { var index = -1, + isArr = isArrayLike(collection), length = collection.length, - isArr = isLength(length), propsLength = props.length, result = Array(propsLength); @@ -2169,8 +2169,8 @@ * * @private * @param {Array} array The array to flatten. - * @param {boolean} isDeep Specify a deep flatten. - * @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isDeep, isStrict) { @@ -2181,8 +2181,8 @@ while (++index < length) { var value = array[index]; - - if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). value = baseFlatten(value, isDeep, isStrict); @@ -2483,8 +2483,7 @@ */ function baseMap(collection, iteratee) { var index = -1, - length = getLength(collection), - result = isLength(length) ? Array(length) : []; + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); @@ -2584,7 +2583,7 @@ if (!isObject(object)) { return object; } - var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); + var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)); if (!isSrcArr) { var props = keys(source); push.apply(props, getSymbols(source)); @@ -2647,10 +2646,10 @@ if (isCommon) { result = srcValue; - if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { + if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { result = isArray(value) ? value - : (getLength(value) ? arrayCopy(value) : []); + : (isArrayLike(value) ? arrayCopy(value) : []); } else if (isPlainObject(srcValue) || isArguments(srcValue)) { result = isArguments(value) @@ -3292,11 +3291,11 @@ */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { - var length = collection ? getLength(collection) : 0; - if (!isLength(length)) { + if (!isArrayLike(collection)) { return eachFunc(collection, iteratee); } - var index = fromRight ? length : -1, + var length = collection.length, + index = fromRight ? length : -1, iterable = toObject(collection); while ((fromRight ? index-- : ++index < length)) { @@ -4309,6 +4308,17 @@ return func == null ? undefined : func.apply(object, args); } + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + /** * Checks if `value` is a valid array-like index. * @@ -4337,13 +4347,9 @@ return false; } var type = typeof index; - if (type == 'number') { - var length = getLength(object), - prereq = isLength(length) && isIndex(index, length); - } else { - prereq = type == 'string' && index in object; - } - if (prereq) { + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { var other = object[index]; return value === value ? (value === other) : (other !== other); } @@ -4657,7 +4663,7 @@ if (value == null) { return []; } - if (!isLength(getLength(value))) { + if (!isArrayLike(value)) { return values(value); } if (lodash.support.unindexedChars && isString(value)) { @@ -4806,7 +4812,7 @@ * // => [1, 3] */ var difference = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, baseFlatten(values, false, true)) : []; }); @@ -5294,7 +5300,7 @@ while (++argsIndex < argsLength) { var value = arguments[argsIndex]; - if (isArray(value) || isArguments(value)) { + if (isArrayLike(value)) { args.push(value); caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); } @@ -5954,7 +5960,7 @@ length = 0; array = arrayFilter(array, function(group) { - if (isArray(group) || isArguments(group)) { + if (isArrayLike(group)) { length = nativeMax(group.length, length); return true; } @@ -6021,7 +6027,7 @@ * // => [3] */ var without = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, values) : []; }); @@ -6046,7 +6052,7 @@ while (++index < length) { var array = arguments[index]; - if (isArray(array) || isArguments(array)) { + if (isArrayLike(array)) { var result = result ? baseDifference(result, array).concat(baseDifference(array, result)) : array; @@ -6419,8 +6425,7 @@ * // => ['barney', 'pebbles'] */ var at = restParam(function(collection, props) { - var length = collection ? getLength(collection) : 0; - if (isLength(length)) { + if (isArrayLike(collection)) { collection = toIterable(collection); } return baseAt(collection, baseFlatten(props)); @@ -6921,8 +6926,7 @@ var index = -1, isFunc = typeof path == 'function', isProp = isKey(path), - length = getLength(collection), - result = isLength(length) ? Array(length) : []; + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { var func = isFunc ? path : (isProp && value != null && value[path]); @@ -8661,15 +8665,13 @@ * // => false */ function isArguments(value) { - var length = isObjectLike(value) ? value.length : undefined; - return isLength(length) && objToString.call(value) == argsTag; + return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag; } // Fallback for environments without a `toStringTag` for `arguments` objects. if (!support.argsTag) { isArguments = function(value) { - var length = isObjectLike(value) ? value.length : undefined; - return isLength(length) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + return isObjectLike(value) && isArrayLike(value) && + hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; } @@ -8791,10 +8793,9 @@ if (value == null) { return true; } - var length = getLength(value); - if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) || + if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || (isObjectLike(value) && isFunction(value.splice)))) { - return !length; + return !value.length; } return !keys(value).length; } @@ -9785,12 +9786,9 @@ * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { - if (object) { - var Ctor = object.constructor, - length = object.length; - } + var Ctor = object != null && object.constructor; if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object == 'function' ? lodash.support.enumPrototypes : isLength(length))) { + (typeof object == 'function' ? lodash.support.enumPrototypes : isArrayLike(object))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; diff --git a/test/test.js b/test/test.js index a7601c7d78..a111b97088 100644 --- a/test/test.js +++ b/test/test.js @@ -3855,12 +3855,11 @@ deepEqual(_.difference([1, NaN, 3], largeArray), [1, 3]); }); - test('should ignore values that are not arrays or `arguments` objects', 4, function() { + test('should ignore values that are not array-like', 3, function() { var array = [1, null, 3]; deepEqual(_.difference(args, 3, { '0': 1 }), [1, 2, 3]); deepEqual(_.difference(null, array, 1), []); deepEqual(_.difference(array, args, null), [null]); - deepEqual(_.difference('abc', array, 'b'), []); }); }(1, 2, 3)); @@ -16532,10 +16531,6 @@ var array = [1, 2, 3, 1, 2, 3]; deepEqual(_.without(array, 1, 2), [3, 3]); }); - - test('should treat string values for `array` as empty', 1, function() { - deepEqual(_.without('abc', 'b'), []); - }); }(1, 2, 3)); /*--------------------------------------------------------------------------*/ From ce6ccef2d03461fa7337e105a24175d560b60bef Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 28 Apr 2015 21:04:45 -0700 Subject: [PATCH 35/43] Ensure `baseAt`, `basePullAt`, and `pullAt` handle nullish values correctly. --- lodash.src.js | 10 +++++----- test/test.js | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 4d6d9edb25..40ff37888a 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -1829,8 +1829,9 @@ */ function baseAt(collection, props) { var index = -1, - isArr = isArrayLike(collection), - length = collection.length, + isNil = collection == null, + isArr = !isNil && isArrayLike(collection), + length = isArr && collection.length, propsLength = props.length, result = Array(propsLength); @@ -1839,7 +1840,7 @@ if (isArr) { result[index] = isIndex(key, length) ? collection[key] : undefined; } else { - result[index] = collection[key]; + result[index] = isNil ? undefined : collection[key]; } } return result; @@ -2711,7 +2712,7 @@ * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { - var length = indexes.length; + var length = array ? indexes.length : 0; while (length--) { var index = parseFloat(indexes[length]); if (index != previous && isIndex(index)) { @@ -5476,7 +5477,6 @@ * // => [10, 20] */ var pullAt = restParam(function(array, indexes) { - array || (array = []); indexes = baseFlatten(indexes); var result = baseAt(array, indexes); diff --git a/test/test.js b/test/test.js index a111b97088..a521d33ac7 100644 --- a/test/test.js +++ b/test/test.js @@ -1219,11 +1219,11 @@ }); test('should work with a falsey `collection` argument when keys are provided', 1, function() { - var expected = _.map(falsey, _.constant([undefined, undefined])); + var expected = _.map(falsey, _.constant(Array(4))); var actual = _.map(falsey, function(value) { try { - return _.at(value, 0, 1); + return _.at(value, 0, 1, 'pop', 'push'); } catch(e) {} }); @@ -4456,7 +4456,7 @@ var array = [1, 2, 3], actual = _.fill(array); - deepEqual(actual, [undefined, undefined, undefined]); + deepEqual(actual, Array(3)); ok(_.every(actual, function(value, index) { return index in actual; })); }); @@ -12467,7 +12467,7 @@ var values = _.reject(empties, function(value) { return value === 0 || _.isArray(value); - }).concat(-1, 1.1); + }).concat(-1, 1.1, 'pop', 'push'); var expected = _.map(values, _.constant(undefined)), actual = _.pullAt(array, values); @@ -12506,11 +12506,11 @@ }); test('should work with a falsey `array` argument when keys are provided', 1, function() { - var expected = _.map(falsey, _.constant([undefined, undefined])); + var expected = _.map(falsey, _.constant(Array(4))); var actual = _.map(falsey, function(value) { try { - return _.pullAt(value, 0, 1); + return _.pullAt(value, 0, 1, 'pop', 'push'); } catch(e) {} }); From 8ae7d8aa078123d65319d9931a32f7a1f6d66f14 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 28 Apr 2015 23:53:01 -0700 Subject: [PATCH 36/43] Simplify `SameValueZero` doc notes. [ci skip] --- lodash.src.js | 72 +++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 40ff37888a..53ce7c3ec2 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -4795,11 +4795,8 @@ /** * Creates an array excluding all values of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -5208,13 +5205,10 @@ /** * Gets the index at which the first occurrence of `value` is found in `array` - * using `SameValueZero` for equality comparisons. If `fromIndex` is negative, - * it is used as the offset from the end of `array`. If `array` is sorted - * providing `true` for `fromIndex` performs a faster binary search. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. * * @static * @memberOf _ @@ -5274,13 +5268,10 @@ } /** - * Creates an array of unique values in all provided arrays using `SameValueZero` + * Creates an array of unique values in all provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for equality comparisons. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @category Array @@ -5406,14 +5397,11 @@ } /** - * Removes all provided values from `array` using `SameValueZero` for equality - * comparisons. + * Removes all provided values from `array` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * - * **Notes:** - * - Unlike `_.without`, this method mutates `array` - * - [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except - * that `NaN` matches `NaN` + * **Note:** Unlike `_.without`, this method mutates `array`. * * @static * @memberOf _ @@ -5843,11 +5831,8 @@ /** * Creates an array of unique values, in order, of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -5864,8 +5849,9 @@ }); /** - * Creates a duplicate-free version of an array, using `SameValueZero` for - * equality comparisons, in which only the first occurence of each element + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons, in which only the first occurence of each element * is kept. Providing `true` for `isSorted` performs a faster search algorithm * for sorted arrays. If an iteratee function is provided it is invoked for * each element in the array to generate the criterion by which uniqueness @@ -5883,10 +5869,6 @@ * callback returns `true` for elements that have the properties of the given * object, else `false`. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @alias unique @@ -6008,12 +5990,9 @@ } /** - * Creates an array excluding all provided values using `SameValueZero` for - * equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * Creates an array excluding all provided values using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -6800,13 +6779,10 @@ }); /** - * Checks if `value` is in `collection` using `SameValueZero` for equality - * comparisons. If `fromIndex` is negative, it is used as the offset from - * the end of `collection`. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * Checks if `value` is in `collection` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `collection`. * * @static * @memberOf _ From 6cab7ceb0fb2929b6a703b55453eaaef783a8340 Mon Sep 17 00:00:00 2001 From: Tim D Date: Wed, 29 Apr 2015 21:25:09 +1000 Subject: [PATCH 37/43] Removing `length` assignment in `baseFlatten` for a perf win. --- lodash.src.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lodash.src.js b/lodash.src.js index 53ce7c3ec2..d0474f6549 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -2191,7 +2191,6 @@ var valIndex = -1, valLength = value.length; - result.length += valLength; while (++valIndex < valLength) { result[++resIndex] = value[valIndex]; } From 2ce9e09e8bbf55dcc4e4df10ac3b9cb602fca5a8 Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 30 Apr 2015 09:06:48 -0700 Subject: [PATCH 38/43] Ensure `_.padLeft` and `_.padRight` handle empty strings correctly. --- lodash.src.js | 2 +- test/test.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index d0474f6549..2a0b1687f8 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3638,7 +3638,7 @@ function createPadDir(fromRight) { return function(string, length, chars) { string = baseToString(string); - return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string)); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); }; } diff --git a/test/test.js b/test/test.js index a521d33ac7..b1bf548057 100644 --- a/test/test.js +++ b/test/test.js @@ -11474,6 +11474,7 @@ _.each(['pad', 'padLeft', 'padRight'], function(methodName) { var func = _[methodName], + isPad = methodName == 'pad', isPadLeft = methodName == 'padLeft'; test('`_.' + methodName + '` should not pad is string is >= `length`', 2, function() { @@ -11494,11 +11495,12 @@ }); }); - test('`_.' + methodName + '` should return an empty string when provided nullish or empty string values and `chars`', 6, function() { + test('`_.' + methodName + '` should treat nullish values as empty strings', 6, function() { _.each([null, '_-'], function(chars) { - strictEqual(func(null, 0, chars), ''); - strictEqual(func(undefined, 0, chars), ''); - strictEqual(func('', 0, chars), ''); + var expected = chars ? (isPad ? '__' : chars) : ' '; + strictEqual(func(null, 2, chars), expected); + strictEqual(func(undefined, 2, chars), expected); + strictEqual(func('', 2, chars), expected); }); }); From 0ea1fc5602f473ea89ac7617d3c5f3a6761ba9e5 Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 30 Apr 2015 09:08:31 -0700 Subject: [PATCH 39/43] Avoid var name `pad` in `composeArgsRight`. --- lodash.src.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 2a0b1687f8..ef87d96a16 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3197,12 +3197,12 @@ while (++argsIndex < argsLength) { result[argsIndex] = args[argsIndex]; } - var pad = argsIndex; + var offset = argsIndex; while (++rightIndex < rightLength) { - result[pad + rightIndex] = partials[rightIndex]; + result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { - result[pad + holders[holdersIndex]] = args[argsIndex++]; + result[offset + holders[holdersIndex]] = args[argsIndex++]; } return result; } From 566781cab25e0e8374ecc48e7cb57e295ddb2502 Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 30 Apr 2015 22:10:52 -0700 Subject: [PATCH 40/43] Loosen `-0` and `0` checks. --- lodash.src.js | 8 +- test/test.js | 234 +++++++++++++++++++++++++++++-------------- test/underscore.html | 6 ++ 3 files changed, 167 insertions(+), 81 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index ef87d96a16..833f51bcf4 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -2333,8 +2333,7 @@ function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { // Exit early for identical values. if (value === other) { - // Treat `+0` vs. `-0` as not equal. - return value !== 0 || (1 / value == 1 / other); + return true; } var valType = typeof value, othType = typeof other; @@ -3984,8 +3983,7 @@ // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other - // But, treat `-0` vs. `+0` as not equal. - : (object == 0 ? ((1 / object) == (1 / other)) : object == +other); + : object == +other; case regexpTag: case stringTag: @@ -4410,7 +4408,7 @@ * equality comparisons, else `false`. */ function isStrictComparable(value) { - return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value)); + return value === value && !isObject(value); } /** diff --git a/test/test.js b/test/test.js index b1bf548057..d96262d784 100644 --- a/test/test.js +++ b/test/test.js @@ -6423,8 +6423,9 @@ strictEqual(_.includes([1, NaN, 3], NaN), true); }); - test('should match `-0` as `0`', 1, function() { + test('should match `-0` as `0`', 2, function() { strictEqual(_.includes([-0], 0), true); + strictEqual(_.includes([0], -0), true); }); test('should work as an iteratee for methods like `_.reduce`', 1, function() { @@ -7310,7 +7311,7 @@ test('should perform comparisons between primitive values', 1, function() { var pairs = [ [1, 1, true], [1, Object(1), true], [1, '1', false], [1, 2, false], - [-0, -0, true], [0, 0, true], [0, Object(0), true], [Object(0), Object(0), true], [-0, 0, false], [0, '0', false], [0, null, false], + [-0, -0, true], [0, 0, true], [0, Object(0), true], [Object(0), Object(0), true], [-0, 0, true], [0, '0', false], [0, null, false], [NaN, NaN, true], [NaN, Object(NaN), true], [Object(NaN), Object(NaN), true], [NaN, 'a', false], [NaN, Infinity, false], ['a', 'a', true], ['a', Object('a'), true], [Object('a'), Object('a'), true], ['a', 'b', false], ['a', ['a'], false], [true, true, true], [true, Object(true), true], [Object(true), Object(true), true], [true, 1, false], [true, 'a', false], @@ -8138,12 +8139,34 @@ strictEqual(_.isMatch(object, { 'a': { 'b': { 'c': 1 } } }), true); }); - test('should compare a variety of `source` values', 2, function() { - var object1 = { 'a': false, 'b': true, 'c': '3', 'd': 4, 'e': [5], 'f': { 'g': 6 } }, - object2 = { 'a': 0, 'b': 1, 'c': 3, 'd': '4', 'e': ['5'], 'f': { 'g': '6' } }; + test('should match inherited `object` properties', 1, function() { + function Foo() { this.a = 1; } + Foo.prototype.b = 2; - strictEqual(_.isMatch(object1, object1), true); - strictEqual(_.isMatch(object1, object2), false); + strictEqual(_.isMatch({ 'a': new Foo }, { 'a': { 'b': 2 } }), true); + }); + + test('should match `-0` as `0`', 2, function() { + var object1 = { 'a': -0 }, + object2 = { 'a': 0 }; + + strictEqual(_.isMatch(object1, object2), true); + strictEqual(_.isMatch(object2, object1), true); + }); + + test('should not match by inherited `source` properties', 1, function() { + function Foo() { this.a = 1; } + Foo.prototype.b = 2; + + var objects = [{ 'a': 1 }, { 'a': 1, 'b': 2 }], + source = new Foo, + expected = _.map(objects, _.constant(true)); + + var actual = _.map(objects, function(object) { + return _.isMatch(object, source); + }); + + deepEqual(actual, expected); }); test('should return `false` when `object` is nullish', 1, function() { @@ -8171,6 +8194,30 @@ deepEqual(actual, expected); }); + test('should compare a variety of `source` values', 2, function() { + var object1 = { 'a': false, 'b': true, 'c': '3', 'd': 4, 'e': [5], 'f': { 'g': 6 } }, + object2 = { 'a': 0, 'b': 1, 'c': 3, 'd': '4', 'e': ['5'], 'f': { 'g': '6' } }; + + strictEqual(_.isMatch(object1, object1), true); + strictEqual(_.isMatch(object1, object2), false); + }); + + test('should work with a function for `source`', 1, function() { + function source() {} + + source.a = 1; + source.b = function() {}; + source.c = 3; + + var objects = [{ 'a': 1 }, { 'a': 1, 'b': source.b, 'c': 3 }]; + + var actual = _.map(objects, function(object) { + return _.isMatch(object, source); + }); + + deepEqual(actual, [false, true]); + }); + test('should return `true` when comparing a `source` of empty arrays and objects', 1, function() { var objects = [{ 'a': [1], 'b': { 'c': 1 } }, { 'a': [2, 3], 'b': { 'd': 2 } }], source = { 'a': [], 'b': {} }; @@ -8245,21 +8292,38 @@ deepEqual(actual, expected); }); - test('should not match by inherited `source` properties', 1, function() { - function Foo() { this.a = 1; } - Foo.prototype.b = 2; + test('should handle a `source` with `undefined` values', 2, function() { + var matches = _.matches({ 'b': undefined }), + objects = [{ 'a': 1 }, { 'a': 1, 'b': 1 }, { 'a': 1, 'b': undefined }], + actual = _.map(objects, matches), + expected = [false, false, true]; - var objects = [{ 'a': 1 }, { 'a': 1, 'b': 2 }], - source = new Foo, - expected = _.map(objects, _.constant(true)); + deepEqual(actual, expected); - var actual = _.map(objects, function(object) { - return _.isMatch(object, source); - }); + matches = _.matches({ 'a': { 'c': undefined } }); + objects = [{ 'a': { 'b': 1 } }, { 'a': { 'b':1, 'c': 1 } }, { 'a': { 'b': 1, 'c': undefined } }]; + actual = _.map(objects, matches); deepEqual(actual, expected); }); + test('should match properties when `value` is a function', 1, function() { + function Foo() {} + Foo.a = { 'b': 1, 'c': 2 }; + + var matches = _.matches({ 'a': { 'b': 1 } }); + strictEqual(matches(Foo), true); + }); + + test('should match properties when `value` is not a plain object', 1, function() { + function Foo(object) { _.assign(this, object); } + + var object = new Foo({ 'a': new Foo({ 'b': 1, 'c': 2 }) }), + matches = _.matches({ 'a': { 'b': 1 } }); + + strictEqual(matches(object), true); + }); + test('should work with a function for `source`', 1, function() { function source() {} @@ -8267,11 +8331,9 @@ source.b = function() {}; source.c = 3; - var objects = [{ 'a': 1 }, { 'a': 1, 'b': source.b, 'c': 3 }]; - - var actual = _.map(objects, function(object) { - return _.isMatch(object, source); - }); + var matches = _.matches(source), + objects = [{ 'a': 1 }, { 'a': 1, 'b': source.b, 'c': 3 }], + actual = _.map(objects, matches); deepEqual(actual, [false, true]); }); @@ -9328,8 +9390,9 @@ strictEqual(func([1, 2, NaN, NaN], NaN, true), isIndexOf ? 2 : 3); }); - test('`_.' + methodName + '` should match `-0` as `0`', 1, function() { + test('`_.' + methodName + '` should match `-0` as `0`', 2, function() { strictEqual(func([-0], 0), 0); + strictEqual(func([0], -0), 0); }); }); @@ -9650,6 +9713,17 @@ strictEqual(matches(object), true); }); + test('should match `-0` as `0`', 2, function() { + var object1 = { 'a': -0 }, + object2 = { 'a': 0 }, + matches = _.matches(object1); + + strictEqual(matches(object2), true); + + matches = _.matches(object2); + strictEqual(matches(object1), true); + }); + test('should not match by inherited `source` properties', 1, function() { function Foo() { this.a = 1; } Foo.prototype.b = 2; @@ -9899,31 +9973,6 @@ deepEqual(actual, expected); }); - test('should match inherited `value` properties', 2, function() { - function Foo() {} - Foo.prototype.b = 2; - - var object = { 'a': new Foo }; - - _.each(['a', ['a']], function(path) { - var matches = _.matchesProperty(path, { 'b': 2 }); - strictEqual(matches(object), true); - }); - }); - - test('should not match inherited `source` properties', 2, function() { - function Foo() { this.a = 1; } - Foo.prototype.b = 2; - - var objects = [{ 'a': { 'a': 1 } }, { 'a': { 'a': 1, 'b': 2 } }], - expected = _.map(objects, _.constant(true)); - - _.each(['a', ['a']], function(path) { - var matches = _.matchesProperty(path, new Foo); - deepEqual(_.map(objects, matches), expected); - }); - }); - test('should match characters of string indexes (test in IE < 9)', 2, function() { var matches = _.matchesProperty(1, 'o'); _.each(['xo', Object('xo')], function(string) { @@ -9949,6 +9998,48 @@ }); }); + test('should return `false` if parts of `path` are missing', 4, function() { + var object = {}; + + _.each(['a', 'a[1].b.c', ['a'], ['a', '1', 'b', 'c']], function(path) { + var matches = _.matchesProperty(path, 1); + strictEqual(matches(object), false); + }); + }); + + test('should match inherited `value` properties', 2, function() { + function Foo() {} + Foo.prototype.b = 2; + + var object = { 'a': new Foo }; + + _.each(['a', ['a']], function(path) { + var matches = _.matchesProperty(path, { 'b': 2 }); + strictEqual(matches(object), true); + }); + }); + + test('should match `-0` as `0`', 2, function() { + var matches = _.matchesProperty('a', -0); + strictEqual(matches({ 'a': 0 }), true); + + matches = _.matchesProperty('a', 0); + strictEqual(matches({ 'a': -0 }), true); + }); + + test('should not match by inherited `source` properties', 2, function() { + function Foo() { this.a = 1; } + Foo.prototype.b = 2; + + var objects = [{ 'a': { 'a': 1 } }, { 'a': { 'a': 1, 'b': 2 } }], + expected = _.map(objects, _.constant(true)); + + _.each(['a', ['a']], function(path) { + var matches = _.matchesProperty(path, new Foo); + deepEqual(_.map(objects, matches), expected); + }); + }); + test('should return `false` when `object` is nullish', 2, function() { var values = [, null, undefined], expected = _.map(values, _.constant(false)); @@ -9983,26 +10074,6 @@ }); }); - test('should return `false` if parts of `path` are missing', 4, function() { - var object = {}; - - _.each(['a', 'a[1].b.c', ['a'], ['a', '1', 'b', 'c']], function(path) { - var matches = _.matchesProperty(path, 1); - strictEqual(matches(object), false); - }); - }); - - test('should return `true` when comparing a `value` of empty arrays and objects', 1, function() { - var objects = [{ 'a': [1], 'b': { 'c': 1 } }, { 'a': [2, 3], 'b': { 'd': 2 } }], - matches = _.matchesProperty('a', { 'a': [], 'b': {} }); - - var actual = _.filter(objects, function(object) { - return matches({ 'a': object }); - }); - - deepEqual(actual, objects); - }); - test('should compare a variety of values', 2, function() { var object1 = { 'a': false, 'b': true, 'c': '3', 'd': 4, 'e': [5], 'f': { 'g': 6 } }, object2 = { 'a': 0, 'b': 1, 'c': 3, 'd': '4', 'e': ['5'], 'f': { 'g': '6' } }, @@ -10044,6 +10115,17 @@ }); }); + test('should return `true` when comparing a `value` of empty arrays and objects', 1, function() { + var objects = [{ 'a': [1], 'b': { 'c': 1 } }, { 'a': [2, 3], 'b': { 'd': 2 } }], + matches = _.matchesProperty('a', { 'a': [], 'b': {} }); + + var actual = _.filter(objects, function(object) { + return matches({ 'a': object }); + }); + + deepEqual(actual, objects); + }); + test('should search arrays of `value` for values', 3, function() { var objects = [{ 'a': ['b'] }, { 'a': ['c', 'd'] }], matches = _.matchesProperty('a', ['d']), @@ -10086,15 +10168,6 @@ deepEqual(actual, [false, false, true]); }); - test('should match properties when `value` is not a plain object', 1, function() { - function Foo(object) { _.assign(this, object); } - - var object = new Foo({ 'a': new Foo({ 'b': 1, 'c': 2 }) }), - matches = _.matchesProperty('a', { 'b': 1 }); - - strictEqual(matches(object), true); - }); - test('should work with a function for `value`', 1, function() { function source() {} @@ -10109,6 +10182,15 @@ deepEqual(actual, [false, true]); }); + test('should match properties when `value` is not a plain object', 1, function() { + function Foo(object) { _.assign(this, object); } + + var object = new Foo({ 'a': new Foo({ 'b': 1, 'c': 2 }) }), + matches = _.matchesProperty('a', { 'b': 1 }); + + strictEqual(matches(object), true); + }); + test('should match problem JScript properties (test in IE < 9)', 1, function() { var matches = _.matchesProperty('a', shadowObject), objects = [{ 'a': {} }, { 'a': shadowObject }], diff --git a/test/underscore.html b/test/underscore.html index d07910906d..97494d9b5f 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -129,6 +129,12 @@ 'extend': [ 'extend copies all properties from source' ], + 'isEqual': [ + '`0` is not equal to `-0`', + 'Commutative equality is implemented for `0` and `-0`', + '`new Number(0)` and `-0` are not equal', + 'Commutative equality is implemented for `new Number(0)` and `-0`' + ], 'isFinite': [ 'Numeric strings are numbers', 'Number instances can be finite' From 23eba0a0297906238e2726d0aa7e9ebff0fc8209 Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 30 Apr 2015 23:50:58 -0700 Subject: [PATCH 41/43] Avoid `isArrayLike` in `createBaseEach` to bail out early when nullish. --- lodash.src.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 833f51bcf4..fc12d1e18f 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -3290,11 +3290,11 @@ */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { - if (!isArrayLike(collection)) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { return eachFunc(collection, iteratee); } - var length = collection.length, - index = fromRight ? length : -1, + var index = fromRight ? length : -1, iterable = toObject(collection); while ((fromRight ? index-- : ++index < length)) { From b75041173c9aa35343fb4be44d7a28a8acae03f3 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 26 Apr 2015 21:16:05 -0700 Subject: [PATCH 42/43] Rebuild lodash and docs. --- doc/README.md | 623 ++++++++++++++++++++++++++------------------------ lodash.js | 440 +++++++++++++++++++---------------- lodash.min.js | 183 ++++++++------- lodash.src.js | 4 +- 4 files changed, 659 insertions(+), 591 deletions(-) diff --git a/doc/README.md b/doc/README.md index cbc9e271c9..c1eeb8f7cc 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# lodash v3.7.0 +# lodash v3.8.0 @@ -41,10 +41,12 @@ * `_.uniq` * `_.unique` -> `uniq` * `_.unzip` +* `_.unzipWith` * `_.without` * `_.xor` * `_.zip` * `_.zipObject` +* `_.zipWith` @@ -218,6 +220,7 @@ * `_.invert` * `_.keys` * `_.keysIn` +* `_.mapKeys` * `_.mapValues` * `_.merge` * `_.methods` -> `functions` @@ -327,7 +330,7 @@ ### `_.chunk(array, [size=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4714 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L4747 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package") Creates an array of elements split into groups the length of `size`. If `collection` can't be split evenly, the final chunk will be the remaining @@ -355,7 +358,7 @@ _.chunk(['a', 'b', 'c', 'd'], 3); ### `_.compact(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4745 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L4778 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package") Creates an array with all falsey values removed. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are falsey. @@ -378,15 +381,11 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4779 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L4809 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package") Creates an array excluding all values of the provided arrays using -`SameValueZero` for equality comparisons. -
-
-**Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except that -`NaN` matches `NaN`. +[`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) +for equality comparisons. #### Arguments 1. `array` *(Array)*: The array to inspect. @@ -407,7 +406,7 @@ _.difference([1, 2, 3], [4, 2]); ### `_.drop(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4809 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L4839 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package") Creates a slice of `array` with `n` elements dropped from the beginning. @@ -439,7 +438,7 @@ _.drop([1, 2, 3], 0); ### `_.dropRight(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4844 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L4874 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package") Creates a slice of `array` with `n` elements dropped from the end. @@ -471,7 +470,7 @@ _.dropRight([1, 2, 3], 0); ### `_.dropRightWhile(array, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4905 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L4935 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package") Creates a slice of `array` excluding elements dropped from the end. Elements are dropped until `predicate` returns falsey. The predicate is @@ -531,7 +530,7 @@ _.pluck(_.dropRightWhile(users, 'active'), 'user'); ### `_.dropWhile(array, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4960 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L4990 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package") Creates a slice of `array` excluding elements dropped from the beginning. Elements are dropped until `predicate` returns falsey. The predicate is @@ -591,7 +590,7 @@ _.pluck(_.dropWhile(users, 'active'), 'user'); ### `_.fill(array, value, [start=0], [end=array.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L4994 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5024 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package") Fills elements of `array` with `value` from `start` up to, but not including, `end`. @@ -629,7 +628,7 @@ _.fill([4, 6, 8], '*', 1, 2); ### `_.findIndex(array, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5054 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5084 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package") This method is like `_.find` except that it returns the index of the first element `predicate` returns truthy for instead of the element itself. @@ -688,7 +687,7 @@ _.findIndex(users, 'active'); ### `_.findLastIndex(array, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5104 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5134 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package") This method is like `_.findIndex` except that it iterates over elements of `collection` from right to left. @@ -747,7 +746,7 @@ _.findLastIndex(users, 'active'); ### `_.first(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5123 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.first "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5153 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.first "See the npm package") Gets the first element of `array`. @@ -775,7 +774,7 @@ _.first([]); ### `_.flatten(array, [isDeep])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5147 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5177 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package") Flattens a nested array. If `isDeep` is `true` the array is recursively flattened, otherwise it is only flattened a single level. @@ -803,7 +802,7 @@ _.flatten([1, [2, 3, [4]]], true); ### `_.flattenDeep(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5168 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5198 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package") Recursively flattens a nested array. @@ -825,17 +824,13 @@ _.flattenDeep([1, [2, 3, [4]]]); ### `_.indexOf(array, value, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5204 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5231 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package") Gets the index at which the first occurrence of `value` is found in `array` -using `SameValueZero` for equality comparisons. If `fromIndex` is negative, -it is used as the offset from the end of `array`. If `array` is sorted -providing `true` for `fromIndex` performs a faster binary search. -
-
-**Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except that -`NaN` matches `NaN`. +using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) +for equality comparisons. If `fromIndex` is negative, it is used as the offset +from the end of `array`. If `array` is sorted providing `true` for `fromIndex` +performs a faster binary search. #### Arguments 1. `array` *(Array)*: The array to search. @@ -865,7 +860,7 @@ _.indexOf([1, 1, 2, 2], 2, true); ### `_.initial(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5236 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5263 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package") Gets all but the last element of `array`. @@ -887,15 +882,11 @@ _.initial([1, 2, 3]); ### `_.intersection([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5257 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5281 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package") -Creates an array of unique values in all provided arrays using `SameValueZero` +Creates an array of unique values in all provided arrays using +[`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) for equality comparisons. -
-
-**Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except that -`NaN` matches `NaN`. #### Arguments 1. `[arrays]` *(...Array)*: The arrays to inspect. @@ -915,7 +906,7 @@ _.intersection([1, 2], [4, 2], [2, 1]); ### `_.last(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5315 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5339 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package") Gets the last element of `array`. @@ -937,7 +928,7 @@ _.last([1, 2, 3]); ### `_.lastIndexOf(array, value, [fromIndex=array.length-1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5345 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5369 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package") This method is like `_.indexOf` except that it iterates over elements of `array` from right to left. @@ -970,19 +961,14 @@ _.lastIndexOf([1, 1, 2, 2], 2, true); ### `_.pull(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5396 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5417 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package") -Removes all provided values from `array` using `SameValueZero` for equality -comparisons. -
-
-**Notes:** +Removes all provided values from `array` using +[`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) +for equality comparisons.
-* Unlike `_.without`, this method mutates `array`
-* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except -that `NaN` matches `NaN` +**Note:** Unlike `_.without`, this method mutates `array`. #### Arguments 1. `array` *(Array)*: The array to modify. @@ -1006,7 +992,7 @@ console.log(array); ### `_.pullAt(array, [indexes])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5443 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5464 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package") Removes elements from `array` corresponding to the given indexes and returns an array of the removed elements. Indexes may be specified as an array of @@ -1040,7 +1026,7 @@ console.log(evens); ### `_.remove(array, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5491 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5511 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package") Removes all elements from `array` that `predicate` returns truthy for and returns an array of the removed elements. The predicate is bound to @@ -1091,7 +1077,7 @@ console.log(evens); ### `_.rest(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5526 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5546 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package") Gets all but the first element of `array`. @@ -1116,7 +1102,7 @@ _.rest([1, 2, 3]); ### `_.slice(array, [start=0], [end=array.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5544 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5564 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package") Creates a slice of `array` from `start` up to, but not including, `end`.
@@ -1139,7 +1125,7 @@ lists in IE < 9 and to ensure dense arrays are returned. ### `_.sortedIndex(array, value, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5604 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5624 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package") Uses a binary search to determine the lowest index at which `value` should be inserted into `array` in order to maintain its sort order. If an iteratee @@ -1198,7 +1184,7 @@ _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); ### `_.sortedLastIndex(array, value, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5626 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5646 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package") This method is like `_.sortedIndex` except that it returns the highest index at which `value` should be inserted into `array` in order to @@ -1226,7 +1212,7 @@ _.sortedLastIndex([4, 4, 5, 5], 5); ### `_.take(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5652 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5672 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package") Creates a slice of `array` with `n` elements taken from the beginning. @@ -1258,7 +1244,7 @@ _.take([1, 2, 3], 0); ### `_.takeRight(array, [n=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5707 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package") Creates a slice of `array` with `n` elements taken from the end. @@ -1290,7 +1276,7 @@ _.takeRight([1, 2, 3], 0); ### `_.takeRightWhile(array, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5748 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5768 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package") Creates a slice of `array` with elements taken from the end. Elements are taken until `predicate` returns falsey. The predicate is bound to `thisArg` @@ -1350,7 +1336,7 @@ _.pluck(_.takeRightWhile(users, 'active'), 'user'); ### `_.takeWhile(array, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5803 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5823 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package") Creates a slice of `array` with elements taken from the beginning. Elements are taken until `predicate` returns falsey. The predicate is bound to @@ -1410,15 +1396,11 @@ _.pluck(_.takeWhile(users, 'active'), 'user'); ### `_.union([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5827 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5844 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package") Creates an array of unique values, in order, of the provided arrays using -`SameValueZero` for equality comparisons. -
-
-**Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except that -`NaN` matches `NaN`. +[`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) +for equality comparisons. #### Arguments 1. `[arrays]` *(...Array)*: The arrays to inspect. @@ -1438,10 +1420,11 @@ _.union([1, 2], [4, 2], [2, 1]); ### `_.uniq(array, [isSorted], [iteratee], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5883 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5897 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package") -Creates a duplicate-free version of an array, using `SameValueZero` for -equality comparisons, in which only the first occurence of each element +Creates a duplicate-free version of an array, using +[`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) +for equality comparisons, in which only the first occurence of each element is kept. Providing `true` for `isSorted` performs a faster search algorithm for sorted arrays. If an iteratee function is provided it is invoked for each element in the array to generate the criterion by which uniqueness @@ -1461,11 +1444,6 @@ value, else `false`. If an object is provided for `iteratee` the created `_.matches` style callback returns `true` for elements that have the properties of the given object, else `false`. -
-
-**Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except that -`NaN` matches `NaN`. #### Aliases *_.unique* @@ -1505,10 +1483,10 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5920 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5934 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package") 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` +elements and creates an array regrouping the elements to their pre-zip configuration. #### Arguments @@ -1531,16 +1509,41 @@ _.unzip(zipped); +### `_.unzipWith(array, [iteratee], [thisArg])` +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L5974 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package") + +This method is like `_.unzip` except that it accepts an iteratee to specify +how regrouped values should be combined. The `iteratee` is bound to `thisArg` +and invoked with four arguments: (accumulator, value, index, group). + +#### Arguments +1. `array` *(Array)*: The array of grouped elements to process. +2. `[iteratee]` *(Function)*: The function to combine regrouped values. +3. `[thisArg]` *(*)*: The `this` binding of `iteratee`. + +#### Returns +*(Array)*: Returns the new array of regrouped elements. + +#### Example +```js +var zipped = _.zip([1, 2], [10, 20], [100, 200]); +// => [[1, 10, 100], [2, 20, 200]] + +_.unzipWith(zipped, _.add); +// => [3, 30, 300] +``` +* * * + + + + + ### `_.without(array, [values])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5950 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6005 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package") -Creates an array excluding all provided values using `SameValueZero` for -equality comparisons. -
-
-**Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except that -`NaN` matches `NaN`. +Creates an array excluding all provided values using +[`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) +for equality comparisons. #### Arguments 1. `array` *(Array)*: The array to filter. @@ -1561,7 +1564,7 @@ _.without([1, 2, 1, 3], 1, 2); ### `_.xor([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L5970 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6025 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package") Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) of the provided arrays. @@ -1584,7 +1587,7 @@ _.xor([1, 2], [4, 2]); ### `_.zip([arrays])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6000 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6055 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package") Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements @@ -1608,7 +1611,7 @@ _.zip(['fred', 'barney'], [30, 40], [true, false]); ### `_.zipObject(props, [values=[]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6023 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6078 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package") The inverse of `_.pairs`; this method returns an object composed from arrays of property names and values. Provide either a single two dimensional array, @@ -1637,6 +1640,32 @@ _.zipObject(['fred', 'barney'], [30, 40]); + + +### `_.zipWith([arrays], [iteratee], [thisArg])` +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6114 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package") + +This method is like `_.zip` except that it accepts an iteratee to specify +how grouped values should be combined. The `iteratee` is bound to `thisArg` +and invoked with four arguments: (accumulator, value, index, group). + +#### Arguments +1. `[arrays]` *(...Array)*: The arrays to process. +2. `[iteratee]` *(Function)*: The function to combine grouped values. +3. `[thisArg]` *(*)*: The `this` binding of `iteratee`. + +#### Returns +*(Array)*: Returns the new array of grouped elements. + +#### Example +```js +_.zipWith([1, 2], [10, 20], [100, 200], _.add); +// => [111, 222] +``` +* * * + + + @@ -1646,7 +1675,7 @@ _.zipObject(['fred', 'barney'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L974 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L980 "View in source") [Ⓣ][1] Creates a `lodash` object which wraps `value` to enable implicit chaining. Methods that operate on and return arrays, collections, and functions can @@ -1757,7 +1786,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6070 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6157 "View in source") [Ⓣ][1] Creates a `lodash` object that wraps `value` with explicit method chaining enabled. @@ -1792,7 +1821,7 @@ var youngest = _.chain(users) ### `_.tap(value, interceptor, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6099 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6186 "View in source") [Ⓣ][1] This method invokes `interceptor` and returns `value`. The interceptor is bound to `thisArg` and invoked with one argument; (value). The purpose of @@ -1824,7 +1853,7 @@ _([1, 2, 3]) ### `_.thru(value, interceptor, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6125 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6212 "View in source") [Ⓣ][1] This method is like `_.tap` except that it returns the result of `interceptor`. @@ -1854,7 +1883,7 @@ _(' abc ') ### `_.prototype.chain()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6154 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6241 "View in source") [Ⓣ][1] Enables explicit method chaining on the wrapper object. @@ -1886,7 +1915,7 @@ _(users).chain() ### `_.prototype.commit()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6183 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6270 "View in source") [Ⓣ][1] Executes the chained sequence and returns the wrapped result. @@ -1918,7 +1947,7 @@ console.log(array); ### `_.prototype.plant()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6210 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6297 "View in source") [Ⓣ][1] Creates a clone of the chained sequence planting `value` as the wrapped value. @@ -1948,7 +1977,7 @@ wrapper.value(); ### `_.prototype.reverse()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6248 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6335 "View in source") [Ⓣ][1] Reverses the wrapped array so the first element becomes the last, the second element becomes the second to last, and so on. @@ -1976,7 +2005,7 @@ console.log(array); ### `_.prototype.toString()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6273 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6360 "View in source") [Ⓣ][1] Produces the result of coercing the unwrapped value to a string. @@ -1995,7 +2024,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.value()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6290 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6377 "View in source") [Ⓣ][1] Executes the chained sequence to extract the unwrapped value. @@ -2023,7 +2052,7 @@ _([1, 2, 3]).value(); ### `_.at(collection, [props])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6316 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6403 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package") Creates an array of elements corresponding to the given keys, or indexes, of `collection`. Keys may be specified as individual arguments or as arrays @@ -2051,7 +2080,7 @@ _.at(['barney', 'fred', 'pebbles'], 0, 2); ### `_.countBy(collection, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6365 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6451 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package") Creates an object composed of keys generated from the results of running each element of `collection` through `iteratee`. The corresponding value @@ -2103,7 +2132,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6417 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6503 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package") Checks if `predicate` returns truthy for **all** elements of `collection`. The predicate is bound to `thisArg` and invoked with three arguments:
@@ -2164,7 +2193,7 @@ _.every(users, 'active'); ### `_.filter(collection, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6477 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6563 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package") Iterates over elements of `collection`, returning an array of all elements `predicate` returns truthy for. The predicate is bound to `thisArg` and @@ -2226,7 +2255,7 @@ _.pluck(_.filter(users, 'active'), 'user'); ### `_.find(collection, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6533 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6619 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package") Iterates over elements of `collection`, returning the first element `predicate` returns truthy for. The predicate is bound to `thisArg` and @@ -2289,7 +2318,7 @@ _.result(_.find(users, 'active'), 'user'); ### `_.findLast(collection, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6554 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6640 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package") This method is like `_.find` except that it iterates over elements of `collection` from right to left. @@ -2316,7 +2345,7 @@ _.findLast([1, 2, 3, 4], function(n) { ### `_.findWhere(collection, source)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6585 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findwhere "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6671 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findwhere "See the npm package") Performs a deep comparison between each element in `collection` and the source object, returning the first element that has equivalent property @@ -2355,7 +2384,7 @@ _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); ### `_.forEach(collection, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6619 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6705 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package") Iterates over elements of `collection` invoking `iteratee` for each element. The `iteratee` is bound to `thisArg` and invoked with three arguments:
@@ -2397,7 +2426,7 @@ _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { ### `_.forEachRight(collection, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6640 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6726 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package") This method is like `_.forEach` except that it iterates over elements of `collection` from right to left. @@ -2427,7 +2456,7 @@ _([1, 2]).forEachRight(function(n) { ### `_.groupBy(collection, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6684 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6770 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package") Creates an object composed of keys generated from the results of running each element of `collection` through `iteratee`. The corresponding value @@ -2480,16 +2509,12 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.includes(collection, target, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6724 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6807 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package") -Checks if `value` is in `collection` using `SameValueZero` for equality -comparisons. If `fromIndex` is negative, it is used as the offset from -the end of `collection`. -
-
-**Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) -comparisons are like strict equality comparisons, e.g. `===`, except that -`NaN` matches `NaN`. +Checks if `value` is in `collection` using +[`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) +for equality comparisons. If `fromIndex` is negative, it is used as the offset +from the end of `collection`. #### Aliases *_.contains, _.include* @@ -2523,7 +2548,7 @@ _.includes('pebbles', 'eb'); ### `_.indexBy(collection, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6789 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6872 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexby "See the npm package") Creates an object composed of keys generated from the results of running each element of `collection` through `iteratee`. The corresponding value @@ -2580,7 +2605,7 @@ _.indexBy(keyData, function(object) { ### `_.invoke(collection, path, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6815 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6898 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package") Invokes the method at `path` on each element in `collection`, returning an array of the results of each invoked method. Any additional arguments @@ -2610,7 +2635,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6884 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L6967 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package") Creates an array of values by running each element in `collection` through `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three @@ -2636,10 +2661,11 @@ Many lodash methods are guarded to work as interatees for methods like

The guarded methods are:
-`ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, -`dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, -`slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, -`trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` +`ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, +`drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, +`parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, +`trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, +`sum`, `uniq`, and `words` #### Aliases *_.collect* @@ -2680,7 +2706,7 @@ _.map(users, 'user'); ### `_.partition(collection, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6949 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7032 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package") Creates an array of elements split into two groups, the first of which contains elements `predicate` returns truthy for, while the second of which @@ -2750,7 +2776,7 @@ _.map(_.partition(users, 'active'), mapper); ### `_.pluck(collection, path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L6976 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pluck "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7059 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pluck "See the npm package") Gets the property value of `path` from all elements in `collection`. @@ -2782,7 +2808,7 @@ _.pluck(userIndex, 'age'); ### `_.reduce(collection, [iteratee=_.identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7016 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7099 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package") Reduces `collection` to a value which is the accumulated result of running each element in `collection` through `iteratee`, where each successive @@ -2831,7 +2857,7 @@ _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { ### `_.reduceRight(collection, [iteratee=_.identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7040 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7123 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package") This method is like `_.reduce` except that it iterates over elements of `collection` from right to left. @@ -2864,24 +2890,10 @@ _.reduceRight(array, function(flattened, other) { ### `_.reject(collection, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7089 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7161 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package") The opposite of `_.filter`; this method returns the elements of `collection` that `predicate` does **not** return truthy for. -
-
-If a property name is provided for `predicate` the created `_.property` -style callback returns the property value of the given element. -
-
-If a value is also provided for `thisArg` the created `_.matchesProperty` -style callback returns `true` for elements that have a matching property -value, else `false`. -
-
-If an object is provided for `predicate` the created `_.matches` style -callback returns `true` for elements that have the properties of the given -object, else `false`. #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -2922,7 +2934,7 @@ _.pluck(_.reject(users, 'active'), 'user'); ### `_.sample(collection, [n])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7115 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7187 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package") Gets a random element or `n` random elements from a collection. @@ -2948,7 +2960,7 @@ _.sample([1, 2, 3, 4], 2); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7140 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7212 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package") Creates an array of shuffled values, using a version of the [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). @@ -2971,7 +2983,7 @@ _.shuffle([1, 2, 3, 4]); ### `_.size(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7177 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7249 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package") Gets the size of `collection` by returning its length for array-like values or the number of own enumerable properties for objects. @@ -3000,7 +3012,7 @@ _.size('pebbles'); ### `_.some(collection, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7231 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7303 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package") Checks if `predicate` returns truthy for **any** element of `collection`. The function returns as soon as it finds a passing value and does not iterate @@ -3062,7 +3074,7 @@ _.some(users, 'active'); ### `_.sortBy(collection, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7290 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7362 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package") Creates an array of elements, sorted in ascending order by the results of running each element in a collection through `iteratee`. This method performs @@ -3121,7 +3133,7 @@ _.pluck(_.sortBy(users, 'user'), 'user'); ### `_.sortByAll(collection, iteratees)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7341 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortbyall "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7413 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortbyall "See the npm package") This method is like `_.sortBy` except that it can sort by multiple iteratees or property names. @@ -3166,7 +3178,7 @@ _.map(_.sortByAll(users, 'user', function(chr) { ### `_.sortByOrder(collection, iteratees, orders)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7386 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortbyorder "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7458 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortbyorder "See the npm package") This method is like `_.sortByAll` except that it allows specifying the sort orders of the iteratees to sort by. A truthy value in `orders` will @@ -3210,7 +3222,7 @@ _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); ### `_.where(collection, source)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7431 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.where "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7503 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.where "See the npm package") Performs a deep comparison between each element in `collection` and the source object, returning an array of all elements that have equivalent @@ -3255,7 +3267,7 @@ _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); ### `_.now` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7451 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7523 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package") Gets the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). @@ -3280,7 +3292,7 @@ _.defer(function(stamp) { ### `_.after(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7480 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7552 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package") The opposite of `_.before`; this method creates a function that invokes `func` once it is called `n` or more times. @@ -3312,7 +3324,7 @@ _.forEach(saves, function(type) { ### `_.ary(func, [n=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7514 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7586 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package") Creates a function that accepts up to `n` arguments ignoring any additional arguments. @@ -3336,7 +3348,7 @@ _.map(['6', '8', '10'], _.ary(parseInt, 1)); ### `_.before(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7538 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7610 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package") Creates a function that invokes `func`, with the `this` binding and arguments of the created function, while it is called less than `n` times. Subsequent @@ -3361,7 +3373,7 @@ jQuery('#add').on('click', _.before(5, addContactToList)); ### `_.bind(func, thisArg, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7595 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7667 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package") Creates a function that invokes `func` with the `this` binding of `thisArg` and prepends any additional `_.bind` arguments to those provided to the @@ -3407,7 +3419,7 @@ bound('hi'); ### `_.bindAll(object, [methodNames])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7632 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7704 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package") Binds methods of an object to the object itself, overwriting the existing method. Method names may be specified as individual arguments or as arrays @@ -3444,7 +3456,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7689 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7761 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package") Creates a function that invokes the method at `object[key]` and prepends any additional `_.bindKey` arguments to those provided to the bound function. @@ -3499,7 +3511,7 @@ bound('hi'); ### `_.curry(func, [arity=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7738 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7810 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package") Creates a function that accepts one or more arguments of `func` that when called either invokes `func` returning its result, if all `func` arguments @@ -3549,7 +3561,7 @@ curried(1)(_, 3)(2); ### `_.curryRight(func, [arity=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7777 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7849 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package") This method is like `_.curry` except that arguments are applied to `func` in the manner of `_.partialRight` instead of `_.partial`. @@ -3596,7 +3608,7 @@ curried(3)(1, _)(2); ### `_.debounce(func, [wait=0], [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7841 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L7913 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package") Creates a function that delays invoking `func` until after `wait` milliseconds have elapsed since the last time it was invoked. The created function comes @@ -3666,7 +3678,7 @@ delete models.todo; ### `_.defer(func, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7972 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8044 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package") Defers invoking the `func` until the current call stack has cleared. Any additional arguments are provided to `func` when it is invoked. @@ -3692,7 +3704,7 @@ _.defer(function(text) { ### `_.delay(func, wait, [args])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L7994 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8066 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package") Invokes `func` after `wait` milliseconds. Any additional arguments are provided to `func` when it is invoked. @@ -3719,7 +3731,7 @@ _.delay(function(text) { ### `_.flow([funcs])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8018 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8090 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package") Creates a function that returns the result of invoking the provided functions with the `this` binding of the created function, where each @@ -3748,7 +3760,7 @@ addSquare(1, 2); ### `_.flowRight([funcs])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8040 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8112 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package") This method is like `_.flow` except that it creates a function that invokes the provided functions from right to left. @@ -3779,7 +3791,7 @@ addSquare(1, 2); ### `_.memoize(func, [resolver])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8093 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8165 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package") Creates a function that memoizes the result of `func`. If `resolver` is provided it determines the cache key for storing the result based on the @@ -3840,7 +3852,7 @@ identity(other); ### `_.negate(predicate)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8132 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8204 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package") Creates a function that negates the result of the predicate `func`. The `func` predicate is invoked with the `this` binding and arguments of the @@ -3868,7 +3880,7 @@ _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven)); ### `_.once(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8158 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8230 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package") Creates a function that is restricted to invoking `func` once. Repeat calls to the function return the value of the first call. The `func` is invoked @@ -3894,7 +3906,7 @@ initialize(); ### `_.partial(func, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8194 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8266 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package") Creates a function that invokes `func` with `partial` arguments prepended to those provided to the new function. This method is like `_.bind` except @@ -3937,7 +3949,7 @@ greetFred('hi'); ### `_.partialRight(func, [partials])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8227 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8299 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package") This method is like `_.partial` except that partially applied arguments are appended to those provided to the new function. @@ -3979,7 +3991,7 @@ sayHelloTo('fred'); ### `_.rearg(func, indexes)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8257 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8329 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package") Creates a function that invokes `func` with arguments arranged according to the specified indexes where the argument value at the first index is @@ -4015,7 +4027,7 @@ map(function(n) { ### `_.restParam(func, [start=func.length-1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8283 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.restparam "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8355 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.restparam "See the npm package") Creates a function that invokes `func` with the `this` binding of the created function and arguments from `start` and beyond provided as an array. @@ -4047,7 +4059,7 @@ say('hello', 'fred', 'barney', 'pebbles'); ### `_.spread(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8343 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8415 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package") Creates a function that invokes `func` with the `this` binding of the created function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). @@ -4088,7 +4100,7 @@ numbers.then(_.spread(function(x, y) { ### `_.throttle(func, [wait=0], [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8391 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8463 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package") Creates a function that only invokes `func` at most once per every `wait` milliseconds. The created function comes with a `cancel` method to cancel @@ -4136,7 +4148,7 @@ jQuery(window).on('popstate', throttled.cancel); ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8431 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8503 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package") Creates a function that provides `value` to the wrapper function as its first argument. Any additional arguments provided to the function are @@ -4172,7 +4184,7 @@ p('fred, barney, & pebbles'); ### `_.clone(value, [isDeep], [customizer], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8489 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8561 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package") Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, otherwise they are assigned by reference. If `customizer` is provided it is @@ -4233,7 +4245,7 @@ el.childNodes.length; ### `_.cloneDeep(value, [customizer], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8547 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8619 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package") Creates a deep clone of `value`. If `customizer` is provided it is invoked to produce the cloned values. If `customizer` returns `undefined` cloning @@ -4288,7 +4300,7 @@ el.childNodes.length; ### `_.isArguments(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8568 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8640 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package") Checks if `value` is classified as an `arguments` object. @@ -4313,7 +4325,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8597 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8667 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package") Checks if `value` is classified as an `Array` object. @@ -4338,7 +4350,7 @@ _.isArray(function() { return arguments; }()); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8617 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package") Checks if `value` is classified as a boolean primitive or object. @@ -4363,7 +4375,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8637 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8707 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package") Checks if `value` is classified as a `Date` object. @@ -4388,7 +4400,7 @@ _.isDate('Mon April 23 2012'); ### `_.isElement(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8657 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8727 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package") Checks if `value` is a DOM element. @@ -4413,7 +4425,7 @@ _.isElement(''); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8695 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8765 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package") Checks if `value` is empty. A value is considered empty unless it is an `arguments` object, array, string, or jQuery-like collection with a length @@ -4449,7 +4461,7 @@ _.isEmpty({ 'a': 1 }); ### `_.isEqual(value, other, [customizer], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8750 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8819 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package") Performs a deep comparison between two values to determine if they are equivalent. If `customizer` is provided it is invoked to compare values. @@ -4502,7 +4514,7 @@ _.isEqual(array, other, function(value, other) { ### `_.isError(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8776 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8845 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package") Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError`, or `URIError` object. @@ -4528,7 +4540,7 @@ _.isError(Error); ### `_.isFinite(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8807 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8876 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package") Checks if `value` is a finite primitive number.
@@ -4565,7 +4577,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8827 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8896 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package") Checks if `value` is classified as a `Function` object. @@ -4590,7 +4602,7 @@ _.isFunction(/abc/); ### `_.isMatch(object, source, [customizer], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8900 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8969 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package") Performs a deep comparison between `object` and `source` to determine if `object` contains equivalent property values. If `customizer` is provided @@ -4639,7 +4651,7 @@ _.isMatch(object, source, function(value, other) { ### `_.isNaN(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8955 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9024 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package") Checks if `value` is `NaN`.
@@ -4674,7 +4686,7 @@ _.isNaN(undefined); ### `_.isNative(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8977 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9046 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package") Checks if `value` is a native function. @@ -4699,7 +4711,7 @@ _.isNative(_); ### `_.isNull(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9003 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9072 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package") Checks if `value` is `null`. @@ -4724,7 +4736,7 @@ _.isNull(void 0); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9029 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9098 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package") Checks if `value` is classified as a `Number` primitive or object.
@@ -4756,7 +4768,7 @@ _.isNumber('8.4'); ### `_.isObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L8854 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L8923 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package") 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('')`) @@ -4785,7 +4797,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9063 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9132 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package") Checks if `value` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`. @@ -4825,7 +4837,7 @@ _.isPlainObject(Object.create(null)); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9091 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9160 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package") Checks if `value` is classified as a `RegExp` object. @@ -4850,7 +4862,7 @@ _.isRegExp('/abc/'); ### `_.isString(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9111 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9180 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package") Checks if `value` is classified as a `String` primitive or object. @@ -4875,7 +4887,7 @@ _.isString(1); ### `_.isTypedArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9131 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9200 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package") Checks if `value` is classified as a typed array. @@ -4900,7 +4912,7 @@ _.isTypedArray([]); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9151 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9220 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package") Checks if `value` is `undefined`. @@ -4925,7 +4937,7 @@ _.isUndefined(null); ### `_.toArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9170 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9239 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package") Converts `value` to an array. @@ -4949,7 +4961,7 @@ Converts `value` to an array. ### `_.toPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9206 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9275 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package") Converts `value` to a plain object flattening inherited enumerable properties of `value` to own properties of the plain object. @@ -4987,7 +4999,7 @@ _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); ### `_.add(augend, addend)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11712 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11786 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package") Adds two numbers. @@ -5010,7 +5022,7 @@ _.add(6, 4); ### `_.max(collection, [iteratee], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11763 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11837 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package") Gets the maximum value of `collection`. If `collection` is empty or falsey `-Infinity` is returned. If an iteratee function is provided it is invoked @@ -5069,7 +5081,7 @@ _.max(users, 'age'); ### `_.min(collection, [iteratee], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11812 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11886 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package") Gets the minimum value of `collection`. If `collection` is empty or falsey `Infinity` is returned. If an iteratee function is provided it is invoked @@ -5128,7 +5140,7 @@ _.min(users, 'age'); ### `_.sum(collection, [iteratee], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11846 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11920 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package") Gets the sum of the values in `collection`. @@ -5175,7 +5187,7 @@ _.sum(objects, 'n'); ### `_.inRange(n, [start=0], end)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10220 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10294 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package") Checks if `n` is between `start` and up to but not including, `end`. If `end` is not specified it is set to `start` with `start` then set to `0`. @@ -5215,7 +5227,7 @@ _.inRange(5.2, 4); ### `_.random([min=0], [max=1], [floating])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10258 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10332 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package") Produces a random number between `min` and `max` (inclusive). If only one argument is provided a number between `0` and the given number is returned. @@ -5257,7 +5269,7 @@ _.random(1.2, 5.2); ### `_.assign(object, [sources], [customizer], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9245 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9313 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package") Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources overwrite property assignments of previous sources. @@ -5301,7 +5313,7 @@ defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); ### `_.create(prototype, [properties])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9285 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9353 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package") Creates an object that inherits from the given `prototype` object. If a `properties` object is provided its own enumerable properties are assigned @@ -5343,7 +5355,7 @@ circle instanceof Shape; ### `_.defaults(object, [sources])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9311 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9379 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package") Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a @@ -5371,7 +5383,7 @@ _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); ### `_.findKey(object, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9368 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9436 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package") This method is like `_.find` except that it returns the key of the first element `predicate` returns truthy for instead of the element itself. @@ -5430,7 +5442,7 @@ _.findKey(users, 'active'); ### `_.findLastKey(object, [predicate=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9418 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9486 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package") This method is like `_.findKey` except that it iterates over elements of a collection in the opposite order. @@ -5489,7 +5501,7 @@ _.findLastKey(users, 'active'); ### `_.forIn(object, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9447 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9515 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package") Iterates over own and inherited enumerable properties of an object invoking `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked @@ -5525,7 +5537,7 @@ _.forIn(new Foo, function(value, key) { ### `_.forInRight(object, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9474 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9542 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package") This method is like `_.forIn` except that it iterates over properties of `object` in the opposite order. @@ -5559,7 +5571,7 @@ _.forInRight(new Foo, function(value, key) { ### `_.forOwn(object, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9503 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package") Iterates over own enumerable properties of an object invoking `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked with @@ -5595,7 +5607,7 @@ _.forOwn(new Foo, function(value, key) { ### `_.forOwnRight(object, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9530 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9598 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package") This method is like `_.forOwn` except that it iterates over properties of `object` in the opposite order. @@ -5629,7 +5641,7 @@ _.forOwnRight(new Foo, function(value, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9547 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9615 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package") Creates an array of function property names from all enumerable properties, own and inherited, of `object`. @@ -5655,7 +5667,7 @@ _.functions(_); ### `_.get(object, path, [defaultValue])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9575 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9643 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package") Gets the property value of `path` on `object`. If the resolved value is `undefined` the `defaultValue` is used in its place. @@ -5688,7 +5700,7 @@ _.get(object, 'a.b.c', 'default'); ### `_.has(object, path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9602 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9670 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package") Checks if `path` is a direct property. @@ -5719,7 +5731,7 @@ _.has(object, ['a', 'b', 'c']); ### `_.invert(object, [multiValue])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9639 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9707 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package") Creates an object composed of the inverted keys and values of `object`. If `object` contains duplicate values, subsequent values overwrite property @@ -5750,7 +5762,7 @@ _.invert(object, true); ### `_.keys(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9693 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9761 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package") Creates an array of the own enumerable property names of `object`.
@@ -5787,7 +5799,7 @@ _.keys('hi'); ### `_.keysIn(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9727 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9792 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package") Creates an array of the own and inherited enumerable property names of `object`.
@@ -5818,8 +5830,36 @@ _.keysIn(new Foo); +### `_.mapKeys(object, [iteratee=_.identity], [thisArg])` +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9870 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package") + +The opposite of `_.mapValues`; this method creates an object with the +same values as `object` and keys generated by running each own enumerable +property of `object` through `iteratee`. + +#### Arguments +1. `object` *(Object)*: The object to iterate over. +2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. +3. `[thisArg]` *(*)*: The `this` binding of `iteratee`. + +#### Returns +*(Object)*: Returns the new mapped object. + +#### Example +```js +_.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + return key + value; +}); +// => { 'a1': 1, 'b2': 2 } +``` +* * * + + + + + ### `_.mapValues(object, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9826 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9913 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package") Creates an object with the same keys as `object` and values generated by running each own enumerable property of `object` through `iteratee`. The @@ -5871,7 +5911,7 @@ _.mapValues(users, 'age'); ### `_.merge(object, [sources], [customizer], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9884 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9963 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package") Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined` into the destination object. Subsequent sources @@ -5928,15 +5968,10 @@ _.merge(object, other, function(a, b) { ### `_.omit(object, [predicate], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9914 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L9988 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package") The opposite of `_.pick`; this method creates an object composed of the own and inherited enumerable properties of `object` that are not omitted. -Property names may be specified as individual arguments or as arrays of -property names. If `predicate` is provided it is invoked for each property -of `object` omitting the properties `predicate` returns truthy for. The -predicate is bound to `thisArg` and invoked with three arguments:
-(value, key, object). #### Arguments 1. `object` *(Object)*: The source object. @@ -5963,7 +5998,7 @@ _.omit(object, _.isNumber); ### `_.pairs(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9942 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pairs "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10016 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pairs "See the npm package") Creates a two dimensional array of the key-value pairs for `object`, e.g. `[[key1, value1], [key2, value2]]`. @@ -5986,7 +6021,7 @@ _.pairs({ 'barney': 36, 'fred': 40 }); ### `_.pick(object, [predicate], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L9981 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10055 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package") Creates an object composed of the picked `object` properties. Property names may be specified as individual arguments or as arrays of property @@ -6019,7 +6054,7 @@ _.pick(object, _.isString); ### `_.result(object, path, [defaultValue])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10018 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10092 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package") This method is like `_.get` except that if the resolved value is a function it is invoked with the `this` binding of its parent object and its result @@ -6056,7 +6091,7 @@ _.result(object, 'a.b.c', _.constant('default')); ### `_.set(object, path, value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10054 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10128 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package") Sets the property value of `path` on `object`. If a portion of `path` does not exist it is created. @@ -6088,7 +6123,7 @@ console.log(object.x[0].y.z); ### `_.transform(object, [iteratee=_.identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10109 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10183 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package") An alternative to `_.reduce`; this method transforms `object` to a new `accumulator` object which is the result of running each of its own enumerable @@ -6126,7 +6161,7 @@ _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) { ### `_.values(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10156 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10230 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package") Creates an array of the own enumerable property values of `object`.
@@ -6161,7 +6196,7 @@ _.values('hi'); ### `_.valuesIn(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10183 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10257 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package") Creates an array of the own and inherited enumerable property values of `object`. @@ -6200,7 +6235,7 @@ _.valuesIn(new Foo); ### `_.camelCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10314 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10388 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package") Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). @@ -6228,7 +6263,7 @@ _.camelCase('__foo_bar__'); ### `_.capitalize([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10332 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10406 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package") Capitalizes the first character of `string`. @@ -6250,7 +6285,7 @@ _.capitalize('fred'); ### `_.deburr([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10351 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10425 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package") Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). @@ -6273,7 +6308,7 @@ _.deburr('déjà vu'); ### `_.endsWith([string=''], [target], [position=string.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10377 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10451 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package") Checks if `string` ends with the given target string. @@ -6303,7 +6338,7 @@ _.endsWith('abc', 'b', 2); ### `_.escape([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10422 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10496 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package") Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to their corresponding HTML entities. @@ -6348,7 +6383,7 @@ _.escape('fred, barney, & pebbles'); ### `_.escapeRegExp([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10444 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10518 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package") Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. @@ -6371,7 +6406,7 @@ _.escapeRegExp('[lodash](https://lodash.com/)'); ### `_.kebabCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10470 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10544 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package") Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). @@ -6399,7 +6434,7 @@ _.kebabCase('__foo_bar__'); ### `_.pad([string=''], [length=0], [chars=' '])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10496 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10570 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package") Pads `string` on the left and right sides if it is shorter than `length`. Padding characters are truncated if they can't be evenly divided by `length`. @@ -6430,7 +6465,7 @@ _.pad('abc', 3); ### `_.padLeft([string=''], [length=0], [chars=' '])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10534 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padleft "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10608 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padleft "See the npm package") Pads `string` on the left side if it is shorter than `length`. Padding characters are truncated if they exceed `length`. @@ -6461,7 +6496,7 @@ _.padLeft('abc', 3); ### `_.padRight([string=''], [length=0], [chars=' '])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10558 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10632 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padright "See the npm package") Pads `string` on the right side if it is shorter than `length`. Padding characters are truncated if they exceed `length`. @@ -6492,7 +6527,7 @@ _.padRight('abc', 3); ### `_.parseInt(string, [radix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10583 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10657 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package") Converts `string` to an integer of the specified radix. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal, @@ -6524,7 +6559,7 @@ _.map(['6', '08', '10'], _.parseInt); ### `_.repeat([string=''], [n=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10625 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10699 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package") Repeats the given string `n` times. @@ -6553,7 +6588,7 @@ _.repeat('abc', 0); ### `_.snakeCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10664 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10738 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package") Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). @@ -6581,7 +6616,7 @@ _.snakeCase('--foo-bar'); ### `_.startCase([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10761 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package") Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). @@ -6609,7 +6644,7 @@ _.startCase('__foo_bar__'); ### `_.startsWith([string=''], [target], [position=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10712 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10786 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package") Checks if `string` starts with the given target string. @@ -6639,7 +6674,7 @@ _.startsWith('abc', 'b', 1); ### `_.template([string=''], [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10817 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L10891 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package") Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, HTML-escape interpolated data properties in @@ -6746,7 +6781,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.trim([string=''], [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10944 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11018 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package") Removes leading and trailing whitespace or specified characters from `string`. @@ -6775,7 +6810,7 @@ _.map([' foo ', ' bar '], _.trim); ### `_.trimLeft([string=''], [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L10975 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimleft "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11049 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimleft "See the npm package") Removes leading whitespace or specified characters from `string`. @@ -6801,7 +6836,7 @@ _.trimLeft('-_-abc-_-', '_-'); ### `_.trimRight([string=''], [chars=whitespace])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11005 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimright "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11079 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimright "See the npm package") Removes trailing whitespace or specified characters from `string`. @@ -6827,7 +6862,7 @@ _.trimRight('-_-abc-_-', '_-'); ### `_.trunc([string=''], [options], [options.length=30], [options.omission='...'], [options.separator])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11057 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trunc "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11131 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trunc "See the npm package") Truncates `string` if it is longer than the given maximum string length. The last characters of the truncated string are replaced with the omission @@ -6875,7 +6910,7 @@ _.trunc('hi-diddly-ho there, neighborino', { ### `_.unescape([string=''])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11127 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11201 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package") The inverse of `_.escape`; this method converts the HTML entities `&`, `<`, `>`, `"`, `'`, and ``` in `string` to their @@ -6903,7 +6938,7 @@ _.unescape('fred, barney, & pebbles'); ### `_.words([string=''], [pattern])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11152 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11226 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package") Splits `string` into an array of its words. @@ -6935,7 +6970,7 @@ _.words('fred, barney, & pebbles', /[^, ]+/g); ### `_.attempt(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11182 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11256 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package") Attempts to invoke `func`, returning either the result or the caught error object. Any additional arguments are provided to `func` when it is invoked. @@ -6964,7 +6999,7 @@ if (_.isError(elements)) { ### `_.callback([func=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11228 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.callback "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11302 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.callback "See the npm package") Creates a function that invokes `func` with the `this` binding of `thisArg` and arguments of the created function. If `func` is a property name the @@ -7012,7 +7047,7 @@ _.filter(users, 'age__gt36'); ### `_.constant(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11253 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11327 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package") Creates a function that returns `value`. @@ -7037,7 +7072,7 @@ getter() === object; ### `_.identity(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11274 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11348 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package") This method returns the first argument provided to it. @@ -7061,7 +7096,7 @@ _.identity(object) === object; ### `_.matches(source)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11303 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11377 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package") Creates a function which performs a deep comparison between a given object and `source`, returning `true` if the given object has equivalent property @@ -7096,7 +7131,7 @@ _.filter(users, _.matches({ 'age': 40, 'active': false })); ### `_.matchesProperty(path, value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11331 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11405 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package") Creates a function which compares the property value of `path` on a given object to `value`. @@ -7130,7 +7165,7 @@ _.find(users, _.matchesProperty('user', 'fred')); ### `_.method(path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11356 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11430 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package") Creates a function which invokes the method at `path` on a given object. @@ -7160,7 +7195,7 @@ _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); ### `_.methodOf(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11382 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11456 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package") The opposite of `_.method`; this method creates a function which invokes the method at a given path on `object`. @@ -7189,7 +7224,7 @@ _.map([['a', '2'], ['c', '0']], _.methodOf(object)); ### `_.mixin([object=lodash], source, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11427 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11501 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package") Adds all own enumerable function properties of a source object to the destination object. If `object` is a function then methods are added to @@ -7237,7 +7272,7 @@ _('fred').vowels(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11492 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11566 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package") Reverts the `_` variable to its previous value and returns a reference to the `lodash` function. @@ -7256,7 +7291,7 @@ var lodash = _.noConflict(); ### `_.noop()` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11511 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11585 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package") A no-operation function which returns `undefined` regardless of the arguments it receives. @@ -7275,7 +7310,7 @@ _.noop(object) === undefined; ### `_.property(path)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11537 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11611 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package") Creates a function which returns the property value at `path` on a given object. @@ -7306,7 +7341,7 @@ _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); ### `_.propertyOf(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11561 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11635 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package") The opposite of `_.property`; this method creates a function which returns the property value at a given path on `object`. @@ -7335,7 +7370,7 @@ _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); ### `_.range([start=0], end, [step=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11600 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11674 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package") Creates an array of numbers (positive and/or negative) progressing from `start` up to, but not including, `end`. If `end` is not specified it is @@ -7377,7 +7412,7 @@ _.range(0); ### `_.runInContext([context=root])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L718 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L717 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package") Create a new pristine `lodash` function using the given `context` object. @@ -7421,7 +7456,7 @@ var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; ### `_.times(n, [iteratee=_.identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11653 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11727 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package") Invokes the iteratee function `n` times, returning an array of the results of each invocation. The `iteratee` is bound to `thisArg` and invoked with @@ -7457,7 +7492,7 @@ _.times(3, function(n) { ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L11691 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L11765 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package") Generates a unique ID. If `prefix` is provided the ID is appended to it. @@ -7488,7 +7523,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1225 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1232 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -7505,7 +7540,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L12136 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L12213 "View in source") [Ⓣ][1] (string): The semantic version number. @@ -7516,7 +7551,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1016 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.support "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1022 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.support "See the npm package") (Object): An object environment feature flags. @@ -7527,7 +7562,7 @@ A reference to the `lodash` function. ### `_.support.argsTag` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1040 "View in source") [Ⓣ][1] (boolean): Detect if the `toStringTag` of `arguments` objects is resolvable (all but Firefox < 4, IE < 9). @@ -7539,7 +7574,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1042 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1049 "View in source") [Ⓣ][1] (boolean): Detect if `name` or `message` properties of `Error.prototype` are enumerable by default (IE < 9, Safari < 5.1). @@ -7551,7 +7586,7 @@ enumerable by default (IE < 9, Safari < 5.1). ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1056 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1063 "View in source") [Ⓣ][1] (boolean): Detect if `prototype` properties are enumerable by default.
@@ -7568,7 +7603,7 @@ property to `true`. ### `_.support.funcDecomp` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1066 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1073 "View in source") [Ⓣ][1] (boolean): Detect if functions can be decompiled by `Function#toString` (all but Firefox OS certified apps, older Opera mobile browsers, and @@ -7581,7 +7616,7 @@ the PlayStation 3; forced `false` for Windows 8 apps). ### `_.support.funcNames` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1074 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1081 "View in source") [Ⓣ][1] (boolean): Detect if `Function#name` is supported (all but IE). @@ -7592,7 +7627,7 @@ the PlayStation 3; forced `false` for Windows 8 apps). ### `_.support.nodeTag` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1082 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1089 "View in source") [Ⓣ][1] (boolean): Detect if the `toStringTag` of DOM nodes is resolvable (all but IE < 9). @@ -7603,7 +7638,7 @@ the PlayStation 3; forced `false` for Windows 8 apps). ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1101 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1108 "View in source") [Ⓣ][1] (boolean): Detect if properties shadowing those on `Object.prototype` are non-enumerable.
@@ -7618,7 +7653,7 @@ are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug). ### `_.support.nonEnumStrings` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1090 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1097 "View in source") [Ⓣ][1] (boolean): Detect if string indexes are non-enumerable (IE < 9, RingoJS, Rhino, Narwhal). @@ -7629,7 +7664,7 @@ are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug). ### `_.support.ownLast` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1109 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1116 "View in source") [Ⓣ][1] (boolean): Detect if own properties are iterated after inherited properties (IE < 9). @@ -7640,7 +7675,7 @@ are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug). ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1124 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1131 "View in source") [Ⓣ][1] (boolean): Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -7659,7 +7694,7 @@ while `splice()` is buggy regardless of mode in IE < 9. ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1135 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1142 "View in source") [Ⓣ][1] (boolean): Detect lack of support for accessing string characters by index.
@@ -7674,7 +7709,7 @@ by index on string literals, not string objects. ### `_.templateSettings` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1177 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package") +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1184 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package") (Object): By default, the template delimiters used by lodash are like those in embedded Ruby (ERB). Change the following template settings to use @@ -7687,7 +7722,7 @@ alternative delimiters. ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1185 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1192 "View in source") [Ⓣ][1] (RegExp): Used to detect `data` property values to be HTML-escaped. @@ -7698,7 +7733,7 @@ alternative delimiters. ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1193 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1200 "View in source") [Ⓣ][1] (RegExp): Used to detect code to be evaluated. @@ -7709,7 +7744,7 @@ alternative delimiters. ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1217 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1224 "View in source") [Ⓣ][1] (Object): Used to import variables into the compiled template. @@ -7720,7 +7755,7 @@ alternative delimiters. ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1201 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1208 "View in source") [Ⓣ][1] (RegExp): Used to detect `data` property values to inject. @@ -7731,7 +7766,7 @@ alternative delimiters. ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/lodash/lodash/blob/3.7.0/lodash.src.js#L1209 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/3.8.0/lodash.src.js#L1216 "View in source") [Ⓣ][1] (string): Used to reference the data object in the template text. diff --git a/lodash.js b/lodash.js index 02b4118a18..4008530fe3 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * lodash 3.7.0 (Custom Build) + * lodash 3.8.0 (Custom Build) * Build: `lodash modern -o ./lodash.js` * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '3.7.0'; + var VERSION = '3.8.0'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -88,7 +88,7 @@ reInterpolate = /<%=([\s\S]+?)%>/g; /** Used to match property names within property paths. */ - var reIsDeepProp = /\.|\[(?:[^[\]]+|(["'])(?:(?!\1)[^\n\\]|\\.)*?)\1\]/, + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; @@ -280,8 +280,6 @@ */ var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this; - /*--------------------------------------------------------------------------*/ - /** * The base implementation of `compareAscending` which compares values and * sorts them in ascending order without guaranteeing a stable sort. @@ -652,8 +650,6 @@ return htmlUnescapes[chr]; } - /*--------------------------------------------------------------------------*/ - /** * Create a new pristine `lodash` function using the given `context` object. * @@ -749,7 +745,7 @@ getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, push = arrayProto.push, - preventExtensions = isNative(Object.preventExtensions = Object.preventExtensions) && preventExtensions, + preventExtensions = isNative(preventExtensions = Object.preventExtensions) && preventExtensions, propertyIsEnumerable = objectProto.propertyIsEnumerable, Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, @@ -777,12 +773,19 @@ // // 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; + // to assign values to readonly indexes of strings. + var func = preventExtensions && isNative(func = Object.assign) && func; + try { + if (func) { + var object = preventExtensions({ '1': 0 }); + object[0] = 1; + } + } catch(e) { + // Only attempt in strict mode. + try { func(object, 'xo'); } catch(e) {} + return !object[1] && func; + } + return false; }()); /* Native method references for those with the same name as other `lodash` methods. */ @@ -803,7 +806,7 @@ /** Used as references for the maximum length and index of an array. */ var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; /** Used as the size, in bytes, of each `Float64Array` element. */ @@ -821,8 +824,6 @@ /** Used to lookup unminified function names. */ var realNames = {}; - /*------------------------------------------------------------------------*/ - /** * Creates a `lodash` object which wraps `value` to enable implicit chaining. * Methods that operate on and return arrays, collections, and functions can @@ -962,6 +963,7 @@ (function(x) { var Ctor = function() { this.x = x; }, + args = arguments, object = { '0': x, 'length': x }, props = []; @@ -1011,7 +1013,7 @@ * @type boolean */ try { - support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1); + support.nonEnumArgs = !propertyIsEnumerable.call(args, 1); } catch(e) { support.nonEnumArgs = true; } @@ -1078,8 +1080,6 @@ } }; - /*------------------------------------------------------------------------*/ - /** * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. * @@ -1208,8 +1208,6 @@ return result; } - /*------------------------------------------------------------------------*/ - /** * Creates a cache object to store key/value pairs. * @@ -1278,8 +1276,6 @@ return this; } - /*------------------------------------------------------------------------*/ - /** * * Creates a cache object to store unique values. @@ -1329,8 +1325,6 @@ } } - /*------------------------------------------------------------------------*/ - /** * Copies the values of `source` to `array`. * @@ -1674,8 +1668,9 @@ */ function baseAt(collection, props) { var index = -1, - length = collection.length, - isArr = isLength(length), + isNil = collection == null, + isArr = !isNil && isArrayLike(collection), + length = isArr && collection.length, propsLength = props.length, result = Array(propsLength); @@ -1684,7 +1679,7 @@ if (isArr) { result[index] = isIndex(key, length) ? collection[key] : undefined; } else { - result[index] = collection[key]; + result[index] = isNil ? undefined : collection[key]; } } return result; @@ -2011,8 +2006,8 @@ * * @private * @param {Array} array The array to flatten. - * @param {boolean} isDeep Specify a deep flatten. - * @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isDeep, isStrict) { @@ -2023,8 +2018,8 @@ while (++index < length) { var value = array[index]; - - if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). value = baseFlatten(value, isDeep, isStrict); @@ -2032,7 +2027,6 @@ var valIndex = -1, valLength = value.length; - result.length += valLength; while (++valIndex < valLength) { result[++resIndex] = value[valIndex]; } @@ -2153,9 +2147,9 @@ length = path.length; while (object != null && ++index < length) { - var result = object = object[path[index]]; + object = object[path[index]]; } - return result; + return (index && index == length) ? object : undefined; } /** @@ -2174,8 +2168,7 @@ function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { // Exit early for identical values. if (value === other) { - // Treat `+0` vs. `-0` as not equal. - return value !== 0 || (1 / value == 1 / other); + return true; } var valType = typeof value, othType = typeof other; @@ -2324,8 +2317,7 @@ */ function baseMap(collection, iteratee) { var index = -1, - length = getLength(collection), - result = isLength(length) ? Array(length) : []; + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); @@ -2424,7 +2416,7 @@ if (!isObject(object)) { return object; } - var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); + var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)); if (!isSrcArr) { var props = keys(source); push.apply(props, getSymbols(source)); @@ -2487,10 +2479,10 @@ if (isCommon) { result = srcValue; - if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { + if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { result = isArray(value) ? value - : (getLength(value) ? arrayCopy(value) : []); + : (isArrayLike(value) ? arrayCopy(value) : []); } else if (isPlainObject(srcValue) || isArguments(srcValue)) { result = isArguments(value) @@ -2552,7 +2544,7 @@ * @returns {Array} Returns `array`. */ function basePullAt(array, indexes) { - var length = indexes.length; + var length = array ? indexes.length : 0; while (length--) { var index = parseFloat(indexes[length]); if (index != previous && isIndex(index)) { @@ -3038,12 +3030,12 @@ while (++argsIndex < argsLength) { result[argsIndex] = args[argsIndex]; } - var pad = argsIndex; + var offset = argsIndex; while (++rightIndex < rightLength) { - result[pad + rightIndex] = partials[rightIndex]; + result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { - result[pad + holders[holdersIndex]] = args[argsIndex++]; + result[offset + holders[holdersIndex]] = args[argsIndex++]; } return result; } @@ -3311,7 +3303,7 @@ return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, eachFunc); - } + }; } /** @@ -3377,7 +3369,7 @@ funcName = getFuncName(func); var data = funcName == 'wrapper' ? getData(func) : null; - if (data && isLaziable(data[0])) { + if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); @@ -3447,6 +3439,28 @@ }; } + /** + * Creates a function for `_.mapKeys` or `_.mapValues`. + * + * @private + * @param {boolean} [isMapKeys] Specify mapping keys instead of values. + * @returns {Function} Returns the new map function. + */ + function createObjectMapper(isMapKeys) { + return function(object, iteratee, thisArg) { + var result = {}; + iteratee = getCallback(iteratee, thisArg, 3); + + baseForOwn(object, function(value, key, object) { + var mapped = iteratee(value, key, object); + key = isMapKeys ? mapped : key; + value = isMapKeys ? value : mapped; + result[key] = value; + }); + return result; + }; + } + /** * Creates a function for `_.padLeft` or `_.padRight`. * @@ -3457,7 +3471,7 @@ function createPadDir(fromRight) { return function(string, length, chars) { string = baseToString(string); - return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string)); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); }; } @@ -3803,8 +3817,7 @@ // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other - // But, treat `-0` vs. `+0` as not equal. - : (object == 0 ? ((1 / object) == (1 / other)) : object == +other); + : object == +other; case regexpTag: case stringTag: @@ -3984,7 +3997,7 @@ * 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. + * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. @@ -4123,6 +4136,17 @@ return func == null ? undefined : func.apply(object, args); } + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + /** * Checks if `value` is a valid array-like index. * @@ -4151,13 +4175,9 @@ return false; } var type = typeof index; - if (type == 'number') { - var length = getLength(object), - prereq = isLength(length) && isIndex(index, length); - } else { - prereq = type == 'string' && index in object; - } - if (prereq) { + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { var other = object[index]; return value === value ? (value === other) : (other !== other); } @@ -4218,7 +4238,7 @@ * equality comparisons, else `false`. */ function isStrictComparable(value) { - return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value)); + return value === value && !isObject(value); } /** @@ -4292,7 +4312,7 @@ } /** - * A specialized version of `_.pick` that picks `object` properties specified + * A specialized version of `_.pick` which picks `object` properties specified * by `props`. * * @private @@ -4317,7 +4337,7 @@ } /** - * A specialized version of `_.pick` that picks `object` properties `predicate` + * A specialized version of `_.pick` which picks `object` properties `predicate` * returns truthy for. * * @private @@ -4462,7 +4482,7 @@ if (value == null) { return []; } - if (!isLength(getLength(value))) { + if (!isArrayLike(value)) { return values(value); } return isObject(value) ? value : Object(value); @@ -4510,8 +4530,6 @@ : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); } - /*------------------------------------------------------------------------*/ - /** * Creates an array of elements split into groups the length of `size`. * If `collection` can't be split evenly, the final chunk will be the remaining @@ -4580,11 +4598,8 @@ /** * Creates an array excluding all values of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -4598,7 +4613,7 @@ * // => [1, 3] */ var difference = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, baseFlatten(values, false, true)) : []; }); @@ -4993,13 +5008,10 @@ /** * Gets the index at which the first occurrence of `value` is found in `array` - * using `SameValueZero` for equality comparisons. If `fromIndex` is negative, - * it is used as the offset from the end of `array`. If `array` is sorted - * providing `true` for `fromIndex` performs a faster binary search. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. * * @static * @memberOf _ @@ -5059,13 +5071,10 @@ } /** - * Creates an array of unique values in all provided arrays using `SameValueZero` + * Creates an array of unique values in all provided arrays using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * for equality comparisons. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @category Array @@ -5086,7 +5095,7 @@ while (++argsIndex < argsLength) { var value = arguments[argsIndex]; - if (isArray(value) || isArguments(value)) { + if (isArrayLike(value)) { args.push(value); caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); } @@ -5191,14 +5200,11 @@ } /** - * Removes all provided values from `array` using `SameValueZero` for equality - * comparisons. + * Removes all provided values from `array` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * - * **Notes:** - * - Unlike `_.without`, this method mutates `array` - * - [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except - * that `NaN` matches `NaN` + * **Note:** Unlike `_.without`, this method mutates `array`. * * @static * @memberOf _ @@ -5262,7 +5268,6 @@ * // => [10, 20] */ var pullAt = restParam(function(array, indexes) { - array || (array = []); indexes = baseFlatten(indexes); var result = baseAt(array, indexes); @@ -5629,11 +5634,8 @@ /** * Creates an array of unique values, in order, of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -5650,8 +5652,9 @@ }); /** - * Creates a duplicate-free version of an array, using `SameValueZero` for - * equality comparisons, in which only the first occurence of each element + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons, in which only the first occurence of each element * is kept. Providing `true` for `isSorted` performs a faster search algorithm * for sorted arrays. If an iteratee function is provided it is invoked for * each element in the array to generate the criterion by which uniqueness @@ -5669,10 +5672,6 @@ * callback returns `true` for elements that have the properties of the given * object, else `false`. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @alias unique @@ -5722,7 +5721,7 @@ /** * 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` + * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static @@ -5739,10 +5738,19 @@ * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { + if (!(array && array.length)) { + return []; + } var index = -1, - length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, - result = Array(length); + length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLike(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + var result = Array(length); while (++index < length) { result[index] = arrayMap(array, baseProperty(index)); } @@ -5750,12 +5758,44 @@ } /** - * Creates an array excluding all provided values using `SameValueZero` for - * equality comparisons. + * This method is like `_.unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee] The function to combine regrouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of regrouped elements. + * @example * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(result, function(group) { + return arrayReduce(group, iteratee, undefined, true); + }); + } + + /** + * Creates an array excluding all provided values using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -5769,7 +5809,7 @@ * // => [3] */ var without = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, values) : []; }); @@ -5794,7 +5834,7 @@ while (++index < length) { var array = arguments[index]; - if (isArray(array) || isArguments(array)) { + if (isArrayLike(array)) { var result = result ? baseDifference(result, array).concat(baseDifference(array, result)) : array; @@ -5860,7 +5900,37 @@ return result; } - /*------------------------------------------------------------------------*/ + /** + * This method is like `_.zip` except that it accepts an iteratee to specify + * how grouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], _.add); + * // => [111, 222] + */ + var zipWith = restParam(function(arrays) { + var length = arrays.length, + iteratee = arrays[length - 2], + thisArg = arrays[length - 1]; + + if (length > 2 && typeof iteratee == 'function') { + length -= 2; + } else { + iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined; + thisArg = undefined; + } + arrays.length = length; + return unzipWith(arrays, iteratee, thisArg); + }); /** * Creates a `lodash` object that wraps `value` with explicit method @@ -6112,8 +6182,6 @@ return baseWrapperValue(this.__wrapped__, this.__actions__); } - /*------------------------------------------------------------------------*/ - /** * Creates an array of elements corresponding to the given keys, or indexes, * of `collection`. Keys may be specified as individual arguments or as arrays @@ -6135,10 +6203,6 @@ * // => ['barney', 'pebbles'] */ var at = restParam(function(collection, props) { - var length = collection ? getLength(collection) : 0; - if (isLength(length)) { - collection = toIterable(collection); - } return baseAt(collection, baseFlatten(props)); }); @@ -6511,13 +6575,10 @@ }); /** - * Checks if `value` is in `collection` using `SameValueZero` for equality - * comparisons. If `fromIndex` is negative, it is used as the offset from - * the end of `collection`. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * Checks if `value` is in `collection` using + * [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `collection`. * * @static * @memberOf _ @@ -6637,8 +6698,7 @@ var index = -1, isFunc = typeof path == 'function', isProp = isKey(path), - length = getLength(collection), - result = isLength(length) ? Array(length) : []; + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { var func = isFunc ? path : (isProp && value != null && value[path]); @@ -6667,10 +6727,11 @@ * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: - * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, - * `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, - * `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, - * `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` * * @static * @memberOf _ @@ -6858,23 +6919,12 @@ * }, []); * // => [4, 5, 2, 3, 0, 1] */ - var reduceRight = createReduce(arrayReduceRight, baseEachRight); + var reduceRight = createReduce(arrayReduceRight, baseEachRight); /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * - * If a property name is provided for `predicate` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `predicate` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * * @static * @memberOf _ * @category Collection @@ -7253,8 +7303,6 @@ return filter(collection, baseMatches(source)); } - /*------------------------------------------------------------------------*/ - /** * Gets the number of milliseconds that have elapsed since the Unix epoch * (1 January 1970 00:00:00 UTC). @@ -7273,8 +7321,6 @@ return new Date().getTime(); }; - /*------------------------------------------------------------------------*/ - /** * The opposite of `_.before`; this method creates a function that invokes * `func` once it is called `n` or more times. @@ -8254,8 +8300,6 @@ return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); } - /*------------------------------------------------------------------------*/ - /** * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, * otherwise they are assigned by reference. If `customizer` is provided it is @@ -8387,8 +8431,7 @@ * // => false */ function isArguments(value) { - var length = isObjectLike(value) ? value.length : undefined; - return isLength(length) && objToString.call(value) == argsTag; + return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag; } /** @@ -8509,10 +8552,9 @@ if (value == null) { return true; } - var length = getLength(value); - if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) || + if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || (isObjectLike(value) && isFunction(value.splice)))) { - return !length; + return !value.length; } return !keys(value).length; } @@ -8902,7 +8944,7 @@ * // => false */ function isRegExp(value) { - return (isObjectLike(value) && objToString.call(value) == regexpTag) || false; + return isObjectLike(value) && objToString.call(value) == regexpTag; } /** @@ -9018,8 +9060,6 @@ return baseCopy(value, keysIn(value)); } - /*------------------------------------------------------------------------*/ - /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources overwrite property assignments of previous sources. @@ -9030,7 +9070,6 @@ * **Note:** This method mutates `object` and is based on * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). * - * * @static * @memberOf _ * @alias extend @@ -9502,12 +9541,9 @@ * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { - if (object) { - var Ctor = object.constructor, - length = object.length; - } + var Ctor = object != null && object.constructor; if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && isLength(length))) { + (typeof object != 'function' && isArrayLike(object))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; @@ -9564,6 +9600,28 @@ return result; } + /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * property of `object` through `iteratee`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + var mapKeys = createObjectMapper(true); + /** * Creates an object with the same keys as `object` and values generated by * running each own enumerable property of `object` through `iteratee`. The @@ -9605,15 +9663,7 @@ * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ - function mapValues(object, iteratee, thisArg) { - var result = {}; - iteratee = getCallback(iteratee, thisArg, 3); - - baseForOwn(object, function(value, key, object) { - result[key] = iteratee(value, key, object); - }); - return result; - } + var mapValues = createObjectMapper(); /** * Recursively merges own enumerable properties of the source object(s), that @@ -9668,11 +9718,6 @@ /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable properties of `object` that are not omitted. - * Property names may be specified as individual arguments or as arrays of - * property names. If `predicate` is provided it is invoked for each property - * of `object` omitting the properties `predicate` returns truthy for. The - * predicate is bound to `thisArg` and invoked with three arguments: - * (value, key, object). * * @static * @memberOf _ @@ -9966,8 +10011,6 @@ return baseValues(object, keysIn(object)); } - /*------------------------------------------------------------------------*/ - /** * Checks if `n` is between `start` and up to but not including, `end`. If * `end` is not specified it is set to `start` with `start` then set to `0`. @@ -10072,8 +10115,6 @@ return baseRandom(min, max); } - /*------------------------------------------------------------------------*/ - /** * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). * @@ -10939,8 +10980,6 @@ return string.match(pattern || reWords) || []; } - /*------------------------------------------------------------------------*/ - /** * Attempts to invoke `func`, returning either the result or the caught error * object. Any additional arguments are provided to `func` when it is invoked. @@ -11011,7 +11050,9 @@ if (guard && isIterateeCall(func, thisArg, guard)) { thisArg = null; } - return baseCallback(func, thisArg); + return isObjectLike(func) + ? matches(func) + : baseCallback(func, thisArg); } /** @@ -11136,7 +11177,7 @@ var method = restParam(function(path, args) { return function(object) { return invokePath(object, path, args); - } + }; }); /** @@ -11473,8 +11514,6 @@ return baseToString(prefix) + id; } - /*------------------------------------------------------------------------*/ - /** * Adds two numbers. * @@ -11639,8 +11678,6 @@ : baseSum(collection, iteratee); } - /*------------------------------------------------------------------------*/ - // Ensure wrappers are instances of `baseLodash`. lodash.prototype = baseLodash.prototype; @@ -11711,6 +11748,7 @@ lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; + lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; @@ -11759,6 +11797,7 @@ lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; + lodash.unzipWith = unzipWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.where = where; @@ -11767,6 +11806,7 @@ lodash.xor = xor; lodash.zip = zip; lodash.zipObject = zipObject; + lodash.zipWith = zipWith; // Add aliases. lodash.backflow = flowRight; @@ -11785,8 +11825,6 @@ // Add functions to `lodash.prototype`. mixin(lodash, lodash); - /*------------------------------------------------------------------------*/ - // Add functions that return unwrapped values when chaining. lodash.add = add; lodash.attempt = attempt; @@ -11890,8 +11928,6 @@ return source; }()), false); - /*------------------------------------------------------------------------*/ - // Add functions capable of returning wrapped and unwrapped values when chaining. lodash.sample = sample; @@ -11904,8 +11940,6 @@ }); }; - /*------------------------------------------------------------------------*/ - /** * The semantic version number. * @@ -12016,8 +12050,13 @@ LazyWrapper.prototype.slice = function(start, end) { start = start == null ? 0 : (+start || 0); - var result = start < 0 ? this.takeRight(-start) : this.drop(start); + var result = this; + if (start < 0) { + result = this.takeRight(-start); + } else if (start) { + result = this.drop(start); + } if (end !== undefined) { end = (+end || 0); result = end < 0 ? result.dropRight(-end) : result.take(end - start); @@ -12040,7 +12079,6 @@ lodash.prototype[methodName] = function() { var args = arguments, - length = args.length, chainAll = this.__chain__, value = this.__wrapped__, isHybrid = !!this.__actions__.length, @@ -12129,8 +12167,6 @@ return lodash; } - /*--------------------------------------------------------------------------*/ - // Export lodash. var _ = runInContext(); diff --git a/lodash.min.js b/lodash.min.js index 46b088303b..0d0fd3349d 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -1,140 +1,137 @@ /** * @license - * lodash 3.7.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE + * lodash 3.8.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE * Build: `lodash modern -o ./lodash.js` */ ;(function(){function n(n,t){if(n!==t){var r=n===n,e=t===t;if(n>t||!r||n===w&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n); -}function v(n,t){for(var r=-1,e=n.length,u=-1,o=[];++re&&(e=u)}return e}function Hn(n,t){for(var r=-1,e=n.length;++ri(t,a,0)&&u.push(a);return u}function at(n,t){var r=true;return zu(n,function(n,e,u){return r=!!t(n,e,u)}),r}function ct(n,t){var r=[];return zu(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function lt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function st(n,t,r){ +for(var e=-1,u=n.length,o=-1,i=[];++ei(t,a,0)&&u.push(a);return u}function at(n,t){var r=true;return Nu(n,function(n,e,u){return r=!!t(n,e,u)}),r}function ct(n,t){var r=[];return Nu(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function lt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function st(n,t,r){ -for(var e=-1,u=n.length,o=-1,i=[];++et&&(t=-t>u?0:u+t),r=r===w||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0, +r=Ue(u);++eu(a,s,0)&&((t||f)&&a.push(s),c.push(l))}return c}function Ut(n,t){for(var r=-1,e=t.length,u=Ue(e);++r>>1,i=n[o];(r?i<=t:it&&(t=-t>u?0:u+t),r=r===w||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ce(u);++eu(a,s,0)&&((t||f)&&a.push(s),c.push(l))}return c}function Ut(n,t){for(var r=-1,e=t.length,u=Ce(e);++ru?null:o,u=1);++e>>1,i=n[o];(r?i<=t:iu?null:o,u=1);++earguments.length;return typeof e=="function"&&o===w&&To(r)?n(r,e,u,i):Et(r,dr(e,o,4),u,i,t)}}function cr(n,t,r,e,u,o,i,f,a,c){function l(){for(var b=arguments.length,j=b,k=Ue(b);j--;)k[j]=arguments[j];if(e&&(k=Mt(k,e,u)),o&&(k=Dt(k,o,i)),_||y){var j=l.placeholder,O=v(k,j),b=b-O.length;if(barguments.length;return typeof e=="function"&&o===w&&Io(r)?n(r,e,u,i):Et(r,yr(e,o,4),u,i,t)}}function ar(n,t,r,e,u,o,i,f,a,c){function l(){for(var b=arguments.length,j=b,k=Ce(b);j--;)k[j]=arguments[j]; +}if(!p)return false;c||(c="constructor"==s)}return c||(r=n.constructor,e=t.constructor,!(r!=e&&"constructor"in n&&"constructor"in t)||typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)?true:false}function yr(n,t,r){var e=r?Iu:Eu,u=e,o=u;return zu(n,function(n,i,f){i=t(n,i,f),((r?iu)||i===e&&i===o)&&(u=i,o=n)}),o}function dr(n,t,r){var e=$n.callback||Ee,e=e===Ee?ut:e;return r?e(n,t,r):e}function mr(n,t,e){var u=$n.indexOf||Dr,u=u===Dr?r:u;return n?u(n,t,e):u}function wr(n){var t=n.length,r=new n.constructor(t); -if(e&&(k=Mt(k,e,u)),o&&(k=Dt(k,o,i)),_||y){var j=l.placeholder,O=v(k,j),b=b-O.length;if(bt?0:t)):[]}function Br(n,t,r){var e=n?n.length:0;return e?((r?Or(n,t,r):null==t)&&(t=1),t=e-(+t||0),It(n,0,0>t?0:t)):[]}function Mr(n){return n?n[0]:w}function Dr(n,t,e){var u=n?n.length:0;if(!u)return-1;if(typeof e=="number")e=0>e?bu(u+e,0):e;else if(e)return e=$t(n,t),n=n[e],(t===t?t===n:n!==n)?e:-1;return r(n,t,e||0)}function Pr(n){var t=n?n.length:0;return t?n[t-1]:w}function qr(n){return zr(n,1)}function Kr(n,t,e,u){ +if(!n||!n.length)return[];null!=t&&typeof t!="boolean"&&(u=e,e=Or(n,t,u)?null:t,t=false);var o=dr();if((o!==ut||null!=e)&&(e=o(e,u,3)),t&&mr()==r){t=e;var i;e=-1,u=n.length;for(var o=-1,f=[];++er?bu(u+r,0):r||0,typeof n=="string"||!To(n)&&ve(n)?rt?0:+t||0,n.length),n)}function re(n){n=Nr(n);for(var t=-1,r=n.length,e=Ue(r);++t=n&&(t=null),r}}function oe(n,t,r){function e(){var r=t-(wo()-c);0>=r||r>t?(f&&eu(f),r=p,f=s=p=w,r&&(h=wo(),a=n.apply(l,i),s||f||(i=l=null))):s=su(e,r)}function u(){s&&eu(s),f=s=p=w,(v||_!==t)&&(h=wo(),a=n.apply(l,i),s||f||(i=l=null))}function o(){if(i=arguments,c=wo(),l=this,p=v&&(s||!g), +!1===_)var r=g&&!s;else{f||g||(h=c);var o=_-(c-h),y=0>=o||o>_;y?(f&&(f=eu(f)),h=c,a=n.apply(l,i)):f||(f=su(u,o))}return y&&s?s=eu(s):s||t===_||(s=su(e,t)),r&&(y=true,a=n.apply(l,i)),!y||s||f||(i=l=null),a}var i,f,a,c,l,s,p,h=0,_=false,v=true;if(typeof n!="function")throw new Pe(L);if(t=0>t?0:+t||0,true===r)var g=true,v=false;else se(r)&&(g=r.leading,_="maxWait"in r&&bu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&eu(s),f&&eu(f),f=s=p=w},o}function ie(n,t){function r(){var e=arguments,u=r.cache,o=t?t.apply(this,e):e[0]; -}function gr(n,t,r){var e=r?ju:Au,u=e,o=u;return Nu(n,function(n,i,f){i=t(n,i,f),((r?iu)||i===e&&i===o)&&(u=i,o=n)}),o}function yr(n,t,r){var e=$n.callback||je,e=e===je?ut:e;return r?e(n,t,r):e}function dr(n,t,e){var u=$n.indexOf||zr,u=u===zr?r:u;return n?u(n,t,e):u}function mr(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&Ke.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function wr(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=Fe),new n; +return u.has(o)?u.get(o):(e=n.apply(this,e),u.set(o,e),e)}if(typeof n!="function"||t&&typeof t!="function")throw new Pe(L);return r.cache=new ie.Cache,r}function fe(n,t){if(typeof n!="function")throw new Pe(L);return t=bu(t===w?n.length-1:+t||0,0),function(){for(var r=arguments,e=-1,u=bu(r.length-t,0),o=Ue(u);++et?0:t)):[]}function Lr(n,t,r){var e=n?n.length:0;return e?((r?jr(n,t,r):null==t)&&(t=1),t=e-(+t||0),It(n,0,0>t?0:t)):[]; +}}function ae(n){return h(n)&&jr(n)&&Xe.call(n)==B}function ce(n){return!!n&&1===n.nodeType&&h(n)&&-1e?yu(u+e,0):e;else if(e)return e=$t(n,t),n=n[e],(t===t?t===n:n!==n)?e:-1;return r(n,t,e||0)}function Mr(n){var t=n?n.length:0;return t?n[t-1]:w}function Dr(n){return $r(n,1)}function Pr(n,t,e,u){if(!n||!n.length)return[];null!=t&&typeof t!="boolean"&&(u=e,e=jr(n,t,u)?null:t,t=false);var o=yr();if((o!==ut||null!=e)&&(e=o(e,u,3)),t&&dr()==r){t=e;var i;e=-1,u=n.length;for(var o=-1,f=[];++e>>0,e=Ce(r);++tr?yu(u+r,0):r||0,typeof n=="string"||!Io(n)&&pe(n)?rt?0:+t||0,n.length),n)}function Qr(n){n=Tr(n);for(var t=-1,r=n.length,e=Ce(r);++t=n&&(t=null),r}}function re(n,t,r){function e(){var r=t-(_o()-c);0>=r||r>t?(f&&Qe(f),r=p,f=s=p=w,r&&(h=_o(),a=n.apply(l,i),s||f||(i=l=null))):s=fu(e,r)}function u(){ -s&&Qe(s),f=s=p=w,(v||_!==t)&&(h=_o(),a=n.apply(l,i),s||f||(i=l=null))}function o(){if(i=arguments,c=_o(),l=this,p=v&&(s||!g),false===_)var r=g&&!s;else{f||g||(h=c);var o=_-(c-h),y=0>=o||o>_;y?(f&&(f=Qe(f)),h=c,a=n.apply(l,i)):f||(f=fu(u,o))}return y&&s?s=Qe(s):s||t===_||(s=fu(e,t)),r&&(y=true,a=n.apply(l,i)),!y||s||f||(i=l=null),a}var i,f,a,c,l,s,p,h=0,_=false,v=true;if(typeof n!="function")throw new Be(L);if(t=0>t?0:+t||0,true===r)var g=true,v=false;else ae(r)&&(g=r.leading,_="maxWait"in r&&yu(+r.maxWait||0,t),v="trailing"in r?r.trailing:v); +}function ge(n){return h(n)&&Rr(n.length)&&!!Un[Xe.call(n)]}function ye(n){return et(n,me(n))}function de(n){return vt(n,me(n))}function me(n){if(null==n)return[];se(n)||(n=Be(n));for(var t=n.length,t=t&&Rr(t)&&(To(n)||Fu.nonEnumArgs&&ae(n))&&t||0,r=n.constructor,e=-1,r=typeof r=="function"&&r.prototype===n,u=Ue(t),o=0t||!n||!mu(t))return r;do t%2&&(r+=n),t=uu(t/2),n+=n;while(t);return r}function ke(n,t,r){var e=n;return(n=u(n))?(r?Or(e,t,r):null==t)?n.slice(g(n),y(n)+1):(t+="",n.slice(i(n,t),f(n,t)+1)):n}function Oe(n,t,r){return r&&Or(n,t,r)&&(t=null),n=u(n),n.match(t||Wn)||[]}function Ee(n,t,r){return r&&Or(n,t,r)&&(t=null),h(n)?Ce(n):ut(n,t)}function Ie(n){ +return function(){return n}}function Re(n){return n}function Ce(n){return wt(ot(n,true))}function We(n,t,r){if(null==r){var e=se(t),u=e&&Ko(t);((u=u&&u.length&&vt(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=vt(t,Ko(t)));var o=true,e=-1,i=No(n),f=u.length;false===r?o=false:se(r)&&"chain"in r&&(o=r.chain);for(;++e>>1,Su=vu?vu.BYTES_PER_ELEMENT:0,Tu=Le.pow(2,53)-1,Uu=_u&&new _u,Nu={},Fu=$n.support={}; -case 1:return n.call(this,r[0],o);case 2:return n.call(this,r[0],r[1],o)}for(u=Ce(t+1),e=-1;++e=T)return r}else n=0;return Pu(r,e)}}(),Ju=fe(function(n,t){return jr(n)?ft(n,st(t,false,true)):[]}),Xu=Qt(),Hu=Qt(true),Qu=fe(function(t,r){r=st(r);var e=rt(t,r);return kt(t,r.sort(n)),e}),no=pr(),to=pr(true),ro=fe(function(n){return Tt(st(n,false,true)); -return u}function ye(n){return Ut(n,zo(n))}function de(n){return(n=u(n))&&n.replace(In,c).replace(xn,"")}function me(n){return(n=u(n))&&bn.test(n)?n.replace(wn,"\\$&"):n}function we(n,t,r){return r&&jr(n,t,r)&&(t=0),bu(n,t)}function be(n,t){var r="";if(n=u(n),t=+t,1>t||!n||!vu(t))return r;do t%2&&(r+=n),t=nu(t/2),n+=n;while(t);return r}function xe(n,t,r){var e=n;return(n=u(n))?(r?jr(e,t,r):null==t)?n.slice(g(n),y(n)+1):(t+="",n.slice(i(n,t),f(n,t)+1)):n}function Ae(n,t,r){return r&&jr(n,t,r)&&(t=null), -n=u(n),n.match(t||Sn)||[]}function je(n,t,r){return r&&jr(n,t,r)&&(t=null),ut(n,t)}function ke(n){return function(){return n}}function Oe(n){return n}function Ee(n,t,r){if(null==r){var e=ae(t),u=e&&zo(t);((u=u&&u.length&&vt(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=vt(t,zo(t)));var o=true,e=-1,i=Co(n),f=u.length;false===r?o=false:ae(r)&&"chain"in r&&(o=r.chain);for(;++e>>1,Iu=su?su.BYTES_PER_ELEMENT:0,Ru=Ue.pow(2,53)-1,Cu=lu&&new lu,Su={},Wu=$n.support={}; +},bo=fe(function(n,t,r){var e=x;if(r.length)var u=v(r,bo.placeholder),e=e|E;return hr(n,e,t,r,u)}),xo=fe(function(n,t){t=t.length?st(t):de(n);for(var r=-1,e=t.length;++r=T)return r}else n=0;return Bu(r,e)}}(),Vu=ue(function(n,t){return Io(n)||oe(n)?ft(n,st(t,false,true)):[]}),Yu=Qt(),Zu=Qt(true),Gu=ue(function(t,r){t||(t=[]),r=st(r);var e=rt(t,r);return kt(t,r.sort(n)),e}),Ju=sr(),Xu=sr(true),Hu=ue(function(n){return Tt(st(n,false,true)); +}),To=yu||function(n){return h(n)&&Rr(n.length)&&Xe.call(n)==M};Fu.dom||(ce=function(n){return!!n&&1===n.nodeType&&h(n)&&!Fo(n)});var Uo=ju||function(n){return typeof n=="number"&&mu(n)},No=e(/x/)||hu&&!e(hu)?function(n){return Xe.call(n)==K}:e,Fo=iu?function(n){if(!n||Xe.call(n)!=Y)return false;var t=n.valueOf,r=pe(t)&&(r=iu(t))&&iu(r);return r?n==r||iu(n)==r:Tr(n)}:Tr,$o=qt(function(n,t,r){return r?tt(n,t,r):$u(n,t)}),Lo=fe(function(n){var t=n[0];return null==t?t:(n.push(Qn),$o.apply(w,n))}),zo=nr(ht),Bo=nr(_t),Mo=er(Mu),Do=er(Du),Po=ur(ht),qo=ur(_t),Ko=wu?function(n){ +var t=null!=n&&n.constructor;return typeof t=="function"&&t.prototype===n||typeof n!="function"&&jr(n)?Ur(n):se(n)?wu(n):[]}:Ur,Vo=or(true),Yo=or(),Zo=qt(xt),Go=fe(function(n,t){if(null==n)return{};if("function"!=typeof t[0])return t=Jn(st(t),De),Wr(n,ft(me(n),t));var r=zt(t[0],t[1],3);return Sr(n,function(n,t,e){return!r(n,t,e)})}),Jo=fe(function(n,t){return null==n?{}:"function"==typeof t[0]?Sr(n,zt(t[0],t[1],3)):Wr(n,st(t))}),Xo=Zt(function(n,t,r){return t=t.toLowerCase(),n+(r?t.charAt(0).toUpperCase()+t.slice(1):t); -}),Qu=ue(function(n,t){return Io(n)||oe(n)?ft(n,t):[]}),no=ue(qr),to=ue(function(n,t){var r=n?Pu(n):0;return Er(r)&&(n=Tr(n)),rt(n,st(t))}),ro=Pt(function(n,t,r){Ke.call(n,r)?++n[r]:n[r]=1}),eo=Ht(Nu),uo=Ht(Fu,true),oo=rr(Kn,Nu),io=rr(function(n,t){for(var r=n.length;r--&&false!==t(n[r],r,n););return n},Fu),fo=Pt(function(n,t,r){Ke.call(n,r)?n[r].push(t):n[r]=[t]}),ao=Pt(function(n,t,r){n[r]=t}),co=ue(function(n,t,r){var e=-1,u=typeof t=="function",o=kr(t),i=Pu(n),f=Er(i)?Ce(i):[];return Nu(n,function(n){ -var i=u?t:o&&null!=n&&n[t];f[++e]=i?i.apply(n,r):xr(n,t,r)}),f}),lo=Pt(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),so=fr(function(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++ue&&(e=u)}return e}),fi=Xt(function(n){for(var t=-1,r=n.length,e=Iu;++t--n?t.apply(this,arguments):void 0}},$n.ary=function(n,t,r){return r&&Or(n,t,r)&&(t=null), +t=n&&null==t?n.length:bu(+t||0,0),hr(n,R,null,null,null,null,t)},$n.assign=$o,$n.at=io,$n.before=ue,$n.bind=bo,$n.bindAll=xo,$n.bindKey=Ao,$n.callback=Ee,$n.chain=Gr,$n.chunk=function(n,t,r){t=(r?Or(n,t,r):null==t)?1:bu(+t||1,1),r=0;for(var e=n?n.length:0,u=-1,o=Ue(ru(e/t));rr&&(r=-r>u?0:u+r),e=e===w||e>u?u:+e||0,0>e&&(e+=u),u=r>e?0:e>>>0,r>>>=0;re)return f;var i=n[0],c=-1,l=i?i.length:0,s=u[0];n:for(;++c(s?Pn(s,a):o(f,a,0))){for(t=e;--t;){var p=u[t];if(0>(p?Pn(p,a):o(n[t],a,0)))continue n}s&&s.push(a),f.push(a)}return f},$n.invert=function(n,t,r){r&&Or(n,t,r)&&(t=null),r=-1;for(var e=Ko(n),u=e.length,o={};++r--n?t.apply(this,arguments):void 0}},$n.ary=function(n,t,r){return r&&jr(n,t,r)&&(t=null),t=n&&null==t?n.length:yu(+t||0,0),pr(n,R,null,null,null,null,t)},$n.assign=Wo, -$n.at=to,$n.before=te,$n.bind=vo,$n.bindAll=go,$n.bindKey=yo,$n.callback=je,$n.chain=Vr,$n.chunk=function(n,t,r){t=(r?jr(n,t,r):null==t)?1:yu(+t||1,1),r=0;for(var e=n?n.length:0,u=-1,o=Ce(He(e/t));rr&&(r=-r>u?0:u+r),e=e===w||e>u?u:+e||0,0>e&&(e+=u),u=r>e?0:e>>>0,r>>>=0;rt?0:t)):[]},$n.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?Or(n,t,r):null==t)&&(t=1),t=e-(+t||0),It(n,0>t?0:t)):[]},$n.takeRightWhile=function(n,t,r){return n&&n.length?Nt(n,dr(t,r,3),false,true):[]},$n.takeWhile=function(n,t,r){return n&&n.length?Nt(n,dr(t,r,3)):[]},$n.tap=function(n,t,r){return t.call(r,n),n},$n.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Pe(L);return false===r?e=false:se(r)&&(e="leading"in r?!!r.leading:e, +u="trailing"in r?!!r.trailing:u),Fn.leading=e,Fn.maxWait=+t,Fn.trailing=u,oe(n,t,Fn)},$n.thru=Jr,$n.times=function(n,t,r){if(n=uu(n),1>n||!mu(n))return[];var e=-1,u=Ue(xu(n,Ru));for(t=zt(t,r,1);++er?0:+r||0,e),r-=t.length,0<=r&&n.indexOf(t,r)==r},$n.escape=function(n){return(n=u(n))&&hn.test(n)?n.replace(sn,l):n},$n.escapeRegExp=xe,$n.every=Xr,$n.find=ao,$n.findIndex=Xu,$n.findKey=zo,$n.findLast=co,$n.findLastIndex=Hu,$n.findLastKey=Bo,$n.findWhere=function(n,t){return ao(n,wt(t))},$n.first=Mr,$n.get=function(n,t,r){return n=null==n?w:gt(n,$r(t),t+""),n===w?r:n},$n.has=function(n,t){if(null==n)return false;var r=Ge.call(n,t); -return r&&jr(n,t,r)&&(t=false),e?st(n,t):[]},$n.flattenDeep=function(n){return n&&n.length?st(n,true):[]},$n.flow=Ao,$n.flowRight=jo,$n.forEach=oo,$n.forEachRight=io,$n.forIn=Fo,$n.forInRight=$o,$n.forOwn=Lo,$n.forOwnRight=Bo,$n.functions=ve,$n.groupBy=fo,$n.indexBy=ao,$n.initial=function(n){return Lr(n,1)},$n.intersection=function(){for(var n=[],t=-1,e=arguments.length,u=[],o=dr(),i=o==r,f=[];++te)return f; +return r||Er(t)||(t=$r(t),n=1==t.length?n:gt(n,It(t,0,-1)),t=Pr(t),r=null!=n&&Ge.call(n,t)),r},$n.identity=Re,$n.includes=Qr,$n.indexOf=Dr,$n.inRange=function(n,t,r){return t=+t||0,"undefined"===typeof r?(r=t,t=0):r=+r||0,n>=xu(t,r)&&n(s?Pn(s,a):o(f,a,0))){for(t=e;--t;){var p=u[t];if(0>(p?Pn(p,a):o(n[t],a,0)))continue n}s&&s.push(a),f.push(a)}return f},$n.invert=function(n,t,r){r&&jr(n,t,r)&&(t=null),r=-1;for(var e=zo(n),u=e.length,o={};++rr?bu(e+r,0):xu(r||0,e-1))+1;else if(r)return u=$t(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return p(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},$n.max=ii,$n.min=fi,$n.noConflict=function(){ +return _._=He,this},$n.noop=Se,$n.now=wo,$n.pad=function(n,t,r){n=u(n),t=+t;var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},$n.sum=function(n,t,r){r&&Or(n,t,r)&&(t=null); -},$n.property=Re,$n.propertyOf=function(n){return function(t){return gt(n,Nr(t),t+"")}},$n.pull=function(){var n=arguments,t=n[0];if(!t||!t.length)return t;for(var r=0,e=dr(),u=n.length;++rt?0:t)):[]},$n.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?jr(n,t,r):null==t)&&(t=1),t=e-(+t||0),It(n,0>t?0:t)):[]},$n.takeRightWhile=function(n,t,r){return n&&n.length?Nt(n,yr(t,r,3),false,true):[]},$n.takeWhile=function(n,t,r){return n&&n.length?Nt(n,yr(t,r,3)):[]},$n.tap=function(n,t,r){return t.call(r,n),n},$n.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Be(L);return false===r?e=false:ae(r)&&(e="leading"in r?!!r.leading:e, -u="trailing"in r?!!r.trailing:u),Fn.leading=e,Fn.maxWait=+t,Fn.trailing=u,re(n,t,Fn)},$n.thru=Yr,$n.times=function(n,t,r){if(n=nu(n),1>n||!vu(n))return[];var e=-1,u=Ce(du(n,ku));for(t=Bt(t,r,1);++er?0:+r||0,e),r-=t.length,0<=r&&n.indexOf(t,r)==r},$n.escape=function(n){return(n=u(n))&&hn.test(n)?n.replace(sn,l):n},$n.escapeRegExp=me,$n.every=Zr,$n.find=eo,$n.findIndex=Yu,$n.findKey=Uo,$n.findLast=uo,$n.findLastIndex=Zu,$n.findLastKey=No,$n.findWhere=function(n,t){return eo(n,wt(t))},$n.first=Br,$n.get=function(n,t,r){return n=null==n?w:gt(n,Nr(t),t+""),n===w?r:n},$n.has=function(n,t){if(null==n)return false;var r=Ke.call(n,t);return r||kr(t)||(t=Nr(t), -n=1==t.length?n:gt(n,It(t,0,-1)),t=Mr(t),r=null!=n&&Ke.call(n,t)),r},$n.identity=Oe,$n.includes=Jr,$n.indexOf=zr,$n.inRange=function(n,t,r){return t=+t||0,"undefined"===typeof r?(r=t,t=0):r=+r||0,n>=du(t,r)&&nr?yu(e+r,0):du(r||0,e-1))+1;else if(r)return u=$t(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return p(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},$n.max=Qo,$n.min=ni,$n.noConflict=function(){ -return _._=Ze,this},$n.noop=Ie,$n.now=_o,$n.pad=function(n,t,r){n=u(n),t=+t;var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},$n.sum=function(n,t,r){r&&jr(n,t,r)&&(t=null); - -var e=yr(),u=null==t;if(e===ut&&u||(u=false,t=e(t,r,3)),u){for(n=Io(n)?n:Tr(n),t=n.length,r=0;t--;)r+=+n[t]||0;n=r}else n=Wt(n,t);return n},$n.template=function(n,t,r){var e=$n.templateSettings;r&&jr(n,t,r)&&(t=r=null),n=u(n),t=tt(Tu({},r||t),e,nt),r=tt(Tu({},t.imports),e.imports,nt);var o,i,f=zo(r),a=Ut(r,f),c=0;r=t.interpolate||Rn;var l="__p+='";r=$e((t.escape||Rn).source+"|"+r.source+"|"+(r===gn?jn:Rn).source+"|"+(t.evaluate||Rn).source+"|$","g");var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":""; +var e=dr(),u=null==t;if(e===ut&&u||(u=false,t=e(t,r,3)),u){for(n=To(n)?n:Nr(n),t=n.length,r=0;t--;)r+=+n[t]||0;n=r}else n=St(n,t);return n},$n.template=function(n,t,r){var e=$n.templateSettings;r&&Or(n,t,r)&&(t=r=null),n=u(n),t=tt($u({},r||t),e,nt),r=tt($u({},t.imports),e.imports,nt);var o,i,f=Ko(r),a=Ut(r,f),c=0;r=t.interpolate||Rn;var l="__p+='";r=Me((t.escape||Rn).source+"|"+r.source+"|"+(r===gn?jn:Rn).source+"|"+(t.evaluate||Rn).source+"|$","g");var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":""; if(n.replace(r,function(t,r,e,u,f,a){return e||(e=u),l+=n.slice(c,a).replace(Cn,s),r&&(o=true,l+="'+__e("+r+")+'"),f&&(i=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),c=a+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(i?l.replace(fn,""):l).replace(an,"$1").replace(cn,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}", -t=Jo(function(){return Te(f,p+"return "+l).apply(w,a)}),t.source=l,fe(t))throw t;return t},$n.trim=xe,$n.trimLeft=function(n,t,r){var e=n;return(n=u(n))?n.slice((r?jr(e,t,r):null==t)?g(n):i(n,t+"")):n},$n.trimRight=function(n,t,r){var e=n;return(n=u(n))?(r?jr(e,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,f(n,t+"")+1):n},$n.trunc=function(n,t,r){r&&jr(n,t,r)&&(t=null);var e=S;if(r=W,null!=t)if(ae(t)){var o="separator"in t?t.separator:o,e="length"in t?+t.length||0:e;r="omission"in t?u(t.omission):r}else e=+t||0; +t=ei(function(){return $e(f,p+"return "+l).apply(w,a)}),t.source=l,le(t))throw t;return t},$n.trim=ke,$n.trimLeft=function(n,t,r){var e=n;return(n=u(n))?n.slice((r?Or(e,t,r):null==t)?g(n):i(n,t+"")):n},$n.trimRight=function(n,t,r){var e=n;return(n=u(n))?(r?Or(e,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,f(n,t+"")+1):n},$n.trunc=function(n,t,r){r&&Or(n,t,r)&&(t=null);var e=W;if(r=S,null!=t)if(se(t)){var o="separator"in t?t.separator:o,e="length"in t?+t.length||0:e;r="omission"in t?u(t.omission):r}else e=+t||0; -if(n=u(n),e>=n.length)return n;if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==o)return t+r;if(se(o)){if(n.slice(e).search(o)){var i,f=n.slice(0,e);for(o.global||(o=$e(o.source,(kn.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(f);)i=n.index;t=t.slice(0,null==i?e:i)}}else n.indexOf(o,e)!=e&&(o=t.lastIndexOf(o),-1u.__dir__?"Right":"") -}),u},zn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},zn.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[r](n,t).reverse()}}),Kn(["first","last"],function(n,t){var r="take"+(t?"Right":"");zn.prototype[n]=function(){return this[r](1).value()[0]}}),Kn(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");zn.prototype[n]=function(){return this[r](1)}}),Kn(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?wt:Re;zn.prototype[n]=function(n){return this[r](e(n)); +if(n=u(n),e>=n.length)return n;if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==o)return t+r;if(_e(o)){if(n.slice(e).search(o)){var i,f=n.slice(0,e);for(o.global||(o=Me(o.source,(kn.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(f);)i=n.index;t=t.slice(0,null==i?e:i)}}else n.indexOf(o,e)!=e&&(o=t.lastIndexOf(o),-1u.__dir__?"Right":"") +}),u},Bn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},Bn.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[r](n,t).reverse()}}),Kn(["first","last"],function(n,t){var r="take"+(t?"Right":"");Bn.prototype[n]=function(){return this[r](1).value()[0]}}),Kn(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");Bn.prototype[n]=function(){return this[r](1)}}),Kn(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?wt:Te;Bn.prototype[n]=function(n){return this[r](e(n)); -}}),zn.prototype.compact=function(){return this.filter(Oe)},zn.prototype.reject=function(n,t){return n=yr(n,t,1),this.filter(function(t){return!n(t)})},zn.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=0>n?this.takeRight(-n):this.drop(n);return t!==w&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},zn.prototype.toArray=function(){return this.drop(0)},ht(zn.prototype,function(n,t){var r=$n[t];if(r){var e=/^(?:filter|map|reject)|While$/.test(t),u=/^(?:first|last)$/.test(t);$n.prototype[t]=function(){ -function t(n){return n=[n],eu.apply(n,o),r.apply($n,n)}var o=arguments,i=this.__chain__,f=this.__wrapped__,a=!!this.__actions__.length,c=f instanceof zn,l=o[0],s=c||Io(f);return s&&e&&typeof l=="function"&&1!=l.length&&(c=s=false),c=c&&!a,u&&!i?c?n.call(f):r.call($n,this.value()):s?(f=n.apply(c?f:new zn(this),o),u||!a&&!f.__actions__||(f.__actions__||(f.__actions__=[])).push({func:Yr,args:[t],thisArg:$n}),new Bn(f,i)):this.thru(t)}}}),Kn("concat join pop push replace shift sort splice split unshift".split(" "),function(n){ -var t=(/^(?:replace|split)$/.test(n)?De:ze)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|replace|shift)$/.test(n);$n.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),ht(zn.prototype,function(n,t){var r=$n[t];if(r){var e=r.name;(Su[e]||(Su[e]=[])).push({name:t,func:r})}}),Su[ar(null,A).name]=[{name:"wrapper",func:null}],zn.prototype.clone=function(){var n=this.__actions__,t=this.__iteratees__,r=this.__views__,e=new zn(this.__wrapped__); +}}),Bn.prototype.compact=function(){return this.filter(Re)},Bn.prototype.reject=function(n,t){return n=dr(n,t,1),this.filter(function(t){return!n(t)})},Bn.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=this;return 0>n?r=this.takeRight(-n):n&&(r=this.drop(n)),t!==w&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},Bn.prototype.toArray=function(){return this.drop(0)},ht(Bn.prototype,function(n,t){var r=$n[t];if(r){var e=/^(?:filter|map|reject)|While$/.test(t),u=/^(?:first|last)$/.test(t);$n.prototype[t]=function(){ +function t(n){return n=[n],fu.apply(n,o),r.apply($n,n)}var o=arguments,i=this.__chain__,f=this.__wrapped__,a=!!this.__actions__.length,c=f instanceof Bn,l=o[0],s=c||To(f);return s&&e&&typeof l=="function"&&1!=l.length&&(c=s=false),c=c&&!a,u&&!i?c?n.call(f):r.call($n,this.value()):s?(f=n.apply(c?f:new Bn(this),o),u||!a&&!f.__actions__||(f.__actions__||(f.__actions__=[])).push({func:Jr,args:[t],thisArg:$n}),new zn(f,i)):this.thru(t)}}}),Kn("concat join pop push replace shift sort splice split unshift".split(" "),function(n){ +var t=(/^(?:replace|split)$/.test(n)?Ve:qe)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|replace|shift)$/.test(n);$n.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),ht(Bn.prototype,function(n,t){var r=$n[t];if(r){var e=r.name;(Nu[e]||(Nu[e]=[])).push({name:t,func:r})}}),Nu[cr(null,A).name]=[{name:"wrapper",func:null}],Bn.prototype.clone=function(){var n=this.__actions__,t=this.__iteratees__,r=this.__views__,e=new Bn(this.__wrapped__); -return e.__actions__=n?qn(n):null,e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=t?qn(t):null,e.__takeCount__=this.__takeCount__,e.__views__=r?qn(r):null,e},zn.prototype.reverse=function(){if(this.__filtered__){var n=new zn(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},zn.prototype.value=function(){var n=this.__wrapped__.value();if(!Io(n))return Ft(n,this.__actions__);var t,r=this.__dir__,e=0>r;t=n.length;for(var u=this.__views__,o=0,i=-1,f=u?u.length:0;++ip.index:u=_:!h(s))))continue n}else if(p=h(s), -_==$)s=p;else if(!p){if(_==F)continue n;break n}}c[a++]=s}return c},$n.prototype.chain=function(){return Vr(this)},$n.prototype.commit=function(){return new Bn(this.value(),this.__chain__)},$n.prototype.plant=function(n){for(var t,r=this;r instanceof Ln;){var e=Fr(r);t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},$n.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof zn?(this.__actions__.length&&(n=new zn(this)),new Bn(n.reverse(),this.__chain__)):this.thru(function(n){ -return n.reverse()})},$n.prototype.toString=function(){return this.value()+""},$n.prototype.run=$n.prototype.toJSON=$n.prototype.valueOf=$n.prototype.value=function(){return Ft(this.__wrapped__,this.__actions__)},$n.prototype.collect=$n.prototype.map,$n.prototype.head=$n.prototype.first,$n.prototype.select=$n.prototype.filter,$n.prototype.tail=$n.prototype.rest,$n}var w,b="3.7.0",x=1,A=2,j=4,k=8,O=16,E=32,I=64,R=128,C=256,S=30,W="...",T=150,U=16,N=0,F=1,$=2,L="Expected a function",B="__lodash_placeholder__",z="[object Arguments]",M="[object Array]",D="[object Boolean]",P="[object Date]",q="[object Error]",K="[object Function]",V="[object Number]",Y="[object Object]",Z="[object RegExp]",G="[object String]",J="[object ArrayBuffer]",X="[object Float32Array]",H="[object Float64Array]",Q="[object Int8Array]",nn="[object Int16Array]",tn="[object Int32Array]",rn="[object Uint8Array]",en="[object Uint8ClampedArray]",un="[object Uint16Array]",on="[object Uint32Array]",fn=/\b__p\+='';/g,an=/\b(__p\+=)''\+/g,cn=/(__e\(.*?\)|\b__t\))\+'';/g,ln=/&(?:amp|lt|gt|quot|#39|#96);/g,sn=/[&<>"'`]/g,pn=RegExp(ln.source),hn=RegExp(sn.source),_n=/<%-([\s\S]+?)%>/g,vn=/<%([\s\S]+?)%>/g,gn=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]+|(["'])(?:(?!\1)[^\n\\]|\\.)*?)\1\]/,dn=/^\w*$/,mn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,wn=/[.*+?^${}()|[\]\/\\]/g,bn=RegExp(wn.source),xn=/[\u0300-\u036f\ufe20-\ufe23]/g,An=/\\(\\)?/g,jn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kn=/\w*$/,On=/^0[xX]/,En=/^\[object .+?Constructor\]$/,In=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Rn=/($^)/,Cn=/['\n\r\u2028\u2029\\]/g,Sn=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),Wn=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Tn="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window".split(" "),Un={}; +return e.__actions__=n?qn(n):null,e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=t?qn(t):null,e.__takeCount__=this.__takeCount__,e.__views__=r?qn(r):null,e},Bn.prototype.reverse=function(){if(this.__filtered__){var n=new Bn(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Bn.prototype.value=function(){var n=this.__wrapped__.value();if(!To(n))return Ft(n,this.__actions__);var t,r=this.__dir__,e=0>r;t=n.length;for(var u=this.__views__,o=0,i=-1,f=u?u.length:0;++ip.index:u=_:!h(s))))continue n}else if(p=h(s), +_==$)s=p;else if(!p){if(_==F)continue n;break n}}c[a++]=s}return c},$n.prototype.chain=function(){return Gr(this)},$n.prototype.commit=function(){return new zn(this.value(),this.__chain__)},$n.prototype.plant=function(n){for(var t,r=this;r instanceof Ln;){var e=Lr(r);t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},$n.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Bn?(this.__actions__.length&&(n=new Bn(this)),new zn(n.reverse(),this.__chain__)):this.thru(function(n){ +return n.reverse()})},$n.prototype.toString=function(){return this.value()+""},$n.prototype.run=$n.prototype.toJSON=$n.prototype.valueOf=$n.prototype.value=function(){return Ft(this.__wrapped__,this.__actions__)},$n.prototype.collect=$n.prototype.map,$n.prototype.head=$n.prototype.first,$n.prototype.select=$n.prototype.filter,$n.prototype.tail=$n.prototype.rest,$n}var w,b="3.8.0",x=1,A=2,j=4,k=8,O=16,E=32,I=64,R=128,C=256,W=30,S="...",T=150,U=16,N=0,F=1,$=2,L="Expected a function",z="__lodash_placeholder__",B="[object Arguments]",M="[object Array]",D="[object Boolean]",P="[object Date]",q="[object Error]",K="[object Function]",V="[object Number]",Y="[object Object]",Z="[object RegExp]",G="[object String]",J="[object ArrayBuffer]",X="[object Float32Array]",H="[object Float64Array]",Q="[object Int8Array]",nn="[object Int16Array]",tn="[object Int32Array]",rn="[object Uint8Array]",en="[object Uint8ClampedArray]",un="[object Uint16Array]",on="[object Uint32Array]",fn=/\b__p\+='';/g,an=/\b(__p\+=)''\+/g,cn=/(__e\(.*?\)|\b__t\))\+'';/g,ln=/&(?:amp|lt|gt|quot|#39|#96);/g,sn=/[&<>"'`]/g,pn=RegExp(ln.source),hn=RegExp(sn.source),_n=/<%-([\s\S]+?)%>/g,vn=/<%([\s\S]+?)%>/g,gn=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,dn=/^\w*$/,mn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,wn=/[.*+?^${}()|[\]\/\\]/g,bn=RegExp(wn.source),xn=/[\u0300-\u036f\ufe20-\ufe23]/g,An=/\\(\\)?/g,jn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,kn=/\w*$/,On=/^0[xX]/,En=/^\[object .+?Constructor\]$/,In=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Rn=/($^)/,Cn=/['\n\r\u2028\u2029\\]/g,Wn=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),Sn=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Tn="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window".split(" "),Un={}; -Un[X]=Un[H]=Un[Q]=Un[nn]=Un[tn]=Un[rn]=Un[en]=Un[un]=Un[on]=true,Un[z]=Un[M]=Un[J]=Un[D]=Un[P]=Un[q]=Un[K]=Un["[object Map]"]=Un[V]=Un[Y]=Un[Z]=Un["[object Set]"]=Un[G]=Un["[object WeakMap]"]=false;var Nn={};Nn[z]=Nn[M]=Nn[J]=Nn[D]=Nn[P]=Nn[X]=Nn[H]=Nn[Q]=Nn[nn]=Nn[tn]=Nn[V]=Nn[Y]=Nn[Z]=Nn[G]=Nn[rn]=Nn[en]=Nn[un]=Nn[on]=true,Nn[q]=Nn[K]=Nn["[object Map]"]=Nn["[object Set]"]=Nn["[object WeakMap]"]=false;var Fn={leading:false,maxWait:0,trailing:false},$n={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A", +Un[X]=Un[H]=Un[Q]=Un[nn]=Un[tn]=Un[rn]=Un[en]=Un[un]=Un[on]=true,Un[B]=Un[M]=Un[J]=Un[D]=Un[P]=Un[q]=Un[K]=Un["[object Map]"]=Un[V]=Un[Y]=Un[Z]=Un["[object Set]"]=Un[G]=Un["[object WeakMap]"]=false;var Nn={};Nn[B]=Nn[M]=Nn[J]=Nn[D]=Nn[P]=Nn[X]=Nn[H]=Nn[Q]=Nn[nn]=Nn[tn]=Nn[V]=Nn[Y]=Nn[Z]=Nn[G]=Nn[rn]=Nn[en]=Nn[un]=Nn[on]=true,Nn[q]=Nn[K]=Nn["[object Map]"]=Nn["[object Set]"]=Nn["[object WeakMap]"]=false;var Fn={leading:false,maxWait:0,trailing:false},$n={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A", "\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u", -"\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Ln={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Bn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},zn={"function":true,object:true},Mn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Dn=zn[typeof exports]&&exports&&!exports.nodeType&&exports,Pn=zn[typeof module]&&module&&!module.nodeType&&module,qn=zn[typeof self]&&self&&self.Object&&self,Kn=zn[typeof window]&&window&&window.Object&&window,Vn=Pn&&Pn.exports===Dn&&Dn,Yn=Dn&&Pn&&typeof global=="object"&&global&&global.Object&&global||Kn!==(this&&this.window)&&Kn||qn||this,Zn=m(); +"\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Ln={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},zn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Bn={"function":true,object:true},Mn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Dn=Bn[typeof exports]&&exports&&!exports.nodeType&&exports,Pn=Bn[typeof module]&&module&&!module.nodeType&&module,qn=Bn[typeof self]&&self&&self.Object&&self,Kn=Bn[typeof window]&&window&&window.Object&&window,Vn=Pn&&Pn.exports===Dn&&Dn,Yn=Dn&&Pn&&typeof global=="object"&&global&&global.Object&&global||Kn!==(this&&this.window)&&Kn||qn||this,Zn=m(); typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Yn._=Zn, define(function(){return Zn})):Dn&&Pn?Vn?(Pn.exports=Zn)._=Zn:Dn._=Zn:Yn._=Zn}).call(this); \ No newline at end of file diff --git a/lodash.src.js b/lodash.src.js index fc12d1e18f..ee0fa43af2 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -1,6 +1,6 @@ /** * @license - * lodash 3.7.0 + * lodash 3.8.0 * Copyright 2012-2015 The Dojo Foundation * Based on Underscore.js 1.8.3 * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '3.7.0'; + var VERSION = '3.8.0'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, From 6d521195975bae2dd1f40fb8b1807f02a75d8bfd Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 29 Apr 2015 21:04:12 -0700 Subject: [PATCH 43/43] Bump to v3.8.0. --- README.md | 6 +++--- bower.json | 2 +- component.json | 2 +- package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3534f1c349..f137afea6b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash v3.7.0 +# lodash v3.8.0 The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) with packages for [Bower](http://bower.io/), [Component](http://component.github.io/), & [Volo](http://volojs.org/). @@ -16,8 +16,8 @@ $ lodash modern -o ./lodash.js lodash is also available in a variety of other builds & module formats. * npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds - * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.7.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.7.0-amd) builds - * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.7.0-es) build + * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.8.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.8.0-amd) builds + * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.8.0-es) build ## Further Reading diff --git a/bower.json b/bower.json index 1770e608d2..a6e897f9a8 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "3.7.0", + "version": "3.8.0", "main": "lodash.js", "ignore": [ ".*", diff --git a/component.json b/component.json index a3562e4b2e..f01f6c20e0 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "name": "lodash", "repo": "lodash/lodash", - "version": "3.7.0", + "version": "3.8.0", "description": "The modern build of lodash.", "license": "MIT", "main": "lodash.js", diff --git a/package.json b/package.json index 461469125c..6e30bd2f42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "3.7.0", + "version": "3.8.0", "main": "lodash.src.js", "private": true, "devDependencies": {