diff --git a/build/post-compile.js b/build/post-compile.js index c7eb6dc0e..29fa06152 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -38,17 +38,19 @@ ); // replace vars for `false` and `true` with boolean literals - [/(\w+)\s*=\s*!1\b/.exec(source), /(\w+)\s*=\s*!0\b/.exec(source)].forEach(function(varName, index) { + [/(\w+)\s*=\s*!1\b/, /(\w+)\s*=\s*!0\b/].forEach(function(regexp, index) { + var varName = (regexp.exec(source) || 0)[1]; if (varName) { - varName = varName[1]; source = source.replace(RegExp('([!=]==\\s*)' + varName + '|' + varName + '(\\s*[!=]==)', 'g'), '$1' + !!index + '$2'); } }); // replace `!1` and `!0` in expressions with `false` and `true` values - source = source - .replace(/([!=]==\s*)!1|!1(\s*[!=]==)/g, '$1false$2') - .replace(/([!=]==\s*)!0|!0(\s*[!=]==)/g, '$1true$2'); + [/([!=]==)\s*!1|(.)!1\s*([!=]==)/g, /([!=]==)\s*!0|(.)!0\s*([!=]==)/g].forEach(function(regexp, index) { + source = source.replace(regexp, function(match, prelude, chr, postlude) { + return (prelude || chr + (/\w/.test(chr) ? ' ' : '')) + !!index + (postlude || ''); + }); + }); // flip `typeof` expressions to help optimize Safari and // correct the AMD module definition for AMD build optimizers diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index deae2acce..92b8651bf 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -35,10 +35,10 @@ if(true===r)var f=!0,l=!1;else lt(r)&&(f=r.leading,l="trailing"in r?r.trailing:l return dt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Br,a.map=bt,a.max=_t,a.memoize=function(n,t){function r(){var e=r.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return ur.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},a.merge=st,a.min=function(n,t,r){var e=1/0,u=e;if(!t&&Ar(n)){r=-1;for(var o=n.length;++re(i,r))&&(o[r]=n)}),o},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Br(n),e=r.length,u=$t(e);++tr?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===false)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(true===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index ea1dd498c..92c606f8c 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -27,7 +27,7 @@ return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max return u},t.reject=function(n,t,r){return t=W(t,r),E(n,function(n,r,e){return!t(n,r,e)})},t.rest=C,t.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return N(n,function(n){var r=bt(qt()*(++t+1));e[t]=e[r],e[r]=n}),e},t.sortBy=function(n,t,r){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=W(t,r),N(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(e);o--;)i[o]=i[o].c;return i},t.tap=function(n,t){return t(n),n},t.throttle=function(n,t){function r(){i=new Date,a=null,u=n.apply(o,e) }var e,u,o,i=0,a=null;return function(){var f=new Date,l=t-(f-i);return e=arguments,o=this,0r?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1)) },t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null;return b(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){n||(n=""),e=g({},e,t.templateSettings);var u=0,o="__p+='",i=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,i,f){return o+=n.slice(u,f).replace(rt,a),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),e&&(o+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t }),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)(t)}catch(l){throw l.source=o,l}return r?f(r):(f.source=o,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length;