diff --git a/README.md b/README.md index 937b54f8d..6028ddf6b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lodash-amd v4.1.0 +# lodash-amd v4.2.0 The [lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules. @@ -27,4 +27,4 @@ require({ }); ``` -See the [package source](https://github.com/lodash/lodash/tree/4.1.0-amd) for more details. +See the [package source](https://github.com/lodash/lodash/tree/4.2.0-amd) for more details. diff --git a/_apply.js b/_apply.js index 54cdb10c7..eea9fd562 100644 --- a/_apply.js +++ b/_apply.js @@ -7,11 +7,11 @@ define([], function() { * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [args] The arguments to invoke `func` with. + * @param {...*} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { - var length = args ? args.length : 0; + var length = args.length; switch (length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); diff --git a/_baseSum.js b/_baseSum.js index feb11a1f4..3448ed335 100644 --- a/_baseSum.js +++ b/_baseSum.js @@ -22,7 +22,7 @@ define([], function() { result = result === undefined ? current : (result + current); } } - return length ? result : 0; + return result; } return baseSum; diff --git a/array.js b/array.js index 3ab7b3309..6fb6328c7 100644 --- a/array.js +++ b/array.js @@ -1,4 +1,4 @@ -define(['./chunk', './compact', './concat', './difference', './differenceBy', './differenceWith', './drop', './dropRight', './dropRightWhile', './dropWhile', './fill', './findIndex', './findLastIndex', './flatMap', './flatten', './flattenDeep', './fromPairs', './head', './indexOf', './initial', './intersection', './intersectionBy', './intersectionWith', './join', './last', './lastIndexOf', './pull', './pullAll', './pullAllBy', './pullAt', './remove', './reverse', './slice', './sortedIndex', './sortedIndexBy', './sortedIndexOf', './sortedLastIndex', './sortedLastIndexBy', './sortedLastIndexOf', './sortedUniq', './sortedUniqBy', './tail', './take', './takeRight', './takeRightWhile', './takeWhile', './union', './unionBy', './unionWith', './uniq', './uniqBy', './uniqWith', './unzip', './unzipWith', './without', './xor', './xorBy', './xorWith', './zip', './zipObject', './zipObjectDeep', './zipWith'], function(chunk, compact, concat, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, findIndex, findLastIndex, flatMap, flatten, flattenDeep, fromPairs, head, indexOf, initial, intersection, intersectionBy, intersectionWith, join, last, lastIndexOf, pull, pullAll, pullAllBy, pullAt, remove, reverse, slice, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, tail, take, takeRight, takeRightWhile, takeWhile, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, without, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith) { +define(['./chunk', './compact', './concat', './difference', './differenceBy', './differenceWith', './drop', './dropRight', './dropRightWhile', './dropWhile', './fill', './findIndex', './findLastIndex', './flatten', './flattenDeep', './fromPairs', './head', './indexOf', './initial', './intersection', './intersectionBy', './intersectionWith', './join', './last', './lastIndexOf', './pull', './pullAll', './pullAllBy', './pullAt', './remove', './reverse', './slice', './sortedIndex', './sortedIndexBy', './sortedIndexOf', './sortedLastIndex', './sortedLastIndexBy', './sortedLastIndexOf', './sortedUniq', './sortedUniqBy', './tail', './take', './takeRight', './takeRightWhile', './takeWhile', './union', './unionBy', './unionWith', './uniq', './uniqBy', './uniqWith', './unzip', './unzipWith', './without', './xor', './xorBy', './xorWith', './zip', './zipObject', './zipObjectDeep', './zipWith'], function(chunk, compact, concat, difference, differenceBy, differenceWith, drop, dropRight, dropRightWhile, dropWhile, fill, findIndex, findLastIndex, flatten, flattenDeep, fromPairs, head, indexOf, initial, intersection, intersectionBy, intersectionWith, join, last, lastIndexOf, pull, pullAll, pullAllBy, pullAt, remove, reverse, slice, sortedIndex, sortedIndexBy, sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy, tail, take, takeRight, takeRightWhile, takeWhile, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, without, xor, xorBy, xorWith, zip, zipObject, zipObjectDeep, zipWith) { return { 'chunk': chunk, 'compact': compact, @@ -13,7 +13,6 @@ define(['./chunk', './compact', './concat', './difference', './differenceBy', '. 'fill': fill, 'findIndex': findIndex, 'findLastIndex': findLastIndex, - 'flatMap': flatMap, 'flatten': flatten, 'flattenDeep': flattenDeep, 'fromPairs': fromPairs, diff --git a/attempt.js b/attempt.js index 282250c27..bef212c82 100644 --- a/attempt.js +++ b/attempt.js @@ -1,4 +1,4 @@ -define(['./_apply', './isError', './rest'], function(apply, isError, rest) { +define(['./_apply', './isObject', './rest'], function(apply, isObject, rest) { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; @@ -14,7 +14,7 @@ define(['./_apply', './isError', './rest'], function(apply, isError, rest) { * @returns {*} Returns the `func` result or error object. * @example * - * // avoid throwing errors for invalid selectors + * // Avoid throwing errors for invalid selectors. * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); * }, '>_>'); @@ -27,7 +27,7 @@ define(['./_apply', './isError', './rest'], function(apply, isError, rest) { try { return apply(func, undefined, args); } catch (e) { - return isError(e) ? e : new Error(e); + return isObject(e) ? e : new Error(e); } }); diff --git a/bind.js b/bind.js index 395e6d3d2..19d27188f 100644 --- a/bind.js +++ b/bind.js @@ -34,7 +34,7 @@ define(['./_createWrapper', './_replaceHolders', './rest'], function(createWrapp * bound('!'); * // => 'hi fred!' * - * // using placeholders + * // Bound with placeholders. * var bound = _.bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' diff --git a/bindKey.js b/bindKey.js index cc957dbc9..dc3e2d05c 100644 --- a/bindKey.js +++ b/bindKey.js @@ -44,7 +44,7 @@ define(['./_createWrapper', './_replaceHolders', './rest'], function(createWrapp * bound('!'); * // => 'hiya fred!' * - * // using placeholders + * // Bound with placeholders. * var bound = _.bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' diff --git a/collection.js b/collection.js index fbbf5cfdf..8c564ea3e 100644 --- a/collection.js +++ b/collection.js @@ -1,4 +1,4 @@ -define(['./at', './countBy', './each', './eachRight', './every', './filter', './find', './findLast', './forEach', './forEachRight', './groupBy', './includes', './invokeMap', './keyBy', './map', './orderBy', './partition', './reduce', './reduceRight', './reject', './sample', './sampleSize', './shuffle', './size', './some', './sortBy'], function(at, countBy, each, eachRight, every, filter, find, findLast, forEach, forEachRight, groupBy, includes, invokeMap, keyBy, map, orderBy, partition, reduce, reduceRight, reject, sample, sampleSize, shuffle, size, some, sortBy) { +define(['./at', './countBy', './each', './eachRight', './every', './filter', './find', './findLast', './flatMap', './forEach', './forEachRight', './groupBy', './includes', './invokeMap', './keyBy', './map', './orderBy', './partition', './reduce', './reduceRight', './reject', './sample', './sampleSize', './shuffle', './size', './some', './sortBy'], function(at, countBy, each, eachRight, every, filter, find, findLast, flatMap, forEach, forEachRight, groupBy, includes, invokeMap, keyBy, map, orderBy, partition, reduce, reduceRight, reject, sample, sampleSize, shuffle, size, some, sortBy) { return { 'at': at, 'countBy': countBy, @@ -8,6 +8,7 @@ define(['./at', './countBy', './each', './eachRight', './every', './filter', './ 'filter': filter, 'find': find, 'findLast': findLast, + 'flatMap': flatMap, 'forEach': forEach, 'forEachRight': forEachRight, 'groupBy': groupBy, diff --git a/curry.js b/curry.js index 9b4c258a9..a7584ba0c 100644 --- a/curry.js +++ b/curry.js @@ -42,7 +42,7 @@ define(['./_createWrapper'], function(createWrapper) { * curried(1, 2, 3); * // => [1, 2, 3] * - * // using placeholders + * // Curried with placeholders. * curried(1)(_, 3)(2); * // => [1, 2, 3] */ diff --git a/curryRight.js b/curryRight.js index abd19786f..5fa232432 100644 --- a/curryRight.js +++ b/curryRight.js @@ -39,7 +39,7 @@ define(['./_createWrapper'], function(createWrapper) { * curried(1, 2, 3); * // => [1, 2, 3] * - * // using placeholders + * // Curried with placeholders. * curried(3)(1, _)(2); * // => [1, 2, 3] */ diff --git a/debounce.js b/debounce.js index af8b23c4f..20852e84c 100644 --- a/debounce.js +++ b/debounce.js @@ -41,21 +41,21 @@ define(['./isObject', './now', './toNumber'], function(isObject, now, toNumber) * @returns {Function} Returns the new debounced function. * @example * - * // avoid costly calculations while the window size is in flux + * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * - * // invoke `sendMail` when clicked, debouncing subsequent calls + * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * - * // ensure `batchLog` is invoked once after 1 second of debounced calls + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * - * // cancel a trailing debounced invocation + * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { diff --git a/defer.js b/defer.js index 18aa150e4..06741b97e 100644 --- a/defer.js +++ b/defer.js @@ -15,7 +15,7 @@ define(['./_baseDelay', './rest'], function(baseDelay, rest) { * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // logs 'deferred' after one or more milliseconds + * // => logs 'deferred' after one or more milliseconds */ var defer = rest(function(func, args) { return baseDelay(func, 1, args); diff --git a/differenceBy.js b/differenceBy.js index 29038b4ee..6e78fa456 100644 --- a/differenceBy.js +++ b/differenceBy.js @@ -20,7 +20,7 @@ define(['./_baseDifference', './_baseFlatten', './_baseIteratee', './isArrayLike * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); * // => [3.1, 1.3] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ diff --git a/dropRightWhile.js b/dropRightWhile.js index eaf43dc7d..e9579a3b1 100644 --- a/dropRightWhile.js +++ b/dropRightWhile.js @@ -22,15 +22,15 @@ define(['./_baseIteratee', './_baseWhile'], function(baseIteratee, baseWhile) { * _.dropRightWhile(users, function(o) { return !o.active; }); * // => objects for ['barney'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['barney', 'fred'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.dropRightWhile(users, ['active', false]); * // => objects for ['barney'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.dropRightWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ diff --git a/dropWhile.js b/dropWhile.js index be3d3079a..116ce5ee1 100644 --- a/dropWhile.js +++ b/dropWhile.js @@ -22,15 +22,15 @@ define(['./_baseIteratee', './_baseWhile'], function(baseIteratee, baseWhile) { * _.dropWhile(users, function(o) { return !o.active; }); * // => objects for ['pebbles'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.dropWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['fred', 'pebbles'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.dropWhile(users, ['active', false]); * // => objects for ['pebbles'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.dropWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ diff --git a/every.js b/every.js index 0ffef4ad1..396830647 100644 --- a/every.js +++ b/every.js @@ -25,15 +25,15 @@ define(['./_arrayEvery', './_baseEvery', './_baseIteratee', './isArray', './_isI * { 'user': 'fred', 'active': false } * ]; * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.every(users, { 'user': 'barney', 'active': false }); * // => false * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.every(users, ['active', false]); * // => true * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.every(users, 'active'); * // => false */ diff --git a/filter.js b/filter.js index 3a4edd500..87eb82d08 100644 --- a/filter.js +++ b/filter.js @@ -21,15 +21,15 @@ define(['./_arrayFilter', './_baseFilter', './_baseIteratee', './isArray'], func * _.filter(users, function(o) { return !o.active; }); * // => objects for ['fred'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.filter(users, { 'age': 36, 'active': true }); * // => objects for ['barney'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, ['active', false]); * // => objects for ['fred'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] */ diff --git a/find.js b/find.js index a8c746ed5..ed3112b82 100644 --- a/find.js +++ b/find.js @@ -25,15 +25,15 @@ define(['./_baseEach', './_baseFind', './_baseFindIndex', './_baseIteratee', './ * _.find(users, function(o) { return o.age < 40; }); * // => object for 'barney' * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.find(users, { 'age': 1, 'active': true }); * // => object for 'pebbles' * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.find(users, ['active', false]); * // => object for 'fred' * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.find(users, 'active'); * // => object for 'barney' */ diff --git a/findIndex.js b/findIndex.js index 23ccb065c..bff92db31 100644 --- a/findIndex.js +++ b/findIndex.js @@ -21,15 +21,15 @@ define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIter * _.findIndex(users, function(o) { return o.user == 'barney'; }); * // => 0 * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findIndex(users, { 'user': 'fred', 'active': false }); * // => 1 * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findIndex(users, ['active', false]); * // => 0 * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findIndex(users, 'active'); * // => 2 */ diff --git a/findKey.js b/findKey.js index 1427f1d65..8b3ef0615 100644 --- a/findKey.js +++ b/findKey.js @@ -21,15 +21,15 @@ define(['./_baseFind', './_baseForOwn', './_baseIteratee'], function(baseFind, b * _.findKey(users, function(o) { return o.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findKey(users, { 'age': 1, 'active': true }); * // => 'pebbles' * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findKey(users, ['active', false]); * // => 'fred' * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findKey(users, 'active'); * // => 'barney' */ diff --git a/findLastIndex.js b/findLastIndex.js index 17d08bf33..25124b375 100644 --- a/findLastIndex.js +++ b/findLastIndex.js @@ -21,15 +21,15 @@ define(['./_baseFindIndex', './_baseIteratee'], function(baseFindIndex, baseIter * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); * // => 2 * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findLastIndex(users, { 'user': 'barney', 'active': true }); * // => 0 * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findLastIndex(users, ['active', false]); * // => 2 * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findLastIndex(users, 'active'); * // => 0 */ diff --git a/findLastKey.js b/findLastKey.js index f452b0bea..4e5c9356c 100644 --- a/findLastKey.js +++ b/findLastKey.js @@ -21,15 +21,15 @@ define(['./_baseFind', './_baseForOwnRight', './_baseIteratee'], function(baseFi * _.findLastKey(users, function(o) { return o.age < 40; }); * // => returns 'pebbles' assuming `_.findKey` returns 'barney' * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findLastKey(users, { 'age': 36, 'active': true }); * // => 'barney' * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findLastKey(users, ['active', false]); * // => 'fred' * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findLastKey(users, 'active'); * // => 'pebbles' */ diff --git a/flatMap.js b/flatMap.js index f05b36390..766199337 100644 --- a/flatMap.js +++ b/flatMap.js @@ -1,16 +1,16 @@ -define(['./_arrayMap', './_baseFlatten', './_baseIteratee'], function(arrayMap, baseFlatten, baseIteratee) { +define(['./_baseFlatten', './map'], function(baseFlatten, map) { /** - * Creates an array of flattened values by running each element in `array` + * Creates an array of flattened values by running each element in `collection` * through `iteratee` and concating its result to the other mapped values. - * The iteratee is invoked with three arguments: (value, index|key, array). + * The iteratee is invoked with three arguments: (value, index|key, collection). * * @static * @memberOf _ - * @category Array - * @param {Array} array The array to iterate over. + * @category Collection + * @param {Array|Object} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array. + * @returns {Array} Returns the new flattened array. * @example * * function duplicate(n) { @@ -20,9 +20,8 @@ define(['./_arrayMap', './_baseFlatten', './_baseIteratee'], function(arrayMap, * _.flatMap([1, 2], duplicate); * // => [1, 1, 2, 2] */ - function flatMap(array, iteratee) { - var length = array ? array.length : 0; - return length ? baseFlatten(arrayMap(array, baseIteratee(iteratee, 3))) : []; + function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee)); } return flatMap; diff --git a/groupBy.js b/groupBy.js index bfd42c01a..d1ea4ab4a 100644 --- a/groupBy.js +++ b/groupBy.js @@ -23,7 +23,7 @@ define(['./_createAggregator'], function(createAggregator) { * _.groupBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': [4.2], '6': [6.1, 6.3] } * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ diff --git a/indexOf.js b/indexOf.js index 546af4d64..de535b2db 100644 --- a/indexOf.js +++ b/indexOf.js @@ -7,8 +7,7 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) { * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` - * performs a faster binary search. + * from the end of `array`. * * @static * @memberOf _ @@ -22,7 +21,7 @@ define(['./_baseIndexOf', './toInteger'], function(baseIndexOf, toInteger) { * _.indexOf([1, 2, 1, 2], 2); * // => 1 * - * // using `fromIndex` + * // Search from the `fromIndex`. * _.indexOf([1, 2, 1, 2], 2, 2); * // => 3 */ diff --git a/intersectionBy.js b/intersectionBy.js index f58b4a320..2a5eea52f 100644 --- a/intersectionBy.js +++ b/intersectionBy.js @@ -19,7 +19,7 @@ define(['./_arrayMap', './_baseIntersection', './_baseIteratee', './last', './re * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }] */ diff --git a/iteratee.js b/iteratee.js index 48c8bdeec..8c23415d9 100644 --- a/iteratee.js +++ b/iteratee.js @@ -1,4 +1,4 @@ -define(['./_baseIteratee', './isArray', './isObjectLike', './matches'], function(baseIteratee, isArray, isObjectLike, matches) { +define(['./_baseClone', './_baseIteratee'], function(baseClone, baseIteratee) { /** * Creates a function that invokes `func` with the arguments of the created @@ -18,7 +18,7 @@ define(['./_baseIteratee', './isArray', './isObjectLike', './matches'], function * { 'user': 'fred', 'age': 40 } * ]; * - * // create custom iteratee shorthands + * // Create custom iteratee shorthands. * _.iteratee = _.wrap(_.iteratee, function(callback, func) { * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func); * return !p ? callback(func) : function(object) { @@ -30,9 +30,7 @@ define(['./_baseIteratee', './isArray', './isObjectLike', './matches'], function * // => [{ 'user': 'fred', 'age': 40 }] */ function iteratee(func) { - return (isObjectLike(func) && !isArray(func)) - ? matches(func) - : baseIteratee(func); + return baseIteratee(typeof func == 'function' ? func : baseClone(func, true)); } return iteratee; diff --git a/lastIndexOf.js b/lastIndexOf.js index e22f21f3b..ae2dc71f8 100644 --- a/lastIndexOf.js +++ b/lastIndexOf.js @@ -23,7 +23,7 @@ define(['./_indexOfNaN', './toInteger'], function(indexOfNaN, toInteger) { * _.lastIndexOf([1, 2, 1, 2], 2); * // => 3 * - * // using `fromIndex` + * // Search from the `fromIndex`. * _.lastIndexOf([1, 2, 1, 2], 2, 2); * // => 1 */ diff --git a/main.js b/main.js index 74c3dbac4..a1cbdf230 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ /** * @license - * lodash 4.1.0 (Custom Build) + * lodash 4.2.0 (Custom Build) * Build: `lodash exports="amd" -d -o ./main.js` * Copyright 2012-2016 The Dojo Foundation * Based on Underscore.js 1.8.3 @@ -13,7 +13,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.1.0'; + var VERSION = '4.2.0'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -394,11 +394,11 @@ * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. - * @param {...*} [args] The arguments to invoke `func` with. + * @param {...*} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { - var length = args ? args.length : 0; + var length = args.length; switch (length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); @@ -838,7 +838,7 @@ result = result === undefined ? current : (result + current); } } - return length ? result : 0; + return result; } /** @@ -1251,14 +1251,14 @@ * lodash.isFunction(lodash.bar); * // => true * - * // using `context` to mock `Date#getTime` use in `_.now` + * // Use `context` to mock `Date#getTime` use in `_.now`. * var mock = _.runInContext({ * 'Date': function() { * return { 'getTime': getTimeMock }; * } * }); * - * // or creating a suped-up `defer` in Node.js + * // Create a suped-up `defer` in Node.js. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer; */ function runInContext(context) { @@ -1448,11 +1448,11 @@ * * var wrapped = _([1, 2, 3]); * - * // returns an unwrapped value + * // Returns an unwrapped value. * wrapped.reduce(_.add); * // => 6 * - * // returns a wrapped value + * // Returns a wrapped value. * var squares = wrapped.map(square); * * _.isArray(squares); @@ -5468,7 +5468,7 @@ * _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor); * // => [3.1, 1.3] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ @@ -5600,15 +5600,15 @@ * _.dropRightWhile(users, function(o) { return !o.active; }); * // => objects for ['barney'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['barney', 'fred'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.dropRightWhile(users, ['active', false]); * // => objects for ['barney'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.dropRightWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ @@ -5640,15 +5640,15 @@ * _.dropWhile(users, function(o) { return !o.active; }); * // => objects for ['pebbles'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.dropWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['fred', 'pebbles'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.dropWhile(users, ['active', false]); * // => objects for ['pebbles'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.dropWhile(users, 'active'); * // => objects for ['barney', 'fred', 'pebbles'] */ @@ -5719,15 +5719,15 @@ * _.findIndex(users, function(o) { return o.user == 'barney'; }); * // => 0 * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findIndex(users, { 'user': 'fred', 'active': false }); * // => 1 * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findIndex(users, ['active', false]); * // => 0 * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findIndex(users, 'active'); * // => 2 */ @@ -5758,15 +5758,15 @@ * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; }); * // => 2 * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findLastIndex(users, { 'user': 'barney', 'active': true }); * // => 0 * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findLastIndex(users, ['active', false]); * // => 2 * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findLastIndex(users, 'active'); * // => 0 */ @@ -5776,31 +5776,6 @@ : -1; } - /** - * Creates an array of flattened values by running each element in `array` - * through `iteratee` and concating its result to the other mapped values. - * The iteratee is invoked with three arguments: (value, index|key, array). - * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to iterate over. - * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. - * @returns {Array} Returns the new array. - * @example - * - * function duplicate(n) { - * return [n, n]; - * } - * - * _.flatMap([1, 2], duplicate); - * // => [1, 1, 2, 2] - */ - function flatMap(array, iteratee) { - var length = array ? array.length : 0; - return length ? baseFlatten(arrayMap(array, getIteratee(iteratee, 3))) : []; - } - /** * Flattens `array` a single level. * @@ -5888,8 +5863,7 @@ * Gets the index at which the first occurrence of `value` is found in `array` * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. If `fromIndex` is negative, it's used as the offset - * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` - * performs a faster binary search. + * from the end of `array`. * * @static * @memberOf _ @@ -5903,7 +5877,7 @@ * _.indexOf([1, 2, 1, 2], 2); * // => 1 * - * // using `fromIndex` + * // Search from the `fromIndex`. * _.indexOf([1, 2, 1, 2], 2, 2); * // => 3 */ @@ -5974,7 +5948,7 @@ * _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }] */ @@ -6077,7 +6051,7 @@ * _.lastIndexOf([1, 2, 1, 2], 2); * // => 3 * - * // using `fromIndex` + * // Search from the `fromIndex`. * _.lastIndexOf([1, 2, 1, 2], 2, 2); * // => 1 */ @@ -6353,7 +6327,7 @@ * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); * // => 1 * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 0 */ @@ -6421,7 +6395,7 @@ * @returns {number} Returns the index at which `value` should be inserted into `array`. * @example * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * // => 1 */ @@ -6488,7 +6462,7 @@ * @example * * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor); - * // => [1.1, 2.2] + * // => [1.1, 2.3] */ function sortedUniqBy(array, iteratee) { return (array && array.length) @@ -6601,15 +6575,15 @@ * _.takeRightWhile(users, function(o) { return !o.active; }); * // => objects for ['fred', 'pebbles'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false }); * // => objects for ['pebbles'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.takeRightWhile(users, ['active', false]); * // => objects for ['fred', 'pebbles'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.takeRightWhile(users, 'active'); * // => [] */ @@ -6641,15 +6615,15 @@ * _.takeWhile(users, function(o) { return !o.active; }); * // => objects for ['barney', 'fred'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.takeWhile(users, { 'user': 'barney', 'active': false }); * // => objects for ['barney'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.takeWhile(users, ['active', false]); * // => objects for ['barney', 'fred'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.takeWhile(users, 'active'); * // => [] */ @@ -6694,7 +6668,7 @@ * _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [2.1, 1.2, 4.3] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ @@ -6771,7 +6745,7 @@ * _.uniqBy([2.1, 1.2, 2.3], Math.floor); * // => [2.1, 1.2] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ @@ -6927,7 +6901,7 @@ * _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor); * // => [1.2, 4.3] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 2 }] */ @@ -7082,10 +7056,9 @@ } /** - * This method invokes `interceptor` and returns `value`. The interceptor is - * invoked with one argument; (value). The purpose of this method is to "tap into" - * a method chain in order to perform operations on intermediate results within - * the chain. + * This method invokes `interceptor` and returns `value`. The interceptor + * is invoked with one argument; (value). The purpose of this method is to + * "tap into" a method chain in order to modify intermediate results. * * @static * @memberOf _ @@ -7097,6 +7070,7 @@ * * _([1, 2, 3]) * .tap(function(array) { + * // Mutate input array. * array.pop(); * }) * .reverse() @@ -7110,6 +7084,8 @@ /** * This method is like `_.tap` except that it returns the result of `interceptor`. + * The purpose of this method is to "pass thru" values replacing intermediate + * results in a method chain. * * @static * @memberOf _ @@ -7185,11 +7161,11 @@ * { 'user': 'fred', 'age': 40 } * ]; * - * // without explicit chaining + * // A sequence without explicit chaining. * _(users).head(); * // => { 'user': 'barney', 'age': 36 } * - * // with explicit chaining + * // A sequence with explicit chaining. * _(users) * .chain() * .head() @@ -7444,15 +7420,15 @@ * { 'user': 'fred', 'active': false } * ]; * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.every(users, { 'user': 'barney', 'active': false }); * // => false * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.every(users, ['active', false]); * // => true * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.every(users, 'active'); * // => false */ @@ -7485,15 +7461,15 @@ * _.filter(users, function(o) { return !o.active; }); * // => objects for ['fred'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.filter(users, { 'age': 36, 'active': true }); * // => objects for ['barney'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.filter(users, ['active', false]); * // => objects for ['fred'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.filter(users, 'active'); * // => objects for ['barney'] */ @@ -7524,15 +7500,15 @@ * _.find(users, function(o) { return o.age < 40; }); * // => object for 'barney' * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.find(users, { 'age': 1, 'active': true }); * // => object for 'pebbles' * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.find(users, ['active', false]); * // => object for 'fred' * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.find(users, 'active'); * // => object for 'barney' */ @@ -7571,6 +7547,30 @@ return baseFind(collection, predicate, baseEachRight); } + /** + * Creates an array of flattened values by running each element in `collection` + * through `iteratee` and concating its result to the other mapped values. + * The iteratee is invoked with three arguments: (value, index|key, collection). + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @returns {Array} Returns the new flattened array. + * @example + * + * function duplicate(n) { + * return [n, n]; + * } + * + * _.flatMap([1, 2], duplicate); + * // => [1, 1, 2, 2] + */ + function flatMap(collection, iteratee) { + return baseFlatten(map(collection, iteratee)); + } + /** * Iterates over elements of `collection` invoking `iteratee` for each element. * The iteratee is invoked with three arguments: (value, index|key, collection). @@ -7646,7 +7646,7 @@ * _.groupBy([6.1, 4.2, 6.3], Math.floor); * // => { '4': [4.2], '6': [6.1, 6.3] } * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ @@ -7802,7 +7802,7 @@ * { 'user': 'fred' } * ]; * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.map(users, 'user'); * // => ['barney', 'fred'] */ @@ -7834,7 +7834,7 @@ * { 'user': 'barney', 'age': 36 } * ]; * - * // sort by `user` in ascending order and by `age` in descending order + * // Sort by `user` in ascending order and by `age` in descending order. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']); * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ @@ -7875,15 +7875,15 @@ * _.partition(users, function(o) { return o.active; }); * // => objects for [['fred'], ['barney', 'pebbles']] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.partition(users, { 'age': 1, 'active': false }); * // => objects for [['pebbles'], ['barney', 'fred']] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.partition(users, ['active', false]); * // => objects for [['barney', 'pebbles'], ['fred']] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.partition(users, 'active'); * // => objects for [['fred'], ['barney', 'pebbles']] */ @@ -7980,15 +7980,15 @@ * _.reject(users, function(o) { return !o.active; }); * // => objects for ['fred'] * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.reject(users, { 'age': 40, 'active': true }); * // => objects for ['barney'] * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.reject(users, ['active', false]); * // => objects for ['fred'] * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.reject(users, 'active'); * // => objects for ['barney'] */ @@ -8127,15 +8127,15 @@ * { 'user': 'fred', 'active': false } * ]; * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.some(users, { 'user': 'barney', 'active': false }); * // => false * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.some(users, ['active', false]); * // => true * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.some(users, 'active'); * // => true */ @@ -8335,7 +8335,7 @@ * bound('!'); * // => 'hi fred!' * - * // using placeholders + * // Bound with placeholders. * var bound = _.bind(greet, object, _, '!'); * bound('hi'); * // => 'hi fred!' @@ -8388,7 +8388,7 @@ * bound('!'); * // => 'hiya fred!' * - * // using placeholders + * // Bound with placeholders. * var bound = _.bindKey(object, 'greet', _, '!'); * bound('hi'); * // => 'hiya fred!' @@ -8438,7 +8438,7 @@ * curried(1, 2, 3); * // => [1, 2, 3] * - * // using placeholders + * // Curried with placeholders. * curried(1)(_, 3)(2); * // => [1, 2, 3] */ @@ -8482,7 +8482,7 @@ * curried(1, 2, 3); * // => [1, 2, 3] * - * // using placeholders + * // Curried with placeholders. * curried(3)(1, _)(2); * // => [1, 2, 3] */ @@ -8525,21 +8525,21 @@ * @returns {Function} Returns the new debounced function. * @example * - * // avoid costly calculations while the window size is in flux + * // Avoid costly calculations while the window size is in flux. * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); * - * // invoke `sendMail` when clicked, debouncing subsequent calls + * // Invoke `sendMail` when clicked, debouncing subsequent calls. * jQuery(element).on('click', _.debounce(sendMail, 300, { * 'leading': true, * 'trailing': false * })); * - * // ensure `batchLog` is invoked once after 1 second of debounced calls + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); * var source = new EventSource('/stream'); * jQuery(source).on('message', debounced); * - * // cancel a trailing debounced invocation + * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ function debounce(func, wait, options) { @@ -8672,7 +8672,7 @@ * _.defer(function(text) { * console.log(text); * }, 'deferred'); - * // logs 'deferred' after one or more milliseconds + * // => logs 'deferred' after one or more milliseconds */ var defer = rest(function(func, args) { return baseDelay(func, 1, args); @@ -8755,12 +8755,12 @@ * values(object); * // => [1, 2] * - * // modifying the result cache + * // Modify the result cache. * values.cache.set(object, ['a', 'b']); * values(object); * // => ['a', 'b'] * - * // replacing `_.memoize.Cache` + * // Replace `_.memoize.Cache`. * _.memoize.Cache = WeakMap; */ function memoize(func, resolver) { @@ -8905,7 +8905,7 @@ * sayHelloTo('fred'); * // => 'hello fred' * - * // using placeholders + * // Partially applied with placeholders. * var greetFred = _.partial(greet, _, 'fred'); * greetFred('hi'); * // => 'hi fred' @@ -8941,7 +8941,7 @@ * greetFred('hi'); * // => 'hi fred' * - * // using placeholders + * // Partially applied with placeholders. * var sayHelloTo = _.partialRight(greet, 'hello', _); * sayHelloTo('fred'); * // => 'hello fred' @@ -9038,6 +9038,7 @@ * @memberOf _ * @category Function * @param {Function} func The function to spread arguments over. + * @param {number} [start=0] The start position of the spread. * @returns {Function} Returns the new function. * @example * @@ -9048,7 +9049,6 @@ * say(['fred', 'hello']); * // => 'fred says hello' * - * // with a Promise * var numbers = Promise.all([ * Promise.resolve(40), * Promise.resolve(36) @@ -9059,13 +9059,20 @@ * })); * // => a Promise of 76 */ - function spread(func) { + function spread(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - return function(array) { - return apply(func, this, array); - }; + start = start === undefined ? 0 : nativeMax(toInteger(start), 0); + return rest(function(args) { + var array = args[start], + otherArgs = args.slice(0, start); + + if (array) { + arrayPush(otherArgs, array); + } + return apply(func, this, otherArgs); + }); } /** @@ -9098,14 +9105,14 @@ * @returns {Function} Returns the new throttled function. * @example * - * // avoid excessively updating the position while scrolling + * // Avoid excessively updating the position while scrolling. * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); * - * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes + * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); * jQuery(element).on('click', throttled); * - * // cancel a trailing throttled invocation + * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ function throttle(func, wait, options) { @@ -10724,15 +10731,15 @@ * _.findKey(users, function(o) { return o.age < 40; }); * // => 'barney' (iteration order is not guaranteed) * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findKey(users, { 'age': 1, 'active': true }); * // => 'pebbles' * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findKey(users, ['active', false]); * // => 'fred' * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findKey(users, 'active'); * // => 'barney' */ @@ -10761,15 +10768,15 @@ * _.findLastKey(users, function(o) { return o.age < 40; }); * // => returns 'pebbles' assuming `_.findKey` returns 'barney' * - * // using the `_.matches` iteratee shorthand + * // The `_.matches` iteratee shorthand. * _.findLastKey(users, { 'age': 36, 'active': true }); * // => 'barney' * - * // using the `_.matchesProperty` iteratee shorthand + * // The `_.matchesProperty` iteratee shorthand. * _.findLastKey(users, ['active', false]); * // => 'fred' * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.findLastKey(users, 'active'); * // => 'pebbles' */ @@ -11242,7 +11249,7 @@ * _.mapValues(users, function(o) { return o.age; }); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) * - * // using the `_.property` iteratee shorthand + * // The `_.property` iteratee shorthand. * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ @@ -11296,6 +11303,8 @@ * method instead. The `customizer` is invoked with seven arguments: * (objValue, srcValue, key, object, source, stack). * + * **Note:** This method mutates `object`. + * * @static * @memberOf _ * @category Object @@ -11402,7 +11411,7 @@ /** * Creates an object composed of the `object` properties `predicate` returns - * truthy for. The predicate is invoked with one argument: (value). + * truthy for. The predicate is invoked with two arguments: (value, key). * * @static * @memberOf _ @@ -11469,6 +11478,8 @@ * are created for all other missing properties. Use `_.setWith` to customize * `path` creation. * + * **Note:** This method mutates `object`. + * * @static * @memberOf _ * @category Object @@ -11498,6 +11509,8 @@ * path creation is handled by the method instead. The `customizer` is invoked * with three arguments: (nsValue, key, nsObject). * + * **Note:** This method mutates `object`. + * * @static * @memberOf _ * @category Object @@ -11617,6 +11630,8 @@ /** * Removes the property at `path` of `object`. * + * **Note:** This method mutates `object`. + * * @static * @memberOf _ * @category Object @@ -12406,54 +12421,54 @@ * @returns {Function} Returns the compiled template function. * @example * - * // using the "interpolate" delimiter to create a compiled template + * // Use the "interpolate" delimiter to create a compiled template. * var compiled = _.template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' * - * // using the HTML "escape" delimiter to escape data property values + * // Use the HTML "escape" delimiter to escape data property values. * var compiled = _.template('<%- value %>'); * compiled({ 'value': '