diff --git a/build.js b/build.js index 7de6ff646..f12937bcd 100755 --- a/build.js +++ b/build.js @@ -66,7 +66,7 @@ /** Used to track function dependencies */ var dependencyMap = { 'after': [], - 'assign': ['isArguments'], + 'assign': ['isArray', 'forEach', 'forOwn'], 'at': ['isString'], 'bind': ['isFunction', 'isObject'], 'bindAll': ['bind', 'functions'], @@ -78,7 +78,7 @@ 'contains': ['indexOf', 'isString'], 'countBy': ['forEach', 'keys'], 'debounce': [], - 'defaults': ['isArguments'], + 'defaults': ['isArray', 'forEach', 'forOwn'], 'defer': [], 'delay': [], 'difference': ['indexOf'], @@ -1257,6 +1257,9 @@ // flag used to specify only creating the debug build var isDebug = options.indexOf('-d') > -1 || options.indexOf('--debug') > -1; + // flag used to indicate that a custom IIFE was specified + var isIIFE = typeof iife == 'string'; + // flag used to specify a legacy build var isLegacy = options.indexOf('legacy') > -1; @@ -1464,6 +1467,24 @@ source = removeVar(source, 'largeArraySize'); source = removeKeysOptimization(source); + // replace `_.assign` + source = replaceFunction(source, 'assign', [ + ' function assign(object) {', + ' if (!object) {', + ' return object;', + ' }', + ' for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {', + ' var iteratee = arguments[argsIndex];', + ' if (iteratee) {', + ' for (var key in iteratee) {', + ' object[key] = iteratee[key];', + ' }', + ' }', + ' }', + ' return object;', + ' }' + ].join('\n')); + // replace `_.clone` if (useUnderscoreClone) { source = replaceFunction(source, 'clone', [ @@ -1491,6 +1512,26 @@ ' }' ].join('\n')); + // replace `_.defaults` + source = replaceFunction(source, 'defaults', [ + ' function defaults(object) {', + ' if (!object) {', + ' return object;', + ' }', + ' for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {', + ' var iteratee = arguments[argsIndex];', + ' if (iteratee) {', + ' for (var key in iteratee) {', + ' if (object[key] == null) {', + ' object[key] = iteratee[key];', + ' }', + ' }', + ' }', + ' }', + ' return object;', + ' }' + ].join('\n')); + // replace `_.difference` source = replaceFunction(source, 'difference', [ ' function difference(array) {', @@ -1590,7 +1631,7 @@ source = replaceFunction(source, 'template', [ ' function template(text, data, options) {', " text || (text = '');", - ' options = iteratorTemplate ? defaults({}, options, lodash.templateSettings) : lodash.templateSettings;', + ' options = defaults({}, options, lodash.templateSettings);', '', ' var index = 0,', ' source = "__p += \'",', @@ -1969,7 +2010,7 @@ // customize Lo-Dash's IIFE (function() { - if (typeof iife == 'string') { + if (isIIFE) { var token = '%output%', index = iife.indexOf(token); @@ -2133,6 +2174,7 @@ 'isMapped': isMapped, 'isSilent': isSilent, 'isTemplate': isTemplate, + 'modes': isIIFE && ['simple', 'hybrid'], 'outputPath': outputPath, 'onComplete': function(data) { // inject "use strict" directive diff --git a/build/minify.js b/build/minify.js index dcdf6b2f1..e45cd324f 100755 --- a/build/minify.js +++ b/build/minify.js @@ -80,6 +80,7 @@ * onComplete - The function called once minification has finished. */ function minify(source, options) { + var modes = ['simple', 'advanced', 'hybrid']; source || (source = ''); options || (options = {}); @@ -94,6 +95,11 @@ isTemplate = options.indexOf('-t') > -1 || options.indexOf('--template') > -1, outputPath = path.join(path.dirname(filePath), path.basename(filePath, '.js') + '.min.js'); + modes = options.reduce(function(result, value) { + var match = value.match(/modes=(.*)$/); + return match ? match[1].split(/, */) : result; + }, modes); + outputPath = options.reduce(function(result, value, index) { if (/-o|--output/.test(value)) { result = options[index + 1]; @@ -107,11 +113,25 @@ 'isMapped': isMapped, 'isSilent': isSilent, 'isTemplate': isTemplate, + 'modes': modes, 'outputPath': outputPath }; source = fs.readFileSync(filePath, 'utf8'); } + + modes = options.modes || (options.modes = modes); + + if (options.isMapped) { + modes = modes.filter(function(mode) { + return mode != 'hybrid'; + }); + } + if (options.isTemplate) { + modes = modes.filter(function(mode) { + mode != 'advanced'; + }); + } // fetch the Closure Compiler getDependency({ 'id': 'closure-compiler', @@ -166,8 +186,8 @@ this.isTemplate = !!options.isTemplate; this.outputPath = options.outputPath; - source = preprocess(source, options); - this.source = source; + var modes = this.modes = options.modes; + source = this.source = preprocess(source, options); this.onComplete = options.onComplete || function(data) { var outputPath = this.outputPath, @@ -180,7 +200,13 @@ }; // begin the minification process - closureCompile.call(this, source, 'simple', onClosureSimpleCompile.bind(this)); + if (modes.indexOf('simple') > -1) { + closureCompile.call(this, source, 'simple', onClosureSimpleCompile.bind(this)); + } else if (modes.indexOf('advanced') > -1) { + onClosureSimpleGzip.call(this); + } else { + onClosureAdvancedGzip.call(this); + } } /*--------------------------------------------------------------------------*/ @@ -281,13 +307,11 @@ mapPath = getMapPath(outputPath), options = closureOptions.slice(); - // use simple optimizations when minifying template files - options.push('--compilation_level=' + optimizationModes[this.isTemplate ? 'simple' : mode]); + options.push('--compilation_level=' + optimizationModes[mode]); if (isMapped) { options.push('--create_source_map=' + mapPath, '--source_map_format=V3'); } - // the standard error stream, standard output stream, and the Closure Compiler process var error = '', output = '', @@ -416,13 +440,18 @@ if (exception) { throw exception; } - if (!this.isSilent) { - console.log('Done. Size: %d bytes.', result.length); + if (result != null) { + if (!this.isSilent) { + console.log('Done. Size: %d bytes.', result.length); + } + this.compiled.simple.gzip = result; + } + // compile the source using advanced optimizations + if (this.modes.indexOf('advanced') > -1) { + closureCompile.call(this, this.source, 'advanced', onClosureAdvancedCompile.bind(this)); + } else { + onComplete.call(this); } - this.compiled.simple.gzip = result; - - // next, compile the source using advanced optimizations - closureCompile.call(this, this.source, 'advanced', onClosureAdvancedCompile.bind(this)); } /** @@ -456,18 +485,17 @@ if (exception) { throw exception; } - if (!this.isSilent) { - console.log('Done. Size: %d bytes.', result.length); + if (result != null) { + if (!this.isSilent) { + console.log('Done. Size: %d bytes.', result.length); + } + this.compiled.advanced.gzip = result; } - this.compiled.advanced.gzip = result; - - // if mapped, finish by choosing the smallest compressed file - if (this.isMapped) { - onComplete.call(this); - } - // else, minify the source using UglifyJS - else { + // minify the source using UglifyJS + if (!this.isMapped) { uglify.call(this, this.source, 'UglifyJS', onUglify.bind(this)); + } else { + onComplete.call(this); } } @@ -498,13 +526,18 @@ if (exception) { throw exception; } - if (!this.isSilent) { - console.log('Done. Size: %d bytes.', result.length); + if (result != null) { + if (!this.isSilent) { + console.log('Done. Size: %d bytes.', result.length); + } + this.uglified.gzip = result; + } + // minify the already Closure Compiler simple optimized source using UglifyJS + if (this.modes.indexOf('hybrid') > -1) { + uglify.call(this, this.compiled.simple.source, 'hybrid (simple)', onSimpleHybrid.bind(this)); + } else { + onComplete.call(this); } - this.uglified.gzip = result; - - // next, minify the already Closure Compiler simple optimized source using UglifyJS - uglify.call(this, this.compiled.simple.source, 'hybrid (simple)', onSimpleHybrid.bind(this)); } /** @@ -534,13 +567,18 @@ if (exception) { throw exception; } - if (!this.isSilent) { - console.log('Done. Size: %d bytes.', result.length); + if (result != null) { + if (!this.isSilent) { + console.log('Done. Size: %d bytes.', result.length); + } + this.hybrid.simple.gzip = result; + } + // minify the already Closure Compiler advance optimized source using UglifyJS + if (this.modes.indexOf('advanced') > -1) { + uglify.call(this, this.compiled.advanced.source, 'hybrid (advanced)', onAdvancedHybrid.bind(this)); + } else { + onComplete.call(this); } - this.hybrid.simple.gzip = result; - - // next, minify the already Closure Compiler advance optimized source using UglifyJS - uglify.call(this, this.compiled.advanced.source, 'hybrid (advanced)', onAdvancedHybrid.bind(this)); } /** @@ -570,11 +608,12 @@ if (exception) { throw exception; } - if (!this.isSilent) { - console.log('Done. Size: %d bytes.', result.length); + if (result != null) { + if (!this.isSilent) { + console.log('Done. Size: %d bytes.', result.length); + } + this.hybrid.advanced.gzip = result; } - this.hybrid.advanced.gzip = result; - // finish by choosing the smallest compressed file onComplete.call(this); } @@ -591,27 +630,32 @@ hybridSimple = this.hybrid.simple, hybridAdvanced = this.hybrid.advanced; + var objects = [ + compiledSimple, + compiledAdvanced, + uglified, + hybridSimple, + hybridAdvanced + ]; + + var gzips = objects + .map(function(data) { return data.gzip; }) + .filter(Boolean); + // select the smallest gzipped file and use its minified counterpart as the // official minified release (ties go to the Closure Compiler) - var min = this.isMapped - ? Math.min( - compiledSimple.gzip.length, - compiledAdvanced.gzip.length - ) - : Math.min( - compiledSimple.gzip.length, - compiledAdvanced.gzip.length, - uglified.gzip.length, - hybridSimple.gzip.length, - hybridAdvanced.gzip.length - ); + var min = gzips.reduce(function(min, gzip) { + var length = gzip.length; + return min > length ? length : min; + }, Infinity); // pass the minified source to the "onComplete" callback - [compiledSimple, compiledAdvanced, uglified, hybridSimple, hybridAdvanced].some(function(data) { + objects.some(function(data) { var gzip = data.gzip; if (gzip && gzip.length == min) { data.outputPath = this.outputPath; this.onComplete(data); + return true; } }, this); } diff --git a/lodash.min.js b/lodash.min.js index 9f4f9f4c2..f391a51f6 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -3,39 +3,44 @@ * Lo-Dash 1.0.0-rc.3 lodash.com/license * Underscore.js 1.4.3 underscorejs.org/LICENSE */ -;(function(n,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||ot);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(nu;u++)e+="f='"+t.j[u]+"';if(","constructor"==t.j[u]&&(e+="!(d&&d.prototype===i)&&"),e+="e.call(i,f)){"+t.g+"}"}return(t.b||t.h)&&(e+="}"),e+=t.c+";return p",r("c,e,g,h,l,k,o","return function("+n+"){"+e+"}")(a,At,h,E,rr,Ft,Et)}function c(n){return"\\"+er[n]}function l(n){return lr[n]}function p(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function s(){}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++er?Dt(0,u+r):r)||0,typeof u=="number"?o=-1<(E(n)?n.indexOf(t,r):L(n,t,r)):ir(n,function(n){return++eo&&(o=f)}}else t=!t&&E(n)?u:a(t,r),ir(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function B(n,t){return I(n,t+"")}function M(n,t,r,e){var u=3>arguments.length;if(t=a(t,e,ut),sr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var f=cr(n),o=f.length;else Xt&&E(n)&&(u=n.split(""));return t=a(t,e,ut),D(n,function(n,e,a){e=f?f[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function z(n,t,r){var e;if(t=a(t,r),sr(n)){r=-1;for(var u=n.length;++rr?Dt(0,u+r):r||0)-1;else if(r)return e=V(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])L(f,p))&&((r||c)&&f.push(p),i.push(e))}return i}function H(n,t){return Gt||$t&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,ft=/&(?:amp|lt|gt|quot|#x27);/g,ct=/\b__p\+='';/g,lt=/\b(__p\+=)''\+/g,pt=/(__e\(.*?\)|\b__t\))\+'';/g,st=/\w*$/,vt=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,gt=RegExp("^"+(rt.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ht=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,yt=/<%=([\s\S]+?)%>/g,mt=/($^)/,_t=/[&<>"']/g,dt=/['\n\r\t\u2028\u2029\\]/g,bt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),jt=Math.ceil,wt=tt.concat,xt=Math.floor,Ot=gt.test(Ot=Object.getPrototypeOf)&&Ot,At=rt.hasOwnProperty,St=tt.push,Et=rt.propertyIsEnumerable,kt=rt.toString,$t=gt.test($t=v.bind)&&$t,Rt=gt.test(Rt=Array.isArray)&&Rt,qt=n.isFinite,Nt=n.isNaN,Ft=gt.test(Ft=Object.keys)&&Ft,Dt=Math.max,It=Math.min,Tt=Math.random,Bt="[object Arguments]",Mt="[object Array]",Pt="[object Boolean]",zt="[object Date]",Ct="[object Number]",Kt="[object Object]",Lt="[object RegExp]",Ut="[object String]",Vt=!!n.attachEvent,Gt=$t&&/\n|true/.test($t+Vt),Ht=(Ht={0:1,length:1},tt.splice.call(Ht,0,1),Ht[0]),Jt=!0; -(function(){function n(){this.x=1}var t=[];n.prototype={valueOf:1,y:1};for(var r in new n)t.push(r);for(r in arguments)Jt=!r;Z=!/valueOf/.test(t),nt="x"!=t[0]})(1);var Qt=arguments.constructor==Object,Wt=!h(arguments),Xt="xx"!="x"[0]+Object("x")[0];try{var Yt=kt.call(document)==Kt&&!1}catch(Zt){}var nr={"[object Function]":!1};nr[Bt]=nr[Mt]=nr[Pt]=nr[zt]=nr[Ct]=nr[Kt]=nr[Lt]=nr[Ut]=!0;var tr={};tr[Mt]=Array,tr[Pt]=Boolean,tr[zt]=Date,tr[Kt]=Object,tr[Ct]=Number,tr[Lt]=RegExp,tr[Ut]=String;var rr={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},er={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"}; -r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:yt,variable:"",imports:{_:r}};var ur={b:!0,a:"b,a,r",k:"a=a&&typeof r=='undefined'?a:c(a,r)",g:"if(a(i[f],f,b)===false)return p"},or={b:!1},ir=f(ur);Wt&&(h=function(n){return n?At.call(n,"callee"):!1});var ar=f(ur,or,{l:!1}),fr=f(ur,or),cr=Ft?function(n){return typeof n=="function"&&Et.call(n,"prototype")?m(n):A(n)?Ft(n):[]}:m,lr={"&":"&","<":"<",">":">",'"':""","'":"'"},pr=w(lr),sr=Rt||function(n){return Qt&&n instanceof Array||kt.call(n)==Mt -};O(/x/)&&(O=function(n){return n instanceof Function||"[object Function]"==kt.call(n)});var vr=Ot?function(n){if(!n||typeof n!="object")return!1;var t=n.valueOf,r=typeof t=="function"&&(r=Ot(t))&&Ot(r);return r?n==r||Ot(n)==r&&!h(n):y(n)}:y;r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=_,r.at=function(n){var t=-1,r=wt.apply(tt,v(arguments,1)),e=r.length,u=Array(e);for(Xt&&E(n)&&(n=n.split(""));++tL(c,l)){a&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n; -f.push(l)}}return f},r.invert=w,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return D(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=cr,r.map=I,r.max=T,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return At.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=k,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&sr(n)){r=-1;for(var i=n.length;++rL(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},r.pairs=function(n){for(var t=-1,r=cr(n),e=r.length,u=Array(e);++tr?Dt(0,e+r):It(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=Q,r.noConflict=function(){return n._=it,this},r.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+xt(Tt()*((+t||0)-n+1))},r.reduce=M,r.reduceRight=P,r.result=function(n,t){var r=n?n[t]:null;return O(r)?n[t]():r},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:cr(n).length -},r.some=z,r.sortedIndex=V,r.template=function(n,e,u){var o=r.templateSettings;n||(n=""),u=b({},u,o);var i=b({},u.imports,o.imports),o=cr(i),i=$(i),a=0,f=u.interpolate||mt,l=!(1==o.length&&"_"==o[0]&&i[0]===r),p="__p+='";if(n.replace(RegExp((u.escape||mt).source+"|"+f.source+"|"+(f===yt?ht:mt).source+"|"+(u.evaluate||mt).source+"|$","g"),function(t,r,e,u,o,i){return e||(e=u),p+=n.slice(a,i).replace(dt,c),r&&(p+="'+__e("+r+")+'"),o&&(p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),l||(l=o||at.test(r||e)),a=i+t.length,t -}),p+="';\n",f=u=u.variable,!f)if(u="obj",l)p="with("+u+"){"+p+"}";else var s=RegExp("(\\(\\s*)"+u+"\\."+u+"\\b","g"),p=p.replace(vt,"$&"+u+".").replace(s,"$1__d");p=(l?p.replace(ct,""):p).replace(lt,"$1").replace(pt,"$1;"),p="function("+u+"){"+(f?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(l?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(f?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}";try{var v=Function(o,"return "+p).apply(t,i)}catch(g){throw g.source=p,g}return e?v(e):(v.source=p,v) -},r.unescape=function(n){return null==n?"":(n+"").replace(ft,g)},r.uniqueId=function(n){var t=++et;return(null==n?"":n+"")+t},r.all=q,r.any=z,r.detect=F,r.foldl=M,r.foldr=P,r.include=R,r.inject=M,fr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return St.apply(t,arguments),n.apply(r,t)})}),r.first=C,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return v(n,Dt(0,u-e)) -}},r.take=C,r.head=C,fr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return null==t||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=W,r.prototype.valueOf=W,ir(["join","pop","shift"],function(n){var t=tt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),ir(["push","reverse","sort","unshift"],function(n){var t=tt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this -}}),ir(["concat","slice","splice"],function(n){var t=tt[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),Ht&&ir(["pop","shift","splice"],function(n){var t=tt[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r})):X?typeof module=="object"&&module&&module.exports==X?(module.exports=r)._=r:X._=r:n._=r -})(this); \ No newline at end of file +;(function(z,ea){function c(a){if(a&&typeof a=="object"&&a.__wrapped__)return a;if(!(this instanceof c))return new c(a);this.__wrapped__=a}function fa(a,b,d){b||(b=0);var e=a.length,f=e-b>=(d||cb);if(f){var g={};for(d=b-1;++db||typeof a=="undefined")return 1; +if(af;f++)e+="f='"+a.j[f]+"';if(","constructor"==a.j[f]&&(e+="!(d&&d.prototype===i)&&"),e+="e.call(i,f)){"+a.g+"}"}if(a.b||a.h)e+="}";e+=a.c+";return p";return d("c,e,g,h,l,k,o","return function("+b+"){"+e+"}")(l,p,w,B,Ea,I,Fa)}function fb(a){return"\\"+gb[a]}function hb(a){return Ga[a]}function X(a){return typeof a.toString!="function"&&typeof(a+"")=="string"}function ga(){}function n(a,b,d){b||(b=0);typeof d=="undefined"&&(d=a?a.length:0);var e=-1;d=d-b||0;for(var f=Array(0>d?0:d);++e< +d;)f[e]=a[b+e];return f}function ib(a){return jb[a]}function w(a){return s.call(a)==M}function Ha(a){var b=!1;if(!(a&&typeof a=="object")||w(a))return b;var d=a.constructor;if(!v(d)&&(!ja||!X(a))||d instanceof d){if(Ia)return C(a,function(a,d,c){b=!p.call(c,d);return!1}),!1===b;C(a,function(a,d){b=d});return!1===b||p.call(a,b)}return b}function Ja(a){var b=[];x(a,function(a,e){b.push(e)});return b}function ka(a,b,d){for(var e=arguments,f=0,c=typeof d=="number"?2:e.length;++fd?E(0,f+d):d)||0;typeof f=="number"?c=-1<(B(a)?a.indexOf(b,d):F(a,b,d)):t(a,function(a){if(++e>=d)return!(c=a===b)});return c}function Oa(a,b,d){var e=!0;b=l(b,d);if(m(a)){d=-1;for(var c=a.length;++dc&&(c=h)}}else b=!b&&B(a)?Ba:l(b,d),t(a,function(a,d,g){d=b(a, +d,g);d>e&&(e=d,c=a)});return c}function ra(a,b){return qa(a,b+"")}function sa(a,b,d,e){var c=3>arguments.length;b=l(b,e,S);if(m(a)){var g=-1,h=a.length;for(c&&(d=a[++g]);++garguments.length;if(typeof g!="number")var k=A(a),g=k.length;else W&&B(a)&&(c=a.split(""));b=l(b,e,S);r(a,function(a,e,l){e=k?k[--g]:--g;d=h?(h=!1,c[e]):b(d,c[e],e,l)});return d}function Sa(a,b,d){var e; +b=l(b,d);if(m(a)){d=-1;for(var c=a.length;++dd?E(0,c+d):d|| +0)-1;else if(d)return e=Ua(a,b),a[e]===b?e:-1;for(;++e>>1,d(a[e])F(k,n))(d||j)&&k.push(n),h.push(e)}return h}function Va(a,b){return lb||H&&2|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,pb=/&(?:amp|lt|gt|quot|#x27);/g,qb=/\b__p\+='';/g,rb=/\b(__p\+=)''\+/g,sb=/(__e\(.*?\)|\b__t\))\+'';/g,kb=/\w*$/,tb=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,ba=RegExp("^"+(T.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ub=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,Ya=/<%=([\s\S]+?)%>/g,ca=/($^)/, +vb=/[&<>"']/g,wb=/['\n\r\t\u2028\u2029\\]/g,eb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),xb=Math.ceil,K=u.concat,Za=Math.floor,L=ba.test(L=Object.getPrototypeOf)&&L,p=T.hasOwnProperty,aa=u.push,Fa=T.propertyIsEnumerable,s=T.toString,H=ba.test(H=n.bind)&&H,za=ba.test(za=Array.isArray)&&za,yb=z.isFinite,zb=z.isNaN,I=ba.test(I=Object.keys)&&I,E=Math.max,ua=Math.min,$a=Math.random,M="[object Arguments]",R="[object Array]",N="[object Boolean]", +O="[object Date]",P="[object Number]",G="[object Object]",Q="[object RegExp]",J="[object String]",Ab=!!z.attachEvent,lb=H&&/\n|true/.test(H+Ab),Ca,Ia,da=(da={"0":1,length:1},u.splice.call(da,0,1),da[0]),Da=!0;(function(){function a(){this.x=1}var b=[];a.prototype={valueOf:1,y:1};for(var d in new a)b.push(d);for(d in arguments)Da=!d;Ca=!/valueOf/.test(b);Ia="x"!=b[0]})(1);var na=arguments.constructor==Object,ab=!w(arguments),W="xx"!="x"[0]+Object("x")[0];try{var ja=s.call(document)==G&&!1}catch(Bb){}var y= +{"[object Function]":!1};y[M]=y[R]=y[N]=y[O]=y[P]=y[G]=y[Q]=y[J]=!0;var D={};D[R]=Array;D[N]=Boolean;D[O]=Date;D[G]=Object;D[P]=Number;D[Q]=RegExp;D[J]=String;var Ea={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},gb={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"};c.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:Ya,variable:"",imports:{_:c}};var Aa={b:!0,a:"b,a,r",k:"a=a&&typeof r=='undefined'?a:c(a,r)",g:"if(a(i[f],f,b)===false)return p"}, +bb={b:!1},t=ia(Aa);ab&&(w=function(a){return a?p.call(a,"callee"):!1});var C=ia(Aa,bb,{l:!1}),x=ia(Aa,bb),A=!I?Ja:function(a){return typeof a=="function"&&Fa.call(a,"prototype")?Ja(a):V(a)?I(a):[]},Ga={"&":"&","<":"<",">":">",'"':""","'":"'"},jb=Ka(Ga),m=za||function(a){return na&&a instanceof Array||s.call(a)==R};v(/x/)&&(v=function(a){return a instanceof Function||"[object Function]"==s.call(a)});var oa=!L?Ha:function(a){if(!(a&&typeof a=="object"))return!1;var b=a.valueOf,d= +typeof b=="function"&&(d=L(b))&&L(d);return d?a==d||L(a)==d&&!w(a):Ha(a)};c.after=function(a,b){return 1>a?b():function(){if(1>--a)return b.apply(this,arguments)}};c.assign=ka;c.at=function(a){var b=-1,d=K.apply(u,n(arguments,1)),e=d.length,c=Array(e);for(W&&B(a)&&(a=a.split(""));++bF(j,q)){h&&j.push(q);for(var m=d;--m;)if(!(e[m]||(e[m]=fa(b[m], +0,100)))(q))continue a;k.push(q)}}return k};c.invert=Ka;c.invoke=function(a,b){var d=n(arguments,2),e=-1,c=typeof b=="function",g=a?a.length:0,h=Array(typeof g=="number"?g:0);r(a,function(a){h[++e]=(c?b:a[b]).apply(a,d)});return h};c.keys=A;c.map=qa;c.max=Qa;c.memoize=function(a,b){var d={};return function(){var e=(b?b.apply(this,arguments):arguments[0])+"";return p.call(d,e)?d[e]:d[e]=a.apply(this,arguments)}};c.merge=Ma;c.min=function(a,b,d){var e=Infinity,c=e;if(!b&&m(a)){d=-1;for(var g=a.length;++d< +g;){var h=a[d];hF(g,d,1))c[d]=a});return c};c.once=function(a){var b,d;return function(){if(b)return d;b=!0;d=a.apply(this,arguments);a=null;return d}};c.pairs= +function(a){for(var b=-1,d=A(a),e=d.length,c=Array(e);++b=l?(clearTimeout(h),h=null,k=j,f=a.apply(g,c)):h||(h=setTimeout(d,l));return f}};c.times=function(a,b,d){a=+a||0;for(var c=-1,f=Array(a);++cd?E(0,c+d):ua(d,c-1))+ +1);c--;)if(a[c]===b)return c;return-1};c.mixin=Wa;c.noConflict=function(){z._=nb;return this};c.random=function(a,b){null==a&&null==b&&(b=1);a=+a||0;null==b&&(b=a,a=0);return a+Za($a()*((+b||0)-a+1))};c.reduce=sa;c.reduceRight=Ra;c.result=function(a,b){var c=a?a[b]:null;return v(c)?a[b]():c};c.size=function(a){var b=a?a.length:0;return typeof b=="number"?b:A(a).length};c.some=Sa;c.sortedIndex=Ua;c.template=function(a,b,d){var e=c.templateSettings;a||(a="");d=ma({},d,e);var f=ma({},d.imports,e.imports), +e=A(f),f=pa(f),g=0,h=d.interpolate||ca,k=!(1==e.length&&"_"==e[0]&&f[0]===c),j="__p+='";a.replace(RegExp((d.escape||ca).source+"|"+h.source+"|"+(h===Ya?ub:ca).source+"|"+(d.evaluate||ca).source+"|$","g"),function(b,c,d,e,f,h){d||(d=e);j+=a.slice(g,h).replace(wb,fb);c&&(j+="'+__e("+c+")+'");f&&(j+="';"+f+";__p+='");d&&(j+="'+((__t=("+d+"))==null?'':__t)+'");k||(k=f||ob.test(c||d));g=h+b.length;return b});j+="';\n";h=d=d.variable;if(!h)if(d="obj",k)j="with("+d+"){"+j+"}";else var l=RegExp("(\\(\\s*)"+ +d+"\\."+d+"\\b","g"),j=j.replace(tb,"$&"+d+".").replace(l,"$1__d");j=(k?j.replace(qb,""):j).replace(rb,"$1").replace(sb,"$1;");j="function("+d+"){"+(h?"":d+"||("+d+"={});")+"var __t,__p='',__e=_.escape"+(k?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(h?"":",__d="+d+"."+d+"||"+d)+";")+j+"return __p}";try{var m=Function(e,"return "+j).apply(ea,f)}catch(n){throw n.source=j,n;}if(b)return m(b);m.source=j;return m};c.unescape=function(a){return null==a?"":(a+"").replace(pb, +ib)};c.uniqueId=function(a){var b=++mb;return(null==a?"":a+"")+b};c.all=Oa;c.any=Sa;c.detect=Pa;c.foldl=sa;c.foldr=Ra;c.include=Na;c.inject=sa;x(c,function(a,b){c.prototype[b]||(c.prototype[b]=function(){var b=[this.__wrapped__];aa.apply(b,arguments);return a.apply(c,b)})});c.first=ta;c.last=function(a,b,c){if(a){var e=0,f=a.length;if(typeof b=="function"){var g=f;for(b=l(b,c);g--&&b(a[g],g,a);)e++}else if(e=b,null==e||c)return a[f-1];return n(a,E(0,f-e))}};c.take=ta;c.head=ta;x(c,function(a,b){c.prototype[b]|| +(c.prototype[b]=function(b,e){var f=a(this.__wrapped__,b,e);return null==b||e&&typeof b!="function"?f:new c(f)})});c.VERSION="1.0.0-rc.3";c.prototype.toString=function(){return this.__wrapped__+""};c.prototype.value=Xa;c.prototype.valueOf=Xa;t(["join","pop","shift"],function(a){var b=u[a];c.prototype[a]=function(){return b.apply(this.__wrapped__,arguments)}});t(["push","reverse","sort","unshift"],function(a){var b=u[a];c.prototype[a]=function(){b.apply(this.__wrapped__,arguments);return this}});t(["concat", +"slice","splice"],function(a){var b=u[a];c.prototype[a]=function(){return new c(b.apply(this.__wrapped__,arguments))}});da&&t(["pop","shift","splice"],function(a){var b=u[a],d="splice"==a;c.prototype[a]=function(){var a=this.__wrapped__,f=b.apply(a,arguments);0===a.length&&delete a[0];return d?new c(f):f}});typeof define=="function"&&typeof define.amd=="object"&&define.amd?(z._=c,define(function(){return c})):xa?typeof module=="object"&&module&&module.exports==xa?(module.exports=c)._=c:xa._=c:z._= +c})(this); \ No newline at end of file diff --git a/lodash.underscore.js b/lodash.underscore.js index a62e29917..99847dcc8 100644 --- a/lodash.underscore.js +++ b/lodash.underscore.js @@ -787,15 +787,17 @@ * _.assign({ 'name': 'moe' }, { 'age': 40 }); * // => { 'name': 'moe', 'age': 40 } */ - function assign(object, source, guard) { - var args = arguments, - index = 0, - length = typeof guard == 'number' ? 2 : args.length; - - while (++index < length) { - (isArray(args[index]) ? forEach : forOwn)(args[index], function(value, key) { - object[key] = value; - }); + function assign(object) { + if (!object) { + return object; + } + for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) { + var iteratee = arguments[argsIndex]; + if (iteratee) { + for (var key in iteratee) { + object[key] = iteratee[key]; + } + } } return object; } @@ -857,17 +859,19 @@ * _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' }); * // => { 'flavor': 'chocolate', 'sprinkles': 'rainbow' } */ - function defaults(object, source, guard) { - var args = arguments, - index = 0, - length = typeof guard == 'number' ? 2 : args.length; - - while (++index < length) { - (isArray(args[index]) ? forEach : forOwn)(args[index], function(value, key) { - if (object[key] == null) { - object[key] = value; + function defaults(object) { + if (!object) { + return object; + } + for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) { + var iteratee = arguments[argsIndex]; + if (iteratee) { + for (var key in iteratee) { + if (object[key] == null) { + object[key] = iteratee[key]; + } } - }); + } } return object; } diff --git a/lodash.underscore.min.js b/lodash.underscore.min.js index 3165723d3..7fb7e2e15 100644 --- a/lodash.underscore.min.js +++ b/lodash.underscore.min.js @@ -4,29 +4,29 @@ * Build: `lodash underscore -m -o ./lodash.underscore.min.js` * Underscore.js 1.4.3 underscorejs.org/LICENSE */ -;(function(n,t){function r(n,t){var r;if(!n)return n;t||(t=U);for(r in n)if(at.call(n,r)&&t(n[r],r,n)===X)break;return n}function e(n,t){var r;if(n)for(r in t||(t=U),n)if(t(n[r],r,n)===X)break}function u(n,t,r){if(n){t=t&&typeof r=="undefined"?t:a(t,r);var e=n.length;if(r=-1,typeof e=="number")for(;++rt||typeof n=="undefined")return 1;if(nr?0:r);++eo&&(o=f)}}else t=a(t,r),u(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n) -});return o}function R(n,t){return k(n,t+"")}function T(n,t,r,e){var o=3>arguments.length;if(t=a(t,e,X),qt(n)){var i=-1,f=n.length;for(o&&(r=n[++i]);++iarguments.length;if(typeof u!="number")var i=Ft(n),u=i.length;return t=a(t,e,X),N(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=J,n[a]):t(r,n[a],a,f)}),r}function B(n,t,r){var e;if(t=a(t,r),qt(n)){r=-1;for(var o=n.length;++rr?ht(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(f,c))&&(r&&f.push(c),i.push(e))}return i}function P(n,t){var r;if(Et||lt&&2"']/g,et=/['\n\r\t\u2028\u2029\\]/g,ut=Math.ceil,ot=Q.concat,it=Math.floor,at=L.hasOwnProperty,ft=Q.push,ct=L.toString,lt=nt.test(lt=p.bind)&<,pt=nt.test(pt=Array.isArray)&&pt,st=n.isFinite,vt=n.isNaN,gt=nt.test(gt=Object.keys)&>,ht=Math.max,yt=Math.min,_t=Math.random,mt="[object Array]",dt="[object Boolean]",bt="[object Date]",jt="[object Number]",wt="[object Object]",At="[object RegExp]",xt="[object String]",L=!!n.attachEvent,Et=lt&&/\n|true/.test(lt+L),Ot=(Ot={0:1,length:1},Q.splice.call(Ot,0,1),Ot[0]),St=arguments.constructor==Object,Nt={"boolean":J,"function":G,object:G,number:J,string:J,undefined:J},kt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"}; -o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},o.isArguments=function(n){return"[object Arguments]"==ct.call(n)},o.isArguments(arguments)||(o.isArguments=function(n){return n?at.call(n,"callee"):J});var Ft=gt?function(n){return b(n)?gt(n):[]}:v,Rt={"&":"&","<":"<",">":">",'"':""","'":"'"},Tt=_(Rt),qt=pt||function(n){return St&&n instanceof Array||ct.call(n)==mt};d(/x/)&&(d=function(n){return n instanceof Function||"[object Function]"==ct.call(n) -}),o.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},o.bind=P,o.bindAll=function(n){for(var t=ot.apply(Q,arguments),r=1$(e,o,r)&&u.push(o)}return u},o.filter=O,o.flatten=M,o.forEach=N,o.functions=y,o.groupBy=function(n,t,r){var e={};return t=a(t,r),N(n,function(n,r,u){r=t(n,r,u)+"",(at.call(e,r)?e[r]:e[r]=[]).push(n)}),e},o.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else e=t==H||r?1:t||e;return p(n,0,yt(ht(0,u-e),u))},o.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++e$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n; -o.push(i)}}return o},o.invert=_,o.invoke=function(n,t){var r=p(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},o.keys=Ft,o.map=k,o.max=F,o.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return at.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},o.min=function(n,t,r){var e=1/0,o=e;if(!t&&qt(n)){r=-1;for(var i=n.length;++r$(t,e,1)&&(r[e]=n)}),r},o.once=function(n){var t,r;return function(){return t?r:(t=G,r=n.apply(this,arguments),n=H,r)}},o.pairs=function(n){for(var t=-1,r=Ft(n),e=r.length,u=Array(e);++t$(arguments,u,1)&&e.push(u)}return e},o.wrap=function(n,t){return function(){var r=[n];return ft.apply(r,arguments),t.apply(this,r)}},o.zip=function(n){for(var t=-1,r=n?F(R(arguments,"length")):0,e=Array(r);++tr?ht(0,e+r):yt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=V,o.noConflict=function(){return n._=Y,this},o.random=function(n,t){return n==H&&t==H&&(t=1),n=+n||0,t==H&&(t=n,n=0),n+it(_t()*((+t||0)-n+1)) -},o.reduce=T,o.reduceRight=q,o.result=function(n,t){var r=n?n[t]:H;return d(r)?n[t]():r},o.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ft(n).length},o.some=B,o.sortedIndex=z,o.template=function(n,t,r){n||(n=""),r=h({},r,o.templateSettings);var e=0,u="__p+='",i=r.variable;n.replace(RegExp((r.escape||tt).source+"|"+(r.interpolate||tt).source+"|"+(r.evaluate||tt).source+"|$","g"),function(t,r,o,i,a){u+=n.slice(e,a).replace(et,f),u+=r?"'+_['escape']("+r+")+'":i?"';"+i+";__p+='":o?"'+((__t=("+o+"))==null?'':__t)+'":"",e=a+t.length -}),u+="';\n",i||(i="obj",u="with("+i+"||{}){"+u+"}"),u="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+u+"return __p}";try{var a=Function("_","return "+u)(o)}catch(c){throw c.source=u,c}return t?a(t):(a.source=u,a)},o.unescape=function(n){return n==H?"":(n+"").replace(Z,s)},o.uniqueId=function(n){var t=++W+"";return n?n+t:t},o.all=E,o.any=B,o.detect=S,o.foldl=T,o.foldr=q,o.include=x,o.inject=T,o.first=D,o.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==H||r)return n[u-1];return p(n,ht(0,u-e))}},o.take=D,o.head=D,o.chain=function(n){return n=new o(n),n.__chain__=G,n},o.VERSION="1.0.0-rc.3",V(o),o.prototype.chain=function(){return this.__chain__=G,this},o.prototype.value=function(){return this.__wrapped__},u("pop push reverse shift sort splice unshift".split(" "),function(n){var t=Q[n];o.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),Ot&&0===n.length&&delete n[0],this -}}),u(["concat","join","slice"],function(n){var t=Q[n];o.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=G),n}}),K?typeof module=="object"&&module&&module.exports==K?(module.exports=o)._=o:K._=o:n._=o})(this); \ No newline at end of file +;(function(n,t){function r(n,t){var r;if(n)for(r in t||(t=P),n)if(t(n[r],r,n)===W)break}function e(n,t,r){if(n){t=t&&typeof r=="undefined"?t:i(t,r);var e=n.length;if(r=-1,typeof e=="number")for(;++rt||typeof n=="undefined")return 1;if(nr?0:r);++eo&&(o=f)}}else t=i(t,r),e(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function F(n,t){return N(n,t+"") +}function R(n,t,r,u){var o=3>arguments.length;if(t=i(t,u,W),Tt(n)){var a=-1,f=n.length;for(o&&(r=n[++a]);++aarguments.length;if(typeof u!="number")var a=kt(n),u=a.length;return t=i(t,e,W),S(n,function(e,i,f){i=a?a[--u]:--u,r=o?(o=H,n[i]):t(r,n[i],i,f)}),r}function q(n,t,r){var u;if(t=i(t,r),Tt(n)){r=-1;for(var o=n.length;++rr?gt(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])M(f,c))&&(r&&f.push(c),a.push(e))}return a}function C(n,t){var r;if(xt||ct&&2"']/g,rt=/['\n\r\t\u2028\u2029\\]/g,et=Math.ceil,ut=L.concat,ot=Math.floor,it=K.hasOwnProperty,at=L.push,ft=K.toString,ct=Z.test(ct=l.bind)&&ct,lt=Z.test(lt=Array.isArray)&<,st=n.isFinite,pt=n.isNaN,vt=Z.test(vt=Object.keys)&&vt,gt=Math.max,ht=Math.min,yt=Math.random,_t="[object Array]",mt="[object Boolean]",dt="[object Date]",bt="[object Number]",jt="[object Object]",wt="[object RegExp]",At="[object String]",K=!!n.attachEvent,xt=ct&&/\n|true/.test(ct+K),Et=(Et={0:1,length:1},L.splice.call(Et,0,1),Et[0]),Ot=arguments.constructor==Object,St={"boolean":H,"function":V,object:V,number:H,string:H,undefined:H},Nt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"}; +u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},u.isArguments=function(n){return"[object Arguments]"==ft.call(n)},u.isArguments(arguments)||(u.isArguments=function(n){return n?it.call(n,"callee"):H});var kt=vt?function(n){return d(n)?vt(n):[]}:p,Ft={"&":"&","<":"<",">":">",'"':""","'":"'"},Rt=y(Ft),Tt=lt||function(n){return Ot&&n instanceof Array||ft.call(n)==_t};m(/x/)&&(m=function(n){return n instanceof Function||"[object Function]"==ft.call(n) +}),u.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},u.bind=C,u.bindAll=function(n){for(var t=ut.apply(L,arguments),r=1M(e,o,r)&&u.push(o)}return u},u.filter=E,u.flatten=D,u.forEach=S,u.functions=h,u.groupBy=function(n,t,r){var e={};return t=i(t,r),S(n,function(n,r,u){r=t(n,r,u)+"",(it.call(e,r)?e[r]:e[r]=[]).push(n)}),e},u.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t=="function"){var o=u;for(t=i(t,r);o--&&t(n[o],o,n);)e++}else e=t==G||r?1:t||e;return l(n,0,ht(gt(0,u-e),u))},u.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++eM(o,i)){for(var a=r;--a;)if(0>M(t[a],i))continue n; +o.push(i)}}return o},u.invert=y,u.invoke=function(n,t){var r=l(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return S(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},u.keys=kt,u.map=N,u.max=k,u.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return it.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},u.min=function(n,t,r){var u=1/0,o=u;if(!t&&Tt(n)){r=-1;for(var a=n.length;++rM(t,r,1)&&(e[r]=n)}),e},u.once=function(n){var t,r;return function(){return t?r:(t=V,r=n.apply(this,arguments),n=G,r)}},u.pairs=function(n){for(var t=-1,r=kt(n),e=r.length,u=Array(e);++tM(arguments,u,1)&&e.push(u)}return e},u.wrap=function(n,t){return function(){var r=[n];return at.apply(r,arguments),t.apply(this,r)}},u.zip=function(n){for(var t=-1,r=n?k(F(arguments,"length")):0,e=Array(r);++tr?gt(0,e+r):ht(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=U,u.noConflict=function(){return n._=X,this},u.random=function(n,t){return n==G&&t==G&&(t=1),n=+n||0,t==G&&(t=n,n=0),n+ot(yt()*((+t||0)-n+1)) +},u.reduce=R,u.reduceRight=T,u.result=function(n,t){var r=n?n[t]:G;return m(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:kt(n).length},u.some=q,u.sortedIndex=I,u.template=function(n,t,r){n||(n=""),r=g({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||nt).source+"|"+(r.interpolate||nt).source+"|"+(r.evaluate||nt).source+"|$","g"),function(t,r,u,i,f){o+=n.slice(e,f).replace(rt,a),o+=r?"'+_['escape']("+r+")+'":i?"';"+i+";__p+='":u?"'+((__t=("+u+"))==null?'':__t)+'":"",e=f+t.length +}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var f=Function("_","return "+o)(u)}catch(c){throw c.source=o,c}return t?f(t):(f.source=o,f)},u.unescape=function(n){return n==G?"":(n+"").replace(Y,s)},u.uniqueId=function(n){var t=++Q+"";return n?n+t:t},u.all=x,u.any=q,u.detect=O,u.foldl=R,u.foldr=T,u.include=A,u.inject=R,u.first=B,u.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t=="function"){var o=u;for(t=i(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==G||r)return n[u-1];return l(n,gt(0,u-e))}},u.take=B,u.head=B,u.chain=function(n){return n=new u(n),n.__chain__=V,n},u.VERSION="1.0.0-rc.3",U(u),u.prototype.chain=function(){return this.__chain__=V,this},u.prototype.value=function(){return this.__wrapped__},e("pop push reverse shift sort splice unshift".split(" "),function(n){var t=L[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),Et&&0===n.length&&delete n[0],this +}}),e(["concat","join","slice"],function(n){var t=L[n];u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new u(n),n.__chain__=V),n}}),J?typeof module=="object"&&module&&module.exports==J?(module.exports=u)._=u:J._=u:n._=u})(this); \ No newline at end of file