lodash-rails 4.0.0 → 4.3.0
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 +145 -156
- data/vendor/assets/javascripts/lodash.core.min.js +26 -25
- data/vendor/assets/javascripts/lodash.js +723 -392
- data/vendor/assets/javascripts/lodash.min.js +114 -111
- metadata +2 -2
@@ -1,29 +1,30 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* lodash 4.
|
3
|
+
* lodash 4.3.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
|
4
4
|
* Build: `lodash core -o ./dist/lodash.core.js`
|
5
5
|
*/
|
6
|
-
;(function(){function n(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function t(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===
|
7
|
-
}function c(n){var t=false;if(null!=n&&typeof n.toString!="function")try{t=!!(n+"")}catch(r){}return t}function f(n,t){return n=typeof n=="number"||
|
8
|
-
}function s(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(
|
9
|
-
return
|
10
|
-
return t[0]===n}))&&a[1]?a[1]==t:(o.push([n,t]),t=(i?
|
11
|
-
}return true}}function x(n,t){return n=Object(n),
|
12
|
-
}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];(!
|
13
|
-
for(;i--;)a[c++]=arguments[++o];return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=B(n);return e}function
|
14
|
-
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+""}return false}function $(n,t,r,e,u,o){var i=2&u,c=
|
15
|
-
|
16
|
-
|
17
|
-
}function
|
18
|
-
}function
|
19
|
-
}function
|
20
|
-
"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},
|
21
|
-
function n(){}return function(t){if(
|
22
|
-
return r});var
|
23
|
-
|
24
|
-
},a.
|
25
|
-
|
26
|
-
|
27
|
-
a.isFinite=function(n){return typeof n=="number"&&
|
28
|
-
},a.noop=function(){},a.
|
29
|
-
a.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=function(){return S(this.__wrapped__,this.__actions__)},(
|
6
|
+
;(function(){function n(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function t(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===an?i===i:r(i,c)))var c=i,f=o}return f}function r(n,t,r){var e;return r(n,function(n,r,u){return t(n,r,u)?(e=n,false):void 0}),e}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 w(t,function(t){return n[t]})}function o(n){return n&&n.Object===Object?n:null}function i(n){return hn[n];
|
7
|
+
}function c(n){var t=false;if(null!=n&&typeof n.toString!="function")try{t=!!(n+"")}catch(r){}return t}function f(n,t){return n=typeof n=="number"||sn.test(n)?+n:-1,n>-1&&0==n%1&&(null==t?9007199254740991:t)>n}function a(n){if(Y(n)&&!Mn(n)){if(n instanceof l)return n;if(xn.call(n,"__wrapped__")){var t=new l(n.__wrapped__,n.__chain__);return t.__actions__=k(n.__actions__),t}}return new l(n)}function l(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function p(n,t,r,e){return n===an||V(n,On[r])&&!xn.call(e,r)?t:n;
|
8
|
+
}function s(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");return setTimeout(function(){n.apply(an,r)},t)}function h(n,t){var r=true;return In(n,function(n,e,u){return r=!!t(n,e,u)}),r}function v(n,t){var r=[];return In(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function y(t,r,e,u){u||(u=[]);for(var o=-1,i=t.length;++o<i;){var c=t[o];Y(c)&&L(c)&&(e||Mn(c)||K(c))?r?y(c,r,e,u):n(u,c):e||(u[u.length]=c)}return u}function _(n,t){return n&&$n(n,t,en)}function g(n,t){return v(t,function(t){
|
9
|
+
return Q(n[t])})}function b(n,t,r,e,u){return n===t?true:null==n||null==t||!X(n)&&!Y(t)?n!==n&&t!==t:j(n,t,b,r,e,u)}function j(n,t,r,e,u,o){var i=Mn(n),f=Mn(t),a="[object Array]",l="[object Array]";i||(a=An.call(n),"[object Arguments]"==a&&(a="[object Object]")),f||(l=An.call(t),"[object Arguments]"==l&&(l="[object Object]"));var p="[object Object]"==a&&!c(n),f="[object Object]"==l&&!c(t);return!(l=a==l)||i||p?2&u||(a=p&&xn.call(n,"__wrapped__"),f=f&&xn.call(t,"__wrapped__"),!a&&!f)?l?(o||(o=[]),(a=G(o,function(t){
|
10
|
+
return t[0]===n}))&&a[1]?a[1]==t:(o.push([n,t]),t=(i?D:$)(n,t,r,e,u,o),o.pop(),t)):false:r(a?n.value():n,f?t.value():t,e,u,o):I(n,t,a)}function m(n){var t=typeof n;return"function"==t?n:null==n?cn:("object"==t?O:E)(n)}function d(n){n=null==n?n:Object(n);var t,r=[];for(t in n)r.push(t);return r}function w(n,t){var r=-1,e=L(n)?Array(n.length):[];return In(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function O(n){var t=en(n);return function(r){var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];
|
11
|
+
if(!(u in r&&b(n[u],r[u],an,3)))return false}return true}}function x(n,t){return n=Object(n),M(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function E(n){return function(t){return null==t?an:t[n]}}function A(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,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 k(n){return A(n,0,n.length)}function N(n,t){var r;return In(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function S(t,r){return M(r,function(t,r){return r.func.apply(r.thisArg,n([t],r.args));
|
12
|
+
},t)}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];(!V(a,c)||V(a,On[i])&&!xn.call(f,i)||c===an&&!(i in f))&&(f[i]=c)}return r}function F(n){return U(function(t,r){var e=-1,u=r.length,o=u>1?r[u-1]:an,o=typeof o=="function"?(u--,o):an;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,e,o)}return t})}function B(n){return function(){var t=arguments,r=Dn(n.prototype),t=n.apply(r,t);return X(t)?t:r}}function R(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i),l=this&&this!==dn&&this instanceof e?u:n;++c<f;)a[c]=r[c];
|
13
|
+
for(;i--;)a[c++]=arguments[++o];return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");var u=B(n);return e}function D(n,t,r,e,u,o){var i=-1,c=1&u,f=n.length,a=t.length;if(f!=a&&!(2&u&&a>f))return false;for(a=true;++i<f;){var l=n[i],p=t[i];if(void 0!==an){a=false;break}if(c){if(!N(t,function(n){return l===n||r(l,n,e,u,o)})){a=false;break}}else if(l!==p&&!r(l,p,e,u,o)){a=false;break}}return a}function I(n,t,r){switch(r){case"[object Boolean]":case"[object Date]":return+n==+t;case"[object Error]":
|
14
|
+
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+""}return false}function $(n,t,r,e,u,o){var i=2&u,c=en(n),f=c.length,a=en(t).length;if(f!=a&&!i)return false;for(var l=f;l--;){var p=c[l];if(!(i?p in t:xn.call(t,p)))return false}for(a=true;++l<f;){var p=c[l],s=n[p],h=t[p];if(void 0!==an||s!==h&&!r(s,h,e,u,o)){a=false;break}i||(i="constructor"==p)}return a&&!i&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(a=false)),
|
15
|
+
a}function q(n){var t=n?n.length:an;if(W(t)&&(Mn(n)||nn(n)||K(n))){n=String;for(var r=-1,e=Array(t);++r<t;)e[r]=n(r);t=e}else t=null;return t}function z(n){var t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||On)}function C(n){return n?n[0]:an}function G(n,t){return r(n,m(t),In)}function J(n,t){return In(n,typeof t=="function"?t:cn)}function M(n,t,r){return e(n,m(t),r,3>arguments.length,In)}function P(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Pn(n),
|
16
|
+
function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=an),r}}function U(n){var t;if(typeof n!="function")throw new TypeError("Expected a function");return t=Rn(t===an?n.length-1:Pn(t),0),function(){for(var r=arguments,e=-1,u=Rn(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,t){return n===t||n!==n&&t!==t}function H(n,t){return n>t}function K(n){return Y(n)&&L(n)&&xn.call(n,"callee")&&(!Tn.call(n,"callee")||"[object Arguments]"==An.call(n));
|
17
|
+
}function L(n){return null!=n&&!(typeof n=="function"&&Q(n))&&W(qn(n))}function Q(n){return n=X(n)?An.call(n):"","[object Function]"==n||"[object GeneratorFunction]"==n}function W(n){return typeof n=="number"&&n>-1&&0==n%1&&9007199254740991>=n}function X(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function Y(n){return!!n&&typeof n=="object"}function Z(n){return typeof n=="number"||Y(n)&&"[object Number]"==An.call(n)}function nn(n){return typeof n=="string"||!Mn(n)&&Y(n)&&"[object String]"==An.call(n);
|
18
|
+
}function tn(n,t){return t>n}function rn(n){return typeof n=="string"?n:null==n?"":n+""}function en(n){var t=z(n);if(!t&&!L(n))return Bn(Object(n));var r,e=q(n),u=!!e,e=e||[],o=e.length;for(r in n)!xn.call(n,r)||u&&("length"==r||f(r,o))||t&&"constructor"==r||e.push(r);return e}function un(n){for(var t=-1,r=z(n),e=d(n),u=e.length,o=q(n),i=!!o,o=o||[],c=o.length;++t<u;){var a=e[t];i&&("length"==a||f(a,c))||"constructor"==a&&(r||!xn.call(n,a))||o.push(a)}return o}function on(n){return n?u(n,en(n)):[];
|
19
|
+
}function cn(n){return n}function fn(t,r,e){var u=en(r),o=g(r,u);null!=e||X(r)&&(o.length||!u.length)||(e=r,r=t,t=this,o=g(r,en(r)));var i=X(e)&&"chain"in e?e.chain:true,c=Q(t);return In(o,function(e){var u=r[e];t[e]=u,c&&(t.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=t(this.__wrapped__);return(e.__actions__=k(this.__actions__)).push({func:u,args:arguments,thisArg:t}),e.__chain__=r,e}return u.apply(t,n([this.value()],arguments))})}),t}var an,ln=/[&<>"'`]/g,pn=RegExp(ln.source),sn=/^(?:0|[1-9]\d*)$/,hn={
|
20
|
+
"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},vn={"function":true,object:true},yn=vn[typeof exports]&&exports&&!exports.nodeType?exports:null,_n=vn[typeof module]&&module&&!module.nodeType?module:null,gn=o(vn[typeof self]&&self),bn=o(vn[typeof window]&&window),jn=_n&&_n.exports===yn?yn:null,mn=o(vn[typeof this]&&this),dn=o(yn&&_n&&typeof global=="object"&&global)||bn!==(mn&&mn.window)&&bn||gn||mn||Function("return this")(),wn=Array.prototype,On=Object.prototype,xn=On.hasOwnProperty,En=0,An=On.toString,kn=dn._,Nn=dn.f,Sn=Nn?Nn.g:an,Tn=On.propertyIsEnumerable,Fn=dn.isFinite,Bn=Object.keys,Rn=Math.max,Dn=function(){
|
21
|
+
function n(){}return function(t){if(X(t)){n.prototype=t;var r=new n;n.prototype=an}return r||{}}}(),In=function(n,t){return function(r,e){if(null==r)return r;if(!L(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}}(_),$n=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}}();Sn&&!Tn.call({valueOf:1},"valueOf")&&(d=function(n){n=Sn(n);for(var t,r=[];!(t=n.next()).done;)r.push(t.value);
|
22
|
+
return r});var qn=E("length"),zn=U(function(t,r){return Mn(t)||(t=null==t?[]:[Object(t)]),y(r),n(k(t),on)}),Cn=U(function(n,t,r){return R(n,t,r)}),Gn=U(function(n,t){return s(n,1,t)}),Jn=U(function(n,t,r){return s(n,Un(t)||0,r)}),Mn=Array.isArray,Pn=Number,Un=Number,Vn=F(function(n,t){T(t,en(t),n)}),Hn=F(function(n,t){T(t,un(t),n)}),Kn=F(function(n,t,r,e){T(t,un(t),n,e)}),Ln=U(function(n){return n.push(an,p),Kn.apply(an,n)}),Qn=U(function(n,t){return null==n?{}:x(n,y(t))}),Wn=m;l.prototype=Dn(a.prototype),
|
23
|
+
l.prototype.constructor=l,a.assignIn=Hn,a.before=P,a.bind=Cn,a.chain=function(n){return n=a(n),n.__chain__=true,n},a.compact=function(n){return v(n,Boolean)},a.concat=zn,a.create=function(n,t){var r=Dn(n);return t?Vn(r,t):r},a.defaults=Ln,a.defer=Gn,a.delay=Jn,a.filter=function(n,t){return v(n,m(t))},a.flatten=function(n){return n&&n.length?y(n):[]},a.flattenDeep=function(n){return n&&n.length?y(n,true):[]},a.iteratee=Wn,a.keys=en,a.map=function(n,t){return w(n,m(t))},a.matches=function(n){return O(Vn({},n));
|
24
|
+
},a.mixin=fn,a.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},a.once=function(n){return P(2,n)},a.pick=Qn,a.slice=function(n,t,r){var e=n?n.length:0;return r=r===an?e:+r,e?A(n,null==t?0:+t,r):[]},a.sortBy=function(n,t){var r=0;return t=m(t),w(w(n,function(n,e,u){return{c:n,b:r++,a:t(n,e,u)}}).sort(function(n,t){var r;n:{r=n.a;var e=t.a;if(r!==e){var u=null===r,o=r===an,i=r===r,c=null===e,f=e===an,a=e===e;if(r>e&&!c||!i||u&&!f&&a||o&&a){
|
25
|
+
r=1;break n}if(e>r&&!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,
|
26
|
+
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<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1},a.isArguments=K,a.isArray=Mn,a.isBoolean=function(n){return true===n||false===n||Y(n)&&"[object Boolean]"==An.call(n)},a.isDate=function(n){return Y(n)&&"[object Date]"==An.call(n)},a.isEmpty=function(n){if(L(n)&&(Mn(n)||nn(n)||Q(n.splice)||K(n)))return!n.length;for(var t in n)if(xn.call(n,t))return false;return true},a.isEqual=function(n,t){
|
27
|
+
return b(n,t)},a.isFinite=function(n){return typeof n=="number"&&Fn(n)},a.isFunction=Q,a.isNaN=function(n){return Z(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=Z,a.isObject=X,a.isRegExp=function(n){return X(n)&&"[object RegExp]"==An.call(n)},a.isString=nn,a.isUndefined=function(n){return n===an},a.last=function(n){var t=n?n.length:0;return t?n[t-1]:an},a.max=function(n){return n&&n.length?t(n,cn,H):an},a.min=function(n){return n&&n.length?t(n,cn,tn):an},a.noConflict=function(){return dn._===this&&(dn._=kn),
|
28
|
+
this},a.noop=function(){},a.reduce=M,a.result=function(n,t,r){return t=null==n?an:n[t],t===an&&(t=r),Q(t)?t.call(n):t},a.size=function(n){return null==n?0:(n=L(n)?n:en(n),n.length)},a.some=function(n,t,r){return t=r?an:t,N(n,m(t))},a.uniqueId=function(n){var t=++En;return rn(n)+t},a.each=J,a.first=C,fn(a,function(){var n={};return _(a,function(t,r){xn.call(a.prototype,r)||(n[r]=t)}),n}(),{chain:false}),a.VERSION="4.3.0",In("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){
|
29
|
+
var t=(/^(?:replace|split)$/.test(n)?String.prototype:wn)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);a.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),a.prototype.toJSON=a.prototype.valueOf=a.prototype.value=function(){return S(this.__wrapped__,this.__actions__)},(bn||gn||{})._=a,typeof define=="function"&&typeof define.amd=="object"&&define.amd? define(function(){
|
30
|
+
return a}):yn&&_n?(jn&&((_n.exports=a)._=a),yn._=a):dn._=a}).call(this);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* lodash 4.
|
3
|
+
* lodash 4.3.0 (Custom Build) <https://lodash.com/>
|
4
4
|
* Build: `lodash -o ./dist/lodash.js`
|
5
5
|
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
6
6
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
var undefined;
|
14
14
|
|
15
15
|
/** Used as the semantic version number. */
|
16
|
-
var VERSION = '4.
|
16
|
+
var VERSION = '4.3.0';
|
17
17
|
|
18
18
|
/** Used to compose bitmasks for wrapper metadata. */
|
19
19
|
var BIND_FLAG = 1,
|
@@ -82,7 +82,8 @@
|
|
82
82
|
setTag = '[object Set]',
|
83
83
|
stringTag = '[object String]',
|
84
84
|
symbolTag = '[object Symbol]',
|
85
|
-
weakMapTag = '[object WeakMap]'
|
85
|
+
weakMapTag = '[object WeakMap]',
|
86
|
+
weakSetTag = '[object WeakSet]';
|
86
87
|
|
87
88
|
var arrayBufferTag = '[object ArrayBuffer]',
|
88
89
|
float32Tag = '[object Float32Array]',
|
@@ -163,7 +164,8 @@
|
|
163
164
|
|
164
165
|
/** Used to compose unicode character classes. */
|
165
166
|
var rsAstralRange = '\\ud800-\\udfff',
|
166
|
-
|
167
|
+
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
168
|
+
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
167
169
|
rsDingbatRange = '\\u2700-\\u27bf',
|
168
170
|
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
169
171
|
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
@@ -177,12 +179,13 @@
|
|
177
179
|
/** Used to compose unicode capture groups. */
|
178
180
|
var rsAstral = '[' + rsAstralRange + ']',
|
179
181
|
rsBreak = '[' + rsBreakRange + ']',
|
180
|
-
rsCombo = '[' +
|
182
|
+
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
|
181
183
|
rsDigits = '\\d+',
|
182
184
|
rsDingbat = '[' + rsDingbatRange + ']',
|
183
185
|
rsLower = '[' + rsLowerRange + ']',
|
184
186
|
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
|
185
|
-
|
187
|
+
rsFitz = '\\ud83c[\\udffb-\\udfff]',
|
188
|
+
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
|
186
189
|
rsNonAstral = '[^' + rsAstralRange + ']',
|
187
190
|
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
|
188
191
|
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
|
@@ -199,14 +202,17 @@
|
|
199
202
|
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
|
200
203
|
rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
|
201
204
|
|
202
|
-
/**
|
205
|
+
/**
|
206
|
+
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
207
|
+
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
208
|
+
*/
|
203
209
|
var reComboMark = RegExp(rsCombo, 'g');
|
204
210
|
|
205
211
|
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
|
206
|
-
var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g');
|
212
|
+
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
|
207
213
|
|
208
214
|
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
209
|
-
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange +
|
215
|
+
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
210
216
|
|
211
217
|
/** Used to match non-compound words composed of alphanumeric characters. */
|
212
218
|
var reBasicWord = /[a-zA-Z0-9]+/g;
|
@@ -216,7 +222,8 @@
|
|
216
222
|
rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
|
217
223
|
rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
|
218
224
|
rsUpper + '?' + rsLowerMisc + '+',
|
219
|
-
|
225
|
+
rsUpper + '+',
|
226
|
+
rsDigits,
|
220
227
|
rsEmoji
|
221
228
|
].join('|'), 'g');
|
222
229
|
|
@@ -225,8 +232,8 @@
|
|
225
232
|
|
226
233
|
/** Used to assign default `context` object properties. */
|
227
234
|
var contextProps = [
|
228
|
-
'Array', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
229
|
-
'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
235
|
+
'Array', 'Buffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
236
|
+
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
|
230
237
|
'Reflect', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
|
231
238
|
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', '_',
|
232
239
|
'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
|
@@ -391,11 +398,11 @@
|
|
391
398
|
* @private
|
392
399
|
* @param {Function} func The function to invoke.
|
393
400
|
* @param {*} thisArg The `this` binding of `func`.
|
394
|
-
* @param {...*}
|
401
|
+
* @param {...*} args The arguments to invoke `func` with.
|
395
402
|
* @returns {*} Returns the result of `func`.
|
396
403
|
*/
|
397
404
|
function apply(func, thisArg, args) {
|
398
|
-
var length = args
|
405
|
+
var length = args.length;
|
399
406
|
switch (length) {
|
400
407
|
case 0: return func.call(thisArg);
|
401
408
|
case 1: return func.call(thisArg, args[0]);
|
@@ -405,6 +412,27 @@
|
|
405
412
|
return func.apply(thisArg, args);
|
406
413
|
}
|
407
414
|
|
415
|
+
/**
|
416
|
+
* A specialized version of `baseAggregator` for arrays.
|
417
|
+
*
|
418
|
+
* @private
|
419
|
+
* @param {Array} array The array to iterate over.
|
420
|
+
* @param {Function} setter The function to set `accumulator` values.
|
421
|
+
* @param {Function} iteratee The iteratee to transform keys.
|
422
|
+
* @param {Object} accumulator The initial aggregated object.
|
423
|
+
* @returns {Function} Returns `accumulator`.
|
424
|
+
*/
|
425
|
+
function arrayAggregator(array, setter, iteratee, accumulator) {
|
426
|
+
var index = -1,
|
427
|
+
length = array.length;
|
428
|
+
|
429
|
+
while (++index < length) {
|
430
|
+
var value = array[index];
|
431
|
+
setter(accumulator, value, iteratee(value), array);
|
432
|
+
}
|
433
|
+
return accumulator;
|
434
|
+
}
|
435
|
+
|
408
436
|
/**
|
409
437
|
* Creates a new array concatenating `array` with `other`.
|
410
438
|
*
|
@@ -597,14 +625,14 @@
|
|
597
625
|
* @param {Array} array The array to iterate over.
|
598
626
|
* @param {Function} iteratee The function invoked per iteration.
|
599
627
|
* @param {*} [accumulator] The initial value.
|
600
|
-
* @param {boolean} [
|
628
|
+
* @param {boolean} [initAccum] Specify using the first element of `array` as the initial value.
|
601
629
|
* @returns {*} Returns the accumulated value.
|
602
630
|
*/
|
603
|
-
function arrayReduce(array, iteratee, accumulator,
|
631
|
+
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
604
632
|
var index = -1,
|
605
633
|
length = array.length;
|
606
634
|
|
607
|
-
if (
|
635
|
+
if (initAccum && length) {
|
608
636
|
accumulator = array[++index];
|
609
637
|
}
|
610
638
|
while (++index < length) {
|
@@ -621,12 +649,12 @@
|
|
621
649
|
* @param {Array} array The array to iterate over.
|
622
650
|
* @param {Function} iteratee The function invoked per iteration.
|
623
651
|
* @param {*} [accumulator] The initial value.
|
624
|
-
* @param {boolean} [
|
652
|
+
* @param {boolean} [initAccum] Specify using the last element of `array` as the initial value.
|
625
653
|
* @returns {*} Returns the accumulated value.
|
626
654
|
*/
|
627
|
-
function arrayReduceRight(array, iteratee, accumulator,
|
655
|
+
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
628
656
|
var length = array.length;
|
629
|
-
if (
|
657
|
+
if (initAccum && length) {
|
630
658
|
accumulator = array[--length];
|
631
659
|
}
|
632
660
|
while (length--) {
|
@@ -688,7 +716,7 @@
|
|
688
716
|
/**
|
689
717
|
* The base implementation of methods like `_.find` and `_.findKey`, without
|
690
718
|
* support for iteratee shorthands, which iterates over `collection` using
|
691
|
-
*
|
719
|
+
* `eachFunc`.
|
692
720
|
*
|
693
721
|
* @private
|
694
722
|
* @param {Array|Object} collection The collection to search.
|
@@ -756,21 +784,20 @@
|
|
756
784
|
|
757
785
|
/**
|
758
786
|
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
759
|
-
* for iteratee shorthands, which iterates over `collection` using
|
760
|
-
* `eachFunc`.
|
787
|
+
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
761
788
|
*
|
762
789
|
* @private
|
763
790
|
* @param {Array|Object} collection The collection to iterate over.
|
764
791
|
* @param {Function} iteratee The function invoked per iteration.
|
765
792
|
* @param {*} accumulator The initial value.
|
766
|
-
* @param {boolean}
|
793
|
+
* @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value.
|
767
794
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
768
795
|
* @returns {*} Returns the accumulated value.
|
769
796
|
*/
|
770
|
-
function baseReduce(collection, iteratee, accumulator,
|
797
|
+
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
771
798
|
eachFunc(collection, function(value, index, collection) {
|
772
|
-
accumulator =
|
773
|
-
? (
|
799
|
+
accumulator = initAccum
|
800
|
+
? (initAccum = false, value)
|
774
801
|
: iteratee(accumulator, value, index, collection);
|
775
802
|
});
|
776
803
|
return accumulator;
|
@@ -1164,6 +1191,7 @@
|
|
1164
1191
|
/**
|
1165
1192
|
* Gets the number of symbols in `string`.
|
1166
1193
|
*
|
1194
|
+
* @private
|
1167
1195
|
* @param {string} string The string to inspect.
|
1168
1196
|
* @returns {number} Returns the string size.
|
1169
1197
|
*/
|
@@ -1227,14 +1255,14 @@
|
|
1227
1255
|
* lodash.isFunction(lodash.bar);
|
1228
1256
|
* // => true
|
1229
1257
|
*
|
1230
|
-
* //
|
1258
|
+
* // Use `context` to mock `Date#getTime` use in `_.now`.
|
1231
1259
|
* var mock = _.runInContext({
|
1232
1260
|
* 'Date': function() {
|
1233
1261
|
* return { 'getTime': getTimeMock };
|
1234
1262
|
* }
|
1235
1263
|
* });
|
1236
1264
|
*
|
1237
|
-
* //
|
1265
|
+
* // Create a suped-up `defer` in Node.js.
|
1238
1266
|
* var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
|
1239
1267
|
*/
|
1240
1268
|
function runInContext(context) {
|
@@ -1279,14 +1307,15 @@
|
|
1279
1307
|
);
|
1280
1308
|
|
1281
1309
|
/** Built-in value references. */
|
1282
|
-
var
|
1310
|
+
var Buffer = moduleExports ? context.Buffer : undefined,
|
1283
1311
|
Reflect = context.Reflect,
|
1312
|
+
Symbol = context.Symbol,
|
1284
1313
|
Uint8Array = context.Uint8Array,
|
1285
1314
|
clearTimeout = context.clearTimeout,
|
1286
1315
|
enumerate = Reflect ? Reflect.enumerate : undefined,
|
1287
1316
|
getPrototypeOf = Object.getPrototypeOf,
|
1288
1317
|
getOwnPropertySymbols = Object.getOwnPropertySymbols,
|
1289
|
-
iteratorSymbol = typeof (iteratorSymbol =
|
1318
|
+
iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined,
|
1290
1319
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
1291
1320
|
setTimeout = context.setTimeout,
|
1292
1321
|
splice = arrayProto.splice;
|
@@ -1312,14 +1341,15 @@
|
|
1312
1341
|
/** Used to store function metadata. */
|
1313
1342
|
var metaMap = WeakMap && new WeakMap;
|
1314
1343
|
|
1315
|
-
/** Used to detect maps and
|
1344
|
+
/** Used to detect maps, sets, and weakmaps. */
|
1316
1345
|
var mapCtorString = Map ? funcToString.call(Map) : '',
|
1317
|
-
setCtorString = Set ? funcToString.call(Set) : ''
|
1346
|
+
setCtorString = Set ? funcToString.call(Set) : '',
|
1347
|
+
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
|
1318
1348
|
|
1319
1349
|
/** Used to convert symbols to primitives and strings. */
|
1320
|
-
var symbolProto =
|
1321
|
-
symbolValueOf =
|
1322
|
-
symbolToString =
|
1350
|
+
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
1351
|
+
symbolValueOf = Symbol ? symbolProto.valueOf : undefined,
|
1352
|
+
symbolToString = Symbol ? symbolProto.toString : undefined;
|
1323
1353
|
|
1324
1354
|
/** Used to lookup unminified function names. */
|
1325
1355
|
var realNames = {};
|
@@ -1367,47 +1397,48 @@
|
|
1367
1397
|
* The chainable wrapper methods are:
|
1368
1398
|
* `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`,
|
1369
1399
|
* `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`,
|
1370
|
-
* `compact`, `concat`, `conforms`,
|
1400
|
+
* `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`,
|
1371
1401
|
* `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`,
|
1372
|
-
* `differenceBy`, `differenceWith`,
|
1402
|
+
* `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`,
|
1373
1403
|
* `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`,
|
1374
|
-
* `flowRight`, `
|
1375
|
-
* `
|
1376
|
-
* `
|
1377
|
-
* `
|
1378
|
-
* `
|
1379
|
-
* `
|
1380
|
-
* `
|
1381
|
-
* `
|
1382
|
-
* `
|
1383
|
-
* `
|
1384
|
-
* `
|
1385
|
-
* `
|
1386
|
-
* `
|
1387
|
-
* `
|
1388
|
-
* `
|
1389
|
-
* `
|
1404
|
+
* `flowRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`,
|
1405
|
+
* `intersection`, `intersectionBy`, `intersectionWith`, `invert`, `invertBy`,
|
1406
|
+
* `invokeMap`, `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`,
|
1407
|
+
* `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`,
|
1408
|
+
* `method`, `methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`,
|
1409
|
+
* `orderBy`, `over`, `overArgs`, `overEvery`, `overSome`, `partial`,
|
1410
|
+
* `partialRight`, `partition`, `pick`, `pickBy`, `plant`, `property`,
|
1411
|
+
* `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`,
|
1412
|
+
* `rangeRight`, `rearg`, `reject`, `remove`, `rest`, `reverse`, `sampleSize`,
|
1413
|
+
* `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`,
|
1414
|
+
* `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
|
1415
|
+
* `thru`, `toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`,
|
1416
|
+
* `transform`, `unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`,
|
1417
|
+
* `uniqWith`, `unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`,
|
1418
|
+
* `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`,
|
1419
|
+
* `zipObjectDeep`, and `zipWith`
|
1390
1420
|
*
|
1391
1421
|
* The wrapper methods that are **not** chainable by default are:
|
1392
1422
|
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
|
1393
1423
|
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`,
|
1394
1424
|
* `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
|
1395
|
-
* `findLast`, `findLastIndex`, `findLastKey`, `floor`, `
|
1396
|
-
* `
|
1397
|
-
* `
|
1398
|
-
* `
|
1399
|
-
* `
|
1400
|
-
* `
|
1401
|
-
* `
|
1402
|
-
* `
|
1403
|
-
* `
|
1404
|
-
* `
|
1405
|
-
* `
|
1406
|
-
* `
|
1407
|
-
* `
|
1408
|
-
* `
|
1409
|
-
* `
|
1410
|
-
* `
|
1425
|
+
* `findLast`, `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`,
|
1426
|
+
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
|
1427
|
+
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
|
1428
|
+
* `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`,
|
1429
|
+
* `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,
|
1430
|
+
* `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, `isMatchWith`,
|
1431
|
+
* `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`,
|
1432
|
+
* `isPlainObject`, `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`,
|
1433
|
+
* `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`,
|
1434
|
+
* `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`,
|
1435
|
+
* `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`,
|
1436
|
+
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
1437
|
+
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
1438
|
+
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
1439
|
+
* `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toLower`,
|
1440
|
+
* `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`,
|
1441
|
+
* `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`,
|
1411
1442
|
* `upperCase`, `upperFirst`, `value`, and `words`
|
1412
1443
|
*
|
1413
1444
|
* @name _
|
@@ -1423,11 +1454,11 @@
|
|
1423
1454
|
*
|
1424
1455
|
* var wrapped = _([1, 2, 3]);
|
1425
1456
|
*
|
1426
|
-
* //
|
1457
|
+
* // Returns an unwrapped value.
|
1427
1458
|
* wrapped.reduce(_.add);
|
1428
1459
|
* // => 6
|
1429
1460
|
*
|
1430
|
-
* //
|
1461
|
+
* // Returns a wrapped value.
|
1431
1462
|
* var squares = wrapped.map(square);
|
1432
1463
|
*
|
1433
1464
|
* _.isArray(squares);
|
@@ -2117,6 +2148,24 @@
|
|
2117
2148
|
}
|
2118
2149
|
}
|
2119
2150
|
|
2151
|
+
/**
|
2152
|
+
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
2153
|
+
* by `iteratee` and values set by `setter`.
|
2154
|
+
*
|
2155
|
+
* @private
|
2156
|
+
* @param {Array|Object} collection The collection to iterate over.
|
2157
|
+
* @param {Function} setter The function to set `accumulator` values.
|
2158
|
+
* @param {Function} iteratee The iteratee to transform keys.
|
2159
|
+
* @param {Object} accumulator The initial aggregated object.
|
2160
|
+
* @returns {Function} Returns `accumulator`.
|
2161
|
+
*/
|
2162
|
+
function baseAggregator(collection, setter, iteratee, accumulator) {
|
2163
|
+
baseEach(collection, function(value, key, collection) {
|
2164
|
+
setter(accumulator, value, iteratee(value), collection);
|
2165
|
+
});
|
2166
|
+
return accumulator;
|
2167
|
+
}
|
2168
|
+
|
2120
2169
|
/**
|
2121
2170
|
* The base implementation of `_.assign` without support for multiple sources
|
2122
2171
|
* or `customizer` functions.
|
@@ -2205,6 +2254,9 @@
|
|
2205
2254
|
var tag = getTag(value),
|
2206
2255
|
isFunc = tag == funcTag || tag == genTag;
|
2207
2256
|
|
2257
|
+
if (isBuffer(value)) {
|
2258
|
+
return cloneBuffer(value, isDeep);
|
2259
|
+
}
|
2208
2260
|
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
2209
2261
|
if (isHostObject(value)) {
|
2210
2262
|
return object ? value : {};
|
@@ -2290,7 +2342,7 @@
|
|
2290
2342
|
* @private
|
2291
2343
|
* @param {Function} func The function to delay.
|
2292
2344
|
* @param {number} wait The number of milliseconds to delay invocation.
|
2293
|
-
* @param {Object} args The arguments provide to `func`.
|
2345
|
+
* @param {Object} args The arguments to provide to `func`.
|
2294
2346
|
* @returns {number} Returns the timer id.
|
2295
2347
|
*/
|
2296
2348
|
function baseDelay(func, wait, args) {
|
@@ -2535,7 +2587,7 @@
|
|
2535
2587
|
|
2536
2588
|
/**
|
2537
2589
|
* The base implementation of `_.functions` which creates an array of
|
2538
|
-
* `object` function property names filtered from
|
2590
|
+
* `object` function property names filtered from `props`.
|
2539
2591
|
*
|
2540
2592
|
* @private
|
2541
2593
|
* @param {Object} object The object to inspect.
|
@@ -2663,11 +2715,28 @@
|
|
2663
2715
|
return result;
|
2664
2716
|
}
|
2665
2717
|
|
2718
|
+
/**
|
2719
|
+
* The base implementation of `_.invert` and `_.invertBy` which inverts
|
2720
|
+
* `object` with values transformed by `iteratee` and set by `setter`.
|
2721
|
+
*
|
2722
|
+
* @private
|
2723
|
+
* @param {Object} object The object to iterate over.
|
2724
|
+
* @param {Function} setter The function to set `accumulator` values.
|
2725
|
+
* @param {Function} iteratee The iteratee to transform values.
|
2726
|
+
* @param {Object} accumulator The initial inverted object.
|
2727
|
+
* @returns {Function} Returns `accumulator`.
|
2728
|
+
*/
|
2729
|
+
function baseInverter(object, setter, iteratee, accumulator) {
|
2730
|
+
baseForOwn(object, function(value, key, object) {
|
2731
|
+
setter(accumulator, iteratee(value), key, object);
|
2732
|
+
});
|
2733
|
+
return accumulator;
|
2734
|
+
}
|
2735
|
+
|
2666
2736
|
/**
|
2667
2737
|
* The base implementation of `_.invoke` without support for individual
|
2668
2738
|
* method arguments.
|
2669
2739
|
*
|
2670
|
-
*
|
2671
2740
|
* @private
|
2672
2741
|
* @param {Object} object The object to query.
|
2673
2742
|
* @param {Array|string} path The path of the method to invoke.
|
@@ -2810,7 +2879,10 @@
|
|
2810
2879
|
var stack = new Stack,
|
2811
2880
|
result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined;
|
2812
2881
|
|
2813
|
-
if (!(result === undefined
|
2882
|
+
if (!(result === undefined
|
2883
|
+
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
|
2884
|
+
: result
|
2885
|
+
)) {
|
2814
2886
|
return false;
|
2815
2887
|
}
|
2816
2888
|
}
|
@@ -2946,10 +3018,11 @@
|
|
2946
3018
|
* @private
|
2947
3019
|
* @param {Object} object The destination object.
|
2948
3020
|
* @param {Object} source The source object.
|
3021
|
+
* @param {number} srcIndex The index of `source`.
|
2949
3022
|
* @param {Function} [customizer] The function to customize merged values.
|
2950
3023
|
* @param {Object} [stack] Tracks traversed source values and their merged counterparts.
|
2951
3024
|
*/
|
2952
|
-
function baseMerge(object, source, customizer, stack) {
|
3025
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
2953
3026
|
if (object === source) {
|
2954
3027
|
return;
|
2955
3028
|
}
|
@@ -2961,7 +3034,7 @@
|
|
2961
3034
|
}
|
2962
3035
|
if (isObject(srcValue)) {
|
2963
3036
|
stack || (stack = new Stack);
|
2964
|
-
baseMergeDeep(object, source, key, baseMerge, customizer, stack);
|
3037
|
+
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
2965
3038
|
}
|
2966
3039
|
else {
|
2967
3040
|
var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined;
|
@@ -2982,14 +3055,15 @@
|
|
2982
3055
|
* @param {Object} object The destination object.
|
2983
3056
|
* @param {Object} source The source object.
|
2984
3057
|
* @param {string} key The key of the value to merge.
|
3058
|
+
* @param {number} srcIndex The index of `source`.
|
2985
3059
|
* @param {Function} mergeFunc The function to merge values.
|
2986
3060
|
* @param {Function} [customizer] The function to customize assigned values.
|
2987
3061
|
* @param {Object} [stack] Tracks traversed source values and their merged counterparts.
|
2988
3062
|
*/
|
2989
|
-
function baseMergeDeep(object, source, key, mergeFunc, customizer, stack) {
|
3063
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
2990
3064
|
var objValue = object[key],
|
2991
3065
|
srcValue = source[key],
|
2992
|
-
stacked = stack.get(srcValue)
|
3066
|
+
stacked = stack.get(srcValue);
|
2993
3067
|
|
2994
3068
|
if (stacked) {
|
2995
3069
|
assignMergeValue(object, key, stacked);
|
@@ -3001,24 +3075,38 @@
|
|
3001
3075
|
if (isCommon) {
|
3002
3076
|
newValue = srcValue;
|
3003
3077
|
if (isArray(srcValue) || isTypedArray(srcValue)) {
|
3004
|
-
|
3005
|
-
? objValue
|
3006
|
-
|
3078
|
+
if (isArray(objValue)) {
|
3079
|
+
newValue = srcIndex ? copyArray(objValue) : objValue;
|
3080
|
+
}
|
3081
|
+
else if (isArrayLikeObject(objValue)) {
|
3082
|
+
newValue = copyArray(objValue);
|
3083
|
+
}
|
3084
|
+
else {
|
3085
|
+
isCommon = false;
|
3086
|
+
newValue = baseClone(srcValue);
|
3087
|
+
}
|
3007
3088
|
}
|
3008
3089
|
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
3009
|
-
|
3010
|
-
|
3011
|
-
|
3090
|
+
if (isArguments(objValue)) {
|
3091
|
+
newValue = toPlainObject(objValue);
|
3092
|
+
}
|
3093
|
+
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
3094
|
+
isCommon = false;
|
3095
|
+
newValue = baseClone(srcValue);
|
3096
|
+
}
|
3097
|
+
else {
|
3098
|
+
newValue = srcIndex ? baseClone(objValue) : objValue;
|
3099
|
+
}
|
3012
3100
|
}
|
3013
3101
|
else {
|
3014
|
-
isCommon =
|
3102
|
+
isCommon = false;
|
3015
3103
|
}
|
3016
3104
|
}
|
3017
3105
|
stack.set(srcValue, newValue);
|
3018
3106
|
|
3019
3107
|
if (isCommon) {
|
3020
3108
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
3021
|
-
mergeFunc(newValue, srcValue, customizer, stack);
|
3109
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
3022
3110
|
}
|
3023
3111
|
assignMergeValue(object, key, newValue);
|
3024
3112
|
}
|
@@ -3082,7 +3170,7 @@
|
|
3082
3170
|
function basePickBy(object, predicate) {
|
3083
3171
|
var result = {};
|
3084
3172
|
baseForIn(object, function(value, key) {
|
3085
|
-
if (predicate(value)) {
|
3173
|
+
if (predicate(value, key)) {
|
3086
3174
|
result[key] = value;
|
3087
3175
|
}
|
3088
3176
|
});
|
@@ -3605,18 +3693,58 @@
|
|
3605
3693
|
}
|
3606
3694
|
|
3607
3695
|
/**
|
3608
|
-
*
|
3696
|
+
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
3609
3697
|
*
|
3610
3698
|
* @private
|
3611
|
-
* @param {
|
3612
|
-
* @
|
3699
|
+
* @param {Array} props The property names.
|
3700
|
+
* @param {Array} values The property values.
|
3701
|
+
* @param {Function} assignFunc The function to assign values.
|
3702
|
+
* @returns {Object} Returns the new object.
|
3613
3703
|
*/
|
3614
|
-
function
|
3704
|
+
function baseZipObject(props, values, assignFunc) {
|
3705
|
+
var index = -1,
|
3706
|
+
length = props.length,
|
3707
|
+
valsLength = values.length,
|
3708
|
+
result = {};
|
3709
|
+
|
3710
|
+
while (++index < length) {
|
3711
|
+
assignFunc(result, props[index], index < valsLength ? values[index] : undefined);
|
3712
|
+
}
|
3713
|
+
return result;
|
3714
|
+
}
|
3715
|
+
|
3716
|
+
/**
|
3717
|
+
* Creates a clone of `buffer`.
|
3718
|
+
*
|
3719
|
+
* @private
|
3720
|
+
* @param {Buffer} buffer The buffer to clone.
|
3721
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
3722
|
+
* @returns {Buffer} Returns the cloned buffer.
|
3723
|
+
*/
|
3724
|
+
function cloneBuffer(buffer, isDeep) {
|
3725
|
+
if (isDeep) {
|
3726
|
+
return buffer.slice();
|
3727
|
+
}
|
3615
3728
|
var Ctor = buffer.constructor,
|
3616
|
-
result = new Ctor(buffer.
|
3729
|
+
result = new Ctor(buffer.length);
|
3730
|
+
|
3731
|
+
buffer.copy(result);
|
3732
|
+
return result;
|
3733
|
+
}
|
3734
|
+
|
3735
|
+
/**
|
3736
|
+
* Creates a clone of `arrayBuffer`.
|
3737
|
+
*
|
3738
|
+
* @private
|
3739
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
3740
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
3741
|
+
*/
|
3742
|
+
function cloneArrayBuffer(arrayBuffer) {
|
3743
|
+
var Ctor = arrayBuffer.constructor,
|
3744
|
+
result = new Ctor(arrayBuffer.byteLength),
|
3617
3745
|
view = new Uint8Array(result);
|
3618
3746
|
|
3619
|
-
view.set(new Uint8Array(
|
3747
|
+
view.set(new Uint8Array(arrayBuffer));
|
3620
3748
|
return result;
|
3621
3749
|
}
|
3622
3750
|
|
@@ -3667,7 +3795,7 @@
|
|
3667
3795
|
* @returns {Object} Returns the cloned symbol object.
|
3668
3796
|
*/
|
3669
3797
|
function cloneSymbol(symbol) {
|
3670
|
-
return
|
3798
|
+
return Symbol ? Object(symbolValueOf.call(symbol)) : {};
|
3671
3799
|
}
|
3672
3800
|
|
3673
3801
|
/**
|
@@ -3682,7 +3810,7 @@
|
|
3682
3810
|
var buffer = typedArray.buffer,
|
3683
3811
|
Ctor = typedArray.constructor;
|
3684
3812
|
|
3685
|
-
return new Ctor(isDeep ?
|
3813
|
+
return new Ctor(isDeep ? cloneArrayBuffer(buffer) : buffer, typedArray.byteOffset, typedArray.length);
|
3686
3814
|
}
|
3687
3815
|
|
3688
3816
|
/**
|
@@ -3821,29 +3949,16 @@
|
|
3821
3949
|
* Creates a function like `_.groupBy`.
|
3822
3950
|
*
|
3823
3951
|
* @private
|
3824
|
-
* @param {Function} setter The function to set
|
3825
|
-
* @param {Function} [initializer] The
|
3952
|
+
* @param {Function} setter The function to set accumulator values.
|
3953
|
+
* @param {Function} [initializer] The accumulator object initializer.
|
3826
3954
|
* @returns {Function} Returns the new aggregator function.
|
3827
3955
|
*/
|
3828
3956
|
function createAggregator(setter, initializer) {
|
3829
3957
|
return function(collection, iteratee) {
|
3830
|
-
var
|
3831
|
-
|
3832
|
-
|
3833
|
-
if (isArray(collection)) {
|
3834
|
-
var index = -1,
|
3835
|
-
length = collection.length;
|
3958
|
+
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
3959
|
+
accumulator = initializer ? initializer() : {};
|
3836
3960
|
|
3837
|
-
|
3838
|
-
var value = collection[index];
|
3839
|
-
setter(result, value, iteratee(value), collection);
|
3840
|
-
}
|
3841
|
-
} else {
|
3842
|
-
baseEach(collection, function(value, key, collection) {
|
3843
|
-
setter(result, value, iteratee(value), collection);
|
3844
|
-
});
|
3845
|
-
}
|
3846
|
-
return result;
|
3961
|
+
return func(collection, setter, getIteratee(iteratee), accumulator);
|
3847
3962
|
};
|
3848
3963
|
}
|
3849
3964
|
|
@@ -3870,7 +3985,7 @@
|
|
3870
3985
|
while (++index < length) {
|
3871
3986
|
var source = sources[index];
|
3872
3987
|
if (source) {
|
3873
|
-
assigner(object, source, customizer);
|
3988
|
+
assigner(object, source, index, customizer);
|
3874
3989
|
}
|
3875
3990
|
}
|
3876
3991
|
return object;
|
@@ -4033,7 +4148,7 @@
|
|
4033
4148
|
index = length,
|
4034
4149
|
args = Array(length),
|
4035
4150
|
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func,
|
4036
|
-
placeholder = wrapper.placeholder;
|
4151
|
+
placeholder = lodash.placeholder || wrapper.placeholder;
|
4037
4152
|
|
4038
4153
|
while (index--) {
|
4039
4154
|
args[index] = arguments[index];
|
@@ -4149,7 +4264,7 @@
|
|
4149
4264
|
args = composeArgsRight(args, partialsRight, holdersRight);
|
4150
4265
|
}
|
4151
4266
|
if (isCurry || isCurryRight) {
|
4152
|
-
var placeholder = wrapper.placeholder,
|
4267
|
+
var placeholder = lodash.placeholder || wrapper.placeholder,
|
4153
4268
|
argsHolders = replaceHolders(args, placeholder);
|
4154
4269
|
|
4155
4270
|
length -= argsHolders.length;
|
@@ -4176,6 +4291,20 @@
|
|
4176
4291
|
return wrapper;
|
4177
4292
|
}
|
4178
4293
|
|
4294
|
+
/**
|
4295
|
+
* Creates a function like `_.invertBy`.
|
4296
|
+
*
|
4297
|
+
* @private
|
4298
|
+
* @param {Function} setter The function to set accumulator values.
|
4299
|
+
* @param {Function} toIteratee The function to resolve iteratees.
|
4300
|
+
* @returns {Function} Returns the new inverter function.
|
4301
|
+
*/
|
4302
|
+
function createInverter(setter, toIteratee) {
|
4303
|
+
return function(object, iteratee) {
|
4304
|
+
return baseInverter(object, setter, toIteratee(iteratee), {});
|
4305
|
+
};
|
4306
|
+
}
|
4307
|
+
|
4179
4308
|
/**
|
4180
4309
|
* Creates a function like `_.over`.
|
4181
4310
|
*
|
@@ -4555,7 +4684,7 @@
|
|
4555
4684
|
equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG);
|
4556
4685
|
|
4557
4686
|
case symbolTag:
|
4558
|
-
return !!
|
4687
|
+
return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other));
|
4559
4688
|
}
|
4560
4689
|
return false;
|
4561
4690
|
}
|
@@ -4575,7 +4704,6 @@
|
|
4575
4704
|
*/
|
4576
4705
|
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
4577
4706
|
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
|
4578
|
-
isUnordered = bitmask & UNORDERED_COMPARE_FLAG,
|
4579
4707
|
objProps = keys(object),
|
4580
4708
|
objLength = objProps.length,
|
4581
4709
|
othProps = keys(other),
|
@@ -4587,8 +4715,7 @@
|
|
4587
4715
|
var index = objLength;
|
4588
4716
|
while (index--) {
|
4589
4717
|
var key = objProps[index];
|
4590
|
-
if (!(isPartial ? key in other : baseHas(other, key))
|
4591
|
-
!(isUnordered || key == othProps[index])) {
|
4718
|
+
if (!(isPartial ? key in other : baseHas(other, key))) {
|
4592
4719
|
return false;
|
4593
4720
|
}
|
4594
4721
|
}
|
@@ -4658,7 +4785,7 @@
|
|
4658
4785
|
function getFuncName(func) {
|
4659
4786
|
var result = (func.name + ''),
|
4660
4787
|
array = realNames[result],
|
4661
|
-
length =
|
4788
|
+
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
|
4662
4789
|
|
4663
4790
|
while (length--) {
|
4664
4791
|
var data = array[length],
|
@@ -4751,19 +4878,20 @@
|
|
4751
4878
|
return objectToString.call(value);
|
4752
4879
|
}
|
4753
4880
|
|
4754
|
-
// Fallback for IE 11 providing `toStringTag` values for maps and
|
4755
|
-
if ((Map && getTag(new Map) != mapTag) ||
|
4881
|
+
// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
|
4882
|
+
if ((Map && getTag(new Map) != mapTag) ||
|
4883
|
+
(Set && getTag(new Set) != setTag) ||
|
4884
|
+
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
4756
4885
|
getTag = function(value) {
|
4757
4886
|
var result = objectToString.call(value),
|
4758
4887
|
Ctor = result == objectTag ? value.constructor : null,
|
4759
4888
|
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
|
4760
4889
|
|
4761
4890
|
if (ctorString) {
|
4762
|
-
|
4763
|
-
return mapTag;
|
4764
|
-
|
4765
|
-
|
4766
|
-
return setTag;
|
4891
|
+
switch (ctorString) {
|
4892
|
+
case mapCtorString: return mapTag;
|
4893
|
+
case setCtorString: return setTag;
|
4894
|
+
case weakMapCtorString: return weakMapTag;
|
4767
4895
|
}
|
4768
4896
|
}
|
4769
4897
|
return result;
|
@@ -4820,8 +4948,11 @@
|
|
4820
4948
|
result = hasFunc(object, path);
|
4821
4949
|
}
|
4822
4950
|
}
|
4823
|
-
|
4824
|
-
|
4951
|
+
var length = object ? object.length : undefined;
|
4952
|
+
return result || (
|
4953
|
+
!!length && isLength(length) && isIndex(path, length) &&
|
4954
|
+
(isArray(object) || isString(object) || isArguments(object))
|
4955
|
+
);
|
4825
4956
|
}
|
4826
4957
|
|
4827
4958
|
/**
|
@@ -4851,6 +4982,9 @@
|
|
4851
4982
|
* @returns {Object} Returns the initialized clone.
|
4852
4983
|
*/
|
4853
4984
|
function initCloneObject(object) {
|
4985
|
+
if (isPrototype(object)) {
|
4986
|
+
return {};
|
4987
|
+
}
|
4854
4988
|
var Ctor = object.constructor;
|
4855
4989
|
return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
|
4856
4990
|
}
|
@@ -4871,7 +5005,7 @@
|
|
4871
5005
|
var Ctor = object.constructor;
|
4872
5006
|
switch (tag) {
|
4873
5007
|
case arrayBufferTag:
|
4874
|
-
return
|
5008
|
+
return cloneArrayBuffer(object);
|
4875
5009
|
|
4876
5010
|
case boolTag:
|
4877
5011
|
case dateTag:
|
@@ -4910,13 +5044,15 @@
|
|
4910
5044
|
*/
|
4911
5045
|
function indexKeys(object) {
|
4912
5046
|
var length = object ? object.length : undefined;
|
4913
|
-
|
4914
|
-
|
4915
|
-
|
5047
|
+
if (isLength(length) &&
|
5048
|
+
(isArray(object) || isString(object) || isArguments(object))) {
|
5049
|
+
return baseTimes(length, String);
|
5050
|
+
}
|
5051
|
+
return null;
|
4916
5052
|
}
|
4917
5053
|
|
4918
5054
|
/**
|
4919
|
-
* Checks if the
|
5055
|
+
* Checks if the given arguments are from an iteratee call.
|
4920
5056
|
*
|
4921
5057
|
* @private
|
4922
5058
|
* @param {*} value The potential iteratee value argument.
|
@@ -5099,9 +5235,9 @@
|
|
5099
5235
|
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
|
5100
5236
|
if (isObject(objValue) && isObject(srcValue)) {
|
5101
5237
|
stack.set(srcValue, objValue);
|
5102
|
-
baseMerge(objValue, srcValue, mergeDefaults, stack);
|
5238
|
+
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
|
5103
5239
|
}
|
5104
|
-
return objValue
|
5240
|
+
return objValue;
|
5105
5241
|
}
|
5106
5242
|
|
5107
5243
|
/**
|
@@ -5315,13 +5451,16 @@
|
|
5315
5451
|
* // => [1]
|
5316
5452
|
*/
|
5317
5453
|
var concat = rest(function(array, values) {
|
5454
|
+
if (!isArray(array)) {
|
5455
|
+
array = array == null ? [] : [Object(array)];
|
5456
|
+
}
|
5318
5457
|
values = baseFlatten(values);
|
5319
|
-
return arrayConcat(
|
5458
|
+
return arrayConcat(array, values);
|
5320
5459
|
});
|
5321
5460
|
|
5322
5461
|
/**
|
5323
5462
|
* Creates an array of unique `array` values not included in the other
|
5324
|
-
*
|
5463
|
+
* given arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
5325
5464
|
* for equality comparisons.
|
5326
5465
|
*
|
5327
5466
|
* @static
|
@@ -5358,7 +5497,7 @@
|
|
5358
5497
|
* _.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);
|
5359
5498
|
* // => [3.1, 1.3]
|
5360
5499
|
*
|
5361
|
-
* //
|
5500
|
+
* // The `_.property` iteratee shorthand.
|
5362
5501
|
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
5363
5502
|
* // => [{ 'x': 2 }]
|
5364
5503
|
*/
|
@@ -5490,15 +5629,15 @@
|
|
5490
5629
|
* _.dropRightWhile(users, function(o) { return !o.active; });
|
5491
5630
|
* // => objects for ['barney']
|
5492
5631
|
*
|
5493
|
-
* //
|
5632
|
+
* // The `_.matches` iteratee shorthand.
|
5494
5633
|
* _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
|
5495
5634
|
* // => objects for ['barney', 'fred']
|
5496
5635
|
*
|
5497
|
-
* //
|
5636
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
5498
5637
|
* _.dropRightWhile(users, ['active', false]);
|
5499
5638
|
* // => objects for ['barney']
|
5500
5639
|
*
|
5501
|
-
* //
|
5640
|
+
* // The `_.property` iteratee shorthand.
|
5502
5641
|
* _.dropRightWhile(users, 'active');
|
5503
5642
|
* // => objects for ['barney', 'fred', 'pebbles']
|
5504
5643
|
*/
|
@@ -5530,15 +5669,15 @@
|
|
5530
5669
|
* _.dropWhile(users, function(o) { return !o.active; });
|
5531
5670
|
* // => objects for ['pebbles']
|
5532
5671
|
*
|
5533
|
-
* //
|
5672
|
+
* // The `_.matches` iteratee shorthand.
|
5534
5673
|
* _.dropWhile(users, { 'user': 'barney', 'active': false });
|
5535
5674
|
* // => objects for ['fred', 'pebbles']
|
5536
5675
|
*
|
5537
|
-
* //
|
5676
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
5538
5677
|
* _.dropWhile(users, ['active', false]);
|
5539
5678
|
* // => objects for ['pebbles']
|
5540
5679
|
*
|
5541
|
-
* //
|
5680
|
+
* // The `_.property` iteratee shorthand.
|
5542
5681
|
* _.dropWhile(users, 'active');
|
5543
5682
|
* // => objects for ['barney', 'fred', 'pebbles']
|
5544
5683
|
*/
|
@@ -5609,15 +5748,15 @@
|
|
5609
5748
|
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
5610
5749
|
* // => 0
|
5611
5750
|
*
|
5612
|
-
* //
|
5751
|
+
* // The `_.matches` iteratee shorthand.
|
5613
5752
|
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
5614
5753
|
* // => 1
|
5615
5754
|
*
|
5616
|
-
* //
|
5755
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
5617
5756
|
* _.findIndex(users, ['active', false]);
|
5618
5757
|
* // => 0
|
5619
5758
|
*
|
5620
|
-
* //
|
5759
|
+
* // The `_.property` iteratee shorthand.
|
5621
5760
|
* _.findIndex(users, 'active');
|
5622
5761
|
* // => 2
|
5623
5762
|
*/
|
@@ -5648,15 +5787,15 @@
|
|
5648
5787
|
* _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
|
5649
5788
|
* // => 2
|
5650
5789
|
*
|
5651
|
-
* //
|
5790
|
+
* // The `_.matches` iteratee shorthand.
|
5652
5791
|
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
|
5653
5792
|
* // => 0
|
5654
5793
|
*
|
5655
|
-
* //
|
5794
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
5656
5795
|
* _.findLastIndex(users, ['active', false]);
|
5657
5796
|
* // => 2
|
5658
5797
|
*
|
5659
|
-
* //
|
5798
|
+
* // The `_.property` iteratee shorthand.
|
5660
5799
|
* _.findLastIndex(users, 'active');
|
5661
5800
|
* // => 0
|
5662
5801
|
*/
|
@@ -5666,31 +5805,6 @@
|
|
5666
5805
|
: -1;
|
5667
5806
|
}
|
5668
5807
|
|
5669
|
-
/**
|
5670
|
-
* Creates an array of flattened values by running each element in `array`
|
5671
|
-
* through `iteratee` and concating its result to the other mapped values.
|
5672
|
-
* The iteratee is invoked with three arguments: (value, index|key, array).
|
5673
|
-
*
|
5674
|
-
* @static
|
5675
|
-
* @memberOf _
|
5676
|
-
* @category Array
|
5677
|
-
* @param {Array} array The array to iterate over.
|
5678
|
-
* @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
|
5679
|
-
* @returns {Array} Returns the new array.
|
5680
|
-
* @example
|
5681
|
-
*
|
5682
|
-
* function duplicate(n) {
|
5683
|
-
* return [n, n];
|
5684
|
-
* }
|
5685
|
-
*
|
5686
|
-
* _.flatMap([1, 2], duplicate);
|
5687
|
-
* // => [1, 1, 2, 2]
|
5688
|
-
*/
|
5689
|
-
function flatMap(array, iteratee) {
|
5690
|
-
var length = array ? array.length : 0;
|
5691
|
-
return length ? baseFlatten(arrayMap(array, getIteratee(iteratee, 3))) : [];
|
5692
|
-
}
|
5693
|
-
|
5694
5808
|
/**
|
5695
5809
|
* Flattens `array` a single level.
|
5696
5810
|
*
|
@@ -5748,7 +5862,7 @@
|
|
5748
5862
|
|
5749
5863
|
while (++index < length) {
|
5750
5864
|
var pair = pairs[index];
|
5751
|
-
|
5865
|
+
result[pair[0]] = pair[1];
|
5752
5866
|
}
|
5753
5867
|
return result;
|
5754
5868
|
}
|
@@ -5778,8 +5892,7 @@
|
|
5778
5892
|
* Gets the index at which the first occurrence of `value` is found in `array`
|
5779
5893
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
5780
5894
|
* for equality comparisons. If `fromIndex` is negative, it's used as the offset
|
5781
|
-
* from the end of `array`.
|
5782
|
-
* performs a faster binary search.
|
5895
|
+
* from the end of `array`.
|
5783
5896
|
*
|
5784
5897
|
* @static
|
5785
5898
|
* @memberOf _
|
@@ -5793,7 +5906,7 @@
|
|
5793
5906
|
* _.indexOf([1, 2, 1, 2], 2);
|
5794
5907
|
* // => 1
|
5795
5908
|
*
|
5796
|
-
* //
|
5909
|
+
* // Search from the `fromIndex`.
|
5797
5910
|
* _.indexOf([1, 2, 1, 2], 2, 2);
|
5798
5911
|
* // => 3
|
5799
5912
|
*/
|
@@ -5827,8 +5940,8 @@
|
|
5827
5940
|
}
|
5828
5941
|
|
5829
5942
|
/**
|
5830
|
-
* Creates an array of unique values that are included in all
|
5831
|
-
*
|
5943
|
+
* Creates an array of unique values that are included in all given arrays
|
5944
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
5832
5945
|
* for equality comparisons.
|
5833
5946
|
*
|
5834
5947
|
* @static
|
@@ -5837,6 +5950,7 @@
|
|
5837
5950
|
* @param {...Array} [arrays] The arrays to inspect.
|
5838
5951
|
* @returns {Array} Returns the new array of shared values.
|
5839
5952
|
* @example
|
5953
|
+
*
|
5840
5954
|
* _.intersection([2, 1], [4, 2], [1, 2]);
|
5841
5955
|
* // => [2]
|
5842
5956
|
*/
|
@@ -5863,7 +5977,7 @@
|
|
5863
5977
|
* _.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
5864
5978
|
* // => [2.1]
|
5865
5979
|
*
|
5866
|
-
* //
|
5980
|
+
* // The `_.property` iteratee shorthand.
|
5867
5981
|
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
5868
5982
|
* // => [{ 'x': 1 }]
|
5869
5983
|
*/
|
@@ -5966,7 +6080,7 @@
|
|
5966
6080
|
* _.lastIndexOf([1, 2, 1, 2], 2);
|
5967
6081
|
* // => 3
|
5968
6082
|
*
|
5969
|
-
* //
|
6083
|
+
* // Search from the `fromIndex`.
|
5970
6084
|
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
|
5971
6085
|
* // => 1
|
5972
6086
|
*/
|
@@ -5992,7 +6106,7 @@
|
|
5992
6106
|
}
|
5993
6107
|
|
5994
6108
|
/**
|
5995
|
-
* Removes all
|
6109
|
+
* Removes all given values from `array` using
|
5996
6110
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
5997
6111
|
* for equality comparisons.
|
5998
6112
|
*
|
@@ -6029,7 +6143,7 @@
|
|
6029
6143
|
*
|
6030
6144
|
* var array = [1, 2, 3, 1, 2, 3];
|
6031
6145
|
*
|
6032
|
-
* _.
|
6146
|
+
* _.pullAll(array, [2, 3]);
|
6033
6147
|
* console.log(array);
|
6034
6148
|
* // => [1, 1]
|
6035
6149
|
*/
|
@@ -6041,7 +6155,7 @@
|
|
6041
6155
|
|
6042
6156
|
/**
|
6043
6157
|
* This method is like `_.pullAll` except that it accepts `iteratee` which is
|
6044
|
-
* invoked for each element of `array` and `values` to
|
6158
|
+
* invoked for each element of `array` and `values` to generate the criterion
|
6045
6159
|
* by which uniqueness is computed. The iteratee is invoked with one argument: (value).
|
6046
6160
|
*
|
6047
6161
|
* **Note:** Unlike `_.differenceBy`, this method mutates `array`.
|
@@ -6153,6 +6267,7 @@
|
|
6153
6267
|
* **Note:** This method mutates `array` and is based on
|
6154
6268
|
* [`Array#reverse`](https://mdn.io/Array/reverse).
|
6155
6269
|
*
|
6270
|
+
* @static
|
6156
6271
|
* @memberOf _
|
6157
6272
|
* @category Array
|
6158
6273
|
* @returns {Array} Returns `array`.
|
@@ -6241,7 +6356,7 @@
|
|
6241
6356
|
* _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));
|
6242
6357
|
* // => 1
|
6243
6358
|
*
|
6244
|
-
* //
|
6359
|
+
* // The `_.property` iteratee shorthand.
|
6245
6360
|
* _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
6246
6361
|
* // => 0
|
6247
6362
|
*/
|
@@ -6309,7 +6424,7 @@
|
|
6309
6424
|
* @returns {number} Returns the index at which `value` should be inserted into `array`.
|
6310
6425
|
* @example
|
6311
6426
|
*
|
6312
|
-
* //
|
6427
|
+
* // The `_.property` iteratee shorthand.
|
6313
6428
|
* _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
|
6314
6429
|
* // => 1
|
6315
6430
|
*/
|
@@ -6376,7 +6491,7 @@
|
|
6376
6491
|
* @example
|
6377
6492
|
*
|
6378
6493
|
* _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
|
6379
|
-
* // => [1.1, 2.
|
6494
|
+
* // => [1.1, 2.3]
|
6380
6495
|
*/
|
6381
6496
|
function sortedUniqBy(array, iteratee) {
|
6382
6497
|
return (array && array.length)
|
@@ -6489,15 +6604,15 @@
|
|
6489
6604
|
* _.takeRightWhile(users, function(o) { return !o.active; });
|
6490
6605
|
* // => objects for ['fred', 'pebbles']
|
6491
6606
|
*
|
6492
|
-
* //
|
6607
|
+
* // The `_.matches` iteratee shorthand.
|
6493
6608
|
* _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
|
6494
6609
|
* // => objects for ['pebbles']
|
6495
6610
|
*
|
6496
|
-
* //
|
6611
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
6497
6612
|
* _.takeRightWhile(users, ['active', false]);
|
6498
6613
|
* // => objects for ['fred', 'pebbles']
|
6499
6614
|
*
|
6500
|
-
* //
|
6615
|
+
* // The `_.property` iteratee shorthand.
|
6501
6616
|
* _.takeRightWhile(users, 'active');
|
6502
6617
|
* // => []
|
6503
6618
|
*/
|
@@ -6529,15 +6644,15 @@
|
|
6529
6644
|
* _.takeWhile(users, function(o) { return !o.active; });
|
6530
6645
|
* // => objects for ['barney', 'fred']
|
6531
6646
|
*
|
6532
|
-
* //
|
6647
|
+
* // The `_.matches` iteratee shorthand.
|
6533
6648
|
* _.takeWhile(users, { 'user': 'barney', 'active': false });
|
6534
6649
|
* // => objects for ['barney']
|
6535
6650
|
*
|
6536
|
-
* //
|
6651
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
6537
6652
|
* _.takeWhile(users, ['active', false]);
|
6538
6653
|
* // => objects for ['barney', 'fred']
|
6539
6654
|
*
|
6540
|
-
* //
|
6655
|
+
* // The `_.property` iteratee shorthand.
|
6541
6656
|
* _.takeWhile(users, 'active');
|
6542
6657
|
* // => []
|
6543
6658
|
*/
|
@@ -6548,8 +6663,8 @@
|
|
6548
6663
|
}
|
6549
6664
|
|
6550
6665
|
/**
|
6551
|
-
* Creates an array of unique values, in order, from all
|
6552
|
-
*
|
6666
|
+
* Creates an array of unique values, in order, from all given arrays using
|
6667
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
6553
6668
|
* for equality comparisons.
|
6554
6669
|
*
|
6555
6670
|
* @static
|
@@ -6582,7 +6697,7 @@
|
|
6582
6697
|
* _.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
6583
6698
|
* // => [2.1, 1.2, 4.3]
|
6584
6699
|
*
|
6585
|
-
* //
|
6700
|
+
* // The `_.property` iteratee shorthand.
|
6586
6701
|
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
6587
6702
|
* // => [{ 'x': 1 }, { 'x': 2 }]
|
6588
6703
|
*/
|
@@ -6659,7 +6774,7 @@
|
|
6659
6774
|
* _.uniqBy([2.1, 1.2, 2.3], Math.floor);
|
6660
6775
|
* // => [2.1, 1.2]
|
6661
6776
|
*
|
6662
|
-
* //
|
6777
|
+
* // The `_.property` iteratee shorthand.
|
6663
6778
|
* _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
6664
6779
|
* // => [{ 'x': 1 }, { 'x': 2 }]
|
6665
6780
|
*/
|
@@ -6760,7 +6875,7 @@
|
|
6760
6875
|
}
|
6761
6876
|
|
6762
6877
|
/**
|
6763
|
-
* Creates an array excluding all
|
6878
|
+
* Creates an array excluding all given values using
|
6764
6879
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
6765
6880
|
* for equality comparisons.
|
6766
6881
|
*
|
@@ -6783,7 +6898,7 @@
|
|
6783
6898
|
|
6784
6899
|
/**
|
6785
6900
|
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
6786
|
-
* of the
|
6901
|
+
* of the given arrays.
|
6787
6902
|
*
|
6788
6903
|
* @static
|
6789
6904
|
* @memberOf _
|
@@ -6815,7 +6930,7 @@
|
|
6815
6930
|
* _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
|
6816
6931
|
* // => [1.2, 4.3]
|
6817
6932
|
*
|
6818
|
-
* //
|
6933
|
+
* // The `_.property` iteratee shorthand.
|
6819
6934
|
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
6820
6935
|
* // => [{ 'x': 2 }]
|
6821
6936
|
*/
|
@@ -6883,19 +6998,29 @@
|
|
6883
6998
|
* @returns {Object} Returns the new object.
|
6884
6999
|
* @example
|
6885
7000
|
*
|
6886
|
-
* _.zipObject(['
|
6887
|
-
* // => { '
|
7001
|
+
* _.zipObject(['a', 'b'], [1, 2]);
|
7002
|
+
* // => { 'a': 1, 'b': 2 }
|
6888
7003
|
*/
|
6889
7004
|
function zipObject(props, values) {
|
6890
|
-
|
6891
|
-
|
6892
|
-
valsLength = values ? values.length : 0,
|
6893
|
-
result = {};
|
7005
|
+
return baseZipObject(props || [], values || [], assignValue);
|
7006
|
+
}
|
6894
7007
|
|
6895
|
-
|
6896
|
-
|
6897
|
-
|
6898
|
-
|
7008
|
+
/**
|
7009
|
+
* This method is like `_.zipObject` except that it supports property paths.
|
7010
|
+
*
|
7011
|
+
* @static
|
7012
|
+
* @memberOf _
|
7013
|
+
* @category Array
|
7014
|
+
* @param {Array} [props=[]] The property names.
|
7015
|
+
* @param {Array} [values=[]] The property values.
|
7016
|
+
* @returns {Object} Returns the new object.
|
7017
|
+
* @example
|
7018
|
+
*
|
7019
|
+
* _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
|
7020
|
+
* // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
|
7021
|
+
*/
|
7022
|
+
function zipObjectDeep(props, values) {
|
7023
|
+
return baseZipObject(props || [], values || [], baseSet);
|
6899
7024
|
}
|
6900
7025
|
|
6901
7026
|
/**
|
@@ -6960,10 +7085,9 @@
|
|
6960
7085
|
}
|
6961
7086
|
|
6962
7087
|
/**
|
6963
|
-
* This method invokes `interceptor` and returns `value`. The interceptor
|
6964
|
-
* invoked with one argument; (value). The purpose of this method is to
|
6965
|
-
* a method chain in order to
|
6966
|
-
* the chain.
|
7088
|
+
* This method invokes `interceptor` and returns `value`. The interceptor
|
7089
|
+
* is invoked with one argument; (value). The purpose of this method is to
|
7090
|
+
* "tap into" a method chain in order to modify intermediate results.
|
6967
7091
|
*
|
6968
7092
|
* @static
|
6969
7093
|
* @memberOf _
|
@@ -6975,6 +7099,7 @@
|
|
6975
7099
|
*
|
6976
7100
|
* _([1, 2, 3])
|
6977
7101
|
* .tap(function(array) {
|
7102
|
+
* // Mutate input array.
|
6978
7103
|
* array.pop();
|
6979
7104
|
* })
|
6980
7105
|
* .reverse()
|
@@ -6988,6 +7113,8 @@
|
|
6988
7113
|
|
6989
7114
|
/**
|
6990
7115
|
* This method is like `_.tap` except that it returns the result of `interceptor`.
|
7116
|
+
* The purpose of this method is to "pass thru" values replacing intermediate
|
7117
|
+
* results in a method chain.
|
6991
7118
|
*
|
6992
7119
|
* @static
|
6993
7120
|
* @memberOf _
|
@@ -7063,11 +7190,11 @@
|
|
7063
7190
|
* { 'user': 'fred', 'age': 40 }
|
7064
7191
|
* ];
|
7065
7192
|
*
|
7066
|
-
* // without explicit chaining
|
7193
|
+
* // A sequence without explicit chaining.
|
7067
7194
|
* _(users).head();
|
7068
7195
|
* // => { 'user': 'barney', 'age': 36 }
|
7069
7196
|
*
|
7070
|
-
* // with explicit chaining
|
7197
|
+
* // A sequence with explicit chaining.
|
7071
7198
|
* _(users)
|
7072
7199
|
* .chain()
|
7073
7200
|
* .head()
|
@@ -7111,7 +7238,7 @@
|
|
7111
7238
|
/**
|
7112
7239
|
* This method is the wrapper version of `_.flatMap`.
|
7113
7240
|
*
|
7114
|
-
* @
|
7241
|
+
* @name flatMap
|
7115
7242
|
* @memberOf _
|
7116
7243
|
* @category Seq
|
7117
7244
|
* @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
|
@@ -7262,7 +7389,7 @@
|
|
7262
7389
|
*
|
7263
7390
|
* @name value
|
7264
7391
|
* @memberOf _
|
7265
|
-
* @alias
|
7392
|
+
* @alias toJSON, valueOf
|
7266
7393
|
* @category Seq
|
7267
7394
|
* @returns {*} Returns the resolved unwrapped value.
|
7268
7395
|
* @example
|
@@ -7286,7 +7413,7 @@
|
|
7286
7413
|
* @memberOf _
|
7287
7414
|
* @category Collection
|
7288
7415
|
* @param {Array|Object} collection The collection to iterate over.
|
7289
|
-
* @param {Function|Object|string} [iteratee=_.identity] The iteratee
|
7416
|
+
* @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
|
7290
7417
|
* @returns {Object} Returns the composed aggregate object.
|
7291
7418
|
* @example
|
7292
7419
|
*
|
@@ -7322,15 +7449,15 @@
|
|
7322
7449
|
* { 'user': 'fred', 'active': false }
|
7323
7450
|
* ];
|
7324
7451
|
*
|
7325
|
-
* //
|
7452
|
+
* // The `_.matches` iteratee shorthand.
|
7326
7453
|
* _.every(users, { 'user': 'barney', 'active': false });
|
7327
7454
|
* // => false
|
7328
7455
|
*
|
7329
|
-
* //
|
7456
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
7330
7457
|
* _.every(users, ['active', false]);
|
7331
7458
|
* // => true
|
7332
7459
|
*
|
7333
|
-
* //
|
7460
|
+
* // The `_.property` iteratee shorthand.
|
7334
7461
|
* _.every(users, 'active');
|
7335
7462
|
* // => false
|
7336
7463
|
*/
|
@@ -7363,15 +7490,15 @@
|
|
7363
7490
|
* _.filter(users, function(o) { return !o.active; });
|
7364
7491
|
* // => objects for ['fred']
|
7365
7492
|
*
|
7366
|
-
* //
|
7493
|
+
* // The `_.matches` iteratee shorthand.
|
7367
7494
|
* _.filter(users, { 'age': 36, 'active': true });
|
7368
7495
|
* // => objects for ['barney']
|
7369
7496
|
*
|
7370
|
-
* //
|
7497
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
7371
7498
|
* _.filter(users, ['active', false]);
|
7372
7499
|
* // => objects for ['fred']
|
7373
7500
|
*
|
7374
|
-
* //
|
7501
|
+
* // The `_.property` iteratee shorthand.
|
7375
7502
|
* _.filter(users, 'active');
|
7376
7503
|
* // => objects for ['barney']
|
7377
7504
|
*/
|
@@ -7402,15 +7529,15 @@
|
|
7402
7529
|
* _.find(users, function(o) { return o.age < 40; });
|
7403
7530
|
* // => object for 'barney'
|
7404
7531
|
*
|
7405
|
-
* //
|
7532
|
+
* // The `_.matches` iteratee shorthand.
|
7406
7533
|
* _.find(users, { 'age': 1, 'active': true });
|
7407
7534
|
* // => object for 'pebbles'
|
7408
7535
|
*
|
7409
|
-
* //
|
7536
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
7410
7537
|
* _.find(users, ['active', false]);
|
7411
7538
|
* // => object for 'fred'
|
7412
7539
|
*
|
7413
|
-
* //
|
7540
|
+
* // The `_.property` iteratee shorthand.
|
7414
7541
|
* _.find(users, 'active');
|
7415
7542
|
* // => object for 'barney'
|
7416
7543
|
*/
|
@@ -7449,6 +7576,30 @@
|
|
7449
7576
|
return baseFind(collection, predicate, baseEachRight);
|
7450
7577
|
}
|
7451
7578
|
|
7579
|
+
/**
|
7580
|
+
* Creates an array of flattened values by running each element in `collection`
|
7581
|
+
* through `iteratee` and concating its result to the other mapped values.
|
7582
|
+
* The iteratee is invoked with three arguments: (value, index|key, collection).
|
7583
|
+
*
|
7584
|
+
* @static
|
7585
|
+
* @memberOf _
|
7586
|
+
* @category Collection
|
7587
|
+
* @param {Array|Object} collection The collection to iterate over.
|
7588
|
+
* @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
|
7589
|
+
* @returns {Array} Returns the new flattened array.
|
7590
|
+
* @example
|
7591
|
+
*
|
7592
|
+
* function duplicate(n) {
|
7593
|
+
* return [n, n];
|
7594
|
+
* }
|
7595
|
+
*
|
7596
|
+
* _.flatMap([1, 2], duplicate);
|
7597
|
+
* // => [1, 1, 2, 2]
|
7598
|
+
*/
|
7599
|
+
function flatMap(collection, iteratee) {
|
7600
|
+
return baseFlatten(map(collection, iteratee));
|
7601
|
+
}
|
7602
|
+
|
7452
7603
|
/**
|
7453
7604
|
* Iterates over elements of `collection` invoking `iteratee` for each element.
|
7454
7605
|
* The iteratee is invoked with three arguments: (value, index|key, collection).
|
@@ -7510,21 +7661,21 @@
|
|
7510
7661
|
/**
|
7511
7662
|
* Creates an object composed of keys generated from the results of running
|
7512
7663
|
* each element of `collection` through `iteratee`. The corresponding value
|
7513
|
-
* of each key is an array of
|
7664
|
+
* of each key is an array of elements responsible for generating the key.
|
7514
7665
|
* The iteratee is invoked with one argument: (value).
|
7515
7666
|
*
|
7516
7667
|
* @static
|
7517
7668
|
* @memberOf _
|
7518
7669
|
* @category Collection
|
7519
7670
|
* @param {Array|Object} collection The collection to iterate over.
|
7520
|
-
* @param {Function|Object|string} [iteratee=_.identity] The iteratee
|
7671
|
+
* @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
|
7521
7672
|
* @returns {Object} Returns the composed aggregate object.
|
7522
7673
|
* @example
|
7523
7674
|
*
|
7524
7675
|
* _.groupBy([6.1, 4.2, 6.3], Math.floor);
|
7525
7676
|
* // => { '4': [4.2], '6': [6.1, 6.3] }
|
7526
7677
|
*
|
7527
|
-
* //
|
7678
|
+
* // The `_.property` iteratee shorthand.
|
7528
7679
|
* _.groupBy(['one', 'two', 'three'], 'length');
|
7529
7680
|
* // => { '3': ['one', 'two'], '5': ['three'] }
|
7530
7681
|
*/
|
@@ -7622,22 +7773,22 @@
|
|
7622
7773
|
* @memberOf _
|
7623
7774
|
* @category Collection
|
7624
7775
|
* @param {Array|Object} collection The collection to iterate over.
|
7625
|
-
* @param {Function|Object|string} [iteratee=_.identity] The iteratee
|
7776
|
+
* @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys.
|
7626
7777
|
* @returns {Object} Returns the composed aggregate object.
|
7627
7778
|
* @example
|
7628
7779
|
*
|
7629
|
-
* var
|
7780
|
+
* var array = [
|
7630
7781
|
* { 'dir': 'left', 'code': 97 },
|
7631
7782
|
* { 'dir': 'right', 'code': 100 }
|
7632
7783
|
* ];
|
7633
7784
|
*
|
7634
|
-
* _.keyBy(
|
7635
|
-
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
|
7636
|
-
*
|
7637
|
-
* _.keyBy(keyData, function(o) {
|
7785
|
+
* _.keyBy(array, function(o) {
|
7638
7786
|
* return String.fromCharCode(o.code);
|
7639
7787
|
* });
|
7640
7788
|
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
|
7789
|
+
*
|
7790
|
+
* _.keyBy(array, 'dir');
|
7791
|
+
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
|
7641
7792
|
*/
|
7642
7793
|
var keyBy = createAggregator(function(result, value, key) {
|
7643
7794
|
result[key] = value;
|
@@ -7669,18 +7820,18 @@
|
|
7669
7820
|
* return n * n;
|
7670
7821
|
* }
|
7671
7822
|
*
|
7672
|
-
* _.map([
|
7673
|
-
* // => [
|
7823
|
+
* _.map([4, 8], square);
|
7824
|
+
* // => [16, 64]
|
7674
7825
|
*
|
7675
|
-
* _.map({ 'a':
|
7676
|
-
* // => [
|
7826
|
+
* _.map({ 'a': 4, 'b': 8 }, square);
|
7827
|
+
* // => [16, 64] (iteration order is not guaranteed)
|
7677
7828
|
*
|
7678
7829
|
* var users = [
|
7679
7830
|
* { 'user': 'barney' },
|
7680
7831
|
* { 'user': 'fred' }
|
7681
7832
|
* ];
|
7682
7833
|
*
|
7683
|
-
* //
|
7834
|
+
* // The `_.property` iteratee shorthand.
|
7684
7835
|
* _.map(users, 'user');
|
7685
7836
|
* // => ['barney', 'fred']
|
7686
7837
|
*/
|
@@ -7712,7 +7863,7 @@
|
|
7712
7863
|
* { 'user': 'barney', 'age': 36 }
|
7713
7864
|
* ];
|
7714
7865
|
*
|
7715
|
-
* //
|
7866
|
+
* // Sort by `user` in ascending order and by `age` in descending order.
|
7716
7867
|
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
|
7717
7868
|
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
7718
7869
|
*/
|
@@ -7732,9 +7883,9 @@
|
|
7732
7883
|
|
7733
7884
|
/**
|
7734
7885
|
* Creates an array of elements split into two groups, the first of which
|
7735
|
-
* contains elements `predicate` returns truthy for,
|
7736
|
-
* contains elements `predicate` returns falsey for. The predicate is
|
7737
|
-
* with
|
7886
|
+
* contains elements `predicate` returns truthy for, the second of which
|
7887
|
+
* contains elements `predicate` returns falsey for. The predicate is
|
7888
|
+
* invoked with one argument: (value).
|
7738
7889
|
*
|
7739
7890
|
* @static
|
7740
7891
|
* @memberOf _
|
@@ -7753,15 +7904,15 @@
|
|
7753
7904
|
* _.partition(users, function(o) { return o.active; });
|
7754
7905
|
* // => objects for [['fred'], ['barney', 'pebbles']]
|
7755
7906
|
*
|
7756
|
-
* //
|
7907
|
+
* // The `_.matches` iteratee shorthand.
|
7757
7908
|
* _.partition(users, { 'age': 1, 'active': false });
|
7758
7909
|
* // => objects for [['pebbles'], ['barney', 'fred']]
|
7759
7910
|
*
|
7760
|
-
* //
|
7911
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
7761
7912
|
* _.partition(users, ['active', false]);
|
7762
7913
|
* // => objects for [['barney', 'pebbles'], ['fred']]
|
7763
7914
|
*
|
7764
|
-
* //
|
7915
|
+
* // The `_.property` iteratee shorthand.
|
7765
7916
|
* _.partition(users, 'active');
|
7766
7917
|
* // => objects for [['fred'], ['barney', 'pebbles']]
|
7767
7918
|
*/
|
@@ -7773,7 +7924,7 @@
|
|
7773
7924
|
* Reduces `collection` to a value which is the accumulated result of running
|
7774
7925
|
* each element in `collection` through `iteratee`, where each successive
|
7775
7926
|
* invocation is supplied the return value of the previous. If `accumulator`
|
7776
|
-
* is not
|
7927
|
+
* is not given the first element of `collection` is used as the initial
|
7777
7928
|
* value. The iteratee is invoked with four arguments:
|
7778
7929
|
* (accumulator, value, index|key, collection).
|
7779
7930
|
*
|
@@ -7795,7 +7946,7 @@
|
|
7795
7946
|
*
|
7796
7947
|
* _.reduce([1, 2], function(sum, n) {
|
7797
7948
|
* return sum + n;
|
7798
|
-
* });
|
7949
|
+
* }, 0);
|
7799
7950
|
* // => 3
|
7800
7951
|
*
|
7801
7952
|
* _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
@@ -7806,9 +7957,9 @@
|
|
7806
7957
|
*/
|
7807
7958
|
function reduce(collection, iteratee, accumulator) {
|
7808
7959
|
var func = isArray(collection) ? arrayReduce : baseReduce,
|
7809
|
-
|
7960
|
+
initAccum = arguments.length < 3;
|
7810
7961
|
|
7811
|
-
return func(collection, getIteratee(iteratee, 4), accumulator,
|
7962
|
+
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
|
7812
7963
|
}
|
7813
7964
|
|
7814
7965
|
/**
|
@@ -7833,9 +7984,9 @@
|
|
7833
7984
|
*/
|
7834
7985
|
function reduceRight(collection, iteratee, accumulator) {
|
7835
7986
|
var func = isArray(collection) ? arrayReduceRight : baseReduce,
|
7836
|
-
|
7987
|
+
initAccum = arguments.length < 3;
|
7837
7988
|
|
7838
|
-
return func(collection, getIteratee(iteratee, 4), accumulator,
|
7989
|
+
return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
|
7839
7990
|
}
|
7840
7991
|
|
7841
7992
|
/**
|
@@ -7858,15 +8009,15 @@
|
|
7858
8009
|
* _.reject(users, function(o) { return !o.active; });
|
7859
8010
|
* // => objects for ['fred']
|
7860
8011
|
*
|
7861
|
-
* //
|
8012
|
+
* // The `_.matches` iteratee shorthand.
|
7862
8013
|
* _.reject(users, { 'age': 40, 'active': true });
|
7863
8014
|
* // => objects for ['barney']
|
7864
8015
|
*
|
7865
|
-
* //
|
8016
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
7866
8017
|
* _.reject(users, ['active', false]);
|
7867
8018
|
* // => objects for ['fred']
|
7868
8019
|
*
|
7869
|
-
* //
|
8020
|
+
* // The `_.property` iteratee shorthand.
|
7870
8021
|
* _.reject(users, 'active');
|
7871
8022
|
* // => objects for ['barney']
|
7872
8023
|
*/
|
@@ -7899,7 +8050,8 @@
|
|
7899
8050
|
}
|
7900
8051
|
|
7901
8052
|
/**
|
7902
|
-
* Gets `n` random elements from `collection
|
8053
|
+
* Gets `n` random elements at unique keys from `collection` up to the
|
8054
|
+
* size of `collection`.
|
7903
8055
|
*
|
7904
8056
|
* @static
|
7905
8057
|
* @memberOf _
|
@@ -7909,8 +8061,11 @@
|
|
7909
8061
|
* @returns {Array} Returns the random elements.
|
7910
8062
|
* @example
|
7911
8063
|
*
|
7912
|
-
* _.sampleSize([1, 2, 3
|
8064
|
+
* _.sampleSize([1, 2, 3], 2);
|
7913
8065
|
* // => [3, 1]
|
8066
|
+
*
|
8067
|
+
* _.sampleSize([1, 2, 3], 4);
|
8068
|
+
* // => [2, 3, 1]
|
7914
8069
|
*/
|
7915
8070
|
function sampleSize(collection, n) {
|
7916
8071
|
var index = -1,
|
@@ -8001,15 +8156,15 @@
|
|
8001
8156
|
* { 'user': 'fred', 'active': false }
|
8002
8157
|
* ];
|
8003
8158
|
*
|
8004
|
-
* //
|
8159
|
+
* // The `_.matches` iteratee shorthand.
|
8005
8160
|
* _.some(users, { 'user': 'barney', 'active': false });
|
8006
8161
|
* // => false
|
8007
8162
|
*
|
8008
|
-
* //
|
8163
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
8009
8164
|
* _.some(users, ['active', false]);
|
8010
8165
|
* // => true
|
8011
8166
|
*
|
8012
|
-
* //
|
8167
|
+
* // The `_.property` iteratee shorthand.
|
8013
8168
|
* _.some(users, 'active');
|
8014
8169
|
* // => true
|
8015
8170
|
*/
|
@@ -8209,7 +8364,7 @@
|
|
8209
8364
|
* bound('!');
|
8210
8365
|
* // => 'hi fred!'
|
8211
8366
|
*
|
8212
|
-
* //
|
8367
|
+
* // Bound with placeholders.
|
8213
8368
|
* var bound = _.bind(greet, object, _, '!');
|
8214
8369
|
* bound('hi');
|
8215
8370
|
* // => 'hi fred!'
|
@@ -8217,7 +8372,9 @@
|
|
8217
8372
|
var bind = rest(function(func, thisArg, partials) {
|
8218
8373
|
var bitmask = BIND_FLAG;
|
8219
8374
|
if (partials.length) {
|
8220
|
-
var
|
8375
|
+
var placeholder = lodash.placeholder || bind.placeholder,
|
8376
|
+
holders = replaceHolders(partials, placeholder);
|
8377
|
+
|
8221
8378
|
bitmask |= PARTIAL_FLAG;
|
8222
8379
|
}
|
8223
8380
|
return createWrapper(func, bitmask, thisArg, partials, holders);
|
@@ -8262,7 +8419,7 @@
|
|
8262
8419
|
* bound('!');
|
8263
8420
|
* // => 'hiya fred!'
|
8264
8421
|
*
|
8265
|
-
* //
|
8422
|
+
* // Bound with placeholders.
|
8266
8423
|
* var bound = _.bindKey(object, 'greet', _, '!');
|
8267
8424
|
* bound('hi');
|
8268
8425
|
* // => 'hiya fred!'
|
@@ -8270,7 +8427,9 @@
|
|
8270
8427
|
var bindKey = rest(function(object, key, partials) {
|
8271
8428
|
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
|
8272
8429
|
if (partials.length) {
|
8273
|
-
var
|
8430
|
+
var placeholder = lodash.placeholder || bindKey.placeholder,
|
8431
|
+
holders = replaceHolders(partials, placeholder);
|
8432
|
+
|
8274
8433
|
bitmask |= PARTIAL_FLAG;
|
8275
8434
|
}
|
8276
8435
|
return createWrapper(key, bitmask, object, partials, holders);
|
@@ -8312,14 +8471,14 @@
|
|
8312
8471
|
* curried(1, 2, 3);
|
8313
8472
|
* // => [1, 2, 3]
|
8314
8473
|
*
|
8315
|
-
* //
|
8474
|
+
* // Curried with placeholders.
|
8316
8475
|
* curried(1)(_, 3)(2);
|
8317
8476
|
* // => [1, 2, 3]
|
8318
8477
|
*/
|
8319
8478
|
function curry(func, arity, guard) {
|
8320
8479
|
arity = guard ? undefined : arity;
|
8321
8480
|
var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
|
8322
|
-
result.placeholder = curry.placeholder;
|
8481
|
+
result.placeholder = lodash.placeholder || curry.placeholder;
|
8323
8482
|
return result;
|
8324
8483
|
}
|
8325
8484
|
|
@@ -8356,14 +8515,14 @@
|
|
8356
8515
|
* curried(1, 2, 3);
|
8357
8516
|
* // => [1, 2, 3]
|
8358
8517
|
*
|
8359
|
-
* //
|
8518
|
+
* // Curried with placeholders.
|
8360
8519
|
* curried(3)(1, _)(2);
|
8361
8520
|
* // => [1, 2, 3]
|
8362
8521
|
*/
|
8363
8522
|
function curryRight(func, arity, guard) {
|
8364
8523
|
arity = guard ? undefined : arity;
|
8365
8524
|
var result = createWrapper(func, CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
|
8366
|
-
result.placeholder = curryRight.placeholder;
|
8525
|
+
result.placeholder = lodash.placeholder || curryRight.placeholder;
|
8367
8526
|
return result;
|
8368
8527
|
}
|
8369
8528
|
|
@@ -8378,7 +8537,7 @@
|
|
8378
8537
|
* to the debounced function return the result of the last `func` invocation.
|
8379
8538
|
*
|
8380
8539
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
8381
|
-
* on the trailing edge of the timeout only if the
|
8540
|
+
* on the trailing edge of the timeout only if the debounced function is
|
8382
8541
|
* invoked more than once during the `wait` timeout.
|
8383
8542
|
*
|
8384
8543
|
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
|
@@ -8399,21 +8558,21 @@
|
|
8399
8558
|
* @returns {Function} Returns the new debounced function.
|
8400
8559
|
* @example
|
8401
8560
|
*
|
8402
|
-
* //
|
8561
|
+
* // Avoid costly calculations while the window size is in flux.
|
8403
8562
|
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
8404
8563
|
*
|
8405
|
-
* //
|
8564
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
8406
8565
|
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
8407
8566
|
* 'leading': true,
|
8408
8567
|
* 'trailing': false
|
8409
8568
|
* }));
|
8410
8569
|
*
|
8411
|
-
* //
|
8570
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
8412
8571
|
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
8413
8572
|
* var source = new EventSource('/stream');
|
8414
8573
|
* jQuery(source).on('message', debounced);
|
8415
8574
|
*
|
8416
|
-
* //
|
8575
|
+
* // Cancel the trailing debounced invocation.
|
8417
8576
|
* jQuery(window).on('popstate', debounced.cancel);
|
8418
8577
|
*/
|
8419
8578
|
function debounce(func, wait, options) {
|
@@ -8494,7 +8653,7 @@
|
|
8494
8653
|
if (maxWait === false) {
|
8495
8654
|
var leadingCall = leading && !timeoutId;
|
8496
8655
|
} else {
|
8497
|
-
if (!maxTimeoutId && !leading) {
|
8656
|
+
if (!lastCalled && !maxTimeoutId && !leading) {
|
8498
8657
|
lastCalled = stamp;
|
8499
8658
|
}
|
8500
8659
|
var remaining = maxWait - (stamp - lastCalled),
|
@@ -8546,7 +8705,7 @@
|
|
8546
8705
|
* _.defer(function(text) {
|
8547
8706
|
* console.log(text);
|
8548
8707
|
* }, 'deferred');
|
8549
|
-
* // logs 'deferred' after one or more milliseconds
|
8708
|
+
* // => logs 'deferred' after one or more milliseconds
|
8550
8709
|
*/
|
8551
8710
|
var defer = rest(function(func, args) {
|
8552
8711
|
return baseDelay(func, 1, args);
|
@@ -8629,12 +8788,12 @@
|
|
8629
8788
|
* values(object);
|
8630
8789
|
* // => [1, 2]
|
8631
8790
|
*
|
8632
|
-
* //
|
8791
|
+
* // Modify the result cache.
|
8633
8792
|
* values.cache.set(object, ['a', 'b']);
|
8634
8793
|
* values(object);
|
8635
8794
|
* // => ['a', 'b']
|
8636
8795
|
*
|
8637
|
-
* //
|
8796
|
+
* // Replace `_.memoize.Cache`.
|
8638
8797
|
* _.memoize.Cache = WeakMap;
|
8639
8798
|
*/
|
8640
8799
|
function memoize(func, resolver) {
|
@@ -8779,13 +8938,15 @@
|
|
8779
8938
|
* sayHelloTo('fred');
|
8780
8939
|
* // => 'hello fred'
|
8781
8940
|
*
|
8782
|
-
* //
|
8941
|
+
* // Partially applied with placeholders.
|
8783
8942
|
* var greetFred = _.partial(greet, _, 'fred');
|
8784
8943
|
* greetFred('hi');
|
8785
8944
|
* // => 'hi fred'
|
8786
8945
|
*/
|
8787
8946
|
var partial = rest(function(func, partials) {
|
8788
|
-
var
|
8947
|
+
var placeholder = lodash.placeholder || partial.placeholder,
|
8948
|
+
holders = replaceHolders(partials, placeholder);
|
8949
|
+
|
8789
8950
|
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
|
8790
8951
|
});
|
8791
8952
|
|
@@ -8815,13 +8976,15 @@
|
|
8815
8976
|
* greetFred('hi');
|
8816
8977
|
* // => 'hi fred'
|
8817
8978
|
*
|
8818
|
-
* //
|
8979
|
+
* // Partially applied with placeholders.
|
8819
8980
|
* var sayHelloTo = _.partialRight(greet, 'hello', _);
|
8820
8981
|
* sayHelloTo('fred');
|
8821
8982
|
* // => 'hello fred'
|
8822
8983
|
*/
|
8823
8984
|
var partialRight = rest(function(func, partials) {
|
8824
|
-
var
|
8985
|
+
var placeholder = lodash.placeholder || partialRight.placeholder,
|
8986
|
+
holders = replaceHolders(partials, placeholder);
|
8987
|
+
|
8825
8988
|
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
|
8826
8989
|
});
|
8827
8990
|
|
@@ -8912,6 +9075,7 @@
|
|
8912
9075
|
* @memberOf _
|
8913
9076
|
* @category Function
|
8914
9077
|
* @param {Function} func The function to spread arguments over.
|
9078
|
+
* @param {number} [start=0] The start position of the spread.
|
8915
9079
|
* @returns {Function} Returns the new function.
|
8916
9080
|
* @example
|
8917
9081
|
*
|
@@ -8922,7 +9086,6 @@
|
|
8922
9086
|
* say(['fred', 'hello']);
|
8923
9087
|
* // => 'fred says hello'
|
8924
9088
|
*
|
8925
|
-
* // with a Promise
|
8926
9089
|
* var numbers = Promise.all([
|
8927
9090
|
* Promise.resolve(40),
|
8928
9091
|
* Promise.resolve(36)
|
@@ -8933,13 +9096,20 @@
|
|
8933
9096
|
* }));
|
8934
9097
|
* // => a Promise of 76
|
8935
9098
|
*/
|
8936
|
-
function spread(func) {
|
9099
|
+
function spread(func, start) {
|
8937
9100
|
if (typeof func != 'function') {
|
8938
9101
|
throw new TypeError(FUNC_ERROR_TEXT);
|
8939
9102
|
}
|
8940
|
-
|
8941
|
-
|
8942
|
-
|
9103
|
+
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
|
9104
|
+
return rest(function(args) {
|
9105
|
+
var array = args[start],
|
9106
|
+
otherArgs = args.slice(0, start);
|
9107
|
+
|
9108
|
+
if (array) {
|
9109
|
+
arrayPush(otherArgs, array);
|
9110
|
+
}
|
9111
|
+
return apply(func, this, otherArgs);
|
9112
|
+
});
|
8943
9113
|
}
|
8944
9114
|
|
8945
9115
|
/**
|
@@ -8953,7 +9123,7 @@
|
|
8953
9123
|
* result of the last `func` invocation.
|
8954
9124
|
*
|
8955
9125
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
8956
|
-
* on the trailing edge of the timeout only if the
|
9126
|
+
* on the trailing edge of the timeout only if the throttled function is
|
8957
9127
|
* invoked more than once during the `wait` timeout.
|
8958
9128
|
*
|
8959
9129
|
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
|
@@ -8972,14 +9142,14 @@
|
|
8972
9142
|
* @returns {Function} Returns the new throttled function.
|
8973
9143
|
* @example
|
8974
9144
|
*
|
8975
|
-
* //
|
9145
|
+
* // Avoid excessively updating the position while scrolling.
|
8976
9146
|
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
8977
9147
|
*
|
8978
|
-
* //
|
9148
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
8979
9149
|
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
8980
9150
|
* jQuery(element).on('click', throttled);
|
8981
9151
|
*
|
8982
|
-
* //
|
9152
|
+
* // Cancel the trailing throttled invocation.
|
8983
9153
|
* jQuery(window).on('popstate', throttled.cancel);
|
8984
9154
|
*/
|
8985
9155
|
function throttle(func, wait, options) {
|
@@ -9074,7 +9244,7 @@
|
|
9074
9244
|
* This method is like `_.clone` except that it accepts `customizer` which
|
9075
9245
|
* is invoked to produce the cloned value. If `customizer` returns `undefined`
|
9076
9246
|
* cloning is handled by the method instead. The `customizer` is invoked with
|
9077
|
-
* up to
|
9247
|
+
* up to four arguments; (value [, index|key, object, stack]).
|
9078
9248
|
*
|
9079
9249
|
* @static
|
9080
9250
|
* @memberOf _
|
@@ -9090,7 +9260,7 @@
|
|
9090
9260
|
* }
|
9091
9261
|
* }
|
9092
9262
|
*
|
9093
|
-
* var el = _.
|
9263
|
+
* var el = _.cloneWith(document.body, customizer);
|
9094
9264
|
*
|
9095
9265
|
* console.log(el === document.body);
|
9096
9266
|
* // => false
|
@@ -9140,7 +9310,7 @@
|
|
9140
9310
|
* }
|
9141
9311
|
* }
|
9142
9312
|
*
|
9143
|
-
* var el = _.
|
9313
|
+
* var el = _.cloneDeepWith(document.body, customizer);
|
9144
9314
|
*
|
9145
9315
|
* console.log(el === document.body);
|
9146
9316
|
* // => false
|
@@ -9282,6 +9452,27 @@
|
|
9282
9452
|
*/
|
9283
9453
|
var isArray = Array.isArray;
|
9284
9454
|
|
9455
|
+
/**
|
9456
|
+
* Checks if `value` is classified as an `ArrayBuffer` object.
|
9457
|
+
*
|
9458
|
+
* @static
|
9459
|
+
* @memberOf _
|
9460
|
+
* @type Function
|
9461
|
+
* @category Lang
|
9462
|
+
* @param {*} value The value to check.
|
9463
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
9464
|
+
* @example
|
9465
|
+
*
|
9466
|
+
* _.isArrayBuffer(new ArrayBuffer(2));
|
9467
|
+
* // => true
|
9468
|
+
*
|
9469
|
+
* _.isArrayBuffer(new Array(2));
|
9470
|
+
* // => false
|
9471
|
+
*/
|
9472
|
+
function isArrayBuffer(value) {
|
9473
|
+
return isObjectLike(value) && objectToString.call(value) == arrayBufferTag;
|
9474
|
+
}
|
9475
|
+
|
9285
9476
|
/**
|
9286
9477
|
* Checks if `value` is array-like. A value is considered array-like if it's
|
9287
9478
|
* not a function and has a `value.length` that's an integer greater than or
|
@@ -9361,6 +9552,26 @@
|
|
9361
9552
|
(isObjectLike(value) && objectToString.call(value) == boolTag);
|
9362
9553
|
}
|
9363
9554
|
|
9555
|
+
/**
|
9556
|
+
* Checks if `value` is a buffer.
|
9557
|
+
*
|
9558
|
+
* @static
|
9559
|
+
* @memberOf _
|
9560
|
+
* @category Lang
|
9561
|
+
* @param {*} value The value to check.
|
9562
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
9563
|
+
* @example
|
9564
|
+
*
|
9565
|
+
* _.isBuffer(new Buffer(2));
|
9566
|
+
* // => true
|
9567
|
+
*
|
9568
|
+
* _.isBuffer(new Uint8Array(2));
|
9569
|
+
* // => false
|
9570
|
+
*/
|
9571
|
+
var isBuffer = !Buffer ? constant(false) : function(value) {
|
9572
|
+
return value instanceof Buffer;
|
9573
|
+
};
|
9574
|
+
|
9364
9575
|
/**
|
9365
9576
|
* Checks if `value` is classified as a `Date` object.
|
9366
9577
|
*
|
@@ -9429,9 +9640,16 @@
|
|
9429
9640
|
* // => false
|
9430
9641
|
*/
|
9431
9642
|
function isEmpty(value) {
|
9432
|
-
|
9433
|
-
|
9434
|
-
|
9643
|
+
if (isArrayLike(value) &&
|
9644
|
+
(isArray(value) || isString(value) || isFunction(value.splice) || isArguments(value))) {
|
9645
|
+
return !value.length;
|
9646
|
+
}
|
9647
|
+
for (var key in value) {
|
9648
|
+
if (hasOwnProperty.call(value, key)) {
|
9649
|
+
return false;
|
9650
|
+
}
|
9651
|
+
}
|
9652
|
+
return true;
|
9435
9653
|
}
|
9436
9654
|
|
9437
9655
|
/**
|
@@ -9468,7 +9686,7 @@
|
|
9468
9686
|
/**
|
9469
9687
|
* This method is like `_.isEqual` except that it accepts `customizer` which is
|
9470
9688
|
* invoked to compare values. If `customizer` returns `undefined` comparisons are
|
9471
|
-
* handled by the method instead. The `customizer` is invoked with up to
|
9689
|
+
* handled by the method instead. The `customizer` is invoked with up to six arguments:
|
9472
9690
|
* (objValue, othValue [, index|key, object, other, stack]).
|
9473
9691
|
*
|
9474
9692
|
* @static
|
@@ -9656,8 +9874,6 @@
|
|
9656
9874
|
* // => false
|
9657
9875
|
*/
|
9658
9876
|
function isObject(value) {
|
9659
|
-
// Avoid a V8 JIT bug in Chrome 19-20.
|
9660
|
-
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
9661
9877
|
var type = typeof value;
|
9662
9878
|
return !!value && (type == 'object' || type == 'function');
|
9663
9879
|
}
|
@@ -9689,6 +9905,26 @@
|
|
9689
9905
|
return !!value && typeof value == 'object';
|
9690
9906
|
}
|
9691
9907
|
|
9908
|
+
/**
|
9909
|
+
* Checks if `value` is classified as a `Map` object.
|
9910
|
+
*
|
9911
|
+
* @static
|
9912
|
+
* @memberOf _
|
9913
|
+
* @category Lang
|
9914
|
+
* @param {*} value The value to check.
|
9915
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
9916
|
+
* @example
|
9917
|
+
*
|
9918
|
+
* _.isMap(new Map);
|
9919
|
+
* // => true
|
9920
|
+
*
|
9921
|
+
* _.isMap(new WeakMap);
|
9922
|
+
* // => false
|
9923
|
+
*/
|
9924
|
+
function isMap(value) {
|
9925
|
+
return isObjectLike(value) && getTag(value) == mapTag;
|
9926
|
+
}
|
9927
|
+
|
9692
9928
|
/**
|
9693
9929
|
* Performs a deep comparison between `object` and `source` to determine if
|
9694
9930
|
* `object` contains equivalent property values.
|
@@ -9718,7 +9954,7 @@
|
|
9718
9954
|
/**
|
9719
9955
|
* This method is like `_.isMatch` except that it accepts `customizer` which
|
9720
9956
|
* is invoked to compare values. If `customizer` returns `undefined` comparisons
|
9721
|
-
* are handled by the method instead. The `customizer` is invoked with
|
9957
|
+
* are handled by the method instead. The `customizer` is invoked with five
|
9722
9958
|
* arguments: (objValue, srcValue, index|key, object, source).
|
9723
9959
|
*
|
9724
9960
|
* @static
|
@@ -9974,6 +10210,26 @@
|
|
9974
10210
|
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
|
9975
10211
|
}
|
9976
10212
|
|
10213
|
+
/**
|
10214
|
+
* Checks if `value` is classified as a `Set` object.
|
10215
|
+
*
|
10216
|
+
* @static
|
10217
|
+
* @memberOf _
|
10218
|
+
* @category Lang
|
10219
|
+
* @param {*} value The value to check.
|
10220
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
10221
|
+
* @example
|
10222
|
+
*
|
10223
|
+
* _.isSet(new Set);
|
10224
|
+
* // => true
|
10225
|
+
*
|
10226
|
+
* _.isSet(new WeakSet);
|
10227
|
+
* // => false
|
10228
|
+
*/
|
10229
|
+
function isSet(value) {
|
10230
|
+
return isObjectLike(value) && getTag(value) == setTag;
|
10231
|
+
}
|
10232
|
+
|
9977
10233
|
/**
|
9978
10234
|
* Checks if `value` is classified as a `String` primitive or object.
|
9979
10235
|
*
|
@@ -10056,6 +10312,46 @@
|
|
10056
10312
|
return value === undefined;
|
10057
10313
|
}
|
10058
10314
|
|
10315
|
+
/**
|
10316
|
+
* Checks if `value` is classified as a `WeakMap` object.
|
10317
|
+
*
|
10318
|
+
* @static
|
10319
|
+
* @memberOf _
|
10320
|
+
* @category Lang
|
10321
|
+
* @param {*} value The value to check.
|
10322
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
10323
|
+
* @example
|
10324
|
+
*
|
10325
|
+
* _.isWeakMap(new WeakMap);
|
10326
|
+
* // => true
|
10327
|
+
*
|
10328
|
+
* _.isWeakMap(new Map);
|
10329
|
+
* // => false
|
10330
|
+
*/
|
10331
|
+
function isWeakMap(value) {
|
10332
|
+
return isObjectLike(value) && getTag(value) == weakMapTag;
|
10333
|
+
}
|
10334
|
+
|
10335
|
+
/**
|
10336
|
+
* Checks if `value` is classified as a `WeakSet` object.
|
10337
|
+
*
|
10338
|
+
* @static
|
10339
|
+
* @memberOf _
|
10340
|
+
* @category Lang
|
10341
|
+
* @param {*} value The value to check.
|
10342
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
10343
|
+
* @example
|
10344
|
+
*
|
10345
|
+
* _.isWeakSet(new WeakSet);
|
10346
|
+
* // => true
|
10347
|
+
*
|
10348
|
+
* _.isWeakSet(new Set);
|
10349
|
+
* // => false
|
10350
|
+
*/
|
10351
|
+
function isWeakSet(value) {
|
10352
|
+
return isObjectLike(value) && objectToString.call(value) == weakSetTag;
|
10353
|
+
}
|
10354
|
+
|
10059
10355
|
/**
|
10060
10356
|
* Checks if `value` is less than `other`.
|
10061
10357
|
*
|
@@ -10189,7 +10485,7 @@
|
|
10189
10485
|
* @memberOf _
|
10190
10486
|
* @category Lang
|
10191
10487
|
* @param {*} value The value to convert.
|
10192
|
-
* @
|
10488
|
+
* @returns {number} Returns the converted integer.
|
10193
10489
|
* @example
|
10194
10490
|
*
|
10195
10491
|
* _.toLength(3);
|
@@ -10328,7 +10624,7 @@
|
|
10328
10624
|
return '';
|
10329
10625
|
}
|
10330
10626
|
if (isSymbol(value)) {
|
10331
|
-
return
|
10627
|
+
return Symbol ? symbolToString.call(value) : '';
|
10332
10628
|
}
|
10333
10629
|
var result = (value + '');
|
10334
10630
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
@@ -10430,7 +10726,7 @@
|
|
10430
10726
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
10431
10727
|
* // => { 'a': 1, 'b': 2 }
|
10432
10728
|
*/
|
10433
|
-
var assignInWith = createAssigner(function(object, source, customizer) {
|
10729
|
+
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
10434
10730
|
copyObjectWith(source, keysIn(source), object, customizer);
|
10435
10731
|
});
|
10436
10732
|
|
@@ -10460,7 +10756,7 @@
|
|
10460
10756
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
10461
10757
|
* // => { 'a': 1, 'b': 2 }
|
10462
10758
|
*/
|
10463
|
-
var assignWith = createAssigner(function(object, source, customizer) {
|
10759
|
+
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
10464
10760
|
copyObjectWith(source, keys(source), object, customizer);
|
10465
10761
|
});
|
10466
10762
|
|
@@ -10490,7 +10786,7 @@
|
|
10490
10786
|
|
10491
10787
|
/**
|
10492
10788
|
* Creates an object that inherits from the `prototype` object. If a `properties`
|
10493
|
-
* object is
|
10789
|
+
* object is given its own enumerable properties are assigned to the created object.
|
10494
10790
|
*
|
10495
10791
|
* @static
|
10496
10792
|
* @memberOf _
|
@@ -10593,15 +10889,15 @@
|
|
10593
10889
|
* _.findKey(users, function(o) { return o.age < 40; });
|
10594
10890
|
* // => 'barney' (iteration order is not guaranteed)
|
10595
10891
|
*
|
10596
|
-
* //
|
10892
|
+
* // The `_.matches` iteratee shorthand.
|
10597
10893
|
* _.findKey(users, { 'age': 1, 'active': true });
|
10598
10894
|
* // => 'pebbles'
|
10599
10895
|
*
|
10600
|
-
* //
|
10896
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
10601
10897
|
* _.findKey(users, ['active', false]);
|
10602
10898
|
* // => 'fred'
|
10603
10899
|
*
|
10604
|
-
* //
|
10900
|
+
* // The `_.property` iteratee shorthand.
|
10605
10901
|
* _.findKey(users, 'active');
|
10606
10902
|
* // => 'barney'
|
10607
10903
|
*/
|
@@ -10630,15 +10926,15 @@
|
|
10630
10926
|
* _.findLastKey(users, function(o) { return o.age < 40; });
|
10631
10927
|
* // => returns 'pebbles' assuming `_.findKey` returns 'barney'
|
10632
10928
|
*
|
10633
|
-
* //
|
10929
|
+
* // The `_.matches` iteratee shorthand.
|
10634
10930
|
* _.findLastKey(users, { 'age': 36, 'active': true });
|
10635
10931
|
* // => 'barney'
|
10636
10932
|
*
|
10637
|
-
* //
|
10933
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
10638
10934
|
* _.findLastKey(users, ['active', false]);
|
10639
10935
|
* // => 'fred'
|
10640
10936
|
*
|
10641
|
-
* //
|
10937
|
+
* // The `_.property` iteratee shorthand.
|
10642
10938
|
* _.findLastKey(users, 'active');
|
10643
10939
|
* // => 'pebbles'
|
10644
10940
|
*/
|
@@ -10903,14 +11199,12 @@
|
|
10903
11199
|
/**
|
10904
11200
|
* Creates an object composed of the inverted keys and values of `object`.
|
10905
11201
|
* If `object` contains duplicate values, subsequent values overwrite property
|
10906
|
-
* assignments of previous values
|
11202
|
+
* assignments of previous values.
|
10907
11203
|
*
|
10908
11204
|
* @static
|
10909
11205
|
* @memberOf _
|
10910
11206
|
* @category Object
|
10911
11207
|
* @param {Object} object The object to invert.
|
10912
|
-
* @param {boolean} [multiVal] Allow multiple values per key.
|
10913
|
-
* @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
|
10914
11208
|
* @returns {Object} Returns the new inverted object.
|
10915
11209
|
* @example
|
10916
11210
|
*
|
@@ -10918,27 +11212,43 @@
|
|
10918
11212
|
*
|
10919
11213
|
* _.invert(object);
|
10920
11214
|
* // => { '1': 'c', '2': 'b' }
|
11215
|
+
*/
|
11216
|
+
var invert = createInverter(function(result, value, key) {
|
11217
|
+
result[value] = key;
|
11218
|
+
}, constant(identity));
|
11219
|
+
|
11220
|
+
/**
|
11221
|
+
* This method is like `_.invert` except that the inverted object is generated
|
11222
|
+
* from the results of running each element of `object` through `iteratee`.
|
11223
|
+
* The corresponding inverted value of each inverted key is an array of keys
|
11224
|
+
* responsible for generating the inverted value. The iteratee is invoked
|
11225
|
+
* with one argument: (value).
|
11226
|
+
*
|
11227
|
+
* @static
|
11228
|
+
* @memberOf _
|
11229
|
+
* @category Object
|
11230
|
+
* @param {Object} object The object to invert.
|
11231
|
+
* @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
|
11232
|
+
* @returns {Object} Returns the new inverted object.
|
11233
|
+
* @example
|
11234
|
+
*
|
11235
|
+
* var object = { 'a': 1, 'b': 2, 'c': 1 };
|
10921
11236
|
*
|
10922
|
-
*
|
10923
|
-
* _.invert(object, true);
|
11237
|
+
* _.invertBy(object);
|
10924
11238
|
* // => { '1': ['a', 'c'], '2': ['b'] }
|
11239
|
+
*
|
11240
|
+
* _.invertBy(object, function(value) {
|
11241
|
+
* return 'group' + value;
|
11242
|
+
* });
|
11243
|
+
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
|
10925
11244
|
*/
|
10926
|
-
|
10927
|
-
|
10928
|
-
|
10929
|
-
|
10930
|
-
|
10931
|
-
|
10932
|
-
|
10933
|
-
result[value] = [key];
|
10934
|
-
}
|
10935
|
-
}
|
10936
|
-
else {
|
10937
|
-
result[value] = key;
|
10938
|
-
}
|
10939
|
-
return result;
|
10940
|
-
}, {});
|
10941
|
-
}
|
11245
|
+
var invertBy = createInverter(function(result, value, key) {
|
11246
|
+
if (hasOwnProperty.call(result, value)) {
|
11247
|
+
result[value].push(key);
|
11248
|
+
} else {
|
11249
|
+
result[value] = [key];
|
11250
|
+
}
|
11251
|
+
}, getIteratee);
|
10942
11252
|
|
10943
11253
|
/**
|
10944
11254
|
* Invokes the method at `path` of `object`.
|
@@ -11097,7 +11407,7 @@
|
|
11097
11407
|
* _.mapValues(users, function(o) { return o.age; });
|
11098
11408
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
11099
11409
|
*
|
11100
|
-
* //
|
11410
|
+
* // The `_.property` iteratee shorthand.
|
11101
11411
|
* _.mapValues(users, 'age');
|
11102
11412
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
11103
11413
|
*/
|
@@ -11140,8 +11450,8 @@
|
|
11140
11450
|
* _.merge(users, ages);
|
11141
11451
|
* // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
|
11142
11452
|
*/
|
11143
|
-
var merge = createAssigner(function(object, source) {
|
11144
|
-
baseMerge(object, source);
|
11453
|
+
var merge = createAssigner(function(object, source, srcIndex) {
|
11454
|
+
baseMerge(object, source, srcIndex);
|
11145
11455
|
});
|
11146
11456
|
|
11147
11457
|
/**
|
@@ -11151,6 +11461,8 @@
|
|
11151
11461
|
* method instead. The `customizer` is invoked with seven arguments:
|
11152
11462
|
* (objValue, srcValue, key, object, source, stack).
|
11153
11463
|
*
|
11464
|
+
* **Note:** This method mutates `object`.
|
11465
|
+
*
|
11154
11466
|
* @static
|
11155
11467
|
* @memberOf _
|
11156
11468
|
* @category Object
|
@@ -11179,8 +11491,8 @@
|
|
11179
11491
|
* _.mergeWith(object, other, customizer);
|
11180
11492
|
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
|
11181
11493
|
*/
|
11182
|
-
var mergeWith = createAssigner(function(object, source, customizer) {
|
11183
|
-
baseMerge(object, source, customizer);
|
11494
|
+
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
11495
|
+
baseMerge(object, source, srcIndex, customizer);
|
11184
11496
|
});
|
11185
11497
|
|
11186
11498
|
/**
|
@@ -11228,9 +11540,9 @@
|
|
11228
11540
|
* // => { 'b': '2' }
|
11229
11541
|
*/
|
11230
11542
|
function omitBy(object, predicate) {
|
11231
|
-
predicate = getIteratee(predicate);
|
11232
|
-
return basePickBy(object, function(value) {
|
11233
|
-
return !predicate(value);
|
11543
|
+
predicate = getIteratee(predicate, 2);
|
11544
|
+
return basePickBy(object, function(value, key) {
|
11545
|
+
return !predicate(value, key);
|
11234
11546
|
});
|
11235
11547
|
}
|
11236
11548
|
|
@@ -11257,7 +11569,7 @@
|
|
11257
11569
|
|
11258
11570
|
/**
|
11259
11571
|
* Creates an object composed of the `object` properties `predicate` returns
|
11260
|
-
* truthy for. The predicate is invoked with
|
11572
|
+
* truthy for. The predicate is invoked with two arguments: (value, key).
|
11261
11573
|
*
|
11262
11574
|
* @static
|
11263
11575
|
* @memberOf _
|
@@ -11273,7 +11585,7 @@
|
|
11273
11585
|
* // => { 'a': 1, 'c': 3 }
|
11274
11586
|
*/
|
11275
11587
|
function pickBy(object, predicate) {
|
11276
|
-
return object == null ? {} : basePickBy(object, getIteratee(predicate));
|
11588
|
+
return object == null ? {} : basePickBy(object, getIteratee(predicate, 2));
|
11277
11589
|
}
|
11278
11590
|
|
11279
11591
|
/**
|
@@ -11324,6 +11636,8 @@
|
|
11324
11636
|
* are created for all other missing properties. Use `_.setWith` to customize
|
11325
11637
|
* `path` creation.
|
11326
11638
|
*
|
11639
|
+
* **Note:** This method mutates `object`.
|
11640
|
+
*
|
11327
11641
|
* @static
|
11328
11642
|
* @memberOf _
|
11329
11643
|
* @category Object
|
@@ -11353,6 +11667,8 @@
|
|
11353
11667
|
* path creation is handled by the method instead. The `customizer` is invoked
|
11354
11668
|
* with three arguments: (nsValue, key, nsObject).
|
11355
11669
|
*
|
11670
|
+
* **Note:** This method mutates `object`.
|
11671
|
+
*
|
11356
11672
|
* @static
|
11357
11673
|
* @memberOf _
|
11358
11674
|
* @category Object
|
@@ -11439,12 +11755,12 @@
|
|
11439
11755
|
* _.transform([2, 3, 4], function(result, n) {
|
11440
11756
|
* result.push(n *= n);
|
11441
11757
|
* return n % 2 == 0;
|
11442
|
-
* });
|
11758
|
+
* }, []);
|
11443
11759
|
* // => [4, 9]
|
11444
11760
|
*
|
11445
11761
|
* _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
|
11446
11762
|
* (result[value] || (result[value] = [])).push(key);
|
11447
|
-
* });
|
11763
|
+
* }, {});
|
11448
11764
|
* // => { '1': ['a', 'c'], '2': ['b'] }
|
11449
11765
|
*/
|
11450
11766
|
function transform(object, iteratee, accumulator) {
|
@@ -11472,6 +11788,8 @@
|
|
11472
11788
|
/**
|
11473
11789
|
* Removes the property at `path` of `object`.
|
11474
11790
|
*
|
11791
|
+
* **Note:** This method mutates `object`.
|
11792
|
+
*
|
11475
11793
|
* @static
|
11476
11794
|
* @memberOf _
|
11477
11795
|
* @category Object
|
@@ -12040,7 +12358,7 @@
|
|
12040
12358
|
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
|
12041
12359
|
* in which case a `radix` of `16` is used.
|
12042
12360
|
*
|
12043
|
-
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#
|
12361
|
+
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2)
|
12044
12362
|
* of `parseInt`.
|
12045
12363
|
*
|
12046
12364
|
* @static
|
@@ -12234,7 +12552,7 @@
|
|
12234
12552
|
* in "interpolate" delimiters, HTML-escape interpolated data properties in
|
12235
12553
|
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
|
12236
12554
|
* properties may be accessed as free variables in the template. If a setting
|
12237
|
-
* object is
|
12555
|
+
* object is given it takes precedence over `_.templateSettings` values.
|
12238
12556
|
*
|
12239
12557
|
* **Note:** In the development build `_.template` utilizes
|
12240
12558
|
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
|
@@ -12261,54 +12579,54 @@
|
|
12261
12579
|
* @returns {Function} Returns the compiled template function.
|
12262
12580
|
* @example
|
12263
12581
|
*
|
12264
|
-
* //
|
12582
|
+
* // Use the "interpolate" delimiter to create a compiled template.
|
12265
12583
|
* var compiled = _.template('hello <%= user %>!');
|
12266
12584
|
* compiled({ 'user': 'fred' });
|
12267
12585
|
* // => 'hello fred!'
|
12268
12586
|
*
|
12269
|
-
* //
|
12587
|
+
* // Use the HTML "escape" delimiter to escape data property values.
|
12270
12588
|
* var compiled = _.template('<b><%- value %></b>');
|
12271
12589
|
* compiled({ 'value': '<script>' });
|
12272
12590
|
* // => '<b><script></b>'
|
12273
12591
|
*
|
12274
|
-
* //
|
12592
|
+
* // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
|
12275
12593
|
* var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
|
12276
12594
|
* compiled({ 'users': ['fred', 'barney'] });
|
12277
12595
|
* // => '<li>fred</li><li>barney</li>'
|
12278
12596
|
*
|
12279
|
-
* //
|
12597
|
+
* // Use the internal `print` function in "evaluate" delimiters.
|
12280
12598
|
* var compiled = _.template('<% print("hello " + user); %>!');
|
12281
12599
|
* compiled({ 'user': 'barney' });
|
12282
12600
|
* // => 'hello barney!'
|
12283
12601
|
*
|
12284
|
-
* //
|
12602
|
+
* // Use the ES delimiter as an alternative to the default "interpolate" delimiter.
|
12285
12603
|
* var compiled = _.template('hello ${ user }!');
|
12286
12604
|
* compiled({ 'user': 'pebbles' });
|
12287
12605
|
* // => 'hello pebbles!'
|
12288
12606
|
*
|
12289
|
-
* //
|
12607
|
+
* // Use custom template delimiters.
|
12290
12608
|
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
12291
12609
|
* var compiled = _.template('hello {{ user }}!');
|
12292
12610
|
* compiled({ 'user': 'mustache' });
|
12293
12611
|
* // => 'hello mustache!'
|
12294
12612
|
*
|
12295
|
-
* //
|
12613
|
+
* // Use backslashes to treat delimiters as plain text.
|
12296
12614
|
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
|
12297
12615
|
* compiled({ 'value': 'ignored' });
|
12298
12616
|
* // => '<%- value %>'
|
12299
12617
|
*
|
12300
|
-
* //
|
12618
|
+
* // Use the `imports` option to import `jQuery` as `jq`.
|
12301
12619
|
* var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
|
12302
12620
|
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
|
12303
12621
|
* compiled({ 'users': ['fred', 'barney'] });
|
12304
12622
|
* // => '<li>fred</li><li>barney</li>'
|
12305
12623
|
*
|
12306
|
-
* //
|
12624
|
+
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
|
12307
12625
|
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
|
12308
12626
|
* compiled(data);
|
12309
12627
|
* // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
|
12310
12628
|
*
|
12311
|
-
* //
|
12629
|
+
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
|
12312
12630
|
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
|
12313
12631
|
* compiled.source;
|
12314
12632
|
* // => function(data) {
|
@@ -12317,8 +12635,8 @@
|
|
12317
12635
|
* // return __p;
|
12318
12636
|
* // }
|
12319
12637
|
*
|
12320
|
-
* //
|
12321
|
-
* // line numbers in error messages and
|
12638
|
+
* // Use the `source` property to inline compiled templates for meaningful
|
12639
|
+
* // line numbers in error messages and stack traces.
|
12322
12640
|
* fs.writeFileSync(path.join(cwd, 'jst.js'), '\
|
12323
12641
|
* var JST = {\
|
12324
12642
|
* "main": ' + _.template(mainText).source + '\
|
@@ -12765,7 +13083,7 @@
|
|
12765
13083
|
* @returns {*} Returns the `func` result or error object.
|
12766
13084
|
* @example
|
12767
13085
|
*
|
12768
|
-
* //
|
13086
|
+
* // Avoid throwing errors for invalid selectors.
|
12769
13087
|
* var elements = _.attempt(function(selector) {
|
12770
13088
|
* return document.querySelectorAll(selector);
|
12771
13089
|
* }, '>_>');
|
@@ -12778,7 +13096,7 @@
|
|
12778
13096
|
try {
|
12779
13097
|
return apply(func, undefined, args);
|
12780
13098
|
} catch (e) {
|
12781
|
-
return
|
13099
|
+
return isObject(e) ? e : new Error(e);
|
12782
13100
|
}
|
12783
13101
|
});
|
12784
13102
|
|
@@ -12832,7 +13150,7 @@
|
|
12832
13150
|
* [_.matches({ 'a': 1 }), _.constant('matches A')],
|
12833
13151
|
* [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
|
12834
13152
|
* [_.constant(true), _.constant('no match')]
|
12835
|
-
* ])
|
13153
|
+
* ]);
|
12836
13154
|
*
|
12837
13155
|
* func({ 'a': 1, 'b': 2 });
|
12838
13156
|
* // => 'matches A'
|
@@ -12912,9 +13230,9 @@
|
|
12912
13230
|
}
|
12913
13231
|
|
12914
13232
|
/**
|
12915
|
-
* Creates a function that returns the result of invoking the
|
12916
|
-
*
|
12917
|
-
*
|
13233
|
+
* Creates a function that returns the result of invoking the given functions
|
13234
|
+
* with the `this` binding of the created function, where each successive
|
13235
|
+
* invocation is supplied the return value of the previous.
|
12918
13236
|
*
|
12919
13237
|
* @static
|
12920
13238
|
* @memberOf _
|
@@ -12935,7 +13253,7 @@
|
|
12935
13253
|
|
12936
13254
|
/**
|
12937
13255
|
* This method is like `_.flow` except that it creates a function that
|
12938
|
-
* invokes the
|
13256
|
+
* invokes the given functions from right to left.
|
12939
13257
|
*
|
12940
13258
|
* @static
|
12941
13259
|
* @memberOf _
|
@@ -12955,7 +13273,7 @@
|
|
12955
13273
|
var flowRight = createFlow(true);
|
12956
13274
|
|
12957
13275
|
/**
|
12958
|
-
* This method returns the first argument
|
13276
|
+
* This method returns the first argument given to it.
|
12959
13277
|
*
|
12960
13278
|
* @static
|
12961
13279
|
* @memberOf _
|
@@ -12991,7 +13309,7 @@
|
|
12991
13309
|
* { 'user': 'fred', 'age': 40 }
|
12992
13310
|
* ];
|
12993
13311
|
*
|
12994
|
-
* //
|
13312
|
+
* // Create custom iteratee shorthands.
|
12995
13313
|
* _.iteratee = _.wrap(_.iteratee, function(callback, func) {
|
12996
13314
|
* var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);
|
12997
13315
|
* return !p ? callback(func) : function(object) {
|
@@ -13003,9 +13321,7 @@
|
|
13003
13321
|
* // => [{ 'user': 'fred', 'age': 40 }]
|
13004
13322
|
*/
|
13005
13323
|
function iteratee(func) {
|
13006
|
-
return (
|
13007
|
-
? matches(func)
|
13008
|
-
: baseIteratee(func);
|
13324
|
+
return baseIteratee(typeof func == 'function' ? func : baseClone(func, true));
|
13009
13325
|
}
|
13010
13326
|
|
13011
13327
|
/**
|
@@ -13203,7 +13519,9 @@
|
|
13203
13519
|
* var lodash = _.noConflict();
|
13204
13520
|
*/
|
13205
13521
|
function noConflict() {
|
13206
|
-
root._
|
13522
|
+
if (root._ === this) {
|
13523
|
+
root._ = oldDash;
|
13524
|
+
}
|
13207
13525
|
return this;
|
13208
13526
|
}
|
13209
13527
|
|
@@ -13368,8 +13686,7 @@
|
|
13368
13686
|
* Creates an array of numbers (positive and/or negative) progressing from
|
13369
13687
|
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
13370
13688
|
* `start` is specified without an `end` or `step`. If `end` is not specified
|
13371
|
-
* it's set to `start` with `start` then set to `0`.
|
13372
|
-
* `start` a zero-length range is created unless a negative `step` is specified.
|
13689
|
+
* it's set to `start` with `start` then set to `0`.
|
13373
13690
|
*
|
13374
13691
|
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
13375
13692
|
* floating-point values which can produce unexpected results.
|
@@ -13508,7 +13825,7 @@
|
|
13508
13825
|
}
|
13509
13826
|
|
13510
13827
|
/**
|
13511
|
-
* Generates a unique ID. If `prefix` is
|
13828
|
+
* Generates a unique ID. If `prefix` is given the ID is appended to it.
|
13512
13829
|
*
|
13513
13830
|
* @static
|
13514
13831
|
* @memberOf _
|
@@ -13546,6 +13863,9 @@
|
|
13546
13863
|
*/
|
13547
13864
|
function add(augend, addend) {
|
13548
13865
|
var result;
|
13866
|
+
if (augend === undefined && addend === undefined) {
|
13867
|
+
return 0;
|
13868
|
+
}
|
13549
13869
|
if (augend !== undefined) {
|
13550
13870
|
result = augend;
|
13551
13871
|
}
|
@@ -13637,10 +13957,10 @@
|
|
13637
13957
|
*
|
13638
13958
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
13639
13959
|
*
|
13640
|
-
* _.maxBy(objects, function(o) { return o.
|
13960
|
+
* _.maxBy(objects, function(o) { return o.n; });
|
13641
13961
|
* // => { 'n': 2 }
|
13642
13962
|
*
|
13643
|
-
* //
|
13963
|
+
* // The `_.property` iteratee shorthand.
|
13644
13964
|
* _.maxBy(objects, 'n');
|
13645
13965
|
* // => { 'n': 2 }
|
13646
13966
|
*/
|
@@ -13705,10 +14025,10 @@
|
|
13705
14025
|
*
|
13706
14026
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
13707
14027
|
*
|
13708
|
-
* _.minBy(objects, function(o) { return o.
|
14028
|
+
* _.minBy(objects, function(o) { return o.n; });
|
13709
14029
|
* // => { 'n': 1 }
|
13710
14030
|
*
|
13711
|
-
* //
|
14031
|
+
* // The `_.property` iteratee shorthand.
|
13712
14032
|
* _.minBy(objects, 'n');
|
13713
14033
|
* // => { 'n': 1 }
|
13714
14034
|
*/
|
@@ -13756,6 +14076,9 @@
|
|
13756
14076
|
*/
|
13757
14077
|
function subtract(minuend, subtrahend) {
|
13758
14078
|
var result;
|
14079
|
+
if (minuend === undefined && subtrahend === undefined) {
|
14080
|
+
return 0;
|
14081
|
+
}
|
13759
14082
|
if (minuend !== undefined) {
|
13760
14083
|
result = minuend;
|
13761
14084
|
}
|
@@ -13781,7 +14104,7 @@
|
|
13781
14104
|
function sum(array) {
|
13782
14105
|
return (array && array.length)
|
13783
14106
|
? baseSum(array, identity)
|
13784
|
-
:
|
14107
|
+
: 0;
|
13785
14108
|
}
|
13786
14109
|
|
13787
14110
|
/**
|
@@ -13802,14 +14125,14 @@
|
|
13802
14125
|
* _.sumBy(objects, function(o) { return o.n; });
|
13803
14126
|
* // => 20
|
13804
14127
|
*
|
13805
|
-
* //
|
14128
|
+
* // The `_.property` iteratee shorthand.
|
13806
14129
|
* _.sumBy(objects, 'n');
|
13807
14130
|
* // => 20
|
13808
14131
|
*/
|
13809
14132
|
function sumBy(array, iteratee) {
|
13810
14133
|
return (array && array.length)
|
13811
14134
|
? baseSum(array, getIteratee(iteratee))
|
13812
|
-
:
|
14135
|
+
: 0;
|
13813
14136
|
}
|
13814
14137
|
|
13815
14138
|
/*------------------------------------------------------------------------*/
|
@@ -13898,6 +14221,7 @@
|
|
13898
14221
|
lodash.intersectionBy = intersectionBy;
|
13899
14222
|
lodash.intersectionWith = intersectionWith;
|
13900
14223
|
lodash.invert = invert;
|
14224
|
+
lodash.invertBy = invertBy;
|
13901
14225
|
lodash.invokeMap = invokeMap;
|
13902
14226
|
lodash.iteratee = iteratee;
|
13903
14227
|
lodash.keyBy = keyBy;
|
@@ -13986,11 +14310,10 @@
|
|
13986
14310
|
lodash.xorWith = xorWith;
|
13987
14311
|
lodash.zip = zip;
|
13988
14312
|
lodash.zipObject = zipObject;
|
14313
|
+
lodash.zipObjectDeep = zipObjectDeep;
|
13989
14314
|
lodash.zipWith = zipWith;
|
13990
14315
|
|
13991
14316
|
// Add aliases.
|
13992
|
-
lodash.each = forEach;
|
13993
|
-
lodash.eachRight = forEachRight;
|
13994
14317
|
lodash.extend = assignIn;
|
13995
14318
|
lodash.extendWith = assignInWith;
|
13996
14319
|
|
@@ -14042,9 +14365,11 @@
|
|
14042
14365
|
lodash.invoke = invoke;
|
14043
14366
|
lodash.isArguments = isArguments;
|
14044
14367
|
lodash.isArray = isArray;
|
14368
|
+
lodash.isArrayBuffer = isArrayBuffer;
|
14045
14369
|
lodash.isArrayLike = isArrayLike;
|
14046
14370
|
lodash.isArrayLikeObject = isArrayLikeObject;
|
14047
14371
|
lodash.isBoolean = isBoolean;
|
14372
|
+
lodash.isBuffer = isBuffer;
|
14048
14373
|
lodash.isDate = isDate;
|
14049
14374
|
lodash.isElement = isElement;
|
14050
14375
|
lodash.isEmpty = isEmpty;
|
@@ -14055,6 +14380,7 @@
|
|
14055
14380
|
lodash.isFunction = isFunction;
|
14056
14381
|
lodash.isInteger = isInteger;
|
14057
14382
|
lodash.isLength = isLength;
|
14383
|
+
lodash.isMap = isMap;
|
14058
14384
|
lodash.isMatch = isMatch;
|
14059
14385
|
lodash.isMatchWith = isMatchWith;
|
14060
14386
|
lodash.isNaN = isNaN;
|
@@ -14067,10 +14393,13 @@
|
|
14067
14393
|
lodash.isPlainObject = isPlainObject;
|
14068
14394
|
lodash.isRegExp = isRegExp;
|
14069
14395
|
lodash.isSafeInteger = isSafeInteger;
|
14396
|
+
lodash.isSet = isSet;
|
14070
14397
|
lodash.isString = isString;
|
14071
14398
|
lodash.isSymbol = isSymbol;
|
14072
14399
|
lodash.isTypedArray = isTypedArray;
|
14073
14400
|
lodash.isUndefined = isUndefined;
|
14401
|
+
lodash.isWeakMap = isWeakMap;
|
14402
|
+
lodash.isWeakSet = isWeakSet;
|
14074
14403
|
lodash.join = join;
|
14075
14404
|
lodash.kebabCase = kebabCase;
|
14076
14405
|
lodash.last = last;
|
@@ -14133,6 +14462,8 @@
|
|
14133
14462
|
lodash.upperFirst = upperFirst;
|
14134
14463
|
|
14135
14464
|
// Add aliases.
|
14465
|
+
lodash.each = forEach;
|
14466
|
+
lodash.eachRight = forEachRight;
|
14136
14467
|
lodash.first = head;
|
14137
14468
|
|
14138
14469
|
mixin(lodash, (function() {
|