diff --git a/README.md b/README.md
index 50edc6245d..11abd86ea0 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash v4.1.0
+# lodash v4.2.0
The [lodash](https://lodash.com/) library exported as a [UMD](https://github.com/umdjs/umd) module.
@@ -11,13 +11,13 @@ $ lodash core -o ./dist/lodash.core.js
## Community
-[](https://gitter.im/lodash/lodash)
+[](https://gitter.im/lodash/lodash)
## Module formats
-Lodash is also available in a variety of other builds & module formats.
+Lodash is available in a variety of other builds & module formats.
- * [lodash](https://www.npmjs.com/package/lodash) & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) packages
+ * [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized)
* [lodash-amd](https://www.npmjs.com/package/lodash-amd)
* [lodash-es](https://www.npmjs.com/package/lodash-es) & [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash)
diff --git a/dist/lodash.core.js b/dist/lodash.core.js
index cdb750ecad..168de56635 100644
--- a/dist/lodash.core.js
+++ b/dist/lodash.core.js
@@ -1,6 +1,6 @@
/**
* @license
- * lodash 4.1.0 (Custom Build)
+ * lodash 4.2.0 (Custom Build)
* Build: `lodash core -o ./dist/lodash.core.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,
@@ -472,11 +472,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);
@@ -1516,8 +1516,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 _
@@ -1531,7 +1530,7 @@
* _.indexOf([1, 2, 1, 2], 2);
* // => 1
*
- * // using `fromIndex`
+ * // Search from the `fromIndex`.
* _.indexOf([1, 2, 1, 2], 2, 2);
* // => 3
*/
@@ -1629,10 +1628,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 _
@@ -1644,6 +1642,7 @@
*
* _([1, 2, 3])
* .tap(function(array) {
+ * // Mutate input array.
* array.pop();
* })
* .reverse()
@@ -1657,6 +1656,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 _
@@ -1693,11 +1694,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()
@@ -1750,15 +1751,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
*/
@@ -1788,15 +1789,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']
*/
@@ -1826,15 +1827,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'
*/
@@ -1911,7 +1912,7 @@
* { 'user': 'fred' }
* ];
*
- * // using the `_.property` iteratee shorthand
+ * // The `_.property` iteratee shorthand.
* _.map(users, 'user');
* // => ['barney', 'fred']
*/
@@ -2008,15 +2009,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
*/
@@ -2134,7 +2135,7 @@
* bound('!');
* // => 'hi fred!'
*
- * // using placeholders
+ * // Bound with placeholders.
* var bound = _.bind(greet, object, _, '!');
* bound('hi');
* // => 'hi fred!'
@@ -2158,7 +2159,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);
@@ -3442,7 +3443,7 @@
* { '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) {
diff --git a/dist/lodash.core.min.js b/dist/lodash.core.min.js
index 608ebd491d..00e6aa1f28 100644
--- a/dist/lodash.core.min.js
+++ b/dist/lodash.core.min.js
@@ -1,6 +1,6 @@
/**
* @license
- * lodash 4.1.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
+ * lodash 4.2.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash core -o ./dist/lodash.core.js`
*/
;(function(){function n(n,t){for(var r=-1,e=t.length,u=n.length;++rr&&!u||!a||c&&!o&&i||f&&i){r=-1;break n}}r=0}return r||n.b-t.b}),E("c"))},a.tap=function(n,t){return t(n),n},a.thru=function(n,t){return t(n)},a.toArray=function(n){return L(n)?n.length?k(n):[]:on(n)},a.values=on,a.extend=Hn,fn(a,a),a.clone=function(n){return X(n)?Mn(n)?k(n):T(n,en(n)):n},a.escape=function(n){return(n=rn(n))&&pn.test(n)?n.replace(ln,i):n},a.every=function(n,t,r){return t=r?an:t,h(n,m(t))},a.find=G,a.forEach=J,a.has=function(n,t){return null!=n&&xn.call(n,t)},a.head=C,
a.identity=cn,a.indexOf=function(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?Rn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r 1 && !mapping.skipRearg[name]) {
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
}
- if (indexes) {
- result = iterateeRearg(result, indexes);
- } else if (n) {
- result = iterateeAry(result, n);
+ if (reargIndexes) {
+ result = iterateeRearg(result, reargIndexes);
+ } else if (aryN) {
+ result = iterateeAry(result, aryN);
}
if (cap > 1) {
result = curry(result, cap);
@@ -273,11 +279,14 @@ return /******/ (function(modules) { // webpackBootstrap
if (!isLib) {
return wrap(name, func);
}
+ // Add placeholder alias.
+ _.__ = placeholder;
+
// Iterate over methods for the current ary cap.
var pairs = [];
each(mapping.caps, function(cap) {
each(mapping.aryMethod[cap], function(key) {
- var func = _[mapping.key[key] || key];
+ var func = _[mapping.rename[key] || key];
if (func) {
pairs.push([key, wrap(key, func)]);
}
@@ -311,9 +320,12 @@ return /******/ (function(modules) { // webpackBootstrap
'all': 'some',
'allPass': 'overEvery',
'apply': 'spread',
+ 'assoc': 'set',
+ 'assocPath': 'set',
'compose': 'flowRight',
'contains': 'includes',
- 'dissoc': 'omit',
+ 'dissoc': 'unset',
+ 'dissocPath': 'unset',
'each': 'forEach',
'eachRight': 'forEachRight',
'equals': 'isEqual',
@@ -340,53 +352,13 @@ return /******/ (function(modules) { // webpackBootstrap
'zipObj': 'zipObject'
};
- /** Used to map method names to their iteratee ary. */
- exports.aryIteratee = {
- 'assignWith': 2,
- 'assignInWith': 2,
- 'cloneDeepWith': 1,
- 'cloneWith': 1,
- 'dropRightWhile': 1,
- 'dropWhile': 1,
- 'every': 1,
- 'filter': 1,
- 'find': 1,
- 'findIndex': 1,
- 'findKey': 1,
- 'findLast': 1,
- 'findLastIndex': 1,
- 'findLastKey': 1,
- 'flatMap': 1,
- 'forEach': 1,
- 'forEachRight': 1,
- 'forIn': 1,
- 'forInRight': 1,
- 'forOwn': 1,
- 'forOwnRight': 1,
- 'isEqualWith': 2,
- 'isMatchWith': 2,
- 'map': 1,
- 'mapKeys': 1,
- 'mapValues': 1,
- 'partition': 1,
- 'reduce': 2,
- 'reduceRight': 2,
- 'reject': 1,
- 'remove': 1,
- 'some': 1,
- 'takeRightWhile': 1,
- 'takeWhile': 1,
- 'times': 1,
- 'transform': 2
- };
-
/** Used to map ary to method names. */
exports.aryMethod = {
1: [
'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs',
'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over',
'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
- 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
+ 'spread', 'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
],
2: [
'add', 'after', 'ary', 'assign', 'assignIn', 'at', 'before', 'bind', 'bindKey',
@@ -400,13 +372,14 @@ return /******/ (function(modules) { // webpackBootstrap
'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf', 'lt', 'lte', 'map',
'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
- 'partition', 'pick', 'pickBy', 'pull', 'pullAll', 'pullAt', 'random', 'range',
- 'rangeRight', 'rearg', 'reject', 'remove', 'repeat', 'result', 'sampleSize',
- 'some', 'sortBy', 'sortedIndex', 'sortedIndexOf', 'sortedLastIndex',
- 'sortedLastIndexOf', 'sortedUniqBy', 'split', 'startsWith', 'subtract',
- 'sumBy', 'take', 'takeRight', 'takeRightWhile', 'takeWhile', 'tap', 'throttle',
- 'thru', 'times', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset', 'unzipWith',
- 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
+ 'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
+ 'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
+ 'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
+ 'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
+ 'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
+ 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'truncate', 'union', 'uniqBy',
+ 'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
+ 'zipObjectDeep'
],
3: [
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
@@ -427,6 +400,49 @@ return /******/ (function(modules) { // webpackBootstrap
4: [3, 2, 0, 1]
};
+ /** Used to iterate `mapping.aryMethod` keys. */
+ exports.caps = [1, 2, 3, 4];
+
+ /** Used to map method names to their iteratee ary. */
+ exports.iterateeAry = {
+ 'assignWith': 2,
+ 'assignInWith': 2,
+ 'cloneDeepWith': 1,
+ 'cloneWith': 1,
+ 'dropRightWhile': 1,
+ 'dropWhile': 1,
+ 'every': 1,
+ 'filter': 1,
+ 'find': 1,
+ 'findIndex': 1,
+ 'findKey': 1,
+ 'findLast': 1,
+ 'findLastIndex': 1,
+ 'findLastKey': 1,
+ 'flatMap': 1,
+ 'forEach': 1,
+ 'forEachRight': 1,
+ 'forIn': 1,
+ 'forInRight': 1,
+ 'forOwn': 1,
+ 'forOwnRight': 1,
+ 'isEqualWith': 2,
+ 'isMatchWith': 2,
+ 'map': 1,
+ 'mapKeys': 1,
+ 'mapValues': 1,
+ 'partition': 1,
+ 'reduce': 2,
+ 'reduceRight': 2,
+ 'reject': 1,
+ 'remove': 1,
+ 'some': 1,
+ 'takeRightWhile': 1,
+ 'takeWhile': 1,
+ 'times': 1,
+ 'transform': 2
+ };
+
/** Used to map method names to iteratee rearg configs. */
exports.iterateeRearg = {
'findKey': [1],
@@ -448,14 +464,10 @@ return /******/ (function(modules) { // webpackBootstrap
'transform': [2, 0, 1]
};
- /** Used to iterate `mapping.aryMethod` keys. */
- exports.caps = [1, 2, 3, 4];
-
- /** Used to map keys to other keys. */
- exports.key = {
- 'curryN': 'curry',
- 'curryRightN': 'curryRight',
- 'getOr': 'get'
+ /** Used to map method names to spread configs. */
+ exports.methodSpread = {
+ 'partial': 1,
+ 'partialRight': 1
};
/** Used to identify methods which mutate arrays or objects. */
@@ -481,7 +493,8 @@ return /******/ (function(modules) { // webpackBootstrap
},
'set': {
'set': true,
- 'setWith': true
+ 'setWith': true,
+ 'unset': true
}
};
@@ -512,6 +525,13 @@ return /******/ (function(modules) { // webpackBootstrap
return result;
}());
+ /** Used to map method names to other names. */
+ exports.rename = {
+ 'curryN': 'curry',
+ 'curryRightN': 'curryRight',
+ 'getOr': 'get'
+ };
+
/** Used to track methods that skip `_.rearg`. */
exports.skipRearg = {
'assign': true,
@@ -520,6 +540,8 @@ return /******/ (function(modules) { // webpackBootstrap
'difference': true,
'matchesProperty': true,
'merge': true,
+ 'partial': true,
+ 'partialRight': true,
'random': true,
'range': true,
'rangeRight': true,
diff --git a/dist/lodash.fp.min.js b/dist/lodash.fp.min.js
index 549b8f2ec3..95b66bc79b 100644
--- a/dist/lodash.fp.min.js
+++ b/dist/lodash.fp.min.js
@@ -1,11 +1,12 @@
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.fp=t():e.fp=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){function n(e){return i(e,e)}var i=r(1);e.exports=n},function(e,t,r){function n(e,t,r){
-if("function"!=typeof r&&(r=t,t=void 0),null==r)throw new TypeError;var s=void 0===t&&"string"==typeof r.VERSION,u=s?r:{ary:e.ary,cloneDeep:e.cloneDeep,curry:e.curry,forEach:e.forEach,isFunction:e.isFunction,iteratee:e.iteratee,keys:e.keys,rearg:e.rearg},c=u.ary,p=u.cloneDeep,f=u.curry,l=u.forEach,h=u.isFunction,d=u.keys,y=u.rearg,g=function(e,t){return 2==t?function(t,r){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}},m=function(e,t){return 2==t?function(t,r){return e(t,r);
-}:function(t){return e(t)}},v=function(e){for(var t=e?e.length:0,r=Array(t);t--;)r[t]=e[t];return r},W=function(e){return function(t){return e({},t)}},R=function(e,t){return O(e,t,!0)},x=function(e,t){return O(e,function(e){return m(e,t)})},I=function(e,t){return O(e,function(e){var r=t.length;return g(y(m(e,r),t),r)})},O=function(e,t,r){return function(){for(var n=arguments.length,i=Array(n);n--;)i[n]=arguments[n];i[0]=t(i[0]);var a=e.apply(void 0,i);return r?i[0]:a}},b={iteratee:function(e){return function(){
-var t=arguments[0],r=arguments[1];r=r>2?r-2:1,t=e(t);var n=t.length;return n&&r>=n?t:m(t,r)}},mixin:function(e){return function(t){var r=this;if(!h(r))return e(r,Object(t));var n=[],i=[];return l(d(t),function(e){var a=t[e];h(a)&&(i.push(e),n.push(r.prototype[e]))}),e(r,Object(t)),l(i,function(e,t){var i=n[t];h(i)?r.prototype[e]=i:delete r.prototype[e]}),r}},runInContext:function(t){return function(r){return n(e,t(r))}}},k=function(e,t){e=i.aliasToReal[e]||e;var r=b[e];if(r)return r(t);a.array[e]?t=R(t,v):a.object[e]?t=R(t,W(t)):a.set[e]&&(t=R(t,p));
-var n;return l(i.caps,function(r){return l(i.aryMethod[r],function(a){if(e==a){var o=i.iterateeRearg[e],u=!s&&i.aryIteratee[e];return n=c(t,r),r>1&&!i.skipRearg[e]&&(n=y(n,i.methodRearg[e]||i.aryRearg[r])),o?n=I(n,o):u&&(n=x(n,u)),r>1&&(n=f(n,r)),!1}}),!n}),n||(n=t),i.placeholder[e]&&(n.placeholder=o),n};if(!s)return k(t,r);var B=[];return l(i.caps,function(e){l(i.aryMethod[e],function(e){var t=u[i.key[e]||e];t&&B.push([e,k(e,t)])})}),l(B,function(e){u[e[0]]=e[1]}),l(d(u),function(e){l(i.realToAlias[e]||[],function(t){
-u[t]=u[e]})}),u}var i=r(2),a=i.mutate,o={};e.exports=n},function(e,t){t.aliasToReal={all:"some",allPass:"overEvery",apply:"spread",compose:"flowRight",contains:"includes",dissoc:"omit",each:"forEach",eachRight:"forEachRight",equals:"isEqual",extend:"assignIn",extendWith:"assignInWith",first:"head",init:"initial",mapObj:"mapValues",omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",pickAll:"pick",pipe:"flow",prop:"get",propOf:"propertyOf",propOr:"getOr",somePass:"overSome",
-unapply:"rest",unnest:"flatten",useWith:"overArgs",whereEq:"filter",zipObj:"zipObject"},t.aryIteratee={assignWith:2,assignInWith:2,cloneDeepWith:1,cloneWith:1,dropRightWhile:1,dropWhile:1,every:1,filter:1,find:1,findIndex:1,findKey:1,findLast:1,findLastIndex:1,findLastKey:1,flatMap:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,isEqualWith:2,isMatchWith:2,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,
-transform:2},t.aryMethod={1:["attempt","ceil","create","curry","curryRight","floor","fromPairs","invert","iteratee","memoize","method","methodOf","mixin","over","overEvery","overSome","rest","reverse","round","runInContext","template","trim","trimEnd","trimStart","uniqueId","words"],2:["add","after","ary","assign","assignIn","at","before","bind","bindKey","chunk","cloneDeepWith","cloneWith","concat","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","delay","difference","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","merge","minBy","omit","omitBy","orderBy","overArgs","pad","padEnd","padStart","parseInt","partition","pick","pickBy","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],
-3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","getOr","inRange","intersectionBy","intersectionWith","isEqualWith","isMatchWith","mergeWith","pullAllBy","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","xorBy","xorWith","zipWith"],4:["fill","setWith"]},t.aryRearg={2:[1,0],3:[2,1,0],4:[3,2,0,1]},t.iterateeRearg={findKey:[1],findLastKey:[1],mapKeys:[1]},t.methodRearg={assignInWith:[1,2,0],assignWith:[1,2,0],
-clamp:[2,0,1],mergeWith:[1,2,0],reduce:[2,0,1],reduceRight:[2,0,1],set:[2,0,1],setWith:[3,1,2,0],slice:[2,0,1],transform:[2,0,1]},t.caps=[1,2,3,4],t.key={curryN:"curry",curryRightN:"curryRight",getOr:"get"},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignIn:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsDeep:!0,merge:!0,mergeWith:!0},set:{set:!0,setWith:!0}},t.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0
-},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,r=t.aliasToReal,n={};for(var i in r){var a=r[i];e.call(n,a)?n[a].push(i):n[a]=[i]}return n}(),t.skipRearg={assign:!0,assignIn:!0,concat:!0,difference:!0,matchesProperty:!0,merge:!0,random:!0,range:!0,rangeRight:!0,zip:!0,zipObject:!0}}])});
\ No newline at end of file
+if("function"!=typeof r&&(r=t,t=void 0),null==r)throw new TypeError;var s=void 0===t&&"string"==typeof r.VERSION,u=s?r:{ary:e.ary,cloneDeep:e.cloneDeep,curry:e.curry,forEach:e.forEach,isFunction:e.isFunction,iteratee:e.iteratee,keys:e.keys,rearg:e.rearg,rest:e.rest},c=u.ary,p=u.cloneDeep,l=u.curry,f=u.forEach,h=u.isFunction,d=u.keys,g=u.rearg,y=u.spread,m=function(e,t){return 2==t?function(t,r){return e.apply(void 0,arguments)}:function(t){return e.apply(void 0,arguments)}},v=function(e,t){return 2==t?function(t,r){
+return e(t,r)}:function(t){return e(t)}},R=function(e){for(var t=e?e.length:0,r=Array(t);t--;)r[t]=e[t];return r},W=function(e){return function(t){return e({},t)}},x=function(e,t){return b(e,t,!0)},I=function(e,t){return b(e,function(e){return v(e,t)})},O=function(e,t){return b(e,function(e){var r=t.length;return m(g(v(e,r),t),r)})},b=function(e,t,r){return function(){for(var n=arguments.length,i=Array(n);n--;)i[n]=arguments[n];i[0]=t(i[0]);var a=e.apply(void 0,i);return r?i[0]:a}},B={iteratee:function(e){
+return function(){var t=arguments[0],r=arguments[1];r=r>2?r-2:1,t=e(t);var n=t.length;return n&&r>=n?t:v(t,r)}},mixin:function(e){return function(t){var r=this;if(!h(r))return e(r,Object(t));var n=[],i=[];return f(d(t),function(e){var a=t[e];h(a)&&(i.push(e),n.push(r.prototype[e]))}),e(r,Object(t)),f(i,function(e,t){var i=n[t];h(i)?r.prototype[e]=i:delete r.prototype[e]}),r}},runInContext:function(t){return function(r){return n(e,t(r))}}},E=function(e,t){e=i.aliasToReal[e]||e;var r=B[e];if(r)return r(t);
+a.array[e]?t=x(t,R):a.object[e]?t=x(t,W(t)):a.set[e]&&(t=x(t,p));var n;return f(i.caps,function(r){return f(i.aryMethod[r],function(a){if(e==a){var o=!s&&i.iterateeAry[e],u=i.iterateeRearg[e],p=i.methodSpread[e];return n=void 0===p?c(t,r):y(t,p),r>1&&!i.skipRearg[e]&&(n=g(n,i.methodRearg[e]||i.aryRearg[r])),u?n=O(n,u):o&&(n=I(n,o)),r>1&&(n=l(n,r)),!1}}),!n}),n||(n=t),i.placeholder[e]&&(n.placeholder=o),n};if(!s)return E(t,r);u.__=o;var k=[];return f(i.caps,function(e){f(i.aryMethod[e],function(e){
+var t=u[i.rename[e]||e];t&&k.push([e,E(e,t)])})}),f(k,function(e){u[e[0]]=e[1]}),f(d(u),function(e){f(i.realToAlias[e]||[],function(t){u[t]=u[e]})}),u}var i=r(2),a=i.mutate,o={};e.exports=n},function(e,t){t.aliasToReal={all:"some",allPass:"overEvery",apply:"spread",assoc:"set",assocPath:"set",compose:"flowRight",contains:"includes",dissoc:"unset",dissocPath:"unset",each:"forEach",eachRight:"forEachRight",equals:"isEqual",extend:"assignIn",extendWith:"assignInWith",first:"head",init:"initial",mapObj:"mapValues",
+omitAll:"omit",nAry:"ary",path:"get",pathEq:"matchesProperty",pathOr:"getOr",pickAll:"pick",pipe:"flow",prop:"get",propOf:"propertyOf",propOr:"getOr",somePass:"overSome",unapply:"rest",unnest:"flatten",useWith:"overArgs",whereEq:"filter",zipObj:"zipObject"},t.aryMethod={1:["attempt","ceil","create","curry","curryRight","floor","fromPairs","invert","iteratee","memoize","method","methodOf","mixin","over","overEvery","overSome","rest","reverse","round","runInContext","spread","template","trim","trimEnd","trimStart","uniqueId","words"],
+2:["add","after","ary","assign","assignIn","at","before","bind","bindKey","chunk","cloneDeepWith","cloneWith","concat","countBy","curryN","curryRightN","debounce","defaults","defaultsDeep","delay","difference","drop","dropRight","dropRightWhile","dropWhile","endsWith","eq","every","filter","find","find","findIndex","findKey","findLast","findLastIndex","findLastKey","flatMap","forEach","forEachRight","forIn","forInRight","forOwn","forOwnRight","get","groupBy","gt","gte","has","hasIn","includes","indexOf","intersection","invertBy","invoke","invokeMap","isEqual","isMatch","join","keyBy","lastIndexOf","lt","lte","map","mapKeys","mapValues","matchesProperty","maxBy","merge","minBy","omit","omitBy","orderBy","overArgs","pad","padEnd","padStart","parseInt","partial","partialRight","partition","pick","pickBy","pull","pullAll","pullAt","random","range","rangeRight","rearg","reject","remove","repeat","result","sampleSize","some","sortBy","sortedIndex","sortedIndexOf","sortedLastIndex","sortedLastIndexOf","sortedUniqBy","split","startsWith","subtract","sumBy","take","takeRight","takeRightWhile","takeWhile","tap","throttle","thru","times","truncate","union","uniqBy","uniqWith","unset","unzipWith","without","wrap","xor","zip","zipObject","zipObjectDeep"],
+3:["assignInWith","assignWith","clamp","differenceBy","differenceWith","getOr","inRange","intersectionBy","intersectionWith","isEqualWith","isMatchWith","mergeWith","pullAllBy","reduce","reduceRight","replace","set","slice","sortedIndexBy","sortedLastIndexBy","transform","unionBy","unionWith","xorBy","xorWith","zipWith"],4:["fill","setWith"]},t.aryRearg={2:[1,0],3:[2,1,0],4:[3,2,0,1]},t.caps=[1,2,3,4],t.iterateeAry={assignWith:2,assignInWith:2,cloneDeepWith:1,cloneWith:1,dropRightWhile:1,dropWhile:1,
+every:1,filter:1,find:1,findIndex:1,findKey:1,findLast:1,findLastIndex:1,findLastKey:1,flatMap:1,forEach:1,forEachRight:1,forIn:1,forInRight:1,forOwn:1,forOwnRight:1,isEqualWith:2,isMatchWith:2,map:1,mapKeys:1,mapValues:1,partition:1,reduce:2,reduceRight:2,reject:1,remove:1,some:1,takeRightWhile:1,takeWhile:1,times:1,transform:2},t.iterateeRearg={findKey:[1],findLastKey:[1],mapKeys:[1]},t.methodRearg={assignInWith:[1,2,0],assignWith:[1,2,0],clamp:[2,0,1],mergeWith:[1,2,0],reduce:[2,0,1],reduceRight:[2,0,1],
+set:[2,0,1],setWith:[3,1,2,0],slice:[2,0,1],transform:[2,0,1]},t.methodSpread={partial:1,partialRight:1},t.mutate={array:{fill:!0,pull:!0,pullAll:!0,pullAllBy:!0,pullAt:!0,remove:!0,reverse:!0},object:{assign:!0,assignIn:!0,assignInWith:!0,assignWith:!0,defaults:!0,defaultsDeep:!0,merge:!0,mergeWith:!0},set:{set:!0,setWith:!0,unset:!0}},t.placeholder={bind:!0,bindKey:!0,curry:!0,curryRight:!0,partial:!0,partialRight:!0},t.realToAlias=function(){var e=Object.prototype.hasOwnProperty,r=t.aliasToReal,n={};
+for(var i in r){var a=r[i];e.call(n,a)?n[a].push(i):n[a]=[i]}return n}(),t.rename={curryN:"curry",curryRightN:"curryRight",getOr:"get"},t.skipRearg={assign:!0,assignIn:!0,concat:!0,difference:!0,matchesProperty:!0,merge:!0,partial:!0,partialRight:!0,random:!0,range:!0,rangeRight:!0,zip:!0,zipObject:!0}}])});
\ No newline at end of file
diff --git a/dist/lodash.js b/dist/lodash.js
index a5c9206ee1..45efdb3f59 100644
--- a/dist/lodash.js
+++ b/dist/lodash.js
@@ -1,6 +1,6 @@
/**
* @license
- * lodash 4.1.0 (Custom Build)
+ * lodash 4.2.0 (Custom Build)
* Build: `lodash -o ./dist/lodash.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,
@@ -397,11 +397,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]);
@@ -841,7 +841,7 @@
result = result === undefined ? current : (result + current);
}
}
- return length ? result : 0;
+ return result;
}
/**
@@ -1254,14 +1254,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) {
@@ -1451,11 +1451,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);
@@ -5471,7 +5471,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 }]
*/
@@ -5603,15 +5603,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']
*/
@@ -5643,15 +5643,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']
*/
@@ -5722,15 +5722,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
*/
@@ -5761,15 +5761,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
*/
@@ -5779,31 +5779,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.
*
@@ -5891,8 +5866,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 _
@@ -5906,7 +5880,7 @@
* _.indexOf([1, 2, 1, 2], 2);
* // => 1
*
- * // using `fromIndex`
+ * // Search from the `fromIndex`.
* _.indexOf([1, 2, 1, 2], 2, 2);
* // => 3
*/
@@ -5977,7 +5951,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 }]
*/
@@ -6080,7 +6054,7 @@
* _.lastIndexOf([1, 2, 1, 2], 2);
* // => 3
*
- * // using `fromIndex`
+ * // Search from the `fromIndex`.
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
* // => 1
*/
@@ -6356,7 +6330,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
*/
@@ -6424,7 +6398,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
*/
@@ -6491,7 +6465,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)
@@ -6604,15 +6578,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');
* // => []
*/
@@ -6644,15 +6618,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');
* // => []
*/
@@ -6697,7 +6671,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 }]
*/
@@ -6774,7 +6748,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 }]
*/
@@ -6930,7 +6904,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 }]
*/
@@ -7085,10 +7059,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 _
@@ -7100,6 +7073,7 @@
*
* _([1, 2, 3])
* .tap(function(array) {
+ * // Mutate input array.
* array.pop();
* })
* .reverse()
@@ -7113,6 +7087,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 _
@@ -7188,11 +7164,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()
@@ -7447,15 +7423,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
*/
@@ -7488,15 +7464,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']
*/
@@ -7527,15 +7503,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'
*/
@@ -7574,6 +7550,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).
@@ -7649,7 +7649,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'] }
*/
@@ -7805,7 +7805,7 @@
* { 'user': 'fred' }
* ];
*
- * // using the `_.property` iteratee shorthand
+ * // The `_.property` iteratee shorthand.
* _.map(users, 'user');
* // => ['barney', 'fred']
*/
@@ -7837,7 +7837,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]]
*/
@@ -7878,15 +7878,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']]
*/
@@ -7983,15 +7983,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']
*/
@@ -8130,15 +8130,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
*/
@@ -8338,7 +8338,7 @@
* bound('!');
* // => 'hi fred!'
*
- * // using placeholders
+ * // Bound with placeholders.
* var bound = _.bind(greet, object, _, '!');
* bound('hi');
* // => 'hi fred!'
@@ -8391,7 +8391,7 @@
* bound('!');
* // => 'hiya fred!'
*
- * // using placeholders
+ * // Bound with placeholders.
* var bound = _.bindKey(object, 'greet', _, '!');
* bound('hi');
* // => 'hiya fred!'
@@ -8441,7 +8441,7 @@
* curried(1, 2, 3);
* // => [1, 2, 3]
*
- * // using placeholders
+ * // Curried with placeholders.
* curried(1)(_, 3)(2);
* // => [1, 2, 3]
*/
@@ -8485,7 +8485,7 @@
* curried(1, 2, 3);
* // => [1, 2, 3]
*
- * // using placeholders
+ * // Curried with placeholders.
* curried(3)(1, _)(2);
* // => [1, 2, 3]
*/
@@ -8528,21 +8528,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) {
@@ -8675,7 +8675,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);
@@ -8758,12 +8758,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) {
@@ -8908,7 +8908,7 @@
* sayHelloTo('fred');
* // => 'hello fred'
*
- * // using placeholders
+ * // Partially applied with placeholders.
* var greetFred = _.partial(greet, _, 'fred');
* greetFred('hi');
* // => 'hi fred'
@@ -8944,7 +8944,7 @@
* greetFred('hi');
* // => 'hi fred'
*
- * // using placeholders
+ * // Partially applied with placeholders.
* var sayHelloTo = _.partialRight(greet, 'hello', _);
* sayHelloTo('fred');
* // => 'hello fred'
@@ -9041,6 +9041,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
*
@@ -9051,7 +9052,6 @@
* say(['fred', 'hello']);
* // => 'fred says hello'
*
- * // with a Promise
* var numbers = Promise.all([
* Promise.resolve(40),
* Promise.resolve(36)
@@ -9062,13 +9062,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);
+ });
}
/**
@@ -9101,14 +9108,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) {
@@ -10727,15 +10734,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'
*/
@@ -10764,15 +10771,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'
*/
@@ -11245,7 +11252,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)
*/
@@ -11299,6 +11306,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
@@ -11405,7 +11414,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 _
@@ -11472,6 +11481,8 @@
* are created for all other missing properties. Use `_.setWith` to customize
* `path` creation.
*
+ * **Note:** This method mutates `object`.
+ *
* @static
* @memberOf _
* @category Object
@@ -11501,6 +11512,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
@@ -11620,6 +11633,8 @@
/**
* Removes the property at `path` of `object`.
*
+ * **Note:** This method mutates `object`.
+ *
* @static
* @memberOf _
* @category Object
@@ -12409,54 +12424,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': '
-
+
+