diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 563053db1..c92a30aef 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -236,9 +236,8 @@ return false; }()); - /** Detect various environments */ - var isIeOpera = reNative.test(root.attachEvent), - isV8 = nativeBind && !/\n|true/.test(nativeBind + isIeOpera); + /** Used to enable optimizations for V8 */ + var isV8 = nativeBind && !/\n/.test(nativeBind) && !reNative.test(root.attachEvent); /*--------------------------------------------------------------------------*/ @@ -2841,7 +2840,7 @@ function difference(array) { var index = -1, indexOf = getIndexOf(), - length = array.length, + length = array ? array.length : 0, flattened = baseFlatten(arguments, true, true, 1), result = []; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index fe423401f..9e2ed9831 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,35 +4,35 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` */ ;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(tt?0:t);++eu(f,c))&&(t&&f.push(c),i.push(a))}return i}function s(n){return function(r,t,e){var u={};t=L(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++ee&&(e=t,u=n)});else for(;++ou&&(u=t); -return u}function M(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=a(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++oarguments.length;return r=a(r,e,4),F(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function W(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0); -return k(n,function(n){var t;t=++r,t=0+Tr(Ir()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function z(n,r,t){var e;r=L(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function U(n,r,t){var e=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=-1;for(r=L(r,t,3);++ie?Mr(0,u+e):e||0}else if(e)return e=H(r,t),r[e]===t?e:-1;return n(r,t,e)}function G(n,r,t){if(typeof r!="number"&&null!=r){var e=0,o=-1,i=n?n.length:0;for(r=L(r,t,3);++o>>1,t(n[e])u(f,c))&&(t&&f.push(c),i.push(a))}return i}function s(n){return function(r,t,e){var u={};t=L(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++ee&&(e=t,u=n)});else for(;++ou&&(u=t); +return u}function M(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=a(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++oarguments.length;return r=a(r,e,4),F(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function W(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0); +return k(n,function(n){var t;t=++r,t=0+Tr(Ir()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function z(n,r,t){var e;r=L(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function U(n,r,t){var e=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=-1; +for(r=L(r,t,3);++ie?Mr(0,u+e):e||0}else if(e)return e=H(r,t),r[e]===t?e:-1;return n(r,t,e)}function G(n,r,t){if(typeof r!="number"&&null!=r){var e=0,o=-1,i=n?n.length:0;for(r=L(r,t,3);++o>>1,t(n[e])/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Rr||(f=function(n){if(A(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),m(arguments)||(m=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Or.call(n,"callee")||!1 -});var Ur=kr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&xr.call(n)==ir||!1},Vr=function(n){var r,t=[];if(!n||!hr[typeof n])return t;for(r in n)Or.call(n,r)&&t.push(r);return t},Gr=Dr?function(n){return A(n)?Dr(n):[]}:Vr,Hr={"&":"&","<":"<",">":">",'"':""","'":"'"},Jr=w(Hr),Kr=RegExp("("+Gr(Jr).join("|")+")","g"),Lr=RegExp("["+Gr(Hr).join("")+"]","g"),Qr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(r(n[t],t,n)===rr)break;return n},Xr=function(n,r){var t; -if(!n||!hr[typeof n])return n;for(t in n)if(Or.call(n,t)&&r(n[t],t,n)===rr)break;return n};x(/x/)&&(x=function(n){return typeof n=="function"&&"[object Function]"==xr.call(n)});var Yr=s(function(n,r,t){Or.call(n,t)?n[t]++:n[t]=1}),Zr=s(function(n,r,t){(Or.call(n,t)?n[t]:n[t]=[]).push(r)}),nt=s(function(n,r,t){n[t]=r});o.after=function(n,r){if(!x(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=K,o.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;i.push(f)}}return i},o.invert=w,o.invoke=function(n,r){var t=u(arguments,2),e=-1,o=typeof r=="function",i=n?n.length:0,f=Array(typeof i=="number"?i:0);return k(n,function(n){f[++e]=(o?r:n[r]).apply(n,t)}),f},o.keys=Gr,o.map=q,o.max=D,o.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Or.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0; -if(r||typeof i!="number")r=L(r,t,3),k(n,function(n,t,o){t=r(n,t,o),tr(t,u)&&(e[u]=n)}),e},o.once=function(n){var r,t;if(!x(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},o.pairs=function(n){for(var r=-1,t=Gr(n),e=t.length,u=Array(e);++r/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Rr||(f=function(n){if(A(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),m(arguments)||(m=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Or.call(n,"callee")||!1 +});var Pr=kr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&xr.call(n)==ir||!1},Ur=function(n){var r,t=[];if(!n||!hr[typeof n])return t;for(r in n)Or.call(n,r)&&t.push(r);return t},Vr=Dr?function(n){return A(n)?Dr(n):[]}:Ur,Gr={"&":"&","<":"<",">":">",'"':""","'":"'"},Hr=w(Gr),Jr=RegExp("("+Vr(Hr).join("|")+")","g"),Kr=RegExp("["+Vr(Gr).join("")+"]","g"),Lr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(r(n[t],t,n)===rr)break;return n},Qr=function(n,r){var t; +if(!n||!hr[typeof n])return n;for(t in n)if(Or.call(n,t)&&r(n[t],t,n)===rr)break;return n};x(/x/)&&(x=function(n){return typeof n=="function"&&"[object Function]"==xr.call(n)});var Xr=s(function(n,r,t){Or.call(n,t)?n[t]++:n[t]=1}),Yr=s(function(n,r,t){(Or.call(n,t)?n[t]:n[t]=[]).push(r)}),Zr=s(function(n,r,t){n[t]=r});o.after=function(n,r){if(!x(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=K,o.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;i.push(f)}}return i},o.invert=w,o.invoke=function(n,r){var t=u(arguments,2),e=-1,o=typeof r=="function",i=n?n.length:0,f=Array(typeof i=="number"?i:0);return k(n,function(n){f[++e]=(o?r:n[r]).apply(n,t)}),f},o.keys=Vr,o.map=q,o.max=D,o.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Or.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0; +if(r||typeof i!="number")r=L(r,t,3),k(n,function(n,t,o){t=r(n,t,o),tr(t,u)&&(e[u]=n)}),e},o.once=function(n){var r,t;if(!x(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},o.pairs=function(n){for(var r=-1,t=Vr(n),e=t.length,u=Array(e);++rr?0:r);++nr?0:r);++nt?Mr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=Y,o.noConflict=function(){return vr._=jr,this},o.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Tr(Ir()*(r-n+1))},o.reduce=$,o.reduceRight=I,o.result=function(n,r){if(n){var t=n[r]; -return x(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Gr(n).length},o.some=z,o.sortedIndex=H,o.template=function(n,r,e){var u=o,i=u.templateSettings;n=(n||"")+"",e=d({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ur,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r -}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var c=Function("_","return "+a)(u)}catch(l){throw l.source=a,l}return r?c(r):(c.source=a,c)},o.unescape=function(n){return null==n?"":(n+"").replace(Kr,y)},o.uniqueId=function(n){var r=++nr+"";return n?n+r:r},o.all=B,o.any=z,o.detect=R,o.findWhere=function(n,r){return C(n,r,!0)},o.foldl=$,o.foldr=I,o.include=S,o.inject=$,o.first=U,o.last=function(n,r,t){var e=0,o=n?n.length:0; +return x(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Vr(n).length},o.some=z,o.sortedIndex=H,o.template=function(n,r,e){var u=o,i=u.templateSettings;n=(n||"")+"",e=d({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ur,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r +}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var c=Function("_","return "+a)(u)}catch(l){throw l.source=a,l}return r?c(r):(c.source=a,c)},o.unescape=function(n){return null==n?"":(n+"").replace(Jr,y)},o.uniqueId=function(n){var r=++nr+"";return n?n+r:r},o.all=B,o.any=z,o.detect=R,o.findWhere=function(n,r){return C(n,r,!0)},o.foldl=$,o.foldr=I,o.include=S,o.inject=$,o.first=U,o.last=function(n,r,t){var e=0,o=n?n.length:0; if(typeof r!="number"&&null!=r){var i=o;for(r=L(r,t,3);i--&&r(n[i],i,n);)e++}else if(e=r,null==e||t)return n?n[o-1]:Z;return u(n,Mr(0,o-e))},o.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=O(n)),null==r||t?n?n[0+Tr(Ir()*(n.length-1-0+1))]:Z:(n=W(n),n.length=$r(Mr(0,r),n.length),n)},o.take=U,o.head=U,Y(o),o.VERSION="2.2.1",o.prototype.chain=function(){return this.__chain__=!0,this},o.prototype.value=function(){return this.__wrapped__},k("pop push reverse shift sort splice unshift".split(" "),function(n){var r=br[n]; -o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Pr.spliceObjects||0!==n.length||delete n[0],this}}),k(["concat","join","slice"],function(n){var r=br[n];o.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(vr._=o, define(function(){return o})):yr&&mr?_r?(mr.exports=o)._=o:yr._=o:vr._=o}).call(this); \ No newline at end of file +o.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Cr.spliceObjects||0!==n.length||delete n[0],this}}),k(["concat","join","slice"],function(n){var r=br[n];o.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(vr._=o, define(function(){return o})):yr&&mr?_r?(mr.exports=o)._=o:yr._=o:vr._=o}).call(this); \ No newline at end of file