From 8fd6f8a99e71256ecc1d5ecb8150d9a91545cd28 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Thu, 15 Jan 2015 09:33:18 -0800 Subject: [PATCH] Generate lodash script for only methods we use --- lib/lodash.js | 77 +++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 55 deletions(-) diff --git a/lib/lodash.js b/lib/lodash.js index 6114e86..4fbb9fa 100644 --- a/lib/lodash.js +++ b/lib/lodash.js @@ -1,59 +1,26 @@ /** * @license * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE - * Build: `lodash compat exports="node" minus="template" --minify --output ./lib/lodash.js` + * Build: `lodash compat exports="node" include="bindAll,each,first,forEach,forIn,forOwn,include,invoke,isArray,isEqual,isFunction,isObject,isString,keys,map,merge,result,values" --minify --output ./lib/lodash.js` */ -;(function(){function n(n,t,r){r=(r||0)-1;for(var e=n?n.length:0;++ri||typeof a=="undefined")return 1;if(ar?0:r);++e=b&&a===n,l=[];if(f){var p=o(e);p?(a=t,e=p):f=false}for(;++ua(e,p)&&l.push(p);return f&&c(e),l}function X(n,t,r,e){e=(e||0)-1; -for(var u=n?n.length:0,o=[];++e=b&&f===n,h=u||g?a():s;for(g&&(h=o(h),f=t);++if(h,y))&&((u||g)&&h.push(y),s.push(v))}return g?(l(h.k),c(h)):u&&l(h),s}function rt(n){return function(t,r,e){var u={}; -if(r=h.createCallback(r,e,3),Br(t)){e=-1;for(var o=t.length;++ek;k++)e+="n='"+r.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",r.j||(e+="||(!x[n]&&t[n]!==A[n])"),e+="){"+r.g+"}"; -e+="}"}return(r.b||Dr.nonEnumArgs)&&(e+="}"),e+=r.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+e+"}")(V,B,rr,gr,m,ct,Br,mt,W.f,er,$,Ir,L,ur,ar)}function ot(n){return zr[n]}function at(){var t=(t=h.indexOf)===Nt?n:t;return t}function it(n){return typeof n=="function"&&ir.test(n)}function ft(n){var t,r;return!n||ar.call(n)!=F||(t=n.constructor,ht(t)&&!(t instanceof t))||!Dr.argsClass&&ct(n)||!Dr.nodeClass&&f(n)?false:Dr.ownLast?(Mr(n,function(n,t,e){return r=gr.call(e,t),false}),false!==r):(Mr(n,function(n,t){r=t -}),typeof r=="undefined"||gr.call(n,r))}function lt(n){return qr[n]}function ct(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ar.call(n)==A||false}function pt(n,t,r){var e=Rr(n),u=e.length;for(t=V(t,r,3);u--&&(r=e[u],false!==t(n[r],r,n)););return n}function st(n){var t=[];return Mr(n,function(n,r){ht(n)&&t.push(r)}),t.sort()}function gt(n){for(var t=-1,r=Rr(n),e=r.length,u={};++tr?kr(0,o+r):r)||0,Br(n)?a=-1o&&(o=i)}}else t=null==t&&mt(n)?e:h.createCallback(t,r,3),$r(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function Ot(n,t,r,e){var u=3>arguments.length;if(t=h.createCallback(t,e,4),Br(n)){var o=-1,a=n.length;for(u&&(r=n[++o]);++oarguments.length; -return t=h.createCallback(t,e,4),Ct(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function At(n){var t=-1,r=n?n.length:0,e=Jt(typeof r=="number"?r:0);return xt(n,function(n){var r=nt(0,++t);e[t]=e[r],e[r]=n}),e}function It(n,t,r){var e;if(t=h.createCallback(t,r,3),Br(n)){r=-1;for(var u=n.length;++re?kr(0,u+e):e||0}else if(e)return e=Pt(t,r),t[e]===r?e:-1;return n(t,r,e)}function Bt(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=h.createCallback(t,r,3);++u>>1,r(n[e])r?0:r);++t=g;m?(u&&(u=lr(u)),c=a,o=n.apply(i,e)):u||(u=yr(y,g))}return m&&f?f=lr(f):f||t===p||(f=yr(v,t)),r&&(m=true,o=n.apply(i,e)),!m||f||u||(e=i=null),o}}function qt(n){return n}function Kt(n,t,r){var e=true,u=t&&st(t);t&&(r||u.length)||(null==r&&(r=t),o=v,t=n,n=h,u=st(t)),false===r?e=false:vt(r)&&"chain"in r&&(e=r.chain);var o=n,a=ht(o);xt(u,function(r){var u=n[r]=t[r];a&&(o.prototype[r]=function(){var t=this.__chain__,r=this.__wrapped__,a=[r];if(hr.apply(a,arguments),a=u.apply(n,a),e||t){if(r===a&&vt(a))return this; -a=new o(a),a.__chain__=t}return a})})}function Wt(){}function $t(n){return function(t){return t[n]}}function Gt(){return this.__wrapped__}r=r?U.defaults(G.Object(),r,U.pick(G,O)):G;var Jt=r.Array,Mt=r.Boolean,Vt=r.Date,Ht=r.Function,Ut=r.Math,Qt=r.Number,Xt=r.Object,Yt=r.RegExp,Zt=r.String,nr=r.TypeError,tr=[],rr=r.Error.prototype,er=Xt.prototype,ur=Zt.prototype,or=r._,ar=er.toString,ir=Yt("^"+Zt(ar).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),fr=Ut.ceil,lr=r.clearTimeout,cr=Ut.floor,pr=Ht.prototype.toString,sr=it(sr=Xt.getPrototypeOf)&&sr,gr=er.hasOwnProperty,hr=tr.push,vr=er.propertyIsEnumerable,yr=r.setTimeout,mr=tr.splice,dr=tr.unshift,br=function(){try{var n={},t=it(t=Xt.defineProperty)&&t,r=t(n,n,n)&&t -}catch(e){}return r}(),_r=it(_r=Xt.create)&&_r,wr=it(wr=Jt.isArray)&&wr,jr=r.isFinite,xr=r.isNaN,Cr=it(Cr=Xt.keys)&&Cr,kr=Ut.max,Er=Ut.min,Or=r.parseInt,Sr=Ut.random,Ar={};Ar[I]=Jt,Ar[D]=Mt,Ar[N]=Vt,Ar[P]=Ht,Ar[F]=Xt,Ar[R]=Qt,Ar[T]=Yt,Ar[L]=Zt;var Ir={};Ir[I]=Ir[N]=Ir[R]={constructor:true,toLocaleString:true,toString:true,valueOf:true},Ir[D]=Ir[L]={constructor:true,toString:true,valueOf:true},Ir[B]=Ir[P]=Ir[T]={constructor:true,toString:true},Ir[F]={constructor:true},function(){for(var n=S.length;n--;){var t,r=S[n]; -for(t in Ir)gr.call(Ir,t)&&!gr.call(Ir[t],r)&&(Ir[t][r]=false)}}(),v.prototype=h.prototype;var Dr=h.support={};!function(){var n=function(){this.x=1},t={0:1,length:1},e=[];n.prototype={valueOf:1,y:1};for(var u in new n)e.push(u);for(u in arguments);Dr.argsClass=ar.call(arguments)==A,Dr.argsObject=arguments.constructor==Xt&&!(arguments instanceof Jt),Dr.enumErrorProps=vr.call(rr,"message")||vr.call(rr,"name"),Dr.enumPrototypes=vr.call(n,"prototype"),Dr.funcDecomp=!it(r.WinRTError)&&E.test(s),Dr.funcNames=typeof Ht.name=="string",Dr.nonEnumArgs=0!=u,Dr.nonEnumShadows=!/valueOf/.test(e),Dr.ownLast="x"!=e[0],Dr.spliceObjects=(tr.splice.call(t,0,1),!t[0]),Dr.unindexedChars="xx"!="x"[0]+Xt("x")[0]; -try{Dr.nodeClass=!(ar.call(document)==F&&!({toString:0}+""))}catch(o){Dr.nodeClass=true}}(1),_r||(M=function(){function n(){}return function(t){if(vt(t)){n.prototype=t;var e=new n;n.prototype=null}return e||r.Object()}}());var Nr=br?function(n,t){K.value=t,br(n,"__bindData__",K)}:Wt;Dr.argsClass||(ct=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&gr.call(n,"callee")&&!vr.call(n,"callee")||false});var Br=wr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ar.call(n)==I||false -},Pr=ut({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),Rr=Cr?function(n){return vt(n)?Dr.enumPrototypes&&typeof n=="function"||Dr.nonEnumArgs&&n.length&&ct(n)?Pr(n):Cr(n):[]}:Pr,Fr={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:Rr,g:"if(e(t[n],n,g)===false)return E"},Tr={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},qr=gt(zr),Kr=Yt("("+Rr(qr).join("|")+")","g"),Wr=Yt("["+Rr(zr).join("")+"]","g"),$r=ut(Fr),Gr=ut(Tr,{i:Tr.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),Jr=ut(Tr),Mr=ut(Fr,Lr,{j:false}),Vr=ut(Fr,Lr); -ht(/x/)&&(ht=function(n){return typeof n=="function"&&ar.call(n)==P});var Hr=sr?function(n){if(!n||ar.call(n)!=F||!Dr.argsClass&&ct(n))return false;var t=n.valueOf,r=it(t)&&(r=sr(t))&&sr(r);return r?n==r||sr(n)==r:ft(n)}:ft,Ur=rt(function(n,t,r){gr.call(n,r)?n[r]++:n[r]=1}),Qr=rt(function(n,t,r){(gr.call(n,r)?n[r]:n[r]=[]).push(t)}),Xr=rt(function(n,t,r){n[r]=t}),Yr=kt,Zr=it(Zr=Vt.now)&&Zr||function(){return(new Vt).getTime()},ne=8==Or(w+"08")?Or:function(n,t){return Or(mt(n)?n.replace(C,""):n,t||0)}; -return h.after=function(n,t){if(!ht(t))throw new nr;return function(){return 1>--n?t.apply(this,arguments):void 0}},h.assign=Gr,h.at=function(n){var t=arguments,r=-1,e=X(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=Jt(t);for(Dr.unindexedChars&&mt(n)&&(n=n.split(""));++r=b&&o(e?r[e]:s)))}var p=r[0],h=-1,v=p?p.length:0,y=[];n:for(;++h(m?t(m,g):f(s,g))){for(e=u,(m||s).push(g);--e;)if(m=i[e],0>(m?t(m,g):f(r[e],g)))continue n;y.push(g) -}}for(;u--;)(m=i[u])&&c(m);return l(i),l(s),y},h.invert=gt,h.invoke=function(n,t){var r=p(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,a=Jt(typeof o=="number"?o:0);return xt(n,function(n){a[++e]=(u?t:n[t]).apply(n,r)}),a},h.keys=Rr,h.map=kt,h.mapValues=function(n,t,r){var e={};return t=h.createCallback(t,r,3),Vr(n,function(n,r,u){e[r]=t(n,r,u)}),e},h.max=Et,h.memoize=function(n,t){if(!ht(n))throw new nr;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):d+arguments[0];return gr.call(e,u)?e[u]:e[u]=n.apply(this,arguments) -};return r.cache={},r},h.merge=function(n){var t=arguments,r=2;if(!vt(n))return n;if("number"!=typeof t[2]&&(r=t.length),3r?kr(0,e+r):Er(r,e-1))+1);e--;)if(n[e]===t)return e; -return-1},h.mixin=Kt,h.noConflict=function(){return r._=or,this},h.noop=Wt,h.now=Zr,h.parseInt=ne,h.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(typeof n=="boolean"&&u?(r=n,n=1):u||typeof t!="boolean"||(r=t,u=true)),e&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Sr(),Er(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):nt(n,t)},h.reduce=Ot,h.reduceRight=St,h.result=function(n,t){if(n){var r=n[t];return ht(r)?n[t]():r}},h.runInContext=s,h.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:Rr(n).length},h.some=It,h.sortedIndex=Pt,h.unescape=function(n){return null==n?"":Zt(n).replace(Kr,lt)},h.uniqueId=function(n){var t=++y;return Zt(null==n?"":n)+t},h.all=_t,h.any=It,h.detect=jt,h.findWhere=jt,h.foldl=Ot,h.foldr=St,h.include=bt,h.inject=Ot,Kt(function(){var n={};return Vr(h,function(t,r){h.prototype[r]||(n[r]=t)}),n}(),false),h.first=Dt,h.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=h.createCallback(t,r,3);o--&&t(n[o],o,n);)e++ -}else if(e=t,null==e||r)return n?n[u-1]:g;return p(n,kr(0,u-e))},h.sample=function(n,t,r){return n&&typeof n.length!="number"?n=dt(n):Dr.unindexedChars&&mt(n)&&(n=n.split("")),null==t||r?n?n[nt(0,n.length-1)]:g:(n=At(n),n.length=Er(kr(0,t),n.length),n)},h.take=Dt,h.head=Dt,Vr(h,function(n,t){var r="sample"!==t;h.prototype[t]||(h.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||null!=t&&(!e||r&&typeof t=="function")?new v(o,u):o})}),h.VERSION="2.4.1",h.prototype.chain=function(){return this.__chain__=true,this -},h.prototype.toString=function(){return Zt(this.__wrapped__)},h.prototype.value=Gt,h.prototype.valueOf=Gt,$r(["join","pop","shift"],function(n){var t=tr[n];h.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new v(r,n):r}}),$r(["push","reverse","sort","unshift"],function(n){var t=tr[n];h.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),$r(["concat","slice","splice"],function(n){var t=tr[n];h.prototype[n]=function(){return new v(t.apply(this.__wrapped__,arguments),this.__chain__) -}}),Dr.spliceObjects||$r(["pop","shift","splice"],function(n){var t=tr[n],r="splice"==n;h.prototype[n]=function(){var n=this.__chain__,e=this.__wrapped__,u=t.apply(e,arguments);return 0===e.length&&delete e[0],n||r?new v(u,n):u}}),h}var g,h=[],v=[],y=0,m={},d=+new Date+"",b=75,_=40,w=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=/\w*$/,x=/^\s*function[ \n\r\t]+\w/,C=RegExp("^["+w+"]*0+(?=.$)"),E=/\bthis\b/,O="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setTimeout".split(" "),S="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),A="[object Arguments]",I="[object Array]",D="[object Boolean]",N="[object Date]",B="[object Error]",P="[object Function]",R="[object Number]",F="[object Object]",T="[object RegExp]",L="[object String]",z={}; -z[P]=false,z[A]=z[I]=z[D]=z[N]=z[R]=z[F]=z[T]=z[L]=true;var q={leading:false,maxWait:0,trailing:false},K={configurable:false,enumerable:false,value:null,writable:false},W={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:false},$={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},G=$[typeof window]&&window||this,J=$[typeof exports]&&exports&&!exports.nodeType&&exports,M=$[typeof module]&&module&&!module.nodeType&&module,V=M&&M.exports===J&&J,H=$[typeof global]&&global;!H||H.global!==H&&H.window!==H||(G=H); -var U=s();J&&M&&V&&((M.exports=U)._=U)}).call(this); \ No newline at end of file +;(function(){function n(n,t,r){r=(r||0)-1;for(var e=n?n.length:0;++rr?0:r);++ek;k++)e+="n='"+r.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",r.j||(e+="||(!x[n]&&t[n]!==A[n])"),e+="){"+r.g+"}"; +e+="}"}return(r.b||_t.nonEnumArgs)&&(e+="}"),e+=r.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+e+"}")(a,J,ot,st,B,b,Et,O,U.f,ut,X,Ot,H,ft,at)}function y(){var t=(t=o.indexOf)===A?n:t;return t}function v(n){return typeof n=="function"&&it.test(n)}function h(n){var r,e;return!n||at.call(n)!=V||(r=n.constructor,d(r)&&!(r instanceof r))||!_t.argsClass&&b(n)||!_t.nodeClass&&t(n)?false:_t.ownLast?(Ct(n,function(n,t,r){return e=st.call(r,t),false}),false!==e):(Ct(n,function(n,t){e=t}),typeof e=="undefined"||st.call(n,e)) +}function b(n){return n&&typeof n=="object"&&typeof n.length=="number"&&at.call(n)==$||false}function m(n){var t=[];return Ct(n,function(n,r){d(n)&&t.push(r)}),t.sort()}function d(n){return typeof n=="function"}function j(n){return!(!n||!X[typeof n])}function O(n){return typeof n=="string"||n&&typeof n=="object"&&at.call(n)==H||false}function _(n,t,r){var e=-1,o=y(),u=n?n.length:0,f=false;return r=(0>r?dt(0,u+r):r)||0,Et(n)?f=-1e?dt(0,o+e):e||0}else if(e)return e=C(t,r),t[e]===r?e:-1;return n(t,r,e)}function C(n,t,r,e){var u=0,f=n?n.length:u;for(r=r?o.createCallback(r,e,1):P,t=r(t);u>>1,r(n[e])