lodash-rails 4.12.0 → 4.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/lodash/rails/version.rb +1 -1
- data/vendor/assets/javascripts/lodash.core.js +130 -226
- data/vendor/assets/javascripts/lodash.core.min.js +25 -25
- data/vendor/assets/javascripts/lodash.js +397 -235
- data/vendor/assets/javascripts/lodash.min.js +120 -118
- metadata +2 -2
@@ -1,28 +1,28 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* lodash
|
3
|
+
* lodash (Custom Build) /license | Underscore.js 1.8.3 underscorejs.org/LICENSE
|
4
|
+
* Build: `lodash core -o ./dist/lodash.core.js`
|
4
5
|
*/
|
5
|
-
;(function(){function n(n
|
6
|
-
|
7
|
-
}
|
8
|
-
c||(a=
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
function
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Vn(u)?u:[],n)}return this[r](function(r){return t.apply(Vn(r)?r:[],n)})}}),c.prototype.toJSON=c.prototype.valueOf=c.prototype.value=function(){return F(this.__wrapped__,this.__actions__)},(wn||mn||{})._=c,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){return c}):_n&&dn?(jn&&((dn.exports=c)._=c),_n._=c):On._=c}).call(this);
|
6
|
+
;(function(){function n(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function t(n){return mn(Object(n))}function r(n,t){return n.push.apply(n,t),n}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return x(t,function(t){return n[t]})}function o(n){return n&&n.Object===Object?n:null}function i(n){return cn[n]}function c(n){return n instanceof f?n:new f(n)}function f(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function a(n,t,r,e){
|
7
|
+
var u;return(u=n===rn)||(u=hn[r],u=(n===u||n!==n&&u!==u)&&!vn.call(e,r)),u?t:n}function l(n){return L(n)?_n(n):{}}function p(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(rn,r)},t)}function s(n,t){var r=true;return xn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function h(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===rn?i===i:r(i,c)))var c=i,f=o}return f}function v(n,t){var r=[];return xn(n,function(n,e,u){t(n,e,u)&&r.push(n);
|
8
|
+
}),r}function y(n,t,e,u,o){var i=-1,c=n.length;for(e||(e=z),o||(o=[]);++i<c;){var f=n[i];t>0&&e(f)?t>1?y(f,t-1,e,u,o):r(o,f):u||(o[o.length]=f)}return o}function b(n,r){return n&&En(n,r,t)}function g(n,t){return v(t,function(t){return K(n[t])})}function _(n,t){return n>t}function j(n,t,r,e,u){return n===t?true:null==n||null==t||!L(n)&&!Q(t)?n!==n&&t!==t:d(n,t,j,r,e,u)}function d(n,t,r,e,u,o){var i=Tn(n),c=Tn(t),f="[object Array]",a="[object Array]";i||(f=bn.call(n),f="[object Arguments]"==f?"[object Object]":f),
|
9
|
+
c||(a=bn.call(t),a="[object Arguments]"==a?"[object Object]":a);var l="[object Object]"==f&&true,c="[object Object]"==a&&true,a=f==a;o||(o=[]);var p=kn(o,function(t){return t[0]===n});return p&&p[1]?p[1]==t:(o.push([n,t]),a&&!l?(r=i?I(n,t,r,e,u,o):q(n,t,f),o.pop(),r):2&u||(i=l&&vn.call(n,"__wrapped__"),f=c&&vn.call(t,"__wrapped__"),!i&&!f)?a?(r=$(n,t,r,e,u,o),o.pop(),r):false:(i=i?n.value():n,t=f?t.value():t,r=r(i,t,e,u,o),o.pop(),r))}function m(n){return typeof n=="function"?n:null==n?nn:(typeof n=="object"?E:w)(n);
|
10
|
+
}function O(n,t){return t>n}function x(n,t){var r=-1,e=H(n)?Array(n.length):[];return xn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function E(n){var r=t(n);return function(t){var e=r.length;if(null==t)return!e;for(t=Object(t);e--;){var u=r[e];if(!(u in t&&j(n[u],t[u],rn,3)))return false}return true}}function A(n,t){return n=Object(n),M(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function w(n){return function(t){return null==t?rn:t[n]}}function k(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,
|
11
|
+
0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function N(n){return k(n,0,n.length)}function S(n,t){var r;return xn(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function F(n,t){return M(t,function(n,t){return t.func.apply(t.thisArg,r([n],t.args))},n)}function T(n,t,r,e){r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u],c=e?e(r[i],n[i],i,r,n):n[i],f=r,a=f[i];vn.call(f,i)&&(a===c||a!==a&&c!==c)&&(c!==rn||i in f)||(f[i]=c)}return r}function B(n){return U(function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:rn,o=n.length>3&&typeof o=="function"?(u--,
|
12
|
+
o):rn;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,e,o)}return t})}function R(n){return function(){var t=arguments,r=l(n.prototype),t=n.apply(r,t);return L(t)?t:r}}function D(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i),l=this&&this!==pn&&this instanceof e?u:n;++c<f;)a[c]=r[c];for(;i--;)a[c++]=arguments[++o];return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=R(n);return e}function I(n,t,r,e,u,o){var i=n.length,c=t.length;
|
13
|
+
if(i!=c&&!(2&u&&c>i))return false;for(var c=-1,f=true,a=1&u?[]:rn;++c<i;){var l=n[c],p=t[c];if(void 0!==rn){f=false;break}if(a){if(!S(t,function(n,t){return G(a,t)||l!==n&&!r(l,n,e,u,o)?void 0:a.push(t)})){f=false;break}}else if(l!==p&&!r(l,p,e,u,o)){f=false;break}}return f}function q(n,t,r){switch(r){case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":return n.name==t.name&&n.message==t.message;case"[object Number]":return n!=+n?t!=+t:n==+t;case"[object RegExp]":case"[object String]":return n==t+"";
|
14
|
+
}return false}function $(n,r,e,u,o,i){var c=2&o,f=t(n),a=f.length,l=t(r).length;if(a!=l&&!c)return false;for(var p=a;p--;){var s=f[p];if(!(c?s in r:vn.call(r,s)))return false}for(l=true;++p<a;){var s=f[p],h=n[s],v=r[s];if(void 0!==rn||h!==v&&!e(h,v,u,o,i)){l=false;break}c||(c="constructor"==s)}return l&&!c&&(e=n.constructor,u=r.constructor,e!=u&&"constructor"in n&&"constructor"in r&&!(typeof e=="function"&&e instanceof e&&typeof u=="function"&&u instanceof u)&&(l=false)),l}function z(n){return Tn(n)||V(n)}function C(n){
|
15
|
+
return n&&n.length?n[0]:rn}function G(n,t,r){var e=n?n.length:0;r=typeof r=="number"?0>r?On(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1}function J(n,t){return xn(n,m(t))}function M(n,t,r){return e(n,m(t),r,3>arguments.length,xn)}function P(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Bn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=rn),r}}function U(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");
|
16
|
+
return t=On(t===rn?n.length-1:Bn(t),0),function(){for(var r=arguments,e=-1,u=On(r.length-t,0),o=Array(u);++e<u;)o[e]=r[t+e];for(u=Array(t+1),e=-1;++e<t;)u[e]=r[e];return u[t]=o,n.apply(this,u)}}function V(n){return Q(n)&&H(n)&&vn.call(n,"callee")&&(!jn.call(n,"callee")||"[object Arguments]"==bn.call(n))}function H(n){var t;return(t=null!=n)&&(t=An(n),t=typeof t=="number"&&t>-1&&0==t%1&&9007199254740991>=t),t&&!K(n)}function K(n){return n=L(n)?bn.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n;
|
17
|
+
}function L(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function Q(n){return!!n&&typeof n=="object"}function W(n){return typeof n=="number"||Q(n)&&"[object Number]"==bn.call(n)}function X(n){return typeof n=="string"||!Tn(n)&&Q(n)&&"[object String]"==bn.call(n)}function Y(n){return typeof n=="string"?n:null==n?"":n+""}function Z(n){return n?u(n,t(n)):[]}function nn(n){return n}function tn(n,e,u){var o=t(e),i=g(e,o);null!=u||L(e)&&(i.length||!o.length)||(u=e,e=n,n=this,i=g(e,t(e)));var c=!(L(u)&&"chain"in u&&!u.chain),f=K(n);
|
18
|
+
return xn(i,function(t){var u=e[t];n[t]=u,f&&(n.prototype[t]=function(){var t=this.__chain__;if(c||t){var e=n(this.__wrapped__);return(e.__actions__=N(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=t,e}return u.apply(n,r([this.value()],arguments))})}),n}var rn,en=1/0,un=/[&<>"'`]/g,on=RegExp(un.source),cn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},fn=typeof exports=="object"&&exports,an=fn&&typeof module=="object"&&module,ln=o(typeof self=="object"&&self),pn=o(typeof global=="object"&&global)||ln||o(typeof this=="object"&&this)||Function("return this")(),sn=Array.prototype,hn=Object.prototype,vn=hn.hasOwnProperty,yn=0,bn=hn.toString,gn=pn._,_n=Object.create,jn=hn.propertyIsEnumerable,dn=pn.isFinite,mn=Object.keys,On=Math.max;
|
19
|
+
f.prototype=l(c.prototype),f.prototype.constructor=f;var xn=function(n,t){return function(r,e){if(null==r)return r;if(!H(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}(b),En=function(n){return function(t,r,e){var u=-1,o=Object(t);e=e(t);for(var i=e.length;i--;){var c=e[n?i:++u];if(false===r(o[c],c,o))break}return t}}(),An=w("length"),wn=String,kn=function(n){return function(r,e,u){var o=Object(r);if(e=m(e),!H(r))var i=t(r);return u=n(i||r,function(n,t){
|
20
|
+
return i&&(t=n,n=o[t]),e(n,t,o)},u),u>-1?r[i?i[u]:u]:rn}}(function(n,t,r){var e=n?n.length:0;if(!e)return-1;r=null==r?0:Bn(r),0>r&&(r=On(e+r,0));n:{for(t=m(t),e=n.length,r+=-1;++r<e;)if(t(n[r],r,n)){n=r;break n}n=-1}return n}),Nn=U(function(n,t,r){return D(n,t,r)}),Sn=U(function(n,t){return p(n,1,t)}),Fn=U(function(n,t,r){return p(n,Rn(t)||0,r)}),Tn=Array.isArray,Bn=Number,Rn=Number,Dn=B(function(n,r){T(r,t(r),n)}),In=B(function(t,r){T(r,n(r),t)}),qn=B(function(t,r,e,u){T(r,n(r),t,u)}),$n=U(function(n){
|
21
|
+
return n.push(rn,a),qn.apply(rn,n)}),zn=U(function(n,t){return null==n?{}:A(n,x(y(t,1),wn))});c.assignIn=In,c.before=P,c.bind=Nn,c.chain=function(n){return n=c(n),n.__chain__=true,n},c.compact=function(n){return v(n,Boolean)},c.concat=function(){for(var n=arguments.length,t=Array(n?n-1:0),e=arguments[0],u=n;u--;)t[u-1]=arguments[u];return n?r(Tn(e)?N(e):[e],y(t,1)):[]},c.create=function(n,t){var r=l(n);return t?Dn(r,t):r},c.defaults=$n,c.defer=Sn,c.delay=Fn,c.filter=function(n,t){return v(n,m(t))},
|
22
|
+
c.flatten=function(n){return n&&n.length?y(n,1):[]},c.flattenDeep=function(n){return n&&n.length?y(n,en):[]},c.iteratee=m,c.keys=t,c.map=function(n,t){return x(n,m(t))},c.matches=function(n){return E(Dn({},n))},c.mixin=tn,c.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},c.once=function(n){return P(2,n)},c.pick=zn,c.slice=function(n,t,r){var e=n?n.length:0;return r=r===rn?e:+r,e?k(n,null==t?0:+t,r):[]},c.sortBy=function(n,t){
|
23
|
+
var r=0;return t=m(t),x(x(n,function(n,e,u){return{value:n,index:r++,criteria:t(n,e,u)}}).sort(function(n,t){var r;n:{r=n.criteria;var e=t.criteria;if(r!==e){var u=r!==rn,o=null===r,i=r===r,c=e!==rn,f=null===e,a=e===e;if(!f&&r>e||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&e>r||f&&u&&i||!c&&i||!a){r=-1;break n}}r=0}return r||n.index-t.index}),w("value"))},c.tap=function(n,t){return t(n),n},c.thru=function(n,t){return t(n)},c.toArray=function(n){return H(n)?n.length?N(n):[]:Z(n)},c.values=Z,c.extend=In,
|
24
|
+
tn(c,c),c.clone=function(n){return L(n)?Tn(n)?N(n):T(n,t(n)):n},c.escape=function(n){return(n=Y(n))&&on.test(n)?n.replace(un,i):n},c.every=function(n,t,r){return t=r?rn:t,s(n,m(t))},c.find=kn,c.forEach=J,c.has=function(n,t){return null!=n&&vn.call(n,t)},c.head=C,c.identity=nn,c.indexOf=G,c.isArguments=V,c.isArray=Tn,c.isBoolean=function(n){return true===n||false===n||Q(n)&&"[object Boolean]"==bn.call(n)},c.isDate=function(n){return Q(n)&&"[object Date]"==bn.call(n)},c.isEmpty=function(n){return H(n)&&(Tn(n)||X(n)||K(n.splice)||V(n))?!n.length:!t(n).length;
|
25
|
+
},c.isEqual=function(n,t){return j(n,t)},c.isFinite=function(n){return typeof n=="number"&&dn(n)},c.isFunction=K,c.isNaN=function(n){return W(n)&&n!=+n},c.isNull=function(n){return null===n},c.isNumber=W,c.isObject=L,c.isRegExp=function(n){return L(n)&&"[object RegExp]"==bn.call(n)},c.isString=X,c.isUndefined=function(n){return n===rn},c.last=function(n){var t=n?n.length:0;return t?n[t-1]:rn},c.max=function(n){return n&&n.length?h(n,nn,_):rn},c.min=function(n){return n&&n.length?h(n,nn,O):rn},c.noConflict=function(){
|
26
|
+
return pn._===this&&(pn._=gn),this},c.noop=function(){},c.reduce=M,c.result=function(n,t,r){return t=null==n?rn:n[t],t===rn&&(t=r),K(t)?t.call(n):t},c.size=function(n){return null==n?0:(n=H(n)?n:t(n),n.length)},c.some=function(n,t,r){return t=r?rn:t,S(n,m(t))},c.uniqueId=function(n){var t=++yn;return Y(n)+t},c.each=J,c.first=C,tn(c,function(){var n={};return b(c,function(t,r){vn.call(c.prototype,r)||(n[r]=t)}),n}(),{chain:false}),c.VERSION="4.13.1",xn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){
|
27
|
+
var t=(/^(?:replace|split)$/.test(n)?String.prototype:sn)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);c.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Tn(u)?u:[],n)}return this[r](function(r){return t.apply(Tn(r)?r:[],n)})}}),c.prototype.toJSON=c.prototype.valueOf=c.prototype.value=function(){return F(this.__wrapped__,this.__actions__)},(ln||{})._=c,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){
|
28
|
+
return c}):an?((an.exports=c)._=c,fn._=c):pn._=c}).call(this);
|
@@ -12,7 +12,7 @@
|
|
12
12
|
var undefined;
|
13
13
|
|
14
14
|
/** Used as the semantic version number. */
|
15
|
-
var VERSION = '4.
|
15
|
+
var VERSION = '4.13.1';
|
16
16
|
|
17
17
|
/** Used as the size to enable large array optimizations. */
|
18
18
|
var LARGE_ARRAY_SIZE = 200;
|
@@ -116,7 +116,7 @@
|
|
116
116
|
/** Used to match property names within property paths. */
|
117
117
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
118
118
|
reIsPlainProp = /^\w*$/,
|
119
|
-
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
|
119
|
+
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g;
|
120
120
|
|
121
121
|
/**
|
122
122
|
* Used to match `RegExp`
|
@@ -249,7 +249,7 @@
|
|
249
249
|
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
250
250
|
'Promise', 'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError',
|
251
251
|
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
252
|
-
'_', '
|
252
|
+
'_', 'isFinite', 'parseInt', 'setTimeout'
|
253
253
|
];
|
254
254
|
|
255
255
|
/** Used to make template sourceURLs easier to identify. */
|
@@ -328,12 +328,6 @@
|
|
328
328
|
'`': '`'
|
329
329
|
};
|
330
330
|
|
331
|
-
/** Used to determine if values are of the language type `Object`. */
|
332
|
-
var objectTypes = {
|
333
|
-
'function': true,
|
334
|
-
'object': true
|
335
|
-
};
|
336
|
-
|
337
331
|
/** Used to escape characters for inclusion in compiled string literals. */
|
338
332
|
var stringEscapes = {
|
339
333
|
'\\': '\\',
|
@@ -349,41 +343,25 @@
|
|
349
343
|
freeParseInt = parseInt;
|
350
344
|
|
351
345
|
/** Detect free variable `exports`. */
|
352
|
-
var freeExports =
|
353
|
-
? exports
|
354
|
-
: undefined;
|
346
|
+
var freeExports = typeof exports == 'object' && exports;
|
355
347
|
|
356
348
|
/** Detect free variable `module`. */
|
357
|
-
var freeModule =
|
358
|
-
? module
|
359
|
-
: undefined;
|
349
|
+
var freeModule = freeExports && typeof module == 'object' && module;
|
360
350
|
|
361
351
|
/** Detect the popular CommonJS extension `module.exports`. */
|
362
|
-
var moduleExports =
|
363
|
-
? freeExports
|
364
|
-
: undefined;
|
352
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
365
353
|
|
366
354
|
/** Detect free variable `global` from Node.js. */
|
367
|
-
var freeGlobal = checkGlobal(
|
355
|
+
var freeGlobal = checkGlobal(typeof global == 'object' && global);
|
368
356
|
|
369
357
|
/** Detect free variable `self`. */
|
370
|
-
var freeSelf = checkGlobal(
|
371
|
-
|
372
|
-
/** Detect free variable `window`. */
|
373
|
-
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
|
358
|
+
var freeSelf = checkGlobal(typeof self == 'object' && self);
|
374
359
|
|
375
360
|
/** Detect `this` as the global object. */
|
376
|
-
var thisGlobal = checkGlobal(
|
361
|
+
var thisGlobal = checkGlobal(typeof this == 'object' && this);
|
377
362
|
|
378
|
-
/**
|
379
|
-
|
380
|
-
*
|
381
|
-
* The `this` value is used if it's the global object to avoid Greasemonkey's
|
382
|
-
* restricted `window` object, otherwise the `window` object is used.
|
383
|
-
*/
|
384
|
-
var root = freeGlobal ||
|
385
|
-
((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
|
386
|
-
freeSelf || thisGlobal || Function('return this')();
|
363
|
+
/** Used as a reference to the global object. */
|
364
|
+
var root = freeGlobal || freeSelf || thisGlobal || Function('return this')();
|
387
365
|
|
388
366
|
/*--------------------------------------------------------------------------*/
|
389
367
|
|
@@ -439,7 +417,7 @@
|
|
439
417
|
* A specialized version of `baseAggregator` for arrays.
|
440
418
|
*
|
441
419
|
* @private
|
442
|
-
* @param {Array} array The array to iterate over.
|
420
|
+
* @param {Array} [array] The array to iterate over.
|
443
421
|
* @param {Function} setter The function to set `accumulator` values.
|
444
422
|
* @param {Function} iteratee The iteratee to transform keys.
|
445
423
|
* @param {Object} accumulator The initial aggregated object.
|
@@ -447,7 +425,7 @@
|
|
447
425
|
*/
|
448
426
|
function arrayAggregator(array, setter, iteratee, accumulator) {
|
449
427
|
var index = -1,
|
450
|
-
length = array.length;
|
428
|
+
length = array ? array.length : 0;
|
451
429
|
|
452
430
|
while (++index < length) {
|
453
431
|
var value = array[index];
|
@@ -461,13 +439,13 @@
|
|
461
439
|
* iteratee shorthands.
|
462
440
|
*
|
463
441
|
* @private
|
464
|
-
* @param {Array} array The array to iterate over.
|
442
|
+
* @param {Array} [array] The array to iterate over.
|
465
443
|
* @param {Function} iteratee The function invoked per iteration.
|
466
444
|
* @returns {Array} Returns `array`.
|
467
445
|
*/
|
468
446
|
function arrayEach(array, iteratee) {
|
469
447
|
var index = -1,
|
470
|
-
length = array.length;
|
448
|
+
length = array ? array.length : 0;
|
471
449
|
|
472
450
|
while (++index < length) {
|
473
451
|
if (iteratee(array[index], index, array) === false) {
|
@@ -482,12 +460,12 @@
|
|
482
460
|
* iteratee shorthands.
|
483
461
|
*
|
484
462
|
* @private
|
485
|
-
* @param {Array} array The array to iterate over.
|
463
|
+
* @param {Array} [array] The array to iterate over.
|
486
464
|
* @param {Function} iteratee The function invoked per iteration.
|
487
465
|
* @returns {Array} Returns `array`.
|
488
466
|
*/
|
489
467
|
function arrayEachRight(array, iteratee) {
|
490
|
-
var length = array.length;
|
468
|
+
var length = array ? array.length : 0;
|
491
469
|
|
492
470
|
while (length--) {
|
493
471
|
if (iteratee(array[length], length, array) === false) {
|
@@ -502,14 +480,14 @@
|
|
502
480
|
* iteratee shorthands.
|
503
481
|
*
|
504
482
|
* @private
|
505
|
-
* @param {Array} array The array to iterate over.
|
483
|
+
* @param {Array} [array] The array to iterate over.
|
506
484
|
* @param {Function} predicate The function invoked per iteration.
|
507
485
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
508
486
|
* else `false`.
|
509
487
|
*/
|
510
488
|
function arrayEvery(array, predicate) {
|
511
489
|
var index = -1,
|
512
|
-
length = array.length;
|
490
|
+
length = array ? array.length : 0;
|
513
491
|
|
514
492
|
while (++index < length) {
|
515
493
|
if (!predicate(array[index], index, array)) {
|
@@ -524,13 +502,13 @@
|
|
524
502
|
* iteratee shorthands.
|
525
503
|
*
|
526
504
|
* @private
|
527
|
-
* @param {Array} array The array to iterate over.
|
505
|
+
* @param {Array} [array] The array to iterate over.
|
528
506
|
* @param {Function} predicate The function invoked per iteration.
|
529
507
|
* @returns {Array} Returns the new filtered array.
|
530
508
|
*/
|
531
509
|
function arrayFilter(array, predicate) {
|
532
510
|
var index = -1,
|
533
|
-
length = array.length,
|
511
|
+
length = array ? array.length : 0,
|
534
512
|
resIndex = 0,
|
535
513
|
result = [];
|
536
514
|
|
@@ -548,26 +526,27 @@
|
|
548
526
|
* specifying an index to search from.
|
549
527
|
*
|
550
528
|
* @private
|
551
|
-
* @param {Array} array The array to search.
|
529
|
+
* @param {Array} [array] The array to search.
|
552
530
|
* @param {*} target The value to search for.
|
553
531
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
554
532
|
*/
|
555
533
|
function arrayIncludes(array, value) {
|
556
|
-
|
534
|
+
var length = array ? array.length : 0;
|
535
|
+
return !!length && baseIndexOf(array, value, 0) > -1;
|
557
536
|
}
|
558
537
|
|
559
538
|
/**
|
560
539
|
* This function is like `arrayIncludes` except that it accepts a comparator.
|
561
540
|
*
|
562
541
|
* @private
|
563
|
-
* @param {Array} array The array to search.
|
542
|
+
* @param {Array} [array] The array to search.
|
564
543
|
* @param {*} target The value to search for.
|
565
544
|
* @param {Function} comparator The comparator invoked per element.
|
566
545
|
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
567
546
|
*/
|
568
547
|
function arrayIncludesWith(array, value, comparator) {
|
569
548
|
var index = -1,
|
570
|
-
length = array.length;
|
549
|
+
length = array ? array.length : 0;
|
571
550
|
|
572
551
|
while (++index < length) {
|
573
552
|
if (comparator(value, array[index])) {
|
@@ -582,13 +561,13 @@
|
|
582
561
|
* shorthands.
|
583
562
|
*
|
584
563
|
* @private
|
585
|
-
* @param {Array} array The array to iterate over.
|
564
|
+
* @param {Array} [array] The array to iterate over.
|
586
565
|
* @param {Function} iteratee The function invoked per iteration.
|
587
566
|
* @returns {Array} Returns the new mapped array.
|
588
567
|
*/
|
589
568
|
function arrayMap(array, iteratee) {
|
590
569
|
var index = -1,
|
591
|
-
length = array.length,
|
570
|
+
length = array ? array.length : 0,
|
592
571
|
result = Array(length);
|
593
572
|
|
594
573
|
while (++index < length) {
|
@@ -621,7 +600,7 @@
|
|
621
600
|
* iteratee shorthands.
|
622
601
|
*
|
623
602
|
* @private
|
624
|
-
* @param {Array} array The array to iterate over.
|
603
|
+
* @param {Array} [array] The array to iterate over.
|
625
604
|
* @param {Function} iteratee The function invoked per iteration.
|
626
605
|
* @param {*} [accumulator] The initial value.
|
627
606
|
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
@@ -630,7 +609,7 @@
|
|
630
609
|
*/
|
631
610
|
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
632
611
|
var index = -1,
|
633
|
-
length = array.length;
|
612
|
+
length = array ? array.length : 0;
|
634
613
|
|
635
614
|
if (initAccum && length) {
|
636
615
|
accumulator = array[++index];
|
@@ -646,7 +625,7 @@
|
|
646
625
|
* iteratee shorthands.
|
647
626
|
*
|
648
627
|
* @private
|
649
|
-
* @param {Array} array The array to iterate over.
|
628
|
+
* @param {Array} [array] The array to iterate over.
|
650
629
|
* @param {Function} iteratee The function invoked per iteration.
|
651
630
|
* @param {*} [accumulator] The initial value.
|
652
631
|
* @param {boolean} [initAccum] Specify using the last element of `array` as
|
@@ -654,7 +633,7 @@
|
|
654
633
|
* @returns {*} Returns the accumulated value.
|
655
634
|
*/
|
656
635
|
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
657
|
-
var length = array.length;
|
636
|
+
var length = array ? array.length : 0;
|
658
637
|
if (initAccum && length) {
|
659
638
|
accumulator = array[--length];
|
660
639
|
}
|
@@ -669,14 +648,14 @@
|
|
669
648
|
* shorthands.
|
670
649
|
*
|
671
650
|
* @private
|
672
|
-
* @param {Array} array The array to iterate over.
|
651
|
+
* @param {Array} [array] The array to iterate over.
|
673
652
|
* @param {Function} predicate The function invoked per iteration.
|
674
653
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
675
654
|
* else `false`.
|
676
655
|
*/
|
677
656
|
function arraySome(array, predicate) {
|
678
657
|
var index = -1,
|
679
|
-
length = array.length;
|
658
|
+
length = array ? array.length : 0;
|
680
659
|
|
681
660
|
while (++index < length) {
|
682
661
|
if (predicate(array[index], index, array)) {
|
@@ -687,23 +666,21 @@
|
|
687
666
|
}
|
688
667
|
|
689
668
|
/**
|
690
|
-
* The base implementation of methods like `_.
|
691
|
-
* support for iteratee shorthands, which iterates over `collection`
|
692
|
-
* `eachFunc`.
|
669
|
+
* The base implementation of methods like `_.findKey` and `_.findLastKey`,
|
670
|
+
* without support for iteratee shorthands, which iterates over `collection`
|
671
|
+
* using `eachFunc`.
|
693
672
|
*
|
694
673
|
* @private
|
695
674
|
* @param {Array|Object} collection The collection to search.
|
696
675
|
* @param {Function} predicate The function invoked per iteration.
|
697
676
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
698
|
-
* @param {boolean} [retKey] Specify returning the key of the found element
|
699
|
-
* instead of the element itself.
|
700
677
|
* @returns {*} Returns the found element or its key, else `undefined`.
|
701
678
|
*/
|
702
|
-
function
|
679
|
+
function baseFindKey(collection, predicate, eachFunc) {
|
703
680
|
var result;
|
704
681
|
eachFunc(collection, function(value, key, collection) {
|
705
682
|
if (predicate(value, key, collection)) {
|
706
|
-
result =
|
683
|
+
result = key;
|
707
684
|
return false;
|
708
685
|
}
|
709
686
|
});
|
@@ -717,12 +694,13 @@
|
|
717
694
|
* @private
|
718
695
|
* @param {Array} array The array to search.
|
719
696
|
* @param {Function} predicate The function invoked per iteration.
|
697
|
+
* @param {number} fromIndex The index to search from.
|
720
698
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
721
699
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
722
700
|
*/
|
723
|
-
function baseFindIndex(array, predicate, fromRight) {
|
701
|
+
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
724
702
|
var length = array.length,
|
725
|
-
index = fromRight ?
|
703
|
+
index = fromIndex + (fromRight ? 1 : -1);
|
726
704
|
|
727
705
|
while ((fromRight ? index-- : ++index < length)) {
|
728
706
|
if (predicate(array[index], index, array)) {
|
@@ -1029,6 +1007,18 @@
|
|
1029
1007
|
return '\\' + stringEscapes[chr];
|
1030
1008
|
}
|
1031
1009
|
|
1010
|
+
/**
|
1011
|
+
* Gets the value at `key` of `object`.
|
1012
|
+
*
|
1013
|
+
* @private
|
1014
|
+
* @param {Object} [object] The object to query.
|
1015
|
+
* @param {string} key The key of the property to get.
|
1016
|
+
* @returns {*} Returns the property value.
|
1017
|
+
*/
|
1018
|
+
function getValue(object, key) {
|
1019
|
+
return object == null ? undefined : object[key];
|
1020
|
+
}
|
1021
|
+
|
1032
1022
|
/**
|
1033
1023
|
* Gets the index at which the first occurrence of `NaN` is found in `array`.
|
1034
1024
|
*
|
@@ -1040,7 +1030,7 @@
|
|
1040
1030
|
*/
|
1041
1031
|
function indexOfNaN(array, fromIndex, fromRight) {
|
1042
1032
|
var length = array.length,
|
1043
|
-
index = fromIndex + (fromRight ?
|
1033
|
+
index = fromIndex + (fromRight ? 1 : -1);
|
1044
1034
|
|
1045
1035
|
while ((fromRight ? index-- : ++index < length)) {
|
1046
1036
|
var other = array[index];
|
@@ -1231,10 +1221,10 @@
|
|
1231
1221
|
* lodash.isFunction(lodash.bar);
|
1232
1222
|
* // => true
|
1233
1223
|
*
|
1234
|
-
* // Use `context` to
|
1235
|
-
* var
|
1224
|
+
* // Use `context` to stub `Date#getTime` use in `_.now`.
|
1225
|
+
* var stubbed = _.runInContext({
|
1236
1226
|
* 'Date': function() {
|
1237
|
-
* return { 'getTime':
|
1227
|
+
* return { 'getTime': stubGetTime };
|
1238
1228
|
* }
|
1239
1229
|
* });
|
1240
1230
|
*
|
@@ -1256,6 +1246,15 @@
|
|
1256
1246
|
objectProto = context.Object.prototype,
|
1257
1247
|
stringProto = context.String.prototype;
|
1258
1248
|
|
1249
|
+
/** Used to detect overreaching core-js shims. */
|
1250
|
+
var coreJsData = context['__core-js_shared__'];
|
1251
|
+
|
1252
|
+
/** Used to detect methods masquerading as native. */
|
1253
|
+
var maskSrcKey = (function() {
|
1254
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
1255
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
1256
|
+
}());
|
1257
|
+
|
1259
1258
|
/** Used to resolve the decompiled source of functions. */
|
1260
1259
|
var funcToString = context.Function.prototype.toString;
|
1261
1260
|
|
@@ -1289,15 +1288,16 @@
|
|
1289
1288
|
Reflect = context.Reflect,
|
1290
1289
|
Symbol = context.Symbol,
|
1291
1290
|
Uint8Array = context.Uint8Array,
|
1292
|
-
clearTimeout = context.clearTimeout,
|
1293
1291
|
enumerate = Reflect ? Reflect.enumerate : undefined,
|
1294
1292
|
getOwnPropertySymbols = Object.getOwnPropertySymbols,
|
1295
1293
|
iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,
|
1296
1294
|
objectCreate = Object.create,
|
1297
1295
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
1298
|
-
setTimeout = context.setTimeout,
|
1299
1296
|
splice = arrayProto.splice;
|
1300
1297
|
|
1298
|
+
/** Built-in method references that are mockable. */
|
1299
|
+
var setTimeout = function(func, wait) { return context.setTimeout.call(root, func, wait); };
|
1300
|
+
|
1301
1301
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
1302
1302
|
var nativeCeil = Math.ceil,
|
1303
1303
|
nativeFloor = Math.floor,
|
@@ -1419,19 +1419,21 @@
|
|
1419
1419
|
* `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`,
|
1420
1420
|
* `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`,
|
1421
1421
|
* `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`,
|
1422
|
-
* `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
1423
|
-
* `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
1424
|
-
* `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
1425
|
-
* `
|
1426
|
-
* `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
|
1427
|
-
* `
|
1428
|
-
* `
|
1429
|
-
* `
|
1430
|
-
* `
|
1431
|
-
* `
|
1432
|
-
* `
|
1433
|
-
* `
|
1434
|
-
* `
|
1422
|
+
* `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
1423
|
+
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
1424
|
+
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
1425
|
+
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
|
1426
|
+
* `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
|
1427
|
+
* `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
|
1428
|
+
* `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
|
1429
|
+
* `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
|
1430
|
+
* `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
|
1431
|
+
* `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
|
1432
|
+
* `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
|
1433
|
+
* `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
|
1434
|
+
* `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
|
1435
|
+
* `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
|
1436
|
+
* `upperFirst`, `value`, and `words`
|
1435
1437
|
*
|
1436
1438
|
* @name _
|
1437
1439
|
* @constructor
|
@@ -2732,7 +2734,7 @@
|
|
2732
2734
|
* The base implementation of `_.has` without support for deep paths.
|
2733
2735
|
*
|
2734
2736
|
* @private
|
2735
|
-
* @param {Object} object The object to query.
|
2737
|
+
* @param {Object} [object] The object to query.
|
2736
2738
|
* @param {Array|string} key The key to check.
|
2737
2739
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
2738
2740
|
*/
|
@@ -2740,20 +2742,21 @@
|
|
2740
2742
|
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
|
2741
2743
|
// that are composed entirely of index properties, return `false` for
|
2742
2744
|
// `hasOwnProperty` checks of them.
|
2743
|
-
return
|
2744
|
-
(
|
2745
|
+
return object != null &&
|
2746
|
+
(hasOwnProperty.call(object, key) ||
|
2747
|
+
(typeof object == 'object' && key in object && getPrototype(object) === null));
|
2745
2748
|
}
|
2746
2749
|
|
2747
2750
|
/**
|
2748
2751
|
* The base implementation of `_.hasIn` without support for deep paths.
|
2749
2752
|
*
|
2750
2753
|
* @private
|
2751
|
-
* @param {Object} object The object to query.
|
2754
|
+
* @param {Object} [object] The object to query.
|
2752
2755
|
* @param {Array|string} key The key to check.
|
2753
2756
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
2754
2757
|
*/
|
2755
2758
|
function baseHasIn(object, key) {
|
2756
|
-
return key in Object(object);
|
2759
|
+
return object != null && key in Object(object);
|
2757
2760
|
}
|
2758
2761
|
|
2759
2762
|
/**
|
@@ -3007,6 +3010,22 @@
|
|
3007
3010
|
return true;
|
3008
3011
|
}
|
3009
3012
|
|
3013
|
+
/**
|
3014
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
3015
|
+
*
|
3016
|
+
* @private
|
3017
|
+
* @param {*} value The value to check.
|
3018
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
3019
|
+
* else `false`.
|
3020
|
+
*/
|
3021
|
+
function baseIsNative(value) {
|
3022
|
+
if (!isObject(value) || isMasked(value)) {
|
3023
|
+
return false;
|
3024
|
+
}
|
3025
|
+
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
3026
|
+
return pattern.test(toSource(value));
|
3027
|
+
}
|
3028
|
+
|
3010
3029
|
/**
|
3011
3030
|
* The base implementation of `_.iteratee`.
|
3012
3031
|
*
|
@@ -3375,6 +3394,9 @@
|
|
3375
3394
|
length = values.length,
|
3376
3395
|
seen = array;
|
3377
3396
|
|
3397
|
+
if (array === values) {
|
3398
|
+
values = copyArray(values);
|
3399
|
+
}
|
3378
3400
|
if (iteratee) {
|
3379
3401
|
seen = arrayMap(array, baseUnary(iteratee));
|
3380
3402
|
}
|
@@ -4527,6 +4549,31 @@
|
|
4527
4549
|
return wrapper;
|
4528
4550
|
}
|
4529
4551
|
|
4552
|
+
/**
|
4553
|
+
* Creates a `_.find` or `_.findLast` function.
|
4554
|
+
*
|
4555
|
+
* @private
|
4556
|
+
* @param {Function} findIndexFunc The function to find the collection index.
|
4557
|
+
* @returns {Function} Returns the new find function.
|
4558
|
+
*/
|
4559
|
+
function createFind(findIndexFunc) {
|
4560
|
+
return function(collection, predicate, fromIndex) {
|
4561
|
+
var iterable = Object(collection);
|
4562
|
+
predicate = getIteratee(predicate, 3);
|
4563
|
+
if (!isArrayLike(collection)) {
|
4564
|
+
var props = keys(collection);
|
4565
|
+
}
|
4566
|
+
var index = findIndexFunc(props || collection, function(value, key) {
|
4567
|
+
if (props) {
|
4568
|
+
key = value;
|
4569
|
+
value = iterable[key];
|
4570
|
+
}
|
4571
|
+
return predicate(value, key, iterable);
|
4572
|
+
}, fromIndex);
|
4573
|
+
return index > -1 ? collection[props ? props[index] : index] : undefined;
|
4574
|
+
};
|
4575
|
+
}
|
4576
|
+
|
4530
4577
|
/**
|
4531
4578
|
* Creates a `_.flow` or `_.flowRight` function.
|
4532
4579
|
*
|
@@ -4890,7 +4937,7 @@
|
|
4890
4937
|
var func = Math[methodName];
|
4891
4938
|
return function(number, precision) {
|
4892
4939
|
number = toNumber(number);
|
4893
|
-
precision = toInteger(precision);
|
4940
|
+
precision = nativeMin(toInteger(precision), 292);
|
4894
4941
|
if (precision) {
|
4895
4942
|
// Shift with exponential notation to avoid floating-point issues.
|
4896
4943
|
// See [MDN](https://mdn.io/round#Examples) for more details.
|
@@ -5371,11 +5418,14 @@
|
|
5371
5418
|
* @returns {Array} Returns the match data of `object`.
|
5372
5419
|
*/
|
5373
5420
|
function getMatchData(object) {
|
5374
|
-
var result =
|
5421
|
+
var result = keys(object),
|
5375
5422
|
length = result.length;
|
5376
5423
|
|
5377
5424
|
while (length--) {
|
5378
|
-
|
5425
|
+
var key = result[length],
|
5426
|
+
value = object[key];
|
5427
|
+
|
5428
|
+
result[length] = [key, value, isStrictComparable(value)];
|
5379
5429
|
}
|
5380
5430
|
return result;
|
5381
5431
|
}
|
@@ -5389,8 +5439,8 @@
|
|
5389
5439
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
5390
5440
|
*/
|
5391
5441
|
function getNative(object, key) {
|
5392
|
-
var value = object
|
5393
|
-
return
|
5442
|
+
var value = getValue(object, key);
|
5443
|
+
return baseIsNative(value) ? value : undefined;
|
5394
5444
|
}
|
5395
5445
|
|
5396
5446
|
/**
|
@@ -5419,9 +5469,7 @@
|
|
5419
5469
|
|
5420
5470
|
// Fallback for IE < 11.
|
5421
5471
|
if (!getOwnPropertySymbols) {
|
5422
|
-
getSymbols =
|
5423
|
-
return [];
|
5424
|
-
};
|
5472
|
+
getSymbols = stubArray;
|
5425
5473
|
}
|
5426
5474
|
|
5427
5475
|
/**
|
@@ -5753,6 +5801,26 @@
|
|
5753
5801
|
return !!data && func === data[0];
|
5754
5802
|
}
|
5755
5803
|
|
5804
|
+
/**
|
5805
|
+
* Checks if `func` has its source masked.
|
5806
|
+
*
|
5807
|
+
* @private
|
5808
|
+
* @param {Function} func The function to check.
|
5809
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
5810
|
+
*/
|
5811
|
+
function isMasked(func) {
|
5812
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
5813
|
+
}
|
5814
|
+
|
5815
|
+
/**
|
5816
|
+
* Checks if `func` is capable of being masked.
|
5817
|
+
*
|
5818
|
+
* @private
|
5819
|
+
* @param {*} value The value to check.
|
5820
|
+
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
5821
|
+
*/
|
5822
|
+
var isMaskable = coreJsData ? isFunction : stubFalse;
|
5823
|
+
|
5756
5824
|
/**
|
5757
5825
|
* Checks if `value` is likely a prototype object.
|
5758
5826
|
*
|
@@ -6149,8 +6217,8 @@
|
|
6149
6217
|
* @see _.without, _.xor
|
6150
6218
|
* @example
|
6151
6219
|
*
|
6152
|
-
* _.difference([
|
6153
|
-
* // => [
|
6220
|
+
* _.difference([2, 1], [2, 3]);
|
6221
|
+
* // => [1]
|
6154
6222
|
*/
|
6155
6223
|
var difference = rest(function(array, values) {
|
6156
6224
|
return isArrayLikeObject(array)
|
@@ -6175,8 +6243,8 @@
|
|
6175
6243
|
* @returns {Array} Returns the new array of filtered values.
|
6176
6244
|
* @example
|
6177
6245
|
*
|
6178
|
-
* _.differenceBy([
|
6179
|
-
* // => [
|
6246
|
+
* _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
6247
|
+
* // => [1.2]
|
6180
6248
|
*
|
6181
6249
|
* // The `_.property` iteratee shorthand.
|
6182
6250
|
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
@@ -6428,6 +6496,7 @@
|
|
6428
6496
|
* @param {Array} array The array to search.
|
6429
6497
|
* @param {Array|Function|Object|string} [predicate=_.identity]
|
6430
6498
|
* The function invoked per iteration.
|
6499
|
+
* @param {number} [fromIndex=0] The index to search from.
|
6431
6500
|
* @returns {number} Returns the index of the found element, else `-1`.
|
6432
6501
|
* @example
|
6433
6502
|
*
|
@@ -6452,10 +6521,16 @@
|
|
6452
6521
|
* _.findIndex(users, 'active');
|
6453
6522
|
* // => 2
|
6454
6523
|
*/
|
6455
|
-
function findIndex(array, predicate) {
|
6456
|
-
|
6457
|
-
|
6458
|
-
|
6524
|
+
function findIndex(array, predicate, fromIndex) {
|
6525
|
+
var length = array ? array.length : 0;
|
6526
|
+
if (!length) {
|
6527
|
+
return -1;
|
6528
|
+
}
|
6529
|
+
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
6530
|
+
if (index < 0) {
|
6531
|
+
index = nativeMax(length + index, 0);
|
6532
|
+
}
|
6533
|
+
return baseFindIndex(array, getIteratee(predicate, 3), index);
|
6459
6534
|
}
|
6460
6535
|
|
6461
6536
|
/**
|
@@ -6469,6 +6544,7 @@
|
|
6469
6544
|
* @param {Array} array The array to search.
|
6470
6545
|
* @param {Array|Function|Object|string} [predicate=_.identity]
|
6471
6546
|
* The function invoked per iteration.
|
6547
|
+
* @param {number} [fromIndex=array.length-1] The index to search from.
|
6472
6548
|
* @returns {number} Returns the index of the found element, else `-1`.
|
6473
6549
|
* @example
|
6474
6550
|
*
|
@@ -6493,10 +6569,19 @@
|
|
6493
6569
|
* _.findLastIndex(users, 'active');
|
6494
6570
|
* // => 0
|
6495
6571
|
*/
|
6496
|
-
function findLastIndex(array, predicate) {
|
6497
|
-
|
6498
|
-
|
6499
|
-
|
6572
|
+
function findLastIndex(array, predicate, fromIndex) {
|
6573
|
+
var length = array ? array.length : 0;
|
6574
|
+
if (!length) {
|
6575
|
+
return -1;
|
6576
|
+
}
|
6577
|
+
var index = length - 1;
|
6578
|
+
if (fromIndex !== undefined) {
|
6579
|
+
index = toInteger(fromIndex);
|
6580
|
+
index = fromIndex < 0
|
6581
|
+
? nativeMax(length + index, 0)
|
6582
|
+
: nativeMin(index, length - 1);
|
6583
|
+
}
|
6584
|
+
return baseFindIndex(array, getIteratee(predicate, 3), index, true);
|
6500
6585
|
}
|
6501
6586
|
|
6502
6587
|
/**
|
@@ -6643,11 +6728,11 @@
|
|
6643
6728
|
if (!length) {
|
6644
6729
|
return -1;
|
6645
6730
|
}
|
6646
|
-
|
6647
|
-
if (
|
6648
|
-
|
6731
|
+
var index = fromIndex == null ? 0 : toInteger(fromIndex);
|
6732
|
+
if (index < 0) {
|
6733
|
+
index = nativeMax(length + index, 0);
|
6649
6734
|
}
|
6650
|
-
return baseIndexOf(array, value,
|
6735
|
+
return baseIndexOf(array, value, index);
|
6651
6736
|
}
|
6652
6737
|
|
6653
6738
|
/**
|
@@ -6682,7 +6767,7 @@
|
|
6682
6767
|
* @returns {Array} Returns the new array of intersecting values.
|
6683
6768
|
* @example
|
6684
6769
|
*
|
6685
|
-
* _.intersection([2, 1], [
|
6770
|
+
* _.intersection([2, 1], [2, 3]);
|
6686
6771
|
* // => [2]
|
6687
6772
|
*/
|
6688
6773
|
var intersection = rest(function(arrays) {
|
@@ -6708,7 +6793,7 @@
|
|
6708
6793
|
* @returns {Array} Returns the new array of intersecting values.
|
6709
6794
|
* @example
|
6710
6795
|
*
|
6711
|
-
* _.intersectionBy([2.1, 1.2], [
|
6796
|
+
* _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
6712
6797
|
* // => [2.1]
|
6713
6798
|
*
|
6714
6799
|
* // The `_.property` iteratee shorthand.
|
@@ -6838,7 +6923,7 @@
|
|
6838
6923
|
) + 1;
|
6839
6924
|
}
|
6840
6925
|
if (value !== value) {
|
6841
|
-
return indexOfNaN(array, index, true);
|
6926
|
+
return indexOfNaN(array, index - 1, true);
|
6842
6927
|
}
|
6843
6928
|
while (index--) {
|
6844
6929
|
if (array[index] === value) {
|
@@ -6849,7 +6934,7 @@
|
|
6849
6934
|
}
|
6850
6935
|
|
6851
6936
|
/**
|
6852
|
-
* Gets the element at `n`
|
6937
|
+
* Gets the element at index `n` of `array`. If `n` is negative, the nth
|
6853
6938
|
* element from the end is returned.
|
6854
6939
|
*
|
6855
6940
|
* @static
|
@@ -6890,11 +6975,11 @@
|
|
6890
6975
|
* @returns {Array} Returns `array`.
|
6891
6976
|
* @example
|
6892
6977
|
*
|
6893
|
-
* var array = [
|
6978
|
+
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
6894
6979
|
*
|
6895
|
-
* _.pull(array,
|
6980
|
+
* _.pull(array, 'a', 'c');
|
6896
6981
|
* console.log(array);
|
6897
|
-
* // => [
|
6982
|
+
* // => ['b', 'b']
|
6898
6983
|
*/
|
6899
6984
|
var pull = rest(pullAll);
|
6900
6985
|
|
@@ -6912,11 +6997,11 @@
|
|
6912
6997
|
* @returns {Array} Returns `array`.
|
6913
6998
|
* @example
|
6914
6999
|
*
|
6915
|
-
* var array = [
|
7000
|
+
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
|
6916
7001
|
*
|
6917
|
-
* _.pullAll(array, [
|
7002
|
+
* _.pullAll(array, ['a', 'c']);
|
6918
7003
|
* console.log(array);
|
6919
|
-
* // => [
|
7004
|
+
* // => ['b', 'b']
|
6920
7005
|
*/
|
6921
7006
|
function pullAll(array, values) {
|
6922
7007
|
return (array && array.length && values && values.length)
|
@@ -6998,14 +7083,14 @@
|
|
6998
7083
|
* @returns {Array} Returns the new array of removed elements.
|
6999
7084
|
* @example
|
7000
7085
|
*
|
7001
|
-
* var array = [
|
7002
|
-
* var
|
7086
|
+
* var array = ['a', 'b', 'c', 'd'];
|
7087
|
+
* var pulled = _.pullAt(array, [1, 3]);
|
7003
7088
|
*
|
7004
7089
|
* console.log(array);
|
7005
|
-
* // => [
|
7090
|
+
* // => ['a', 'c']
|
7006
7091
|
*
|
7007
|
-
* console.log(
|
7008
|
-
* // => [
|
7092
|
+
* console.log(pulled);
|
7093
|
+
* // => ['b', 'd']
|
7009
7094
|
*/
|
7010
7095
|
var pullAt = rest(function(array, indexes) {
|
7011
7096
|
indexes = baseFlatten(indexes, 1);
|
@@ -7145,9 +7230,6 @@
|
|
7145
7230
|
*
|
7146
7231
|
* _.sortedIndex([30, 50], 40);
|
7147
7232
|
* // => 1
|
7148
|
-
*
|
7149
|
-
* _.sortedIndex([4, 5], 4);
|
7150
|
-
* // => 0
|
7151
7233
|
*/
|
7152
7234
|
function sortedIndex(array, value) {
|
7153
7235
|
return baseSortedIndex(array, value);
|
@@ -7170,13 +7252,13 @@
|
|
7170
7252
|
* into `array`.
|
7171
7253
|
* @example
|
7172
7254
|
*
|
7173
|
-
* var
|
7255
|
+
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
7174
7256
|
*
|
7175
|
-
* _.sortedIndexBy(
|
7176
|
-
* // =>
|
7257
|
+
* _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
7258
|
+
* // => 0
|
7177
7259
|
*
|
7178
7260
|
* // The `_.property` iteratee shorthand.
|
7179
|
-
* _.sortedIndexBy(
|
7261
|
+
* _.sortedIndexBy(objects, { 'x': 4 }, 'x');
|
7180
7262
|
* // => 0
|
7181
7263
|
*/
|
7182
7264
|
function sortedIndexBy(array, value, iteratee) {
|
@@ -7196,8 +7278,8 @@
|
|
7196
7278
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
7197
7279
|
* @example
|
7198
7280
|
*
|
7199
|
-
* _.sortedIndexOf([
|
7200
|
-
* // =>
|
7281
|
+
* _.sortedIndexOf([4, 5, 5, 5, 6], 5);
|
7282
|
+
* // => 1
|
7201
7283
|
*/
|
7202
7284
|
function sortedIndexOf(array, value) {
|
7203
7285
|
var length = array ? array.length : 0;
|
@@ -7225,8 +7307,8 @@
|
|
7225
7307
|
* into `array`.
|
7226
7308
|
* @example
|
7227
7309
|
*
|
7228
|
-
* _.sortedLastIndex([4, 5],
|
7229
|
-
* // =>
|
7310
|
+
* _.sortedLastIndex([4, 5, 5, 5, 6], 5);
|
7311
|
+
* // => 4
|
7230
7312
|
*/
|
7231
7313
|
function sortedLastIndex(array, value) {
|
7232
7314
|
return baseSortedIndex(array, value, true);
|
@@ -7249,8 +7331,13 @@
|
|
7249
7331
|
* into `array`.
|
7250
7332
|
* @example
|
7251
7333
|
*
|
7334
|
+
* var objects = [{ 'x': 4 }, { 'x': 5 }];
|
7335
|
+
*
|
7336
|
+
* _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
7337
|
+
* // => 1
|
7338
|
+
*
|
7252
7339
|
* // The `_.property` iteratee shorthand.
|
7253
|
-
* _.sortedLastIndexBy(
|
7340
|
+
* _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
|
7254
7341
|
* // => 1
|
7255
7342
|
*/
|
7256
7343
|
function sortedLastIndexBy(array, value, iteratee) {
|
@@ -7270,7 +7357,7 @@
|
|
7270
7357
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
7271
7358
|
* @example
|
7272
7359
|
*
|
7273
|
-
* _.sortedLastIndexOf([
|
7360
|
+
* _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
|
7274
7361
|
* // => 3
|
7275
7362
|
*/
|
7276
7363
|
function sortedLastIndexOf(array, value) {
|
@@ -7510,8 +7597,8 @@
|
|
7510
7597
|
* @returns {Array} Returns the new array of combined values.
|
7511
7598
|
* @example
|
7512
7599
|
*
|
7513
|
-
* _.union([2
|
7514
|
-
* // => [2, 1
|
7600
|
+
* _.union([2], [1, 2]);
|
7601
|
+
* // => [2, 1]
|
7515
7602
|
*/
|
7516
7603
|
var union = rest(function(arrays) {
|
7517
7604
|
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
|
@@ -7533,8 +7620,8 @@
|
|
7533
7620
|
* @returns {Array} Returns the new array of combined values.
|
7534
7621
|
* @example
|
7535
7622
|
*
|
7536
|
-
* _.unionBy([2.1, 1.2
|
7537
|
-
* // => [2.1, 1.2
|
7623
|
+
* _.unionBy([2.1], [1.2, 2.3], Math.floor);
|
7624
|
+
* // => [2.1, 1.2]
|
7538
7625
|
*
|
7539
7626
|
* // The `_.property` iteratee shorthand.
|
7540
7627
|
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
@@ -7641,7 +7728,7 @@
|
|
7641
7728
|
* @returns {Array} Returns the new duplicate free array.
|
7642
7729
|
* @example
|
7643
7730
|
*
|
7644
|
-
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 },
|
7731
|
+
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
|
7645
7732
|
*
|
7646
7733
|
* _.uniqWith(objects, _.isEqual);
|
7647
7734
|
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
|
@@ -7736,7 +7823,7 @@
|
|
7736
7823
|
* @see _.difference, _.xor
|
7737
7824
|
* @example
|
7738
7825
|
*
|
7739
|
-
* _.without([1, 2,
|
7826
|
+
* _.without([2, 1, 2, 3], 1, 2);
|
7740
7827
|
* // => [3]
|
7741
7828
|
*/
|
7742
7829
|
var without = rest(function(array, values) {
|
@@ -7760,8 +7847,8 @@
|
|
7760
7847
|
* @see _.difference, _.without
|
7761
7848
|
* @example
|
7762
7849
|
*
|
7763
|
-
* _.xor([2, 1], [
|
7764
|
-
* // => [1,
|
7850
|
+
* _.xor([2, 1], [2, 3]);
|
7851
|
+
* // => [1, 3]
|
7765
7852
|
*/
|
7766
7853
|
var xor = rest(function(arrays) {
|
7767
7854
|
return baseXor(arrayFilter(arrays, isArrayLikeObject));
|
@@ -7783,8 +7870,8 @@
|
|
7783
7870
|
* @returns {Array} Returns the new array of filtered values.
|
7784
7871
|
* @example
|
7785
7872
|
*
|
7786
|
-
* _.xorBy([2.1, 1.2], [
|
7787
|
-
* // => [1.2, 4
|
7873
|
+
* _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
|
7874
|
+
* // => [1.2, 3.4]
|
7788
7875
|
*
|
7789
7876
|
* // The `_.property` iteratee shorthand.
|
7790
7877
|
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
@@ -8017,9 +8104,6 @@
|
|
8017
8104
|
*
|
8018
8105
|
* _(object).at(['a[0].b.c', 'a[1]']).value();
|
8019
8106
|
* // => [3, 4]
|
8020
|
-
*
|
8021
|
-
* _(['a', 'b', 'c']).at(0, 2).value();
|
8022
|
-
* // => ['a', 'c']
|
8023
8107
|
*/
|
8024
8108
|
var wrapperAt = rest(function(paths) {
|
8025
8109
|
paths = baseFlatten(paths, 1);
|
@@ -8282,6 +8366,7 @@
|
|
8282
8366
|
* _.countBy([6.1, 4.2, 6.3], Math.floor);
|
8283
8367
|
* // => { '4': 1, '6': 2 }
|
8284
8368
|
*
|
8369
|
+
* // The `_.property` iteratee shorthand.
|
8285
8370
|
* _.countBy(['one', 'two', 'three'], 'length');
|
8286
8371
|
* // => { '3': 2, '5': 1 }
|
8287
8372
|
*/
|
@@ -8387,6 +8472,7 @@
|
|
8387
8472
|
* @param {Array|Object} collection The collection to search.
|
8388
8473
|
* @param {Array|Function|Object|string} [predicate=_.identity]
|
8389
8474
|
* The function invoked per iteration.
|
8475
|
+
* @param {number} [fromIndex=0] The index to search from.
|
8390
8476
|
* @returns {*} Returns the matched element, else `undefined`.
|
8391
8477
|
* @example
|
8392
8478
|
*
|
@@ -8411,14 +8497,7 @@
|
|
8411
8497
|
* _.find(users, 'active');
|
8412
8498
|
* // => object for 'barney'
|
8413
8499
|
*/
|
8414
|
-
|
8415
|
-
predicate = getIteratee(predicate, 3);
|
8416
|
-
if (isArray(collection)) {
|
8417
|
-
var index = baseFindIndex(collection, predicate);
|
8418
|
-
return index > -1 ? collection[index] : undefined;
|
8419
|
-
}
|
8420
|
-
return baseFind(collection, predicate, baseEach);
|
8421
|
-
}
|
8500
|
+
var find = createFind(findIndex);
|
8422
8501
|
|
8423
8502
|
/**
|
8424
8503
|
* This method is like `_.find` except that it iterates over elements of
|
@@ -8431,6 +8510,7 @@
|
|
8431
8510
|
* @param {Array|Object} collection The collection to search.
|
8432
8511
|
* @param {Array|Function|Object|string} [predicate=_.identity]
|
8433
8512
|
* The function invoked per iteration.
|
8513
|
+
* @param {number} [fromIndex=collection.length-1] The index to search from.
|
8434
8514
|
* @returns {*} Returns the matched element, else `undefined`.
|
8435
8515
|
* @example
|
8436
8516
|
*
|
@@ -8439,14 +8519,7 @@
|
|
8439
8519
|
* });
|
8440
8520
|
* // => 3
|
8441
8521
|
*/
|
8442
|
-
|
8443
|
-
predicate = getIteratee(predicate, 3);
|
8444
|
-
if (isArray(collection)) {
|
8445
|
-
var index = baseFindIndex(collection, predicate, true);
|
8446
|
-
return index > -1 ? collection[index] : undefined;
|
8447
|
-
}
|
8448
|
-
return baseFind(collection, predicate, baseEachRight);
|
8449
|
-
}
|
8522
|
+
var findLast = createFind(findLastIndex);
|
8450
8523
|
|
8451
8524
|
/**
|
8452
8525
|
* Creates a flattened array of values by running each element in `collection`
|
@@ -9203,7 +9276,6 @@
|
|
9203
9276
|
* @static
|
9204
9277
|
* @memberOf _
|
9205
9278
|
* @since 2.4.0
|
9206
|
-
* @type {Function}
|
9207
9279
|
* @category Date
|
9208
9280
|
* @returns {number} Returns the timestamp.
|
9209
9281
|
* @example
|
@@ -9211,9 +9283,11 @@
|
|
9211
9283
|
* _.defer(function(stamp) {
|
9212
9284
|
* console.log(_.now() - stamp);
|
9213
9285
|
* }, _.now());
|
9214
|
-
* // => Logs the number of milliseconds it took for the deferred
|
9286
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
9215
9287
|
*/
|
9216
|
-
|
9288
|
+
function now() {
|
9289
|
+
return Date.now();
|
9290
|
+
}
|
9217
9291
|
|
9218
9292
|
/*------------------------------------------------------------------------*/
|
9219
9293
|
|
@@ -9317,7 +9391,7 @@
|
|
9317
9391
|
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
|
9318
9392
|
* may be used as a placeholder for partially applied arguments.
|
9319
9393
|
*
|
9320
|
-
* **Note:** Unlike native `Function#bind
|
9394
|
+
* **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
|
9321
9395
|
* property of bound functions.
|
9322
9396
|
*
|
9323
9397
|
* @static
|
@@ -9557,7 +9631,7 @@
|
|
9557
9631
|
maxWait,
|
9558
9632
|
result,
|
9559
9633
|
timerId,
|
9560
|
-
lastCallTime
|
9634
|
+
lastCallTime,
|
9561
9635
|
lastInvokeTime = 0,
|
9562
9636
|
leading = false,
|
9563
9637
|
maxing = false,
|
@@ -9608,7 +9682,7 @@
|
|
9608
9682
|
// Either this is the first call, activity has stopped and we're at the
|
9609
9683
|
// trailing edge, the system time has gone backwards and we're treating
|
9610
9684
|
// it as the trailing edge, or we've hit the `maxWait` limit.
|
9611
|
-
return (
|
9685
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
9612
9686
|
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
9613
9687
|
}
|
9614
9688
|
|
@@ -9622,7 +9696,6 @@
|
|
9622
9696
|
}
|
9623
9697
|
|
9624
9698
|
function trailingEdge(time) {
|
9625
|
-
clearTimeout(timerId);
|
9626
9699
|
timerId = undefined;
|
9627
9700
|
|
9628
9701
|
// Only invoke if we have `lastArgs` which means `func` has been
|
@@ -9635,11 +9708,8 @@
|
|
9635
9708
|
}
|
9636
9709
|
|
9637
9710
|
function cancel() {
|
9638
|
-
|
9639
|
-
|
9640
|
-
}
|
9641
|
-
lastCallTime = lastInvokeTime = 0;
|
9642
|
-
lastArgs = lastThis = timerId = undefined;
|
9711
|
+
lastInvokeTime = 0;
|
9712
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
9643
9713
|
}
|
9644
9714
|
|
9645
9715
|
function flush() {
|
@@ -9660,7 +9730,6 @@
|
|
9660
9730
|
}
|
9661
9731
|
if (maxing) {
|
9662
9732
|
// Handle invocations in a tight loop.
|
9663
|
-
clearTimeout(timerId);
|
9664
9733
|
timerId = setTimeout(timerExpired, wait);
|
9665
9734
|
return invokeFunc(lastCallTime);
|
9666
9735
|
}
|
@@ -9884,7 +9953,7 @@
|
|
9884
9953
|
*
|
9885
9954
|
* var func = _.overArgs(function(x, y) {
|
9886
9955
|
* return [x, y];
|
9887
|
-
* }, square, doubled);
|
9956
|
+
* }, [square, doubled]);
|
9888
9957
|
*
|
9889
9958
|
* func(9, 3);
|
9890
9959
|
* // => [81, 6]
|
@@ -10001,7 +10070,7 @@
|
|
10001
10070
|
*
|
10002
10071
|
* var rearged = _.rearg(function(a, b, c) {
|
10003
10072
|
* return [a, b, c];
|
10004
|
-
* }, 2, 0, 1);
|
10073
|
+
* }, [2, 0, 1]);
|
10005
10074
|
*
|
10006
10075
|
* rearged('b', 'c', 'a')
|
10007
10076
|
* // => ['a', 'b', 'c']
|
@@ -10640,7 +10709,7 @@
|
|
10640
10709
|
* _.isBuffer(new Uint8Array(2));
|
10641
10710
|
* // => false
|
10642
10711
|
*/
|
10643
|
-
var isBuffer = !Buffer ?
|
10712
|
+
var isBuffer = !Buffer ? stubFalse : function(value) {
|
10644
10713
|
return value instanceof Buffer;
|
10645
10714
|
};
|
10646
10715
|
|
@@ -11140,7 +11209,15 @@
|
|
11140
11209
|
}
|
11141
11210
|
|
11142
11211
|
/**
|
11143
|
-
* Checks if `value` is a native function.
|
11212
|
+
* Checks if `value` is a pristine native function.
|
11213
|
+
*
|
11214
|
+
* **Note:** This method can't reliably detect native functions in the
|
11215
|
+
* presence of the `core-js` package because `core-js` circumvents this kind
|
11216
|
+
* of detection. Despite multiple requests, the `core-js` maintainer has made
|
11217
|
+
* it clear: any attempt to fix the detection will be obstructed. As a result,
|
11218
|
+
* we're left with little choice but to throw an error. Unfortunately, this
|
11219
|
+
* also affects packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
|
11220
|
+
* which rely on `core-js`.
|
11144
11221
|
*
|
11145
11222
|
* @static
|
11146
11223
|
* @memberOf _
|
@@ -11158,11 +11235,10 @@
|
|
11158
11235
|
* // => false
|
11159
11236
|
*/
|
11160
11237
|
function isNative(value) {
|
11161
|
-
if (
|
11162
|
-
|
11238
|
+
if (isMaskable(value)) {
|
11239
|
+
throw new Error('This method is not supported with `core-js`. Try https://github.com/es-shims.');
|
11163
11240
|
}
|
11164
|
-
|
11165
|
-
return pattern.test(toSource(value));
|
11241
|
+
return baseIsNative(value);
|
11166
11242
|
}
|
11167
11243
|
|
11168
11244
|
/**
|
@@ -11624,7 +11700,7 @@
|
|
11624
11700
|
/**
|
11625
11701
|
* Converts `value` to an integer.
|
11626
11702
|
*
|
11627
|
-
* **Note:** This
|
11703
|
+
* **Note:** This method is loosely based on
|
11628
11704
|
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
|
11629
11705
|
*
|
11630
11706
|
* @static
|
@@ -11978,9 +12054,6 @@
|
|
11978
12054
|
*
|
11979
12055
|
* _.at(object, ['a[0].b.c', 'a[1]']);
|
11980
12056
|
* // => [3, 4]
|
11981
|
-
*
|
11982
|
-
* _.at(['a', 'b', 'c'], 0, 2);
|
11983
|
-
* // => ['a', 'c']
|
11984
12057
|
*/
|
11985
12058
|
var at = rest(function(object, paths) {
|
11986
12059
|
return baseAt(object, baseFlatten(paths, 1));
|
@@ -12113,7 +12186,7 @@
|
|
12113
12186
|
* // => 'barney'
|
12114
12187
|
*/
|
12115
12188
|
function findKey(object, predicate) {
|
12116
|
-
return
|
12189
|
+
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
|
12117
12190
|
}
|
12118
12191
|
|
12119
12192
|
/**
|
@@ -12153,7 +12226,7 @@
|
|
12153
12226
|
* // => 'pebbles'
|
12154
12227
|
*/
|
12155
12228
|
function findLastKey(object, predicate) {
|
12156
|
-
return
|
12229
|
+
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
|
12157
12230
|
}
|
12158
12231
|
|
12159
12232
|
/**
|
@@ -13012,15 +13085,16 @@
|
|
13012
13085
|
* An alternative to `_.reduce`; this method transforms `object` to a new
|
13013
13086
|
* `accumulator` object which is the result of running each of its own
|
13014
13087
|
* enumerable string keyed properties thru `iteratee`, with each invocation
|
13015
|
-
* potentially mutating the `accumulator` object.
|
13016
|
-
* with
|
13017
|
-
*
|
13088
|
+
* potentially mutating the `accumulator` object. If `accumulator` is not
|
13089
|
+
* provided, a new object with the same `[[Prototype]]` will be used. The
|
13090
|
+
* iteratee is invoked with four arguments: (accumulator, value, key, object).
|
13091
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
13018
13092
|
*
|
13019
13093
|
* @static
|
13020
13094
|
* @memberOf _
|
13021
13095
|
* @since 1.3.0
|
13022
13096
|
* @category Object
|
13023
|
-
* @param {
|
13097
|
+
* @param {Object} object The object to iterate over.
|
13024
13098
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
13025
13099
|
* @param {*} [accumulator] The custom accumulator value.
|
13026
13100
|
* @returns {*} Returns the accumulated value.
|
@@ -13442,7 +13516,7 @@
|
|
13442
13516
|
* @category String
|
13443
13517
|
* @param {string} [string=''] The string to search.
|
13444
13518
|
* @param {string} [target] The string to search for.
|
13445
|
-
* @param {number} [position=string.length] The position to search
|
13519
|
+
* @param {number} [position=string.length] The position to search up to.
|
13446
13520
|
* @returns {boolean} Returns `true` if `string` ends with `target`,
|
13447
13521
|
* else `false`.
|
13448
13522
|
* @example
|
@@ -14527,7 +14601,7 @@
|
|
14527
14601
|
* }
|
14528
14602
|
* };
|
14529
14603
|
*
|
14530
|
-
* _.bindAll(view, 'onClick');
|
14604
|
+
* _.bindAll(view, ['onClick']);
|
14531
14605
|
* jQuery(element).on('click', view.onClick);
|
14532
14606
|
* // => Logs 'clicked docs' when clicked.
|
14533
14607
|
*/
|
@@ -14608,7 +14682,7 @@
|
|
14608
14682
|
* { 'user': 'fred', 'age': 40 }
|
14609
14683
|
* ];
|
14610
14684
|
*
|
14611
|
-
* _.filter(users, _.conforms({ 'age':
|
14685
|
+
* _.filter(users, _.conforms({ 'age': function(n) { return n > 38; } }));
|
14612
14686
|
* // => [{ 'user': 'fred', 'age': 40 }]
|
14613
14687
|
*/
|
14614
14688
|
function conforms(source) {
|
@@ -14626,10 +14700,12 @@
|
|
14626
14700
|
* @returns {Function} Returns the new constant function.
|
14627
14701
|
* @example
|
14628
14702
|
*
|
14629
|
-
* var
|
14630
|
-
*
|
14703
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
14704
|
+
*
|
14705
|
+
* console.log(objects);
|
14706
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
14631
14707
|
*
|
14632
|
-
*
|
14708
|
+
* console.log(objects[0] === objects[1]);
|
14633
14709
|
* // => true
|
14634
14710
|
*/
|
14635
14711
|
function constant(value) {
|
@@ -14656,7 +14732,7 @@
|
|
14656
14732
|
* return n * n;
|
14657
14733
|
* }
|
14658
14734
|
*
|
14659
|
-
* var addSquare = _.flow(_.add, square);
|
14735
|
+
* var addSquare = _.flow([_.add, square]);
|
14660
14736
|
* addSquare(1, 2);
|
14661
14737
|
* // => 9
|
14662
14738
|
*/
|
@@ -14679,7 +14755,7 @@
|
|
14679
14755
|
* return n * n;
|
14680
14756
|
* }
|
14681
14757
|
*
|
14682
|
-
* var addSquare = _.flowRight(square, _.add);
|
14758
|
+
* var addSquare = _.flowRight([square, _.add]);
|
14683
14759
|
* addSquare(1, 2);
|
14684
14760
|
* // => 9
|
14685
14761
|
*/
|
@@ -14698,7 +14774,7 @@
|
|
14698
14774
|
*
|
14699
14775
|
* var object = { 'user': 'fred' };
|
14700
14776
|
*
|
14701
|
-
* _.identity(object) === object;
|
14777
|
+
* console.log(_.identity(object) === object);
|
14702
14778
|
* // => true
|
14703
14779
|
*/
|
14704
14780
|
function identity(value) {
|
@@ -14959,8 +15035,7 @@
|
|
14959
15035
|
}
|
14960
15036
|
|
14961
15037
|
/**
|
14962
|
-
* A
|
14963
|
-
* arguments it receives.
|
15038
|
+
* A method that returns `undefined`.
|
14964
15039
|
*
|
14965
15040
|
* @static
|
14966
15041
|
* @memberOf _
|
@@ -14968,17 +15043,15 @@
|
|
14968
15043
|
* @category Util
|
14969
15044
|
* @example
|
14970
15045
|
*
|
14971
|
-
*
|
14972
|
-
*
|
14973
|
-
* _.noop(object) === undefined;
|
14974
|
-
* // => true
|
15046
|
+
* _.times(2, _.noop);
|
15047
|
+
* // => [undefined, undefined]
|
14975
15048
|
*/
|
14976
15049
|
function noop() {
|
14977
15050
|
// No operation performed.
|
14978
15051
|
}
|
14979
15052
|
|
14980
15053
|
/**
|
14981
|
-
* Creates a function that gets the argument at `n
|
15054
|
+
* Creates a function that gets the argument at index `n`. If `n` is negative,
|
14982
15055
|
* the nth argument from the end is returned.
|
14983
15056
|
*
|
14984
15057
|
* @static
|
@@ -15017,7 +15090,7 @@
|
|
15017
15090
|
* @returns {Function} Returns the new function.
|
15018
15091
|
* @example
|
15019
15092
|
*
|
15020
|
-
* var func = _.over(Math.max, Math.min);
|
15093
|
+
* var func = _.over([Math.max, Math.min]);
|
15021
15094
|
*
|
15022
15095
|
* func(1, 2, 3, 4);
|
15023
15096
|
* // => [4, 1]
|
@@ -15037,7 +15110,7 @@
|
|
15037
15110
|
* @returns {Function} Returns the new function.
|
15038
15111
|
* @example
|
15039
15112
|
*
|
15040
|
-
* var func = _.overEvery(Boolean, isFinite);
|
15113
|
+
* var func = _.overEvery([Boolean, isFinite]);
|
15041
15114
|
*
|
15042
15115
|
* func('1');
|
15043
15116
|
* // => true
|
@@ -15063,7 +15136,7 @@
|
|
15063
15136
|
* @returns {Function} Returns the new function.
|
15064
15137
|
* @example
|
15065
15138
|
*
|
15066
|
-
* var func = _.overSome(Boolean, isFinite);
|
15139
|
+
* var func = _.overSome([Boolean, isFinite]);
|
15067
15140
|
*
|
15068
15141
|
* func('1');
|
15069
15142
|
* // => true
|
@@ -15210,6 +15283,101 @@
|
|
15210
15283
|
*/
|
15211
15284
|
var rangeRight = createRange(true);
|
15212
15285
|
|
15286
|
+
/**
|
15287
|
+
* A method that returns a new empty array.
|
15288
|
+
*
|
15289
|
+
* @static
|
15290
|
+
* @memberOf _
|
15291
|
+
* @since 4.13.0
|
15292
|
+
* @category Util
|
15293
|
+
* @returns {Array} Returns the new empty array.
|
15294
|
+
* @example
|
15295
|
+
*
|
15296
|
+
* var arrays = _.times(2, _.stubArray);
|
15297
|
+
*
|
15298
|
+
* console.log(arrays);
|
15299
|
+
* // => [[], []]
|
15300
|
+
*
|
15301
|
+
* console.log(arrays[0] === arrays[1]);
|
15302
|
+
* // => false
|
15303
|
+
*/
|
15304
|
+
function stubArray() {
|
15305
|
+
return [];
|
15306
|
+
}
|
15307
|
+
|
15308
|
+
/**
|
15309
|
+
* A method that returns `false`.
|
15310
|
+
*
|
15311
|
+
* @static
|
15312
|
+
* @memberOf _
|
15313
|
+
* @since 4.13.0
|
15314
|
+
* @category Util
|
15315
|
+
* @returns {boolean} Returns `false`.
|
15316
|
+
* @example
|
15317
|
+
*
|
15318
|
+
* _.times(2, _.stubFalse);
|
15319
|
+
* // => [false, false]
|
15320
|
+
*/
|
15321
|
+
function stubFalse() {
|
15322
|
+
return false;
|
15323
|
+
}
|
15324
|
+
|
15325
|
+
/**
|
15326
|
+
* A method that returns a new empty object.
|
15327
|
+
*
|
15328
|
+
* @static
|
15329
|
+
* @memberOf _
|
15330
|
+
* @since 4.13.0
|
15331
|
+
* @category Util
|
15332
|
+
* @returns {Object} Returns the new empty object.
|
15333
|
+
* @example
|
15334
|
+
*
|
15335
|
+
* var objects = _.times(2, _.stubObject);
|
15336
|
+
*
|
15337
|
+
* console.log(objects);
|
15338
|
+
* // => [{}, {}]
|
15339
|
+
*
|
15340
|
+
* console.log(objects[0] === objects[1]);
|
15341
|
+
* // => false
|
15342
|
+
*/
|
15343
|
+
function stubObject() {
|
15344
|
+
return {};
|
15345
|
+
}
|
15346
|
+
|
15347
|
+
/**
|
15348
|
+
* A method that returns an empty string.
|
15349
|
+
*
|
15350
|
+
* @static
|
15351
|
+
* @memberOf _
|
15352
|
+
* @since 4.13.0
|
15353
|
+
* @category Util
|
15354
|
+
* @returns {string} Returns the empty string.
|
15355
|
+
* @example
|
15356
|
+
*
|
15357
|
+
* _.times(2, _.stubString);
|
15358
|
+
* // => ['', '']
|
15359
|
+
*/
|
15360
|
+
function stubString() {
|
15361
|
+
return '';
|
15362
|
+
}
|
15363
|
+
|
15364
|
+
/**
|
15365
|
+
* A method that returns `true`.
|
15366
|
+
*
|
15367
|
+
* @static
|
15368
|
+
* @memberOf _
|
15369
|
+
* @since 4.13.0
|
15370
|
+
* @category Util
|
15371
|
+
* @returns {boolean} Returns `true`.
|
15372
|
+
* @example
|
15373
|
+
*
|
15374
|
+
* _.times(2, _.stubTrue);
|
15375
|
+
* // => [true, true]
|
15376
|
+
*/
|
15377
|
+
function stubTrue() {
|
15378
|
+
return true;
|
15379
|
+
}
|
15380
|
+
|
15213
15381
|
/**
|
15214
15382
|
* Invokes the iteratee `n` times, returning an array of the results of
|
15215
15383
|
* each invocation. The iteratee is invoked with one argument; (index).
|
@@ -15226,8 +15394,8 @@
|
|
15226
15394
|
* _.times(3, String);
|
15227
15395
|
* // => ['0', '1', '2']
|
15228
15396
|
*
|
15229
|
-
* _.times(4, _.constant(
|
15230
|
-
* // => [
|
15397
|
+
* _.times(4, _.constant(0));
|
15398
|
+
* // => [0, 0, 0, 0]
|
15231
15399
|
*/
|
15232
15400
|
function times(n, iteratee) {
|
15233
15401
|
n = toInteger(n);
|
@@ -15263,15 +15431,6 @@
|
|
15263
15431
|
*
|
15264
15432
|
* _.toPath('a[0].b.c');
|
15265
15433
|
* // => ['a', '0', 'b', 'c']
|
15266
|
-
*
|
15267
|
-
* var path = ['a', 'b', 'c'],
|
15268
|
-
* newPath = _.toPath(path);
|
15269
|
-
*
|
15270
|
-
* console.log(newPath);
|
15271
|
-
* // => ['a', 'b', 'c']
|
15272
|
-
*
|
15273
|
-
* console.log(path === newPath);
|
15274
|
-
* // => false
|
15275
15434
|
*/
|
15276
15435
|
function toPath(value) {
|
15277
15436
|
if (isArray(value)) {
|
@@ -15910,6 +16069,11 @@
|
|
15910
16069
|
lodash.meanBy = meanBy;
|
15911
16070
|
lodash.min = min;
|
15912
16071
|
lodash.minBy = minBy;
|
16072
|
+
lodash.stubArray = stubArray;
|
16073
|
+
lodash.stubFalse = stubFalse;
|
16074
|
+
lodash.stubObject = stubObject;
|
16075
|
+
lodash.stubString = stubString;
|
16076
|
+
lodash.stubTrue = stubTrue;
|
15913
16077
|
lodash.multiply = multiply;
|
15914
16078
|
lodash.nth = nth;
|
15915
16079
|
lodash.noConflict = noConflict;
|
@@ -16216,7 +16380,7 @@
|
|
16216
16380
|
// also prevents errors in cases where Lodash is loaded by a script tag in the
|
16217
16381
|
// presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch
|
16218
16382
|
// for more details. Use `_.noConflict` to remove Lodash from the global object.
|
16219
|
-
(
|
16383
|
+
(freeSelf || {})._ = _;
|
16220
16384
|
|
16221
16385
|
// Some AMD build optimizers like r.js check for condition patterns like the following:
|
16222
16386
|
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
@@ -16227,11 +16391,9 @@
|
|
16227
16391
|
});
|
16228
16392
|
}
|
16229
16393
|
// Check for `exports` after `define` in case a build optimizer adds an `exports` object.
|
16230
|
-
else if (
|
16394
|
+
else if (freeModule) {
|
16231
16395
|
// Export for Node.js.
|
16232
|
-
|
16233
|
-
(freeModule.exports = _)._ = _;
|
16234
|
-
}
|
16396
|
+
(freeModule.exports = _)._ = _;
|
16235
16397
|
// Export for CommonJS support.
|
16236
16398
|
freeExports._ = _;
|
16237
16399
|
}
|