Files
lodash/lodash.min.js
John-David Dalton acb6656958 Update minified build and documentation.
Former-commit-id: 19462dc946eca093f4265620b8e063b8c162c27d
2012-07-08 03:40:51 -04:00

35 lines
15 KiB
JavaScript

/*!
Lo-Dash 0.3.2 lodash.com/license
Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE
*/
;(function(e,t){"use strict";function s(e){return new o(e)}function o(e){if(e&&e._wrapped)return e;this._wrapped=e}function u(){for(var e,t,n,s=-1,o=arguments.length,u={e:"",f:"",k:"",r:"",c:{d:"",n:"++l<o"},p:{d:""}};++s<o;)for(t in e=arguments[s],e)n=(n=e[t])==r?"":n,/d|n|j/.test(t)?("string"==typeof n&&(n={b:n,o:n}),u.c[t]=n.b,u.p[t]=n.o):u[t]=n;e=u.a,t=u.c,n=u.p;var s=/^[^,]+/.exec(e)[0],o=n.n,f=/\S+$/.exec(o||s)[0];u.g=s,u.i=yt,u.h="j.call("+f+",l)",u.l=wt,u.m=f,u.q=Q,u.s=u.s!==i,u.f||(u.f="if(!"+
s+")return z");if("s"==s||!t.j)u.c=r;o||(n.n="l in "+f),t="var l,z",u.k&&(t+="="+u.k),t+=";"+u.f+";"+u.r+";",u.c&&(t+="var o="+u.g+".length;l=-1;",u.p&&(t+="if(o===o>>>0){"),t+=u.c.d+";while("+u.c.n+"){"+u.c.j+"}",u.p&&(t+="}"));if(u.p){u.c&&(t+="else{"),u.i||(t+="var A=typeof "+u.m+"=='function'&&y.call("+u.m+",'prototype');"),t+=u.p.d+";",u.l&&u.s?t+="var w=q("+u.m+"),v=-1,o=w.length;while(++v<o){l=w[v];if(!(A&&l=='prototype')){"+u.p.j+"}}":(t+="for("+u.p.n+"){",u.i?(u.s&&(t+="if("+u.h+"){"),t+=
u.p.j+";",u.s&&(t+="}")):(t+="if(!(A&&l=='prototype')",u.s&&(t+="&&"+u.h),t+="){"+u.p.j+"}"),t+="}");if(u.i){t+="var h="+u.m+".constructor;";for(n=0;7>n;n++)t+="l='"+u.q[n]+"';if(","constructor"==u.q[n]&&(t+="!(h&&h.prototype==="+u.m+")&&"),t+=u.h+"){"+u.p.j+"}"}u.c&&(t+="}")}return t+=u.e+";return z",Function("c,g,i,j,k,n,t,q,y,B,E,H",'"use strict";return function('+e+"){"+t+"}")(ft,a,ht,et,k,h,St,at,nt,rt,vt,it)}function a(e,n){return e=e.a,n=n.a,e===t?1:n===t?-1:e<n?-1:e>n?1:0}function f(e,t){
return Y[t]}function l(e){return"\\"+xt[e]}function c(e){return Et[e]}function h(e,t){return function(n,r,i){return e.call(t,n,r,i)}}function p(){}function d(e,t){if(F.test(t))return"<e%-"+t+"%>";var n=Y.length;return Y[n]="'+__e("+t+")+'",G+n}function v(e,t,n,r){return e=Y.length,t?Y[e]="';"+t+";__p+='":n?Y[e]="'+__we("+n+")+'":r&&(Y[e]="'+((__wt=("+r+"))==null?'':__wt)+'"),G+e}function m(e,t){if(F.test(t))return"<e%="+t+"%>";var n=Y.length;return Y[n]="'+((__t=("+t+"))==null?'':__t)+'",G+n}function g
(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments.length;r&&(t=h(t,r));if(i===i>>>0){for(i&&s&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}var o=Yt(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function y(e,t,n){if(e)return t==r||n?e[0]:rt.call(e,0,t)}function b(e,t){var n=[];if(!e)return n;for(var r,i=-1,s=e.length;++i<s;)r=e[i],Qt(r)?tt.apply(n,t?r:b(r)):n.push(r);return n}function w(e,t,n){if(!e)return-1;var r=-1,i=e.length;if(n){if("number"!=typeof n)return r=x(e
,t),e[r]===t?r:-1;r=(0>n?Math.max(0,i+n):n)-1}for(;++r<i;)if(e[r]===t)return r;return-1}function E(e,t,n){var r=-Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]>i&&(i=e[s]);return i}for(n&&(t=h(t,n));++s<o;)n=t(e[s],s,e),n>r&&(r=n,i=e[s]);return i}function S(e,t,n){return e?rt.call(e,t==r||n?1:t):[]}function x(e,t,n,r){if(!e)return 0;var i=0,s=e.length;if(n){r&&(n=N(n,r));for(t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r}else for(;i<s;)r=i+s>>>1,e[r]<t?i=r+1:s=r;return i}function T
(e,t,n,r){var s=[];if(!e)return s;var o=-1,u=e.length,a=[];"function"==typeof t&&(r=n,n=t,t=i);for(n?r&&(n=h(n,r)):n=k;++o<u;)if(r=n(e[o],o,e),t?!o||a[a.length-1]!==r:0>w(a,r))a.push(r),s.push(e[o]);return s}function N(e,t){function n(){var u=arguments,a=t;return s||(e=t[i]),o.length&&(u=u.length?Z.apply(o,u):o),this instanceof n?(p.prototype=e.prototype,a=new p,u=e.apply(a,u),St[typeof u]&&u!==r?u:a):e.apply(a,u)}var i,s=it.call(e)==ht;if(s){if(bt||st&&2<arguments.length)return st.call.apply(st,
arguments)}else i=t,t=e;var o=rt.call(arguments,2);return n}function C(e,t,s){s||(s=[]);if(e===t)return 0!==e||1/e==1/t;if(e==r||t==r)return e===t;e._chain&&(e=e._wrapped),t._chain&&(t=t._wrapped);if(e.isEqual&&it.call(e.isEqual)==ht)return e.isEqual(t);if(t.isEqual&&it.call(t.isEqual)==ht)return t.isEqual(e);var o=it.call(e);if(o!=it.call(t))return i;switch(o){case vt:return e==""+t;case pt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case lt:case ct:return+e==+t;case dt:return e.source==t.source&&e.global==
t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return i;for(var u=s.length;u--;)if(s[u]==e)return n;var u=-1,a=n,f=0;s.push(e);if(o==ft){if(f=e.length,a=f==t.length)for(;f--&&(a=C(e[f],t[f],s)););}else{if("constructor"in e!="constructor"in t||e.constructor!=t.constructor)return i;for(var l in e)if(et.call(e,l)&&(f++,!(a=et.call(t,l)&&C(e[l],t[l],s))))break;if(a){for(l in t)if(et.call(t,l)&&!(f--))break;a=!f}if(a&&yt)for(;7>++u&&(l=Q[u],!et
.call(e,l)||!!(a=et.call(t,l)&&C(e[l],t[l],s))););}return s.pop(),a}function k(e){return e}function L(e){Bt(Kt(e),function(t){var r=s[t]=e[t];o.prototype[t]=function(){var e=[this._wrapped];return arguments.length&&tt.apply(e,arguments),e=r.apply(s,e),this._chain&&(e=new o(e),e._chain=n),e}})}var n=!0,r=null,i=!1,A,O,M,_,D="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),P=Array.prototype,H=Object.prototype,B=0,j=e._,F=/[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/
,I=/^';/,q=/^'\+/,R=/(?:__p\+='|\+')$/,U=/\b__p\+='';/g,z=/\b(__p\+?=)''\+/g,W=/(__w?e\(.*?\)|\b__w?t\))\+'';/g,X=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,V=RegExp("^"+(H.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),$=/__token__(\d+)/g,J=/[&<"']/g,K=/['\n\r\t\u2028\u2029\\]/g,Q="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),G="__token__",Y=[],Z=P.concat,et=H.hasOwnProperty,tt=P.push,nt=H
.propertyIsEnumerable,rt=P.slice,it=H.toString,st=V.test(st=rt.bind)&&st,ot=V.test(ot=Array.isArray)&&ot,ut=e.isFinite,at=V.test(at=Object.keys)&&at,ft="[object Array]",lt="[object Boolean]",ct="[object Date]",ht="[object Function]",pt="[object Number]",dt="[object RegExp]",vt="[object String]",mt=e.clearTimeout,gt=e.setTimeout,yt=!nt.call({valueOf:0},"valueOf"),bt=st&&/\n|Opera/.test(st+it.call(e.opera)),wt=at&&/^.+$|true/.test(at+!!e.attachEvent),Et={"&":"&amp;","<":"&lt;",'"':"&quot;","'":"&#x27;"
},St={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},xt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var Tt={a:"f,d,G",k:"f",r:"if(!d){d=k}else if(G)d=n(d,G)",j:"d(f[l],l,f)"},Nt={k:"true",j:"if(!d(f[l],l,f))return!z"},Ct={a:"s",k:"s",r:"for(var C,D=1,o=arguments.length;D<o;D++){C=arguments[D];"+(yt?"if(C){":""),n:"l in C",s
:i,j:"s[l]=C[l]",e:(yt?"}":"")+"}"},kt={k:"[]",j:"d(f[l],l,f)&&z.push(f[l])"},Lt={r:"if(G)d=n(d,G)"},At={j:{o:Tt.j}},Ot={k:"",f:"if(!f)return[]",d:{b:"z=Array(o)",o:"z=[]"},j:{b:"z[l]=d(f[l],l,f)",o:"z.push(d(f[l],l,f))"}},Mt=u({a:"s",f:"if(!t[typeof s]||s===null)throw TypeError()",k:"[]",j:"z.push(l)"}),_t=u({a:"f,F",k:"false",j:"if(f[l]===F)return true"}),Dt=u(Tt,Nt),Pt=u(Tt,kt),Ht=u(Tt,Lt,{k:"",j:"if(d(f[l],l,f))return f[l]"}),Bt=u(Tt,Lt),jt=u(Tt,{k:"{}",r:"var u,m=typeof d=='function';if(m&&G)d=n(d,G)"
,j:"u=m?d(f[l],l,f):f[l][d];(j.call(z,u)?z[u]:z[u]=[]).push(f[l])"}),Ft=u(Ot,{a:"f,p",r:"var b=B.call(arguments,2),m=typeof p=='function'",j:{b:"z[l]=(m?p:f[l][p]).apply(f[l],b)",o:"z.push((m?p:f[l][p]).apply(f[l],b))"}}),It=u(Tt,Ot),qt=u(Ot,{a:"f,x",j:{b:"z[l]=f[l][x]",o:"z.push(f[l][x])"}}),Rt=u({a:"f,d,a,G",k:"a",r:"var r=arguments.length<3;if(G)d=n(d,G)",d:{b:"if(r)z=f[++l]"},j:{b:"z=d(z,f[l],l,f)",o:"z=r?(r=false,f[l]):d(z,f[l],l,f)"}}),Ut=u(Tt,kt,{j:"!"+kt.j}),zt=u(Tt,Nt,{k:"false",j:Nt.j.replace
("!","")}),Wt=u(Tt,Ot,{r:"if(typeof d=='string'){var u=d;d=function(f){return f[u]}}else if(G)d=n(d,G)",j:{b:"z[l]={a:d(f[l],l,f),b:f[l]}",o:"z.push({a:d(f[l],l,f),b:f[l]})"},e:"z.sort(g);o=z.length;while(o--){z[o]=z[o].b}"}),Xt=u(Ct,{j:"if(s[l]==null)"+Ct.j}),Vt=u(Ct),$t=u(Tt,Lt,At,{s:i}),Jt=u(Tt,Lt,At),Kt=u({a:"s",k:"[]",s:i,j:"if(H.call(s[l])==i)z.push(l)",e:"z.sort()"});Bt({Arguments:"[object Arguments]",Date:ct,Function:ht,Number:pt,RegExp:dt,String:vt},function(e,t){s["is"+t]=function(t){return it
.call(t)==e}}),s.isArguments(arguments)||(s.isArguments=function(e){return!!e&&!!et.call(e,"callee")});var Qt=ot||function(e){return it.call(e)==ft},Gt=u({a:"I",k:"true",r:"var e=H.call(I);if(e==c||e==E)return!I.length",j:{o:"return false"}}),Yt=at?function(e){return"function"==typeof e&&nt.call(e,"prototype")?Mt(e):at(e)}:Mt,Zt=u({a:"s",k:"[]",j:"z.push(s[l])"});s.VERSION="0.3.2",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=N,s.bindAll=function(
e){var t=arguments,n=1;1==t.length&&(n=0,t=Kt(e));for(var r=t.length;n<r;n++)e[t[n]]=N(e[t[n]],e);return e},s.chain=function(e){return e=new o(e),e._chain=n,e},s.clone=function(e){return St[typeof e]&&e!==r?Qt(e)?e.slice():Vt({},e):e},s.compact=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++n<r;)e[n]&&t.push(e[n]);return t},s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.contains=_t,s.debounce=function(
e,t,n){function i(){a=r,n||e.apply(u,s)}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,mt(a),a=gt(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=Xt,s.defer=function(e){var n=rt.call(arguments,1);return gt(function(){return e.apply(t,n)},1)},s.delay=function(e,n){var r=rt.call(arguments,2);return gt(function(){return e.apply(t,r)},n)},s.difference=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=Z.apply(t,arguments);++n<r;)0>w(i,e[n],r)&&t.push(e[n]);return t},s.escape=function(
e){return e==r?"":(e+"").replace(J,c)},s.every=Dt,s.extend=Vt,s.filter=Pt,s.find=Ht,s.first=y,s.flatten=b,s.forEach=Bt,s.forIn=$t,s.forOwn=Jt,s.functions=Kt,s.groupBy=jt,s.has=function(e,t){return et.call(e,t)},s.identity=k,s.indexOf=w,s.initial=function(e,t,n){return e?rt.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=[];if(!e)return t;for(var n,r=-1,i=e.length,s=rt.call(arguments,1);++r<i;)n=e[r],0>w(t,n)&&Dt(s,function(e){return-1<w(e,n)})&&t.push(n);return t},s.invoke=Ft,s.isArray=
Qt,s.isBoolean=function(e){return e===n||e===i||it.call(e)==lt},s.isElement=function(e){return!!e&&1==e.nodeType},s.isEmpty=Gt,s.isEqual=C,s.isFinite=function(e){return ut(e)&&it.call(e)==pt},s.isNaN=function(e){return it.call(e)==pt&&e!=+e},s.isNull=function(e){return e===r},s.isObject=function(e){return St[typeof e]&&e!==r},s.isUndefined=function(e){return e===t},s.keys=Yt,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:rt.call(e,-t||i)}},s.lastIndexOf=function(e,t,n){if(!e)return-1
;var r=e.length;for(n&&"number"==typeof n&&(r=(0>n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=It,s.max=E,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s<o;)e[s]<i&&(i=e[s]);return i}for(n&&(t=h(t,n));++s<o;)n=t(e[s],s,e),n<r&&(r=n,i=e[s]);return i},s.mixin=L,s.noConflict=
function(){return e._=j,this},s.once=function(e){var t,r=i;return function(){return r?t:(r=n,t=e.apply(this,arguments))}},s.partial=function(e){var t=rt.call(arguments,1),n=t.length;return function(){var r;return r=arguments,r.length&&(t.length=n,tt.apply(t,r)),r=1==t.length?e.call(this,t[0]):e.apply(this,t),t.length=n,r}},s.pick=function(e){for(var t,n=0,r=Z.apply(P,arguments),i=r.length,s={};++n<i;)t=r[n],t in e&&(s[t]=e[t]);return s},s.pluck=qt,s.range=function(e,t,n){n||(n=1),t==r&&(t=e||0,e=0
);for(var i=-1,t=Math.max(0,Math.ceil((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reduce=Rt,s.reduceRight=g,s.reject=Ut,s.rest=S,s.result=function(e,t){if(!e)return r;var n=e[t];return it.call(n)==ht?e[t]():n},s.shuffle=function(e){if(!e)return[];for(var t,n=-1,r=e.length,i=Array(r);++n<r;)t=Math.floor(Math.random()*(n+1)),i[n]=i[t],i[t]=e[n];return i},s.size=function(e){if(!e)return 0;var t=e.length;return t===t>>>0?e.length:Yt(e).length},s.some=zt,s.sortBy=Wt,s.sortedIndex=x,s.tap=function(
e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var i,o,u,a,c=s.templateSettings;return i=n.escape,o=n.evaluate,u=n.interpolate,n=n.variable,i==r&&(i=c.escape),o==r&&(o=c.evaluate),u==r&&(u=c.interpolate),i&&(e=e.replace(i,d)),u&&(e=e.replace(u,m)),o!=A&&(A=o,_=RegExp((o?o.source:"($^)")+"|<e%-([\\s\\S]+?)%>|<e%=([\\s\\S]+?)%>","g")),u=Y.length,e=e.replace(_,v),i=Y.length-1,o=u<=i,!n&&(n=c.variable||O||"obj",a=o)&&(Y[u]="';__with("+n+"){"+Y[u].replace(I,"").replace(q,"__p+="),Y[i]=Y[i].replace
(R,"")+"}____p+='"),c="$&"+n+".",e="__p='"+e.replace(K,l).replace($,f)+"';",Y.length=0,a&&(u=e.indexOf("__with"),i=e.indexOf("}__",u+10)),n!=O&&(O=n,M=RegExp("([(\\s])"+n+"\\."+n+"\\b","g")),e=(a?e.slice(0,u):e).replace(X,c).replace(M,"$1__d")+(a?e.slice(u+2,i+1)+e.slice(i+3).replace(X,c).replace(M,"$1__d"):""),e=(o?e.replace(U,""):e).replace(z,"$1").replace(W,"$1;"),e="function("+n+"){"+n+"||("+n+"={});var __p,__t,__wt,__d="+n+"."+n+"||"+n+",__e=_.escape,__we=__e"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"
:";")+e+"return __p}",a=Function("_","return "+e)(s),t?a(t):(a.source=e,a)},s.throttle=function(e,t){function n(){a=new Date,u=r,e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(a=r,s=e.apply(o,i)):u||(u=gt(n,f)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++r<e;)t.call(n,r);else for(;++r<e;)t(r)},s.toArray=function(e){if(!e)return[];if(e.toArray&&it.call(e.toArray)==ht)return e.toArray();var t=e.length;return t===t>>>0?rt.call(e):Zt(e)},s
.union=function(){for(var e=-1,t=[],n=Z.apply(t,arguments),r=n.length;++e<r;)0>w(t,n[e])&&t.push(n[e]);return t},s.uniq=T,s.uniqueId=function(e){var t=B++;return e?e+t:t},s.values=Zt,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++n<r;)0>w(arguments,e[n],1)&&t.push(e[n]);return t},s.wrap=function(e,t){return function(){var n=[e];return arguments.length&&tt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){if(!e)return[];for(var t=-1,n=E(qt(arguments,"length")),r=Array
(n);++t<n;)r[t]=qt(arguments,t);return r},s.zipObject=function(e,t){if(!e)return{};var n=-1,r=e.length,i={};for(t||(t=[]);++n<r;)i[e[n]]=t[n];return i},s.all=Dt,s.any=zt,s.collect=It,s.detect=Ht,s.each=Bt,s.foldl=Rt,s.foldr=g,s.head=y,s.include=_t,s.inject=Rt,s.methods=Kt,s.select=Pt,s.tail=S,s.take=y,s.unique=T,o.prototype=s.prototype,L(s),o.prototype.chain=function(){return this._chain=n,this},o.prototype.value=function(){return this._wrapped},Bt("pop push reverse shift sort splice unshift".split
(" "),function(e){var t=P[e];o.prototype[e]=function(){var e=this._wrapped;return t.apply(e,arguments),e.length===0&&delete e[0],this._chain&&(e=new o(e),e._chain=n),e}}),Bt(["concat","join","slice"],function(e){var t=P[e];o.prototype[e]=function(){var e=t.apply(this._wrapped,arguments);return this._chain&&(e=new o(e),e._chain=n),e}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):D?"object"==typeof module&&module&&module.t==D?(module.t=s).
_=s:D._=s:e._=s})(this);