lodash-rails 1.1.1 → 1.2.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.compat.js +215 -137
- data/vendor/assets/javascripts/lodash.compat.min.js +41 -41
- data/vendor/assets/javascripts/lodash.js +312 -291
- data/vendor/assets/javascripts/lodash.min.js +39 -37
- data/vendor/assets/javascripts/lodash.underscore.js +165 -120
- data/vendor/assets/javascripts/lodash.underscore.min.js +29 -29
- metadata +2 -2
@@ -1,46 +1,46 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* Lo-Dash 1.
|
3
|
+
* Lo-Dash 1.2.0 (Custom Build) lodash.com/license
|
4
4
|
* Build: `lodash -o ./dist/lodash.compat.js`
|
5
5
|
* Underscore.js 1.4.4 underscorejs.org/LICENSE
|
6
6
|
*/
|
7
|
-
;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!
|
8
|
-
|
9
|
-
else if(r+="for(i in m){",(
|
10
|
-
}function
|
11
|
-
var r=-1;e=e-t||0;for(var u=
|
12
|
-
case
|
13
|
-
var
|
14
|
-
if(p!=
|
15
|
-
}),
|
16
|
-
for(;++u<o;)(
|
17
|
-
}),a}function
|
18
|
-
if(t(o,e,n))return o}}function
|
19
|
-
});return u}function
|
20
|
-
|
21
|
-
return i}function
|
22
|
-
typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var
|
23
|
-
return
|
24
|
-
|
25
|
-
try{
|
26
|
-
|
27
|
-
|
28
|
-
for(
|
29
|
-
}},a.countBy=function(n,t,e){var r={};return t=a.createCallback(t,e),
|
30
|
-
}:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){i=null,
|
31
|
-
return t=a.createCallback(t,e),
|
32
|
-
|
33
|
-
if(!t&&
|
34
|
-
u[t]=[a,n[a]]}return u},a.partial=function(n){return
|
35
|
-
return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),
|
36
|
-
}var
|
37
|
-
r(a)||u
|
38
|
-
for(t=a.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},a.findKey=function(n,t,e){var r;return t=a.createCallback(t,e),
|
39
|
-
var e=
|
40
|
-
for(typeof e=="number"&&(r=(0>e?
|
41
|
-
n||(n=""),r=
|
42
|
-
|
43
|
-
for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return
|
44
|
-
}}),
|
45
|
-
a.global===a&&(n=a);var o=0,i={},f=/\b__p\+='';/g,
|
46
|
-
|
7
|
+
;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!Z(n)&&Qt.call(n,"__wrapped__")?n:new U(n)}function F(n){var t=n.length,e=t>=l;if(e)for(var r={},u=-1;++u<t;){var a=f+n[u];(r[a]||(r[a]=[])).push(n[u])}return function(t){if(e){var u=f+t;return r[u]&&-1<_t(r[u],t)}return-1<_t(n,t)}}function R(n){return n.charCodeAt(0)}function T(n,t){var e=n.b,r=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1}return e<r?-1:1}function D(n,t,e,r){function u(){var r=arguments,l=o?this:t;
|
8
|
+
return a||(n=t[i]),e.length&&(r=r.length?(r=le.call(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(V.prototype=n.prototype,l=new V,V.prototype=null,r=n.apply(l,r),et(r)?r:l):n.apply(l,r)}var a=tt(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new Dt;t=n}return u}function z(){for(var n,t={g:C,b:"k(m)",c:"",e:"m",f:"",h:"",i:!0,j:!!de},e=0;n=arguments[e];e++)for(var r in n)t[r]=n[r];if(n=t.a,t.d=/^[^,]+/.exec(n)[0],e=$t,r="var i,m="+t.d+",u="+t.e+";if(!m)return u;"+t.h+";",t.b?(r+="var n=m.length;i=-1;if("+t.b+"){",ve.unindexedChars&&(r+="if(l(m)){m=m.split('')}"),r+="while(++i<n){"+t.f+"}}else{"):ve.nonEnumArgs&&(r+="var n=m.length;i=-1;if(n&&j(m)){while(++i<n){i+='';"+t.f+"}}else{"),ve.enumPrototypes&&(r+="var v=typeof m=='function';"),t.i&&t.j)r+="var s=-1,t=r[typeof m]?o(m):[],n=t.length;while(++s<n){i=t[s];",ve.enumPrototypes&&(r+="if(!(v&&i=='prototype')){"),r+=t.f,ve.enumPrototypes&&(r+="}"),r+="}";
|
9
|
+
else if(r+="for(i in m){",(ve.enumPrototypes||t.i)&&(r+="if(",ve.enumPrototypes&&(r+="!(v&&i=='prototype')"),ve.enumPrototypes&&t.i&&(r+="&&"),t.i&&(r+="h.call(m,i)"),r+="){"),r+=t.f+";",(ve.enumPrototypes||t.i)&&(r+="}"),r+="}",ve.nonEnumShadows){r+="var f=m.constructor;";for(var u=0;7>u;u++)r+="i='"+t.g[u]+"';if(","constructor"==t.g[u]&&(r+="!(f&&f.prototype===m)&&"),r+="h.call(m,i)){"+t.f+"}"}return(t.b||ve.nonEnumArgs)&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Qt,Q,Z,ut,de,a,$)
|
10
|
+
}function L(n){return"\\"+q[n]}function K(n){return _e[n]}function M(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function G(n){var t=!1;if(!n||Zt.call(n)!=A||!ve.argsClass&&Q(n))return t;var e=n.constructor;return(tt(e)?e instanceof e:ve.nodeClass||!M(n))?ve.ownLast?(ke(n,function(n,e,r){return t=Qt.call(r,e),!1}),!0===t):(ke(n,function(n,e){t=e}),!1===t||Qt.call(n,t)):t}function H(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);
|
11
|
+
var r=-1;e=e-t||0;for(var u=It(0>e?0:e);++r<e;)u[r]=n[t+r];return u}function J(n){return we[n]}function Q(n){return Zt.call(n)==j}function W(n,t,r,u,o,i){var f=n;if(typeof t=="function"&&(u=r,r=t,t=!1),typeof r=="function"){if(r=typeof u=="undefined"?r:a.createCallback(r,u,1),f=r(f),typeof f!="undefined")return f;f=n}if(u=et(f)){var l=Zt.call(f);if(!N[l]||!ve.nodeClass&&M(f))return f;var c=Z(f)}if(!u||!t)return u?c?H(f):Ce({},f):f;switch(u=se[l],l){case x:case O:return new u(+f);case S:case P:return new u(f);
|
12
|
+
case I:return u(f.source,h.exec(f))}for(o||(o=[]),i||(i=[]),l=o.length;l--;)if(o[l]==n)return i[l];return f=c?u(f.length):{},c&&(Qt.call(n,"index")&&(f.index=n.index),Qt.call(n,"input")&&(f.input=n.input)),o.push(n),i.push(f),(c?pt:xe)(n,function(n,u){f[u]=W(n,t,r,e,o,i)}),f}function X(n){var t=[];return ke(n,function(n,e){tt(n)&&t.push(e)}),t.sort()}function Y(n){for(var t=-1,e=de(n),r=e.length,u={};++t<r;){var a=e[t];u[n[a]]=a}return u}function Z(n){return ve.argsObject&&n instanceof It||(te?te(n):Zt.call(n)==k)
|
13
|
+
}function nt(n,t,e,r,u,o){var f=e===i;if(typeof e=="function"&&!f){e=a.createCallback(e,r,2);var l=e(n,t);if(typeof l!="undefined")return!!l}if(n===t)return 0!==n||1/n==1/t;var c=typeof n,p=typeof t;if(n===n&&(!n||"function"!=c&&"object"!=c)&&(!t||"function"!=p&&"object"!=p))return!1;if(null==n||null==t)return n===t;if(p=Zt.call(n),c=Zt.call(t),p==j&&(p=A),c==j&&(c=A),p!=c)return!1;switch(p){case x:case O:return+n==+t;case S:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case I:case P:return n==Tt(t)}if(c=p==k,!c){if(Qt.call(n,"__wrapped__")||Qt.call(t,"__wrapped__"))return nt(n.__wrapped__||n,t.__wrapped__||t,e,r,u,o);
|
14
|
+
if(p!=A||!ve.nodeClass&&(M(n)||M(t)))return!1;var p=!ve.argsObject&&Q(n)?Ft:n.constructor,s=!ve.argsObject&&Q(t)?Ft:t.constructor;if(p!=s&&(!tt(p)||!(p instanceof p&&tt(s)&&s instanceof s)))return!1}for(u||(u=[]),o||(o=[]),p=u.length;p--;)if(u[p]==n)return o[p]==t;var v=0,l=!0;if(u.push(n),o.push(t),c){if(p=n.length,v=t.length,l=v==n.length,!l&&!f)return l;for(;v--;)if(c=p,s=t[v],f)for(;c--&&!(l=nt(n[c],s,e,r,u,o)););else if(!(l=nt(n[v],s,e,r,u,o)))break;return l}return ke(t,function(t,a,i){return Qt.call(i,a)?(v++,l=Qt.call(n,a)&&nt(n[a],t,e,r,u,o)):void 0
|
15
|
+
}),l&&!f&&ke(n,function(n,t,e){return Qt.call(e,t)?l=-1<--v:void 0}),l}function tt(n){return typeof n=="function"}function et(n){return n?$[typeof n]:!1}function rt(n){return typeof n=="number"||Zt.call(n)==S}function ut(n){return typeof n=="string"||Zt.call(n)==P}function at(n,t,e){var r=arguments,u=0,o=2;if(!et(n))return n;if(e===i)var f=r[3],l=r[4],c=r[5];else l=[],c=[],typeof e!="number"&&(o=r.length),3<o&&"function"==typeof r[o-2]?f=a.createCallback(r[--o-1],r[o--],2):2<o&&"function"==typeof r[o-1]&&(f=r[--o]);
|
16
|
+
for(;++u<o;)(Z(r[u])?pt:xe)(r[u],function(t,e){var r,u,a=t,o=n[e];if(t&&((u=Z(t))||Oe(t))){for(a=l.length;a--;)if(r=l[a]==t){o=c[a];break}if(!r){var p;f&&(a=f(o,t),p=typeof a!="undefined")&&(o=a),p||(o=u?Z(o)?o:[]:Oe(o)?o:{}),l.push(t),c.push(o),p||(o=at(o,t,i,f,l,c))}}else f&&(a=f(o,t),typeof a=="undefined"&&(a=t)),typeof a!="undefined"&&(o=a);n[e]=o});return n}function ot(n){for(var t=-1,e=de(n),r=e.length,u=It(r);++t<r;)u[t]=n[e[t]];return u}function it(n,t,e){var r=-1,u=n?n.length:0,a=!1;return e=(0>e?ae(0,u+e):e)||0,typeof u=="number"?a=-1<(ut(n)?n.indexOf(t,e):_t(n,t,e)):be(n,function(n){return++r<e?void 0:!(a=n===t)
|
17
|
+
}),a}function ft(n,t,e){var r=!0;if(t=a.createCallback(t,e),Z(n)){e=-1;for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else be(n,function(n,e,u){return r=!!t(n,e,u)});return r}function lt(n,t,e){var r=[];if(t=a.createCallback(t,e),Z(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}}else be(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function ct(n,t,e){if(t=a.createCallback(t,e),!Z(n)){var r;return be(n,function(n,e,u){return t(n,e,u)?(r=n,!1):void 0}),r}e=-1;for(var u=n.length;++e<u;){var o=n[e];
|
18
|
+
if(t(o,e,n))return o}}function pt(n,t,e){if(t&&typeof e=="undefined"&&Z(n)){e=-1;for(var r=n.length;++e<r&&!1!==t(n[e],e,n););}else be(n,t,e);return n}function st(n,t,e){var r=-1,u=n?n.length:0,o=It(typeof u=="number"?u:0);if(t=a.createCallback(t,e),Z(n))for(;++r<u;)o[r]=t(n[r],r,n);else be(n,function(n,e,u){o[++r]=t(n,e,u)});return o}function vt(n,t,e){var r=-1/0,u=r;if(!t&&Z(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i>u&&(u=i)}}else t=!t&&ut(n)?R:a.createCallback(t,e),be(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)
|
19
|
+
});return u}function gt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),Z(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++o<i;)e=t(e,n[o],o,n)}else be(n,function(n,r,a){e=u?(u=!1,n):t(e,n,r,a)});return e}function ht(n,t,e,r){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var f=de(n),o=f.length;else ve.unindexedChars&&ut(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),pt(n,function(n,r,a){r=f?f[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function yt(n,t,e){var r;if(t=a.createCallback(t,e),Z(n)){e=-1;
|
20
|
+
for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else be(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function mt(n){for(var t=-1,e=n?n.length:0,r=Gt.apply(zt,le.call(arguments,1)),r=F(r),u=[];++t<e;){var a=n[t];r(a)||u.push(a)}return u}function dt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=a.createCallback(t,e);++o<u&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[0];return H(n,0,oe(ae(0,r),u))}}function bt(n,t,e,r){var u=-1,o=n?n.length:0,i=[];for(typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1),null!=e&&(e=a.createCallback(e,r));++u<o;)r=n[u],e&&(r=e(r,u,n)),Z(r)?Wt.apply(i,t?r:bt(r)):i.push(r);
|
21
|
+
return i}function _t(n,t,e){var r=-1,u=n?n.length:0;if(typeof e=="number")r=(0>e?ae(0,u+e):e||0)-1;else if(e)return r=Ct(n,t),n[r]===t?r:-1;for(;++r<u;)if(n[r]===t)return r;return-1}function wt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,e);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:ae(0,t);return H(n,r)}function Ct(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?a.createCallback(e,r,1):Et,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r;return u}function jt(n,t,e,r){var u=-1,o=n?n.length:0,i=[],c=i;
|
22
|
+
typeof t!="boolean"&&null!=t&&(r=e,e=t,t=!1);var p=!t&&o>=l;if(p)var s={};for(null!=e&&(c=[],e=a.createCallback(e,r));++u<o;){r=n[u];var v=e?e(r,u,n):r;if(p)var g=f+v,g=s[g]?!(c=s[g]):c=s[g]=[];(t?!u||c[c.length-1]!==v:g||0>_t(c,v))&&((e||p)&&c.push(v),i.push(r))}return i}function kt(n,t){for(var e=-1,r=n?n.length:0,u={};++e<r;){var a=n[e];t?u[a]=t[e]:u[a[0]]=a[1]}return u}function xt(n,t){return ve.fastBind||ne&&2<arguments.length?ne.call.apply(ne,arguments):D(n,t,le.call(arguments,2))}function Ot(n){var t=le.call(arguments,1);
|
23
|
+
return Yt(function(){n.apply(e,t)},1)}function Et(n){return n}function St(n){pt(X(n),function(t){var e=a[t]=n[t];a.prototype[t]=function(){var n=this.__wrapped__,t=[n];return Wt.apply(t,arguments),t=e.apply(a,t),n&&typeof n=="object"&&n==t?this:new U(t)}})}function At(){return this.__wrapped__}r=r?B.defaults(n.Object(),r,B.pick(n,w)):n;var It=r.Array,Pt=r.Boolean,Nt=r.Date,$t=r.Function,qt=r.Math,Bt=r.Number,Ft=r.Object,Rt=r.RegExp,Tt=r.String,Dt=r.TypeError,zt=It(),Lt=Ft(),Kt=r._,Mt=Rt("^"+Tt(Lt.valueOf).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Ut=qt.ceil,Vt=r.clearTimeout,Gt=zt.concat,Ht=qt.floor,Jt=Mt.test(Jt=Ft.getPrototypeOf)&&Jt,Qt=Lt.hasOwnProperty,Wt=zt.push,Xt=r.setImmediate,Yt=r.setTimeout,Zt=Lt.toString,ne=Mt.test(ne=Zt.bind)&&ne,te=Mt.test(te=It.isArray)&&te,ee=r.isFinite,re=r.isNaN,ue=Mt.test(ue=Ft.keys)&&ue,ae=qt.max,oe=qt.min,ie=r.parseInt,fe=qt.random,le=zt.slice,ce=Mt.test(r.attachEvent),pe=ne&&!/\n|true/.test(ne+ce),se={};
|
24
|
+
se[k]=It,se[x]=Pt,se[O]=Nt,se[A]=Ft,se[S]=Bt,se[I]=Rt,se[P]=Tt;var ve=a.support={};(function(){var n=function(){this.x=1},t={0:1,length:1},e=[];n.prototype={valueOf:1,y:1};for(var r in new n)e.push(r);for(r in arguments);ve.argsObject=arguments.constructor==Ft&&!(arguments instanceof It),ve.argsClass=Q(arguments),ve.enumPrototypes=n.propertyIsEnumerable("prototype"),ve.fastBind=ne&&!pe,ve.ownLast="x"!=e[0],ve.nonEnumArgs=0!=r,ve.nonEnumShadows=!/valueOf/.test(e),ve.spliceObjects=(zt.splice.call(t,0,1),!t[0]),ve.unindexedChars="xx"!="x"[0]+Ft("x")[0];
|
25
|
+
try{ve.nodeClass=!(Zt.call(document)==A&&!({toString:0}+""))}catch(u){ve.nodeClass=!0}})(1),a.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var ge={a:"q,w,g",h:"var a=arguments,b=0,c=typeof g=='number'?2:a.length;while(++b<c){m=a[b];if(m&&r[typeof m]){",f:"if(typeof u[i]=='undefined')u[i]=m[i]",c:"}}"},he={a:"e,d,x",h:"d=d&&typeof x=='undefined'?d:p.createCallback(d,x)",b:"typeof n=='number'",f:"if(d(m[i],i,e)===false)return u"},ye={h:"if(!r[typeof m])return u;"+he.h,b:!1};
|
26
|
+
U.prototype=a.prototype,ve.argsClass||(Q=function(n){return n?Qt.call(n,"callee"):!1});var me=z({a:"q",e:"[]",h:"if(!(r[typeof q]))return u",f:"u.push(i)",b:!1}),de=ue?function(n){return et(n)?ve.enumPrototypes&&typeof n=="function"||ve.nonEnumArgs&&n.length&&Q(n)?me(n):ue(n):[]}:me,be=z(he),_e={"&":"&","<":"<",">":">",'"':""","'":"'"},we=Y(_e),Ce=z(ge,{h:ge.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=p.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"u[i]=d?d(u[i],m[i]):m[i]"}),je=z(ge),ke=z(he,ye,{i:!1}),xe=z(he,ye);
|
27
|
+
tt(/x/)&&(tt=function(n){return n instanceof $t||Zt.call(n)==E});var Oe=Jt?function(n){if(!n||Zt.call(n)!=A||!ve.argsClass&&Q(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=Jt(t))&&Jt(e);return e?n==e||Jt(n)==e:G(n)}:G;pe&&u&&typeof Xt=="function"&&(Ot=xt(Xt,r));var Ee=8==ie("08")?ie:function(n,t){return ie(ut(n)?n.replace(m,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ce,a.at=function(n){var t=-1,e=Gt.apply(zt,le.call(arguments,1)),r=e.length,u=It(r);
|
28
|
+
for(ve.unindexedChars&&ut(n)&&(n=n.split(""));++t<r;)u[t]=n[e[t]];return u},a.bind=xt,a.bindAll=function(n){for(var t=1<arguments.length?Gt.apply(zt,le.call(arguments,1)):X(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=xt(n[u],n)}return n},a.bindKey=function(n,t){return D(n,t,le.call(arguments,2),i)},a.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},a.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];
|
29
|
+
return t[0]}},a.countBy=function(n,t,e){var r={};return t=a.createCallback(t,e),pt(n,function(n,e,u){e=Tt(t(n,e,u)),Qt.call(r,e)?r[e]++:r[e]=1}),r},a.createCallback=function(n,t,e){if(null==n)return Et;var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var u=de(n);return function(t){for(var e=u.length,r=!1;e--&&(r=nt(t[u[e]],n[u[e]],i)););return r}}return typeof t!="undefined"?1===e?function(e){return n.call(t,e)}:2===e?function(e,r){return n.call(t,e,r)}:4===e?function(e,r,u,a){return n.call(t,e,r,u,a)
|
30
|
+
}:function(e,r,u){return n.call(t,e,r,u)}:n},a.debounce=function(n,t,e){function r(){i=null,f&&(a=n.apply(o,u))}var u,a,o,i,f=!0;if(!0===e)var l=!0,f=!1;else e&&$[typeof e]&&(l=e.leading,f="trailing"in e?e.trailing:f);return function(){var e=l&&!i;return u=arguments,o=this,Vt(i),i=Yt(r,t),e&&(a=n.apply(o,u)),a}},a.defaults=je,a.defer=Ot,a.delay=function(n,t){var r=le.call(arguments,2);return Yt(function(){n.apply(e,r)},t)},a.difference=mt,a.filter=lt,a.flatten=bt,a.forEach=pt,a.forIn=ke,a.forOwn=xe,a.functions=X,a.groupBy=function(n,t,e){var r={};
|
31
|
+
return t=a.createCallback(t,e),pt(n,function(n,e,u){e=Tt(t(n,e,u)),(Qt.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return H(n,0,oe(ae(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],c=i;n:for(;++u<a;){var p=n[u];if(o)var s=f+p,s=r[0][s]?!(c=r[0][s]):c=r[0][s]=[];if(s||0>_t(c,p)){o&&c.push(p);
|
32
|
+
for(var v=e;--v;)if(!(r[v]||(r[v]=F(t[v])))(p))continue n;i.push(p)}}return i},a.invert=Y,a.invoke=function(n,t){var e=le.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=It(typeof a=="number"?a:0);return pt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=de,a.map=st,a.max=vt,a.memoize=function(n,t){var e={};return function(){var r=f+(t?t.apply(this,arguments):arguments[0]);return Qt.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=at,a.min=function(n,t,e){var r=1/0,u=r;
|
33
|
+
if(!t&&Z(n)){e=-1;for(var o=n.length;++e<o;){var i=n[e];i<u&&(u=i)}}else t=!t&&ut(n)?R:a.createCallback(t,e),be(n,function(n,e,a){e=t(n,e,a),e<r&&(r=e,u=n)});return u},a.omit=function(n,t,e){var r=typeof t=="function",u={};if(r)t=a.createCallback(t,e);else var o=Gt.apply(zt,le.call(arguments,1));return ke(n,function(n,e,a){(r?!t(n,e,a):0>_t(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=de(n),r=e.length,u=It(r);++t<r;){var a=e[t];
|
34
|
+
u[t]=[a,n[a]]}return u},a.partial=function(n){return D(n,le.call(arguments,1))},a.partialRight=function(n){return D(n,le.call(arguments,1),null,i)},a.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=Gt.apply(zt,le.call(arguments,1)),i=et(n)?o.length:0;++u<i;){var f=o[u];f in n&&(r[f]=n[f])}else t=a.createCallback(t,e),ke(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},a.pluck=st,a.range=function(n,t,e){n=+n||0,e=+e||1,null==t&&(t=n,n=0);var r=-1;t=ae(0,Ut((t-n)/e));for(var u=It(t);++r<t;)u[r]=n,n+=e;
|
35
|
+
return u},a.reject=function(n,t,e){return t=a.createCallback(t,e),lt(n,function(n,e,r){return!t(n,e,r)})},a.rest=wt,a.shuffle=function(n){var t=-1,e=n?n.length:0,r=It(typeof e=="number"?e:0);return pt(n,function(n){var e=Ht(fe()*(++t+1));r[t]=r[e],r[e]=n}),r},a.sortBy=function(n,t,e){var r=-1,u=n?n.length:0,o=It(typeof u=="number"?u:0);for(t=a.createCallback(t,e),pt(n,function(n,e,u){o[++r]={a:t(n,e,u),b:r,c:n}}),u=o.length,o.sort(T);u--;)o[u]=o[u].c;return o},a.tap=function(n,t){return t(n),n},a.throttle=function(n,t,e){function r(){f=new Nt,i=null,c&&(a=n.apply(o,u))
|
36
|
+
}var u,a,o,i,f=0,l=!0,c=!0;return!1===e?l=!1:e&&$[typeof e]&&(l="leading"in e?e.leading:l,c="trailing"in e?e.trailing:c),function(){var e=new Nt;!i&&!l&&(f=e);var c=t-(e-f);return u=arguments,o=this,0<c?i||(i=Yt(r,c)):(Vt(i),i=null,f=e,a=n.apply(o,u)),a}},a.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=It(n);for(t=a.createCallback(t,e,1);++r<n;)u[r]=t(r);return u},a.toArray=function(n){return n&&typeof n.length=="number"?ve.unindexedChars&&ut(n)?n.split(""):H(n):ot(n)},a.union=function(n){return Z(n)||(arguments[0]=n?le.call(n):zt),jt(Gt.apply(zt,arguments))
|
37
|
+
},a.uniq=jt,a.unzip=function(n){for(var t=-1,e=n?n.length:0,r=e?vt(st(n,"length")):0,u=It(r);++t<e;)for(var a=-1,o=n[t];++a<r;)(u[a]||(u[a]=It(e)))[t]=o[a];return u},a.values=ot,a.where=lt,a.without=function(n){return mt(n,le.call(arguments,1))},a.wrap=function(n,t){return function(){var e=[n];return Wt.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){for(var t=-1,e=n?vt(st(arguments,"length")):0,r=It(e);++t<e;)r[t]=st(arguments,t);return r},a.zipObject=kt,a.collect=st,a.drop=wt,a.each=pt,a.extend=Ce,a.methods=X,a.object=kt,a.select=lt,a.tail=wt,a.unique=jt,St(a),a.clone=W,a.cloneDeep=function(n,t,e){return W(n,!0,t,e)
|
38
|
+
},a.contains=it,a.escape=function(n){return null==n?"":Tt(n).replace(b,K)},a.every=ft,a.find=ct,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=a.createCallback(t,e);++r<u;)if(t(n[r],r,n))return r;return-1},a.findKey=function(n,t,e){var r;return t=a.createCallback(t,e),xe(n,function(n,e,u){return t(n,e,u)?(r=e,!1):void 0}),r},a.has=function(n,t){return n?Qt.call(n,t):!1},a.identity=Et,a.indexOf=_t,a.isArguments=Q,a.isArray=Z,a.isBoolean=function(n){return!0===n||!1===n||Zt.call(n)==x},a.isDate=function(n){return n instanceof Nt||Zt.call(n)==O
|
39
|
+
},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var e=Zt.call(n),r=n.length;return e==k||e==P||(ve.argsClass?e==j:Q(n))||e==A&&typeof r=="number"&&tt(n.splice)?!r:(xe(n,function(){return t=!1}),t)},a.isEqual=nt,a.isFinite=function(n){return ee(n)&&!re(parseFloat(n))},a.isFunction=tt,a.isNaN=function(n){return rt(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=rt,a.isObject=et,a.isPlainObject=Oe,a.isRegExp=function(n){return n instanceof Rt||Zt.call(n)==I
|
40
|
+
},a.isString=ut,a.isUndefined=function(n){return typeof n=="undefined"},a.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?ae(0,r+e):oe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=St,a.noConflict=function(){return r._=Kt,this},a.parseInt=Ee,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Ht(fe()*((+t||0)-n+1))},a.reduce=gt,a.reduceRight=ht,a.result=function(n,t){var r=n?n[t]:e;return tt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;
|
41
|
+
return typeof t=="number"?t:de(n).length},a.some=yt,a.sortedIndex=Ct,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=je({},r,u);var o,i=je({},r.imports,u.imports),u=de(i),i=ot(i),f=0,l=r.interpolate||d,v="__p+='",l=Rt((r.escape||d).source+"|"+l.source+"|"+(l===y?g:d).source+"|"+(r.evaluate||d).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(f,i).replace(_,L),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),f=i+t.length,t
|
42
|
+
}),v+="';\n",l=r=r.variable,l||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(c,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=$t(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Tt(n).replace(v,J)},a.uniqueId=function(n){var t=++o;return Tt(null==n?"":n)+t
|
43
|
+
},a.all=ft,a.any=yt,a.detect=ct,a.foldl=gt,a.foldr=ht,a.include=it,a.inject=gt,xe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Wt.apply(t,arguments),n.apply(a,t)})}),a.first=dt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return H(n,ae(0,u-r))}},a.take=dt,a.head=dt,xe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);
|
44
|
+
return null==t||e&&typeof t!="function"?r:new U(r)})}),a.VERSION="1.2.0",a.prototype.toString=function(){return Tt(this.__wrapped__)},a.prototype.value=At,a.prototype.valueOf=At,be(["join","pop","shift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),be(["push","reverse","sort","unshift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),be(["concat","slice","splice"],function(n){var t=zt[n];a.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments))
|
45
|
+
}}),ve.spliceObjects||be(["pop","shift","splice"],function(n){var t=zt[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new U(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},f=+new Date+"",l=200,c=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=/^0+(?=.$)/,d=/($^)/,b=/[&<>"']/g,_=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),C="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),j="[object Arguments]",k="[object Array]",x="[object Boolean]",O="[object Date]",E="[object Function]",S="[object Number]",A="[object Object]",I="[object RegExp]",P="[object String]",N={};
|
46
|
+
N[E]=!1,N[j]=N[k]=N[x]=N[O]=N[S]=N[A]=N[I]=N[P]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=B,define(function(){return B})):r&&!r.nodeType?u?(u.exports=B)._=B:r._=B:n._=B})(this);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* Lo-Dash 1.
|
3
|
+
* Lo-Dash 1.2.0 (Custom Build) <http://lodash.com/>
|
4
4
|
* Build: `lodash modern -o ./dist/lodash.js`
|
5
5
|
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
|
6
6
|
* Based on Underscore.js 1.4.4 <http://underscorejs.org/>
|
@@ -18,9 +18,9 @@
|
|
18
18
|
/** Detect free variable `module` */
|
19
19
|
var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
|
20
20
|
|
21
|
-
/** Detect free variable `global
|
21
|
+
/** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
|
22
22
|
var freeGlobal = typeof global == 'object' && global;
|
23
|
-
if (freeGlobal.global === freeGlobal) {
|
23
|
+
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
24
24
|
window = freeGlobal;
|
25
25
|
}
|
26
26
|
|
@@ -30,6 +30,12 @@
|
|
30
30
|
/** Used internally to indicate various things */
|
31
31
|
var indicatorObject = {};
|
32
32
|
|
33
|
+
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
|
34
|
+
var keyPrefix = +new Date + '';
|
35
|
+
|
36
|
+
/** Used as the size when optimizations are enabled for large arrays */
|
37
|
+
var largeArraySize = 200;
|
38
|
+
|
33
39
|
/** Used to match empty string literals in compiled template source */
|
34
40
|
var reEmptyStringLeading = /\b__p \+= '';/g,
|
35
41
|
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
@@ -169,7 +175,7 @@
|
|
169
175
|
toString = objectRef.toString;
|
170
176
|
|
171
177
|
/* Native method shortcuts for methods with the same name as other `lodash` methods */
|
172
|
-
var nativeBind = reNative.test(nativeBind =
|
178
|
+
var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
|
173
179
|
nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
|
174
180
|
nativeIsFinite = context.isFinite,
|
175
181
|
nativeIsNaN = context.isNaN,
|
@@ -177,7 +183,8 @@
|
|
177
183
|
nativeMax = Math.max,
|
178
184
|
nativeMin = Math.min,
|
179
185
|
nativeParseInt = context.parseInt,
|
180
|
-
nativeRandom = Math.random
|
186
|
+
nativeRandom = Math.random,
|
187
|
+
nativeSlice = arrayRef.slice;
|
181
188
|
|
182
189
|
/** Detect various environments */
|
183
190
|
var isIeOpera = reNative.test(context.attachEvent),
|
@@ -196,7 +203,7 @@
|
|
196
203
|
/*--------------------------------------------------------------------------*/
|
197
204
|
|
198
205
|
/**
|
199
|
-
* Creates a `lodash` object,
|
206
|
+
* Creates a `lodash` object, which wraps the given `value`, to enable method
|
200
207
|
* chaining.
|
201
208
|
*
|
202
209
|
* In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
|
@@ -214,8 +221,8 @@
|
|
214
221
|
* `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
|
215
222
|
* `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`,
|
216
223
|
* `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`,
|
217
|
-
* `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `
|
218
|
-
* `where`, `without`, `wrap`, and `zip`
|
224
|
+
* `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`,
|
225
|
+
* `values`, `where`, `without`, `wrap`, and `zip`
|
219
226
|
*
|
220
227
|
* The non-chainable wrapper functions are:
|
221
228
|
* `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`,
|
@@ -234,6 +241,26 @@
|
|
234
241
|
* @category Chaining
|
235
242
|
* @param {Mixed} value The value to wrap in a `lodash` instance.
|
236
243
|
* @returns {Object} Returns a `lodash` instance.
|
244
|
+
* @example
|
245
|
+
*
|
246
|
+
* var wrapped = _([1, 2, 3]);
|
247
|
+
*
|
248
|
+
* // returns an unwrapped value
|
249
|
+
* wrapped.reduce(function(sum, num) {
|
250
|
+
* return sum + num;
|
251
|
+
* });
|
252
|
+
* // => 6
|
253
|
+
*
|
254
|
+
* // returns a wrapped value
|
255
|
+
* var squares = wrapped.map(function(num) {
|
256
|
+
* return num * num;
|
257
|
+
* });
|
258
|
+
*
|
259
|
+
* _.isArray(squares);
|
260
|
+
* // => false
|
261
|
+
*
|
262
|
+
* _.isArray(squares.value());
|
263
|
+
* // => true
|
237
264
|
*/
|
238
265
|
function lodash(value) {
|
239
266
|
// don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
|
@@ -322,92 +349,6 @@
|
|
322
349
|
|
323
350
|
/*--------------------------------------------------------------------------*/
|
324
351
|
|
325
|
-
/**
|
326
|
-
* The template used to create iterator functions.
|
327
|
-
*
|
328
|
-
* @private
|
329
|
-
* @param {Obect} data The data object used to populate the text.
|
330
|
-
* @returns {String} Returns the interpolated text.
|
331
|
-
*/
|
332
|
-
var iteratorTemplate = function(obj) {
|
333
|
-
|
334
|
-
var __p = 'var index, iterable = ' +
|
335
|
-
(obj.firstArg) +
|
336
|
-
', result = ' +
|
337
|
-
(obj.init) +
|
338
|
-
';\nif (!iterable) return result;\n' +
|
339
|
-
(obj.top) +
|
340
|
-
';\n';
|
341
|
-
if (obj.arrays) {
|
342
|
-
__p += 'var length = iterable.length; index = -1;\nif (' +
|
343
|
-
(obj.arrays) +
|
344
|
-
') {\n while (++index < length) {\n ' +
|
345
|
-
(obj.loop) +
|
346
|
-
'\n }\n}\nelse { ';
|
347
|
-
}
|
348
|
-
|
349
|
-
if (obj.useHas && obj.useKeys) {
|
350
|
-
__p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n ' +
|
351
|
-
(obj.loop) +
|
352
|
-
'\n } ';
|
353
|
-
} else {
|
354
|
-
__p += '\n for (index in iterable) {';
|
355
|
-
if (obj.useHas) {
|
356
|
-
__p += '\n if (';
|
357
|
-
if (obj.useHas) {
|
358
|
-
__p += 'hasOwnProperty.call(iterable, index)';
|
359
|
-
}
|
360
|
-
__p += ') { ';
|
361
|
-
}
|
362
|
-
__p +=
|
363
|
-
(obj.loop) +
|
364
|
-
'; ';
|
365
|
-
if (obj.useHas) {
|
366
|
-
__p += '\n }';
|
367
|
-
}
|
368
|
-
__p += '\n } ';
|
369
|
-
}
|
370
|
-
|
371
|
-
if (obj.arrays) {
|
372
|
-
__p += '\n}';
|
373
|
-
}
|
374
|
-
__p +=
|
375
|
-
(obj.bottom) +
|
376
|
-
';\nreturn result';
|
377
|
-
|
378
|
-
return __p
|
379
|
-
};
|
380
|
-
|
381
|
-
/** Reusable iterator options for `assign` and `defaults` */
|
382
|
-
var defaultsIteratorOptions = {
|
383
|
-
'args': 'object, source, guard',
|
384
|
-
'top':
|
385
|
-
'var args = arguments,\n' +
|
386
|
-
' argsIndex = 0,\n' +
|
387
|
-
" argsLength = typeof guard == 'number' ? 2 : args.length;\n" +
|
388
|
-
'while (++argsIndex < argsLength) {\n' +
|
389
|
-
' iterable = args[argsIndex];\n' +
|
390
|
-
' if (iterable && objectTypes[typeof iterable]) {',
|
391
|
-
'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]",
|
392
|
-
'bottom': ' }\n}'
|
393
|
-
};
|
394
|
-
|
395
|
-
/** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */
|
396
|
-
var eachIteratorOptions = {
|
397
|
-
'args': 'collection, callback, thisArg',
|
398
|
-
'top': "callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg)",
|
399
|
-
'arrays': false,
|
400
|
-
'loop': 'if (callback(iterable[index], index, collection) === false) return result'
|
401
|
-
};
|
402
|
-
|
403
|
-
/** Reusable iterator options for `forIn` and `forOwn` */
|
404
|
-
var forOwnIteratorOptions = {
|
405
|
-
'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top,
|
406
|
-
'arrays': false
|
407
|
-
};
|
408
|
-
|
409
|
-
/*--------------------------------------------------------------------------*/
|
410
|
-
|
411
352
|
/**
|
412
353
|
* Creates a function optimized to search large arrays for a given `value`,
|
413
354
|
* starting at `fromIndex`, using strict equality for comparisons, i.e. `===`.
|
@@ -415,31 +356,27 @@
|
|
415
356
|
* @private
|
416
357
|
* @param {Array} array The array to search.
|
417
358
|
* @param {Mixed} value The value to search for.
|
418
|
-
* @param {Number} fromIndex The index to search from.
|
419
|
-
* @param {Number} largeSize The length at which an array is considered large.
|
420
359
|
* @returns {Boolean} Returns `true`, if `value` is found, else `false`.
|
421
360
|
*/
|
422
|
-
function cachedContains(array
|
361
|
+
function cachedContains(array) {
|
423
362
|
var length = array.length,
|
424
|
-
isLarge =
|
363
|
+
isLarge = length >= largeArraySize;
|
425
364
|
|
426
365
|
if (isLarge) {
|
427
366
|
var cache = {},
|
428
|
-
index =
|
367
|
+
index = -1;
|
429
368
|
|
430
369
|
while (++index < length) {
|
431
|
-
|
432
|
-
|
433
|
-
var key = String(array[index]);
|
434
|
-
(hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = [])).push(array[index]);
|
370
|
+
var key = keyPrefix + array[index];
|
371
|
+
(cache[key] || (cache[key] = [])).push(array[index]);
|
435
372
|
}
|
436
373
|
}
|
437
374
|
return function(value) {
|
438
375
|
if (isLarge) {
|
439
|
-
var key =
|
440
|
-
return
|
376
|
+
var key = keyPrefix + value;
|
377
|
+
return cache[key] && indexOf(cache[key], value) > -1;
|
441
378
|
}
|
442
|
-
return indexOf(array, value
|
379
|
+
return indexOf(array, value) > -1;
|
443
380
|
}
|
444
381
|
}
|
445
382
|
|
@@ -525,7 +462,7 @@
|
|
525
462
|
}
|
526
463
|
if (partialArgs.length) {
|
527
464
|
args = args.length
|
528
|
-
? (args =
|
465
|
+
? (args = nativeSlice.call(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args))
|
529
466
|
: partialArgs;
|
530
467
|
}
|
531
468
|
if (this instanceof bound) {
|
@@ -544,53 +481,6 @@
|
|
544
481
|
return bound;
|
545
482
|
}
|
546
483
|
|
547
|
-
/**
|
548
|
-
* Creates compiled iteration functions.
|
549
|
-
*
|
550
|
-
* @private
|
551
|
-
* @param {Object} [options1, options2, ...] The compile options object(s).
|
552
|
-
* arrays - A string of code to determine if the iterable is an array or array-like.
|
553
|
-
* useHas - A boolean to specify using `hasOwnProperty` checks in the object loop.
|
554
|
-
* args - A string of comma separated arguments the iteration function will accept.
|
555
|
-
* top - A string of code to execute before the iteration branches.
|
556
|
-
* loop - A string of code to execute in the object loop.
|
557
|
-
* bottom - A string of code to execute after the iteration branches.
|
558
|
-
* @returns {Function} Returns the compiled function.
|
559
|
-
*/
|
560
|
-
function createIterator() {
|
561
|
-
var data = {
|
562
|
-
// iterator options
|
563
|
-
'arrays': 'isArray(iterable)',
|
564
|
-
'bottom': '',
|
565
|
-
'init': 'iterable',
|
566
|
-
'loop': '',
|
567
|
-
'top': '',
|
568
|
-
'useHas': true,
|
569
|
-
'useKeys': !!keys
|
570
|
-
};
|
571
|
-
|
572
|
-
// merge options into a template data object
|
573
|
-
for (var object, index = 0; object = arguments[index]; index++) {
|
574
|
-
for (var key in object) {
|
575
|
-
data[key] = object[key];
|
576
|
-
}
|
577
|
-
}
|
578
|
-
var args = data.args;
|
579
|
-
data.firstArg = /^[^,]+/.exec(args)[0];
|
580
|
-
|
581
|
-
// create the function factory
|
582
|
-
var factory = Function(
|
583
|
-
'hasOwnProperty, isArguments, isArray, isString, keys, ' +
|
584
|
-
'lodash, objectTypes',
|
585
|
-
'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
|
586
|
-
);
|
587
|
-
// return the compiled function
|
588
|
-
return factory(
|
589
|
-
hasOwnProperty, isArguments, isArray, isString, keys,
|
590
|
-
lodash, objectTypes
|
591
|
-
);
|
592
|
-
}
|
593
|
-
|
594
484
|
/**
|
595
485
|
* Used by `template` to escape characters for inclusion in compiled
|
596
486
|
* string literals.
|
@@ -637,7 +527,7 @@
|
|
637
527
|
}
|
638
528
|
|
639
529
|
/**
|
640
|
-
* A fallback implementation of `isPlainObject`
|
530
|
+
* A fallback implementation of `isPlainObject` which checks if a given `value`
|
641
531
|
* is an object created by the `Object` constructor, assuming objects created
|
642
532
|
* by the `Object` constructor have no inherited enumerable properties and that
|
643
533
|
* there are no `Object.prototype` extensions.
|
@@ -729,29 +619,7 @@
|
|
729
619
|
}
|
730
620
|
|
731
621
|
/**
|
732
|
-
*
|
733
|
-
*
|
734
|
-
* @static
|
735
|
-
* @memberOf _
|
736
|
-
* @category Objects
|
737
|
-
* @param {Mixed} value The value to check.
|
738
|
-
* @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
|
739
|
-
* @example
|
740
|
-
*
|
741
|
-
* (function() { return _.isArray(arguments); })();
|
742
|
-
* // => false
|
743
|
-
*
|
744
|
-
* _.isArray([1, 2, 3]);
|
745
|
-
* // => true
|
746
|
-
*/
|
747
|
-
var isArray = nativeIsArray || function(value) {
|
748
|
-
// `instanceof` may cause a memory leak in IE 7 if `value` is a host object
|
749
|
-
// http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak
|
750
|
-
return value instanceof Array || toString.call(value) == arrayClass;
|
751
|
-
};
|
752
|
-
|
753
|
-
/**
|
754
|
-
* A fallback implementation of `Object.keys` that produces an array of the
|
622
|
+
* A fallback implementation of `Object.keys` which produces an array of the
|
755
623
|
* given object's own enumerable property names.
|
756
624
|
*
|
757
625
|
* @private
|
@@ -759,13 +627,18 @@
|
|
759
627
|
* @param {Object} object The object to inspect.
|
760
628
|
* @returns {Array} Returns a new array of property names.
|
761
629
|
*/
|
762
|
-
var shimKeys =
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
630
|
+
var shimKeys = function (object) {
|
631
|
+
var index, iterable = object, result = [];
|
632
|
+
if (!iterable) return result;
|
633
|
+
if (!(objectTypes[typeof object])) return result;
|
634
|
+
|
635
|
+
for (index in iterable) {
|
636
|
+
if (hasOwnProperty.call(iterable, index)) {
|
637
|
+
result.push(index);
|
638
|
+
}
|
639
|
+
}
|
640
|
+
return result
|
641
|
+
};
|
769
642
|
|
770
643
|
/**
|
771
644
|
* Creates an array composed of the own enumerable property names of `object`.
|
@@ -838,18 +711,40 @@
|
|
838
711
|
* defaults(food, { 'name': 'banana', 'type': 'fruit' });
|
839
712
|
* // => { 'name': 'apple', 'type': 'fruit' }
|
840
713
|
*/
|
841
|
-
var assign =
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
714
|
+
var assign = function (object, source, guard) {
|
715
|
+
var index, iterable = object, result = iterable;
|
716
|
+
if (!iterable) return result;
|
717
|
+
var args = arguments,
|
718
|
+
argsIndex = 0,
|
719
|
+
argsLength = typeof guard == 'number' ? 2 : args.length;
|
720
|
+
if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {
|
721
|
+
var callback = lodash.createCallback(args[--argsLength - 1], args[argsLength--], 2);
|
722
|
+
} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {
|
723
|
+
callback = args[--argsLength];
|
724
|
+
}
|
725
|
+
while (++argsIndex < argsLength) {
|
726
|
+
iterable = args[argsIndex];
|
727
|
+
if (iterable && objectTypes[typeof iterable]) {;
|
728
|
+
var length = iterable.length; index = -1;
|
729
|
+
if (isArray(iterable)) {
|
730
|
+
while (++index < length) {
|
731
|
+
result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]
|
732
|
+
}
|
733
|
+
}
|
734
|
+
else {
|
735
|
+
var ownIndex = -1,
|
736
|
+
ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
|
737
|
+
length = ownProps.length;
|
738
|
+
|
739
|
+
while (++ownIndex < length) {
|
740
|
+
index = ownProps[ownIndex];
|
741
|
+
result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]
|
742
|
+
}
|
743
|
+
}
|
744
|
+
}
|
745
|
+
};
|
746
|
+
return result
|
747
|
+
};
|
853
748
|
|
854
749
|
/**
|
855
750
|
* Creates a clone of `value`. If `deep` is `true`, nested objects will also
|
@@ -1042,7 +937,35 @@
|
|
1042
937
|
* _.defaults(food, { 'name': 'banana', 'type': 'fruit' });
|
1043
938
|
* // => { 'name': 'apple', 'type': 'fruit' }
|
1044
939
|
*/
|
1045
|
-
var defaults =
|
940
|
+
var defaults = function (object, source, guard) {
|
941
|
+
var index, iterable = object, result = iterable;
|
942
|
+
if (!iterable) return result;
|
943
|
+
var args = arguments,
|
944
|
+
argsIndex = 0,
|
945
|
+
argsLength = typeof guard == 'number' ? 2 : args.length;
|
946
|
+
while (++argsIndex < argsLength) {
|
947
|
+
iterable = args[argsIndex];
|
948
|
+
if (iterable && objectTypes[typeof iterable]) {;
|
949
|
+
var length = iterable.length; index = -1;
|
950
|
+
if (isArray(iterable)) {
|
951
|
+
while (++index < length) {
|
952
|
+
if (typeof result[index] == 'undefined') result[index] = iterable[index]
|
953
|
+
}
|
954
|
+
}
|
955
|
+
else {
|
956
|
+
var ownIndex = -1,
|
957
|
+
ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
|
958
|
+
length = ownProps.length;
|
959
|
+
|
960
|
+
while (++ownIndex < length) {
|
961
|
+
index = ownProps[ownIndex];
|
962
|
+
if (typeof result[index] == 'undefined') result[index] = iterable[index]
|
963
|
+
}
|
964
|
+
}
|
965
|
+
}
|
966
|
+
};
|
967
|
+
return result
|
968
|
+
};
|
1046
969
|
|
1047
970
|
/**
|
1048
971
|
* This method is similar to `_.find`, except that it returns the key of the
|
@@ -1051,7 +974,7 @@
|
|
1051
974
|
* @static
|
1052
975
|
* @memberOf _
|
1053
976
|
* @category Objects
|
1054
|
-
* @param {
|
977
|
+
* @param {Object} object The object to search.
|
1055
978
|
* @param {Function|Object|String} [callback=identity] The function called per
|
1056
979
|
* iteration. If a property name or object is passed, it will be used to create
|
1057
980
|
* a "_.pluck" or "_.where" style callback, respectively.
|
@@ -1059,14 +982,16 @@
|
|
1059
982
|
* @returns {Mixed} Returns the key of the found element, else `undefined`.
|
1060
983
|
* @example
|
1061
984
|
*
|
1062
|
-
* _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
|
985
|
+
* _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
|
986
|
+
* return num % 2 == 0;
|
987
|
+
* });
|
1063
988
|
* // => 'b'
|
1064
989
|
*/
|
1065
|
-
function findKey(
|
990
|
+
function findKey(object, callback, thisArg) {
|
1066
991
|
var result;
|
1067
992
|
callback = lodash.createCallback(callback, thisArg);
|
1068
|
-
forOwn(
|
1069
|
-
if (callback(value, key,
|
993
|
+
forOwn(object, function(value, key, object) {
|
994
|
+
if (callback(value, key, object)) {
|
1070
995
|
result = key;
|
1071
996
|
return false;
|
1072
997
|
}
|
@@ -1103,9 +1028,17 @@
|
|
1103
1028
|
* });
|
1104
1029
|
* // => alerts 'name' and 'bark' (order is not guaranteed)
|
1105
1030
|
*/
|
1106
|
-
var forIn =
|
1107
|
-
|
1108
|
-
|
1031
|
+
var forIn = function (collection, callback, thisArg) {
|
1032
|
+
var index, iterable = collection, result = iterable;
|
1033
|
+
if (!iterable) return result;
|
1034
|
+
if (!objectTypes[typeof iterable]) return result;
|
1035
|
+
callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
|
1036
|
+
|
1037
|
+
for (index in iterable) {
|
1038
|
+
if (callback(iterable[index], index, collection) === false) return result;
|
1039
|
+
}
|
1040
|
+
return result
|
1041
|
+
};
|
1109
1042
|
|
1110
1043
|
/**
|
1111
1044
|
* Iterates over an object's own enumerable properties, executing the `callback`
|
@@ -1128,7 +1061,22 @@
|
|
1128
1061
|
* });
|
1129
1062
|
* // => alerts '0', '1', and 'length' (order is not guaranteed)
|
1130
1063
|
*/
|
1131
|
-
var forOwn =
|
1064
|
+
var forOwn = function (collection, callback, thisArg) {
|
1065
|
+
var index, iterable = collection, result = iterable;
|
1066
|
+
if (!iterable) return result;
|
1067
|
+
if (!objectTypes[typeof iterable]) return result;
|
1068
|
+
callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
|
1069
|
+
|
1070
|
+
var ownIndex = -1,
|
1071
|
+
ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],
|
1072
|
+
length = ownProps.length;
|
1073
|
+
|
1074
|
+
while (++ownIndex < length) {
|
1075
|
+
index = ownProps[ownIndex];
|
1076
|
+
if (callback(iterable[index], index, collection) === false) return result
|
1077
|
+
}
|
1078
|
+
return result
|
1079
|
+
};
|
1132
1080
|
|
1133
1081
|
/**
|
1134
1082
|
* Creates a sorted array of all enumerable properties, own and inherited,
|
@@ -1200,6 +1148,28 @@
|
|
1200
1148
|
return result;
|
1201
1149
|
}
|
1202
1150
|
|
1151
|
+
/**
|
1152
|
+
* Checks if `value` is an array.
|
1153
|
+
*
|
1154
|
+
* @static
|
1155
|
+
* @memberOf _
|
1156
|
+
* @category Objects
|
1157
|
+
* @param {Mixed} value The value to check.
|
1158
|
+
* @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
|
1159
|
+
* @example
|
1160
|
+
*
|
1161
|
+
* (function() { return _.isArray(arguments); })();
|
1162
|
+
* // => false
|
1163
|
+
*
|
1164
|
+
* _.isArray([1, 2, 3]);
|
1165
|
+
* // => true
|
1166
|
+
*/
|
1167
|
+
function isArray(value) {
|
1168
|
+
// `instanceof` may cause a memory leak in IE 7 if `value` is a host object
|
1169
|
+
// http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak
|
1170
|
+
return value instanceof Array || nativeIsArray(value);
|
1171
|
+
}
|
1172
|
+
|
1203
1173
|
/**
|
1204
1174
|
* Checks if `value` is a boolean value.
|
1205
1175
|
*
|
@@ -1333,11 +1303,8 @@
|
|
1333
1303
|
function isEqual(a, b, callback, thisArg, stackA, stackB) {
|
1334
1304
|
// used to indicate that when comparing objects, `a` has at least the properties of `b`
|
1335
1305
|
var whereIndicator = callback === indicatorObject;
|
1336
|
-
if (callback && !whereIndicator) {
|
1337
|
-
callback = (
|
1338
|
-
? callback
|
1339
|
-
: lodash.createCallback(callback, thisArg, 2);
|
1340
|
-
|
1306
|
+
if (typeof callback == 'function' && !whereIndicator) {
|
1307
|
+
callback = lodash.createCallback(callback, thisArg, 2);
|
1341
1308
|
var result = callback(a, b);
|
1342
1309
|
if (typeof result != 'undefined') {
|
1343
1310
|
return !!result;
|
@@ -1817,22 +1784,24 @@
|
|
1817
1784
|
}
|
1818
1785
|
}
|
1819
1786
|
if (!found) {
|
1820
|
-
|
1821
|
-
? (isArray(value) ? value : [])
|
1822
|
-
: (isPlainObject(value) ? value : {});
|
1823
|
-
|
1787
|
+
var isShallow;
|
1824
1788
|
if (callback) {
|
1825
1789
|
result = callback(value, source);
|
1826
|
-
if (typeof result != 'undefined') {
|
1790
|
+
if ((isShallow = typeof result != 'undefined')) {
|
1827
1791
|
value = result;
|
1828
1792
|
}
|
1829
1793
|
}
|
1794
|
+
if (!isShallow) {
|
1795
|
+
value = isArr
|
1796
|
+
? (isArray(value) ? value : [])
|
1797
|
+
: (isPlainObject(value) ? value : {});
|
1798
|
+
}
|
1830
1799
|
// add `source` and associated `value` to the stack of traversed objects
|
1831
1800
|
stackA.push(source);
|
1832
1801
|
stackB.push(value);
|
1833
1802
|
|
1834
1803
|
// recursively merge objects and arrays (susceptible to call stack limits)
|
1835
|
-
if (!
|
1804
|
+
if (!isShallow) {
|
1836
1805
|
value = merge(value, source, indicatorObject, callback, stackA, stackB);
|
1837
1806
|
}
|
1838
1807
|
}
|
@@ -1887,12 +1856,12 @@
|
|
1887
1856
|
if (isFunc) {
|
1888
1857
|
callback = lodash.createCallback(callback, thisArg);
|
1889
1858
|
} else {
|
1890
|
-
var props = concat.apply(arrayRef, arguments);
|
1859
|
+
var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1));
|
1891
1860
|
}
|
1892
1861
|
forIn(object, function(value, key, object) {
|
1893
1862
|
if (isFunc
|
1894
1863
|
? !callback(value, key, object)
|
1895
|
-
: indexOf(props, key
|
1864
|
+
: indexOf(props, key) < 0
|
1896
1865
|
) {
|
1897
1866
|
result[key] = value;
|
1898
1867
|
}
|
@@ -1955,8 +1924,8 @@
|
|
1955
1924
|
function pick(object, callback, thisArg) {
|
1956
1925
|
var result = {};
|
1957
1926
|
if (typeof callback != 'function') {
|
1958
|
-
var index =
|
1959
|
-
props = concat.apply(arrayRef, arguments),
|
1927
|
+
var index = -1,
|
1928
|
+
props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
|
1960
1929
|
length = isObject(object) ? props.length : 0;
|
1961
1930
|
|
1962
1931
|
while (++index < length) {
|
@@ -2026,7 +1995,7 @@
|
|
2026
1995
|
*/
|
2027
1996
|
function at(collection) {
|
2028
1997
|
var index = -1,
|
2029
|
-
props = concat.apply(arrayRef,
|
1998
|
+
props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
|
2030
1999
|
length = props.length,
|
2031
2000
|
result = Array(length);
|
2032
2001
|
|
@@ -2278,7 +2247,9 @@
|
|
2278
2247
|
* @returns {Mixed} Returns the found element, else `undefined`.
|
2279
2248
|
* @example
|
2280
2249
|
*
|
2281
|
-
* _.find([1, 2, 3, 4], function(num) {
|
2250
|
+
* _.find([1, 2, 3, 4], function(num) {
|
2251
|
+
* return num % 2 == 0;
|
2252
|
+
* });
|
2282
2253
|
* // => 2
|
2283
2254
|
*
|
2284
2255
|
* var food = [
|
@@ -2427,7 +2398,7 @@
|
|
2427
2398
|
* // => [['1', '2', '3'], ['4', '5', '6']]
|
2428
2399
|
*/
|
2429
2400
|
function invoke(collection, methodName) {
|
2430
|
-
var args =
|
2401
|
+
var args = nativeSlice.call(arguments, 2),
|
2431
2402
|
index = -1,
|
2432
2403
|
isFunc = typeof methodName == 'function',
|
2433
2404
|
length = collection ? collection.length : 0,
|
@@ -2669,7 +2640,7 @@
|
|
2669
2640
|
}
|
2670
2641
|
|
2671
2642
|
/**
|
2672
|
-
* Reduces a `collection` to a value
|
2643
|
+
* Reduces a `collection` to a value which is the accumulated result of running
|
2673
2644
|
* each element in the `collection` through the `callback`, where each successive
|
2674
2645
|
* `callback` execution consumes the return value of the previous execution.
|
2675
2646
|
* If `accumulator` is not passed, the first element of the `collection` will be
|
@@ -3073,8 +3044,8 @@
|
|
3073
3044
|
function difference(array) {
|
3074
3045
|
var index = -1,
|
3075
3046
|
length = array ? array.length : 0,
|
3076
|
-
flattened = concat.apply(arrayRef, arguments),
|
3077
|
-
contains = cachedContains(flattened
|
3047
|
+
flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),
|
3048
|
+
contains = cachedContains(flattened),
|
3078
3049
|
result = [];
|
3079
3050
|
|
3080
3051
|
while (++index < length) {
|
@@ -3093,7 +3064,7 @@
|
|
3093
3064
|
* @static
|
3094
3065
|
* @memberOf _
|
3095
3066
|
* @category Arrays
|
3096
|
-
* @param {Array
|
3067
|
+
* @param {Array} array The array to search.
|
3097
3068
|
* @param {Function|Object|String} [callback=identity] The function called per
|
3098
3069
|
* iteration. If a property name or object is passed, it will be used to create
|
3099
3070
|
* a "_.pluck" or "_.where" style callback, respectively.
|
@@ -3101,16 +3072,18 @@
|
|
3101
3072
|
* @returns {Mixed} Returns the index of the found element, else `-1`.
|
3102
3073
|
* @example
|
3103
3074
|
*
|
3104
|
-
* _.findIndex(['apple', 'banana', 'beet'], function(food) {
|
3075
|
+
* _.findIndex(['apple', 'banana', 'beet'], function(food) {
|
3076
|
+
* return /^b/.test(food);
|
3077
|
+
* });
|
3105
3078
|
* // => 1
|
3106
3079
|
*/
|
3107
|
-
function findIndex(
|
3080
|
+
function findIndex(array, callback, thisArg) {
|
3108
3081
|
var index = -1,
|
3109
|
-
length =
|
3082
|
+
length = array ? array.length : 0;
|
3110
3083
|
|
3111
3084
|
callback = lodash.createCallback(callback, thisArg);
|
3112
3085
|
while (++index < length) {
|
3113
|
-
if (callback(
|
3086
|
+
if (callback(array[index], index, array)) {
|
3114
3087
|
return index;
|
3115
3088
|
}
|
3116
3089
|
}
|
@@ -3212,7 +3185,7 @@
|
|
3212
3185
|
* @static
|
3213
3186
|
* @memberOf _
|
3214
3187
|
* @category Arrays
|
3215
|
-
* @param {Array} array The array to
|
3188
|
+
* @param {Array} array The array to flatten.
|
3216
3189
|
* @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level.
|
3217
3190
|
* @param {Function|Object|String} [callback=identity] The function called per
|
3218
3191
|
* iteration. If a property name or object is passed, it will be used to create
|
@@ -3403,7 +3376,7 @@
|
|
3403
3376
|
cache = { '0': {} },
|
3404
3377
|
index = -1,
|
3405
3378
|
length = array ? array.length : 0,
|
3406
|
-
isLarge = length >=
|
3379
|
+
isLarge = length >= largeArraySize,
|
3407
3380
|
result = [],
|
3408
3381
|
seen = result;
|
3409
3382
|
|
@@ -3411,8 +3384,8 @@
|
|
3411
3384
|
while (++index < length) {
|
3412
3385
|
var value = array[index];
|
3413
3386
|
if (isLarge) {
|
3414
|
-
var key =
|
3415
|
-
var inited =
|
3387
|
+
var key = keyPrefix + value;
|
3388
|
+
var inited = cache[0][key]
|
3416
3389
|
? !(seen = cache[0][key])
|
3417
3390
|
: (seen = cache[0][key] = []);
|
3418
3391
|
}
|
@@ -3422,7 +3395,7 @@
|
|
3422
3395
|
}
|
3423
3396
|
var argsIndex = argsLength;
|
3424
3397
|
while (--argsIndex) {
|
3425
|
-
if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex]
|
3398
|
+
if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) {
|
3426
3399
|
continue outer;
|
3427
3400
|
}
|
3428
3401
|
}
|
@@ -3683,7 +3656,7 @@
|
|
3683
3656
|
* @static
|
3684
3657
|
* @memberOf _
|
3685
3658
|
* @category Arrays
|
3686
|
-
* @param {Array} array The array to
|
3659
|
+
* @param {Array} array The array to inspect.
|
3687
3660
|
* @param {Mixed} value The value to evaluate.
|
3688
3661
|
* @param {Function|Object|String} [callback=identity] The function called per
|
3689
3662
|
* iteration. If a property name or object is passed, it will be used to create
|
@@ -3746,7 +3719,10 @@
|
|
3746
3719
|
* _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
3747
3720
|
* // => [1, 2, 3, 101, 10]
|
3748
3721
|
*/
|
3749
|
-
function union() {
|
3722
|
+
function union(array) {
|
3723
|
+
if (!isArray(array)) {
|
3724
|
+
arguments[0] = array ? nativeSlice.call(array) : arrayRef;
|
3725
|
+
}
|
3750
3726
|
return uniq(concat.apply(arrayRef, arguments));
|
3751
3727
|
}
|
3752
3728
|
|
@@ -3806,7 +3782,7 @@
|
|
3806
3782
|
isSorted = false;
|
3807
3783
|
}
|
3808
3784
|
// init value cache for large arrays
|
3809
|
-
var isLarge = !isSorted && length >=
|
3785
|
+
var isLarge = !isSorted && length >= largeArraySize;
|
3810
3786
|
if (isLarge) {
|
3811
3787
|
var cache = {};
|
3812
3788
|
}
|
@@ -3819,8 +3795,8 @@
|
|
3819
3795
|
computed = callback ? callback(value, index, array) : value;
|
3820
3796
|
|
3821
3797
|
if (isLarge) {
|
3822
|
-
var key =
|
3823
|
-
var inited =
|
3798
|
+
var key = keyPrefix + computed;
|
3799
|
+
var inited = cache[key]
|
3824
3800
|
? !(seen = cache[key])
|
3825
3801
|
: (seen = cache[key] = []);
|
3826
3802
|
}
|
@@ -3837,6 +3813,37 @@
|
|
3837
3813
|
return result;
|
3838
3814
|
}
|
3839
3815
|
|
3816
|
+
/**
|
3817
|
+
* The inverse of `_.zip`, this method splits groups of elements into arrays
|
3818
|
+
* composed of elements from each group at their corresponding indexes.
|
3819
|
+
*
|
3820
|
+
* @static
|
3821
|
+
* @memberOf _
|
3822
|
+
* @category Arrays
|
3823
|
+
* @param {Array} array The array to process.
|
3824
|
+
* @returns {Array} Returns a new array of the composed arrays.
|
3825
|
+
* @example
|
3826
|
+
*
|
3827
|
+
* _.unzip([['moe', 30, true], ['larry', 40, false]]);
|
3828
|
+
* // => [['moe', 'larry'], [30, 40], [true, false]];
|
3829
|
+
*/
|
3830
|
+
function unzip(array) {
|
3831
|
+
var index = -1,
|
3832
|
+
length = array ? array.length : 0,
|
3833
|
+
tupleLength = length ? max(pluck(array, 'length')) : 0,
|
3834
|
+
result = Array(tupleLength);
|
3835
|
+
|
3836
|
+
while (++index < length) {
|
3837
|
+
var tupleIndex = -1,
|
3838
|
+
tuple = array[index];
|
3839
|
+
|
3840
|
+
while (++tupleIndex < tupleLength) {
|
3841
|
+
(result[tupleIndex] || (result[tupleIndex] = Array(length)))[index] = tuple[tupleIndex];
|
3842
|
+
}
|
3843
|
+
}
|
3844
|
+
return result;
|
3845
|
+
}
|
3846
|
+
|
3840
3847
|
/**
|
3841
3848
|
* Creates an array with all occurrences of the passed values removed using
|
3842
3849
|
* strict equality for comparisons, i.e. `===`.
|
@@ -3853,18 +3860,7 @@
|
|
3853
3860
|
* // => [2, 3, 4]
|
3854
3861
|
*/
|
3855
3862
|
function without(array) {
|
3856
|
-
|
3857
|
-
length = array ? array.length : 0,
|
3858
|
-
contains = cachedContains(arguments, 1, 30),
|
3859
|
-
result = [];
|
3860
|
-
|
3861
|
-
while (++index < length) {
|
3862
|
-
var value = array[index];
|
3863
|
-
if (!contains(value)) {
|
3864
|
-
result.push(value);
|
3865
|
-
}
|
3866
|
-
}
|
3867
|
-
return result;
|
3863
|
+
return difference(array, nativeSlice.call(arguments, 1));
|
3868
3864
|
}
|
3869
3865
|
|
3870
3866
|
/**
|
@@ -3990,7 +3986,7 @@
|
|
3990
3986
|
// (in V8 `Function#bind` is slower except when partially applied)
|
3991
3987
|
return support.fastBind || (nativeBind && arguments.length > 2)
|
3992
3988
|
? nativeBind.call.apply(nativeBind, arguments)
|
3993
|
-
: createBound(func, thisArg,
|
3989
|
+
: createBound(func, thisArg, nativeSlice.call(arguments, 2));
|
3994
3990
|
}
|
3995
3991
|
|
3996
3992
|
/**
|
@@ -4017,8 +4013,8 @@
|
|
4017
4013
|
* // => alerts 'clicked docs', when the button is clicked
|
4018
4014
|
*/
|
4019
4015
|
function bindAll(object) {
|
4020
|
-
var funcs = concat.apply(arrayRef, arguments),
|
4021
|
-
index =
|
4016
|
+
var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object),
|
4017
|
+
index = -1,
|
4022
4018
|
length = funcs.length;
|
4023
4019
|
|
4024
4020
|
while (++index < length) {
|
@@ -4063,7 +4059,7 @@
|
|
4063
4059
|
* // => 'hi, moe!'
|
4064
4060
|
*/
|
4065
4061
|
function bindKey(object, key) {
|
4066
|
-
return createBound(object, key,
|
4062
|
+
return createBound(object, key, nativeSlice.call(arguments, 2), indicatorObject);
|
4067
4063
|
}
|
4068
4064
|
|
4069
4065
|
/**
|
@@ -4193,44 +4189,53 @@
|
|
4193
4189
|
/**
|
4194
4190
|
* Creates a function that will delay the execution of `func` until after
|
4195
4191
|
* `wait` milliseconds have elapsed since the last time it was invoked. Pass
|
4196
|
-
* `
|
4197
|
-
*
|
4198
|
-
*
|
4192
|
+
* an `options` object to indicate that `func` should be invoked on the leading
|
4193
|
+
* and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced
|
4194
|
+
* function will return the result of the last `func` call.
|
4199
4195
|
*
|
4200
4196
|
* @static
|
4201
4197
|
* @memberOf _
|
4202
4198
|
* @category Functions
|
4203
4199
|
* @param {Function} func The function to debounce.
|
4204
4200
|
* @param {Number} wait The number of milliseconds to delay.
|
4205
|
-
* @param {
|
4206
|
-
* edge of the timeout.
|
4201
|
+
* @param {Object} options The options object.
|
4202
|
+
* [leading=false] A boolean to specify execution on the leading edge of the timeout.
|
4203
|
+
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
|
4207
4204
|
* @returns {Function} Returns the new debounced function.
|
4208
4205
|
* @example
|
4209
4206
|
*
|
4210
4207
|
* var lazyLayout = _.debounce(calculateLayout, 300);
|
4211
4208
|
* jQuery(window).on('resize', lazyLayout);
|
4212
4209
|
*/
|
4213
|
-
function debounce(func, wait,
|
4210
|
+
function debounce(func, wait, options) {
|
4214
4211
|
var args,
|
4215
4212
|
result,
|
4216
4213
|
thisArg,
|
4217
|
-
timeoutId
|
4214
|
+
timeoutId,
|
4215
|
+
trailing = true;
|
4218
4216
|
|
4219
4217
|
function delayed() {
|
4220
4218
|
timeoutId = null;
|
4221
|
-
if (
|
4219
|
+
if (trailing) {
|
4222
4220
|
result = func.apply(thisArg, args);
|
4223
4221
|
}
|
4224
4222
|
}
|
4223
|
+
if (options === true) {
|
4224
|
+
var leading = true;
|
4225
|
+
trailing = false;
|
4226
|
+
} else if (options && objectTypes[typeof options]) {
|
4227
|
+
leading = options.leading;
|
4228
|
+
trailing = 'trailing' in options ? options.trailing : trailing;
|
4229
|
+
}
|
4225
4230
|
return function() {
|
4226
|
-
var
|
4231
|
+
var isLeading = leading && !timeoutId;
|
4227
4232
|
args = arguments;
|
4228
4233
|
thisArg = this;
|
4229
4234
|
|
4230
4235
|
clearTimeout(timeoutId);
|
4231
4236
|
timeoutId = setTimeout(delayed, wait);
|
4232
4237
|
|
4233
|
-
if (
|
4238
|
+
if (isLeading) {
|
4234
4239
|
result = func.apply(thisArg, args);
|
4235
4240
|
}
|
4236
4241
|
return result;
|
@@ -4253,7 +4258,7 @@
|
|
4253
4258
|
* // returns from the function before `alert` is called
|
4254
4259
|
*/
|
4255
4260
|
function defer(func) {
|
4256
|
-
var args =
|
4261
|
+
var args = nativeSlice.call(arguments, 1);
|
4257
4262
|
return setTimeout(function() { func.apply(undefined, args); }, 1);
|
4258
4263
|
}
|
4259
4264
|
// use `setImmediate` if it's available in Node.js
|
@@ -4279,7 +4284,7 @@
|
|
4279
4284
|
* // => 'logged later' (Appears after one second.)
|
4280
4285
|
*/
|
4281
4286
|
function delay(func, wait) {
|
4282
|
-
var args =
|
4287
|
+
var args = nativeSlice.call(arguments, 2);
|
4283
4288
|
return setTimeout(function() { func.apply(undefined, args); }, wait);
|
4284
4289
|
}
|
4285
4290
|
|
@@ -4305,7 +4310,7 @@
|
|
4305
4310
|
function memoize(func, resolver) {
|
4306
4311
|
var cache = {};
|
4307
4312
|
return function() {
|
4308
|
-
var key =
|
4313
|
+
var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
|
4309
4314
|
return hasOwnProperty.call(cache, key)
|
4310
4315
|
? cache[key]
|
4311
4316
|
: (cache[key] = func.apply(this, arguments));
|
@@ -4365,7 +4370,7 @@
|
|
4365
4370
|
* // => 'hi moe'
|
4366
4371
|
*/
|
4367
4372
|
function partial(func) {
|
4368
|
-
return createBound(func,
|
4373
|
+
return createBound(func, nativeSlice.call(arguments, 1));
|
4369
4374
|
}
|
4370
4375
|
|
4371
4376
|
/**
|
@@ -4396,43 +4401,61 @@
|
|
4396
4401
|
* // => { '_': _, 'jq': $ }
|
4397
4402
|
*/
|
4398
4403
|
function partialRight(func) {
|
4399
|
-
return createBound(func,
|
4404
|
+
return createBound(func, nativeSlice.call(arguments, 1), null, indicatorObject);
|
4400
4405
|
}
|
4401
4406
|
|
4402
4407
|
/**
|
4403
|
-
* Creates a function that, when executed, will only call the `func`
|
4404
|
-
*
|
4405
|
-
*
|
4406
|
-
*
|
4407
|
-
*
|
4408
|
+
* Creates a function that, when executed, will only call the `func` function
|
4409
|
+
* at most once per every `wait` milliseconds. If the throttled function is
|
4410
|
+
* invoked more than once during the `wait` timeout, `func` will also be called
|
4411
|
+
* on the trailing edge of the timeout. Pass an `options` object to indicate
|
4412
|
+
* that `func` should be invoked on the leading and/or trailing edge of the
|
4413
|
+
* `wait` timeout. Subsequent calls to the throttled function will return
|
4414
|
+
* the result of the last `func` call.
|
4408
4415
|
*
|
4409
4416
|
* @static
|
4410
4417
|
* @memberOf _
|
4411
4418
|
* @category Functions
|
4412
4419
|
* @param {Function} func The function to throttle.
|
4413
4420
|
* @param {Number} wait The number of milliseconds to throttle executions to.
|
4421
|
+
* @param {Object} options The options object.
|
4422
|
+
* [leading=true] A boolean to specify execution on the leading edge of the timeout.
|
4423
|
+
* [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
|
4414
4424
|
* @returns {Function} Returns the new throttled function.
|
4415
4425
|
* @example
|
4416
4426
|
*
|
4417
4427
|
* var throttled = _.throttle(updatePosition, 100);
|
4418
4428
|
* jQuery(window).on('scroll', throttled);
|
4419
4429
|
*/
|
4420
|
-
function throttle(func, wait) {
|
4430
|
+
function throttle(func, wait, options) {
|
4421
4431
|
var args,
|
4422
4432
|
result,
|
4423
4433
|
thisArg,
|
4424
4434
|
timeoutId,
|
4425
|
-
lastCalled = 0
|
4435
|
+
lastCalled = 0,
|
4436
|
+
leading = true,
|
4437
|
+
trailing = true;
|
4426
4438
|
|
4427
4439
|
function trailingCall() {
|
4428
4440
|
lastCalled = new Date;
|
4429
4441
|
timeoutId = null;
|
4430
|
-
|
4442
|
+
|
4443
|
+
if (trailing) {
|
4444
|
+
result = func.apply(thisArg, args);
|
4445
|
+
}
|
4446
|
+
}
|
4447
|
+
if (options === false) {
|
4448
|
+
leading = false;
|
4449
|
+
} else if (options && objectTypes[typeof options]) {
|
4450
|
+
leading = 'leading' in options ? options.leading : leading;
|
4451
|
+
trailing = 'trailing' in options ? options.trailing : trailing;
|
4431
4452
|
}
|
4432
4453
|
return function() {
|
4433
|
-
var now = new Date
|
4434
|
-
|
4435
|
-
|
4454
|
+
var now = new Date;
|
4455
|
+
if (!timeoutId && !leading) {
|
4456
|
+
lastCalled = now;
|
4457
|
+
}
|
4458
|
+
var remaining = wait - (now - lastCalled);
|
4436
4459
|
args = arguments;
|
4437
4460
|
thisArg = this;
|
4438
4461
|
|
@@ -4662,9 +4685,6 @@
|
|
4662
4685
|
* Note: In the development build, `_.template` utilizes sourceURLs for easier
|
4663
4686
|
* debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
|
4664
4687
|
*
|
4665
|
-
* Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp`
|
4666
|
-
* build and using precompiled templates, or loading Lo-Dash in a sandbox.
|
4667
|
-
*
|
4668
4688
|
* For more information on precompiling templates see:
|
4669
4689
|
* http://lodash.com/#custom-builds
|
4670
4690
|
*
|
@@ -4675,7 +4695,7 @@
|
|
4675
4695
|
* @memberOf _
|
4676
4696
|
* @category Utilities
|
4677
4697
|
* @param {String} text The template text.
|
4678
|
-
* @param {
|
4698
|
+
* @param {Object} data The data object used to populate the text.
|
4679
4699
|
* @param {Object} options The options object.
|
4680
4700
|
* escape - The "escape" delimiter regexp.
|
4681
4701
|
* evaluate - The "evaluate" delimiter regexp.
|
@@ -4875,7 +4895,7 @@
|
|
4875
4895
|
}
|
4876
4896
|
|
4877
4897
|
/**
|
4878
|
-
* The
|
4898
|
+
* The inverse of `_.escape`, this method converts the HTML entities
|
4879
4899
|
* `&`, `<`, `>`, `"`, and `'` in `string` to their
|
4880
4900
|
* corresponding characters.
|
4881
4901
|
*
|
@@ -5028,6 +5048,7 @@
|
|
5028
5048
|
lodash.toArray = toArray;
|
5029
5049
|
lodash.union = union;
|
5030
5050
|
lodash.uniq = uniq;
|
5051
|
+
lodash.unzip = unzip;
|
5031
5052
|
lodash.values = values;
|
5032
5053
|
lodash.where = where;
|
5033
5054
|
lodash.without = without;
|
@@ -5145,7 +5166,7 @@
|
|
5145
5166
|
* @memberOf _
|
5146
5167
|
* @type String
|
5147
5168
|
*/
|
5148
|
-
lodash.VERSION = '1.
|
5169
|
+
lodash.VERSION = '1.2.0';
|
5149
5170
|
|
5150
5171
|
// add "Chaining" functions to the wrapper
|
5151
5172
|
lodash.prototype.toString = wrapperToString;
|