From a90453461e20a0a75d4252d405793a529a78750b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 13 Mar 2014 09:28:38 -0700 Subject: [PATCH] Adjust `fromIndex` and `length` coercions. --- dist/lodash.compat.js | 44 +++++++++---------- dist/lodash.compat.min.js | 34 +++++++-------- dist/lodash.js | 80 +++++++++++++++++------------------ dist/lodash.min.js | 54 +++++++++++------------ dist/lodash.underscore.js | 68 ++++++++++++++--------------- dist/lodash.underscore.min.js | 44 +++++++++---------- lodash.js | 44 +++++++++---------- 7 files changed, 184 insertions(+), 184 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 222581c7d..72ab52354 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -274,7 +274,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - var index = (fromIndex | 0) - 1, + var index = (+fromIndex || 0) - 1, length = array ? array.length : 0; while (++index < length) { @@ -1397,7 +1397,7 @@ * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (fromIndex | 0) - 1, + var index = (+fromIndex || 0) - 1, length = array ? array.length : 0, result = []; @@ -2610,7 +2610,7 @@ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) | 0; + fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : (fromIndex || 0); } else if (fromIndex) { var index = sortedIndex(array, value); return (length && array[index] === value) ? index : -1; @@ -2913,13 +2913,13 @@ var index = -1, length = array ? array.length : 0; - start |= 0; + start = +start || 0; if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { start = length; } - end = typeof end == 'undefined' ? length : (end | 0); + end = typeof end == 'undefined' ? length : (+end || 0); if (end < 0) { end = nativeMax(length + end, 0); } else if (end > length) { @@ -3539,10 +3539,10 @@ * // => true */ function contains(collection, target, fromIndex) { - var length = collection ? collection.length : 0; - fromIndex = (typeof fromIndex == 'number' && fromIndex) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); + fromIndex = (typeof fromIndex == 'number' && +fromIndex) || 0; - if (typeof length == 'number' && length > -1) { + if (length) { if (typeof collection == 'string' || !isArray(collection) && isString(collection)) { if (fromIndex >= length) { return false; @@ -3552,7 +3552,7 @@ : collection.indexOf(target, fromIndex) > -1; } var indexOf = getIndexOf(); - fromIndex = fromIndex < 0 ? nativeMax(0, (length | 0) + fromIndex) : fromIndex; + fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex; return indexOf(collection, target, fromIndex) > -1; } var index = -1, @@ -3997,8 +3997,8 @@ var args = slice(arguments, 2), index = -1, isFunc = typeof methodName == 'function', - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); @@ -4047,8 +4047,8 @@ */ function map(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { @@ -4436,7 +4436,7 @@ collection = collection.split(''); } if (n == null || guard) { - var length = (collection && collection.length) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); @@ -4461,8 +4461,8 @@ */ function shuffle(collection) { var index = -1, - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { var rand = baseRandom(0, ++index); @@ -4612,9 +4612,9 @@ */ function sortBy(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0, + length = collection && collection.length, multi = callback && isArray(callback), - result = Array(length < 0 ? 0 : length); + result = Array(length < 0 ? 0 : length >>> 0); if (!multi) { callback = lodash.createCallback(callback, thisArg, 3); @@ -6930,7 +6930,7 @@ target = String(target); var length = string.length; - position = (typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), length) : length) - target.length; + position = (typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), length) : length) - target.length; return position >= 0 && string.indexOf(target, position) == position; } @@ -7183,7 +7183,7 @@ */ function startsWith(string, target, position) { string = string == null ? '' : String(string); - position = typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), string.length) : 0; + position = typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), string.length) : 0; return string.lastIndexOf(target, position) == position; } @@ -7489,11 +7489,11 @@ if (options && isObject(options)) { var separator = 'separator' in options ? options.separator : separator; - length = 'length' in options ? options.length | 0 : length; + length = 'length' in options ? +options.length || 0 : length; omission = 'omission' in options ? String(options.omission) : omission; } else if (options != null) { - length = options | 0; + length = +options || 0; } string = string == null ? '' : String(string); if (length >= string.length) { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 9c5085cb4..73263be41 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,7 +3,7 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(nt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202a(t,l)&&f.push(l);return f}function pt(n,t){var r=-1,e=n,u=n?n.length:0;if(typeof u=="number"&&-1(e|=0)?0:e,je.unindexedChars&&dr(r)&&(r=r.split(""));e--&&false!==t(r[e],e,n););else mt(n,t,Le);return n}function gt(n,t,r,e){e=(0|e)-1;for(var u=n?n.length:0,o=[];++e(e|=0)?0:e,je.unindexedChars&&dr(r)&&(r=r.split(""));e--&&false!==t(r[e],e,n););else mt(n,t,Le);return n}function gt(n,t,r,e){e=(+e||0)-1;for(var u=n?n.length:0,o=[];++ei(s,h)&&((u||f)&&s.push(h),c.push(p))}return c}function jt(n,t){for(var r=-1,e=t(n),u=e.length,o=Ir(u);++rr&&(r=0),s&&(a=[]),p&&(i=[]),h=[n,t,r,e,u,o,a,i],t==x||t==(x|O)?c(h):X(h)) }function St(){var n=(n=o.indexOf)===Ft?r:n;return n}function It(n){return typeof n=="function"&&Xr.test(Jr.call(n))}function Rt(n){var t,r;return!n||Zr.call(n)!=ot||!ne.call(n,"constructor")&&(t=n.constructor,gr(t)&&!(t instanceof t))||!je.argsClass&&pr(n)||!je.nodeClass&&h(n)?false:je.ownLast?(vt(n,function(n,t,e){return r=ne.call(e,t),false},br),false!==r):(vt(n,function(n,t){r=t},br),typeof r=="undefined"||ne.call(n,r))}function Nt(n){for(var t=-1,r=br(n),e=r.length,u=[];++ta?0:a)}function Ft(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0|(0>e?ge(0,u+e):e); +}return u}function Tt(n,t,r){var e=-1,u=n?n.length:0;for(t=o.createCallback(t,r,3);++ea?0:a)}function Ft(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?ge(0,u+e):e||0; else if(e)return e=Bt(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Pt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,a=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)a++}else a=null==t||r?1:t;return a=e-a,zt(n,0,0>a?0:a)}function $t(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,a=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)a++}else if(a=t,null==a||r)return n?n[e-1]:w;return a=e-a,zt(n,0>a?0:a)}function Dt(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,a=0; -for(t=o.createCallback(t,r,3);++et?0:t;return zt(n,a)}function zt(n,t,r){var e=-1,u=n?n.length:0;for(t|=0,0>t?t=ge(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:0|r,0>r?r=ge(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Ir(u);++e>>1,r(n[e])r?0:r);++tr?ge(0,(0|e)+r):r,-1u?0:u);if(t=o.createCallback(t,r,3),Ne(n))for(;++ea&&(a=l)}else t=null==t&&dr(n)?u:o.createCallback(t,r,3),pt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function nr(n,t,r,e){var u=3>arguments.length;if(t=o.createCallback(t,e,4),Ne(n)){var a=-1,i=n.length;for(u&&i&&(r=n[++a]);++aarguments.length;return t=o.createCallback(t,e,4),ht(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function rr(n){var t=-1,r=0|(n&&n.length),e=Ir(0>r?0:r); +for(t=o.createCallback(t,r,3);++et?0:t;return zt(n,a)}function zt(n,t,r){var e=-1,u=n?n.length:0;for(t=+t||0,0>t?t=ge(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=ge(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Ir(u);++e>>1,r(n[e])r?0:r);++t>>0);if(r=typeof r=="number"&&+r||0,e){if(typeof n=="string"||!Ne(n)&&dr(n))return rr?ge(0,e+r):r,-1u?0:u>>>0);if(t=o.createCallback(t,r,3),Ne(n))for(;++ea&&(a=l)}else t=null==t&&dr(n)?u:o.createCallback(t,r,3),pt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function nr(n,t,r,e){var u=3>arguments.length;if(t=o.createCallback(t,e,4),Ne(n)){var a=-1,i=n.length;for(u&&i&&(r=n[++a]);++aarguments.length;return t=o.createCallback(t,e,4),ht(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function rr(n){var t=-1,r=n&&n.length,e=Ir(0>r?0:r>>>0); return pt(n,function(n){var r=xt(0,++t);e[t]=e[r],e[r]=n}),e}function er(n,t,r){var e;if(t=o.createCallback(t,r,3),Ne(n)){r=-1;for(var u=n.length;++rarguments.length)return At(n,x,null,t);if(n)var r=n[S]?n[S][2]:n.length,e=zt(arguments,2),r=r-e.length;return At(n,x|O,r,t,e)}function or(n,t,r){var e,u,o,a,i,l,f,c=0,s=false,p=true;if(!gr(n))throw new zr;if(t=0>t?0:t,true===r)var h=true,p=false;else vr(r)&&(h=r.leading,s="maxWait"in r&&(ge(t,r.maxWait)||0),p="trailing"in r?r.trailing:p); var g=function(){var r=t-(Be()-a);0>=r||r>t?(u&&Gr(u),r=f,u=l=f=w,r&&(c=Be(),o=n.apply(i,e),l||u||(e=i=null))):l=ue(g,r)},v=function(){l&&Gr(l),u=l=f=w,(p||s!==t)&&(c=Be(),o=n.apply(i,e),l||u||(e=i=null))};return function(){if(e=arguments,a=Be(),i=this,f=p&&(l||!h),false===s)var r=h&&!l;else{u||h||(c=a);var y=s-(a-c),m=0>=y||y>s;m?(u&&(u=Gr(u)),c=a,o=n.apply(i,e)):u||(u=ue(v,y))}return m&&l?l=Gr(l):l||t===s||(l=ue(g,t)),r&&(m=true,o=n.apply(i,e)),!m||l||u||(e=i=null),o}}function ar(n){if(!gr(n))throw new zr; return function(){return!n.apply(this,arguments)}}function ir(n,t,r){if(!n)return n;var e=arguments,u=0,o=e.length,a=typeof r;if("number"!=a&&"string"!=a||!e[3]||e[3][r]!==t||(o=2),3(h?e(h,c):i(f,c))){for(u=o,(h||f).push(c);--u;)if(h=a[u],0>(h?e(h,c):i(t[u],c)))continue n; -p.push(c)}}return p},o.invert=function(n,t){for(var r=-1,e=Le(n),u=e.length,o={};++ro?0:o);return pt(n,function(n){a[++e]=(u?t:n[t]).apply(n,r)}),a},o.keys=Le,o.keysIn=br,o.map=Jt,o.mapValues=function(n,t,r){var e={};return t=o.createCallback(t,r,3),dt(n,function(n,r,u){e[r]=t(n,r,u)}),e},o.matches=Or,o.max=Qt,o.memoize=function(n,t){if(!gr(n))throw new zr; +p.push(c)}}return p},o.invert=function(n,t){for(var r=-1,e=Le(n),u=e.length,o={};++ro?0:o>>>0);return pt(n,function(n){a[++e]=(u?t:n[t]).apply(n,r)}),a},o.keys=Le,o.keysIn=br,o.map=Jt,o.mapValues=function(n,t,r){var e={};return t=o.createCallback(t,r,3),dt(n,function(n,r,u){e[r]=t(n,r,u)}),e},o.matches=Or,o.max=Qt,o.memoize=function(n,t){if(!gr(n))throw new zr; var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return ne.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},o.merge=function(n,t,r){if(!n)return n;var e=arguments,u=e.length,o=typeof r;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u);for(a||(t=o.createCallback(t,r,3)),pt(n,function(n,r,u){if(a)for(r=t.length,u=Ir(r);r--;)u[r]=n[t[r]]; +return n},o.range=function(n,t,r){n=+n||0,r=null==r?1:+r||0,null==t?(t=n,n=0):t=+t||0;var e=-1;t=ge(0,Yr((t-n)/(r||1)));for(var u=Ir(t);++eu?0:u>>>0);for(a||(t=o.createCallback(t,r,3)),pt(n,function(n,r,u){if(a)for(r=t.length,u=Ir(r);r--;)u[r]=n[t[r]]; else u=t(n,r,u);f[++e]={a:u,b:e,c:n}}),u=f.length,f.sort(a?l:i);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,r){return t.call(r,n),n},o.throttle=function(n,t,r){var e=true,u=true;if(!gr(n))throw new zr;return false===r?e=false:vr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),ft.leading=e,ft.maxWait=+t,ft.trailing=u,or(n,t,ft)},o.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Ir(n);for(t=U(t,r,1);++er?ge(0,e+r):ve(r,e-1))+1);e--;)if(n[e]===t)return e; return-1},o.mixin=Er,o.noConflict=function(){return t._=Vr,this},o.noop=Ar,o.now=Be,o.pad=function(n,t,r){n=null==n?"":Dr(n),t|=0;var e=n.length;return e=n.length)return n;var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(mr(u)){if(n.slice(o).search(u)){var a,i,l=n.slice(0,o);for(u.global||(u=$r(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;a=u.exec(l);)i=a.index; -r=r.slice(0,null==i?o:i)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(L,b))},o.uniqueId=function(n){var t=++I;return Dr(null==n?"":n)+t},o.all=Zt,o.any=er,o.detect=Yt,o.findWhere=Yt,o.foldl=nr,o.foldr=tr,o.include=Vt,o.inject=nr,Er(function(){var n={};return dt(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=Wt,o.last=$t,o.sample=function(n,t,r){return n&&typeof n.length!="number"?n=wr(n):je.unindexedChars&&dr(n)&&(n=n.split("")),null==t||r?(t=0|(n&&n.length),0"']/g,F=/<%-([\s\S]+?)%>/g,P=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,K=/($^)/,M=/[.*+?^${}()|[\]\\]/g,V=/\bthis\b/,Z=/['\n\r\t\u2028\u2029\\]/g,X=/[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g,Y=" \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",G="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),H="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),J="[object Arguments]",Q="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Error]",et="[object Function]",ut="[object Number]",ot="[object Object]",at="[object RegExp]",it="[object String]",lt={}; +}catch(h){throw h.source=c,h}return t?s(t):(s.source=c,s)},o.trim=$e,o.trimLeft=De,o.trimRight=ze,o.truncate=function(n,t){var r=30,e="...";if(t&&vr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Dr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Dr(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(mr(u)){if(n.slice(o).search(u)){var a,i,l=n.slice(0,o);for(u.global||(u=$r(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;a=u.exec(l);)i=a.index; +r=r.slice(0,null==i?o:i)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(L,b))},o.uniqueId=function(n){var t=++I;return Dr(null==n?"":n)+t},o.all=Zt,o.any=er,o.detect=Yt,o.findWhere=Yt,o.foldl=nr,o.foldr=tr,o.include=Vt,o.inject=nr,Er(function(){var n={};return dt(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=Wt,o.last=$t,o.sample=function(n,t,r){if(n&&typeof n.length!="number"?n=wr(n):je.unindexedChars&&dr(n)&&(n=n.split("")),null==t||r){var e=(e=n&&n.length,-1>>0); +return 0"']/g,F=/<%-([\s\S]+?)%>/g,P=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,D=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,K=/($^)/,M=/[.*+?^${}()|[\]\\]/g,V=/\bthis\b/,Z=/['\n\r\t\u2028\u2029\\]/g,X=/[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g,Y=" \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",G="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),H="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),J="[object Arguments]",Q="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Error]",et="[object Function]",ut="[object Number]",ot="[object Object]",at="[object RegExp]",it="[object String]",lt={}; lt[et]=false,lt[J]=lt[Q]=lt[nt]=lt[tt]=lt[ut]=lt[ot]=lt[at]=lt[it]=true;var ft={leading:false,maxWait:0,trailing:false},ct={configurable:false,enumerable:false,value:null,writable:false},st={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},ht={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},gt={"function":true,object:true},vt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},yt=gt[typeof window]&&window||this,mt=gt[typeof exports]&&exports&&!exports.nodeType&&exports,gt=gt[typeof module]&&module&&!module.nodeType&&module,dt=mt&>&&typeof global=="object"&&global; !dt||dt.global!==dt&&dt.window!==dt&&dt.self!==dt||(yt=dt);var dt=gt&>.exports===mt&&mt,bt=_();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yt._=bt, define(function(){return bt})):mt&>?dt?(gt.exports=bt)._=bt:mt._=bt:yt._=bt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 675e5bcde..5f4ee1332 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -267,7 +267,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - var index = (fromIndex | 0) - 1, + var index = (+fromIndex || 0) - 1, length = array ? array.length : 0; while (++index < length) { @@ -1234,7 +1234,7 @@ * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (fromIndex | 0) - 1, + var index = (+fromIndex || 0) - 1, length = array ? array.length : 0, result = []; @@ -1757,9 +1757,9 @@ callback = lodash.createCallback(callback, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { var value = collection[index]; setter(result, value, callback(value, index, collection), collection); @@ -2435,7 +2435,7 @@ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) | 0; + fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : (fromIndex || 0); } else if (fromIndex) { var index = sortedIndex(array, value); return (length && array[index] === value) ? index : -1; @@ -2738,13 +2738,13 @@ var index = -1, length = array ? array.length : 0; - start |= 0; + start = +start || 0; if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { start = length; } - end = typeof end == 'undefined' ? length : (end | 0); + end = typeof end == 'undefined' ? length : (+end || 0); if (end < 0) { end = nativeMax(length + end, 0); } else if (end > length) { @@ -3361,10 +3361,10 @@ * // => true */ function contains(collection, target, fromIndex) { - var length = collection ? collection.length : 0; - fromIndex = (typeof fromIndex == 'number' && fromIndex) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); + fromIndex = (typeof fromIndex == 'number' && +fromIndex) || 0; - if (typeof length == 'number' && length > -1) { + if (length) { if (typeof collection == 'string' || !isArray(collection) && isString(collection)) { if (fromIndex >= length) { return false; @@ -3374,7 +3374,7 @@ : collection.indexOf(target, fromIndex) > -1; } var indexOf = getIndexOf(); - fromIndex = fromIndex < 0 ? nativeMax(0, (length | 0) + fromIndex) : fromIndex; + fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex; return indexOf(collection, target, fromIndex) > -1; } var index = -1, @@ -3473,9 +3473,9 @@ predicate = lodash.createCallback(predicate, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { if (!predicate(collection[index], index, collection)) { return false; @@ -3534,9 +3534,9 @@ predicate = lodash.createCallback(predicate, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { var value = collection[index]; if (predicate(value, index, collection)) { @@ -3597,8 +3597,8 @@ * // => { 'name': 'fred', 'age': 40, 'blocked': true } */ function find(collection, predicate, thisArg) { - var length = (collection && collection.length) | 0; - if (length > 0) { + var length = (length = collection && collection.length, length > -1 && length >>> 0); + if (length) { var index = findIndex(collection, predicate, thisArg); return index > -1 ? collection[index] : undefined; } @@ -3627,8 +3627,8 @@ * // => 3 */ function findLast(collection, predicate, thisArg) { - var length = (collection && collection.length) | 0; - if (length > 0) { + var length = (length = collection && collection.length, length > -1 && length >>> 0); + if (length) { var index = findLastIndex(collection, predicate, thisArg); return index > -1 ? collection[index] : undefined; } @@ -3664,10 +3664,10 @@ */ function forEach(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); - if (length > 0) { + if (length) { while (++index < length) { if (callback(collection[index], index, collection) === false) { break; @@ -3697,10 +3697,10 @@ * // => logs each number from right to left and returns '3,2,1' */ function forEachRight(collection, callback, thisArg) { - var length = (collection && collection.length) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); - if (length > 0) { + if (length) { while (length--) { if (callback(collection[length], length, collection) === false) { break; @@ -3824,8 +3824,8 @@ var args = slice(arguments, 2), index = -1, isFunc = typeof methodName == 'function', - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); @@ -3874,10 +3874,10 @@ */ function map(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); callback = lodash.createCallback(callback, thisArg, 3); - if (length > 0) { + if (length) { var result = Array(length); while (++index < length) { result[index] = callback(collection[index], index, collection); @@ -4146,9 +4146,9 @@ callback = lodash.createCallback(callback, thisArg, 4); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { if (noaccum && length) { accumulator = collection[++index]; } @@ -4262,7 +4262,7 @@ collection = values(collection); } if (n == null || guard) { - var length = (collection && collection.length) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); @@ -4287,8 +4287,8 @@ */ function shuffle(collection) { var index = -1, - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { var rand = baseRandom(0, ++index); @@ -4371,9 +4371,9 @@ predicate = lodash.createCallback(predicate, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { if (predicate(collection[index], index, collection)) { return true; @@ -4438,9 +4438,9 @@ */ function sortBy(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0, + length = collection && collection.length, multi = callback && isArray(callback), - result = Array(length < 0 ? 0 : length); + result = Array(length < 0 ? 0 : length >>> 0); if (!multi) { callback = lodash.createCallback(callback, thisArg, 3); @@ -6705,7 +6705,7 @@ target = String(target); var length = string.length; - position = (typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), length) : length) - target.length; + position = (typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), length) : length) - target.length; return position >= 0 && string.indexOf(target, position) == position; } @@ -6958,7 +6958,7 @@ */ function startsWith(string, target, position) { string = string == null ? '' : String(string); - position = typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), string.length) : 0; + position = typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), string.length) : 0; return string.lastIndexOf(target, position) == position; } @@ -7264,11 +7264,11 @@ if (options && isObject(options)) { var separator = 'separator' in options ? options.separator : separator; - length = 'length' in options ? options.length | 0 : length; + length = 'length' in options ? +options.length || 0 : length; omission = 'omission' in options ? String(options.omission) : omission; } else if (options != null) { - length = options | 0; + length = +options || 0; } string = string == null ? '' : String(string); if (length >= string.length) { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index eb5128a93..390fe4b49 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,7 +3,7 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t){return typeof n=="undefined"?t:n}function t(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(nt||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202i(t,l)&&f.push(l);return f}function ft(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number"&&-1(r|=0)?0:r;r--&&false!==t(n[r],r,n););else gt(n,t,Ie); -return n}function pt(n,t,r,e){e=(0|e)-1;for(var u=n?n.length:0,o=[];++ea(p,h)&&((u||f)&&p.push(h),c.push(s))}return c}function wt(n,t){for(var r=-1,e=t(n),u=e.length,o=Ar(u);++rr&&(r=0),p&&(i=[]),s&&(a=[]),h=[n,t,r,e,u,o,i,a],t==w||t==(w|C)?c(h):Z(h))}function Ot(){var n=(n=o.indexOf)===Tt?r:n;return n}function At(n){return typeof n=="function"&&Pr.test(Zr.call(n))}function It(n){var t,r;return n&&Ur.call(n)==rt&&(Yr.call(n,"constructor")||(t=n.constructor,!pr(t)||t instanceof t))?(st(n,function(n,t){r=t +for(;o--;)l[i++]=r[u++];return l}function jt(n,t){return function(r,e,u){var i=t?[[],[]]:{};e=o.createCallback(e,u,3),u=-1;var a=(a=r&&r.length,-1>>0);if(a)for(;++ur&&(r=0),p&&(i=[]),s&&(a=[]),h=[n,t,r,e,u,o,i,a],t==w||t==(w|C)?c(h):Z(h))}function Ot(){var n=(n=o.indexOf)===Tt?r:n;return n}function At(n){return typeof n=="function"&&Pr.test(Zr.call(n))}function It(n){var t,r;return n&&Ur.call(n)==rt&&(Yr.call(n,"constructor")||(t=n.constructor,!pr(t)||t instanceof t))?(st(n,function(n,t){r=t },yr),typeof r=="undefined"||Yr.call(n,r)):false}function Et(n){for(var t=-1,r=yr(n),e=r.length,u=[];++ti?0:i)}function Tt(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0|(0>e?le(0,u+e):e);else if(e)return e=Lt(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Wt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++}else i=null==t||r?1:t;return i=e-i,Dt(n,0,0>i?0:i)}function Ft(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++ -}else if(i=t,null==i||r)return n?n[e-1]:_;return i=e-i,Dt(n,0>i?0:i)}function $t(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,i=0;for(t=o.createCallback(t,r,3);++et?0:t;return Dt(n,i)}function Dt(n,t,r){var e=-1,u=n?n.length:0;for(t|=0,0>t?t=le(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:0|r,0>r?r=le(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Ar(u);++e>>1,r(n[e])i?0:i)}function Tt(n,t,e){var u=n?n.length:0;if(typeof e=="number")e=0>e?le(0,u+e):e||0;else if(e)return e=Lt(n,t),u&&n[e]===t?e:-1;return r(n,t,e)}function Wt(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++}else i=null==t||r?1:t;return i=e-i,Dt(n,0,0>i?0:i)}function Ft(n,t,r){var e=n?n.length:0;if(typeof t!="number"&&null!=t){var u=e,i=0;for(t=o.createCallback(t,r,3);u--&&t(n[u],u,n);)i++ +}else if(i=t,null==i||r)return n?n[e-1]:_;return i=e-i,Dt(n,0>i?0:i)}function $t(n,t,r){if(typeof t!="number"&&null!=t){var e=-1,u=n?n.length:0,i=0;for(t=o.createCallback(t,r,3);++et?0:t;return Dt(n,i)}function Dt(n,t,r){var e=-1,u=n?n.length:0;for(t=+t||0,0>t?t=le(u+t,0):t>u&&(t=u),r=typeof r=="undefined"?u:+r||0,0>r?r=le(u+r,0):r>u&&(r=u),u=t>r?0:r-t,r=Ar(u);++e>>1,r(n[e])r?0:r);++tr?le(0,(0|e)+r):r,-1i&&(i=l)}else t=null==t&&vr(n)?u:o.createCallback(t,r,3),ft(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,i=n)});return i}function Ht(n,t,r,e){var u=3>arguments.length;t=o.createCallback(t,e,4); -var i=-1,a=0|(n&&n.length);if(0arguments.length;return t=o.createCallback(t,e,4),ct(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Qt(n){var t=-1,r=0|(n&&n.length),e=Ar(0>r?0:r);return ft(n,function(n){var r=bt(0,++t);e[t]=e[r],e[r]=n}),e}function nr(n,t,r){var e;t=o.createCallback(t,r,3),r=-1;var u=0|(n&&n.length);if(0arguments.length)return Ct(n,w,null,t);if(n)var r=n[I]?n[I][2]:n.length,e=Dt(arguments,2),r=r-e.length;return Ct(n,w|C,r,t,e)}function rr(n,t,r){var e,u,o,i,a,l,f,c=0,p=false,s=true;if(!pr(n))throw new $r;if(t=0>t?0:t,true===r)var h=true,s=false;else sr(r)&&(h=r.leading,p="maxWait"in r&&(le(t,r.maxWait)||0),s="trailing"in r?r.trailing:s);var g=function(){var r=t-(Fe()-i);0>=r||r>t?(u&&Mr(u),r=f,u=l=f=_,r&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))):l=Jr(g,r) -},v=function(){l&&Mr(l),u=l=f=_,(s||p!==t)&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Fe(),a=this,f=s&&(l||!h),false===p)var r=h&&!l;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=Mr(u)),c=i,o=n.apply(a,e)):u||(u=Jr(v,y))}return m&&l?l=Mr(l):l||t===p||(l=Jr(g,t)),r&&(m=true,o=n.apply(a,e)),!m||l||u||(e=a=null),o}}function er(n){if(!pr(n))throw new $r;return function(){return!n.apply(this,arguments)}}function ur(n,t,r){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof r; -if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3t||null==n)return r;n=Fr(n);do t%2&&(r+=n),t=Vr(t/2),n+=n;while(t);return r}function wr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||U(n,t,r):"object"!=e?Or(n):jr(n)}function xr(n){return n}function jr(n){n||(n={});var t=Ie(n),r=t.length,e=t[0],u=n[e];return 1!=r||u!==u||sr(u)?function(e){for(var u=r,o=false;u--&&(o=t[u],o=Yr.call(e,o)&&mt(e[o],n[o],null,true)););return o}:function(n){return Yr.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false -}}function kr(n,t,r){var e=true,u=t&&lr(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=o,u=lr(t)),false===r?e=false:sr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var i=pr(n),a=u?u.length:0;++r>>0);if(r=typeof r=="number"&&+r||0,e){if(typeof n=="string"||!Oe(n)&&vr(n))return rr?le(0,e+r):r,-1>>0);if(u){for(;++r>>0);if(u)for(;++r>>0);return e?(t=Rt(n,t,r),-1>>0);if(t=t&&typeof r=="undefined"?t:U(t,r,3),u)for(;++e>>0); +if(t=t&&typeof r=="undefined"?t:U(t,r,3),e)for(;e--&&false!==t(n[e],e,n););else ct(n,t);return n}function Yt(n,t,r){var e=-1,u=(u=n&&n.length,-1>>0);if(t=o.createCallback(t,r,3),u)for(var i=Ar(u);++ei&&(i=l)}else t=null==t&&vr(n)?u:o.createCallback(t,r,3),ft(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,i=n) +});return i}function Ht(n,t,r,e){var u=3>arguments.length;t=o.createCallback(t,e,4);var i=-1,a=(a=n&&n.length,-1>>0);if(a)for(u&&a&&(r=n[++i]);++iarguments.length;return t=o.createCallback(t,e,4),ct(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Qt(n){var t=-1,r=n&&n.length,e=Ar(0>r?0:r>>>0);return ft(n,function(n){var r=bt(0,++t);e[t]=e[r],e[r]=n}),e}function nr(n,t,r){var e; +t=o.createCallback(t,r,3),r=-1;var u=(u=n&&n.length,-1>>0);if(u){for(;++rarguments.length)return Ct(n,w,null,t);if(n)var r=n[I]?n[I][2]:n.length,e=Dt(arguments,2),r=r-e.length;return Ct(n,w|C,r,t,e)}function rr(n,t,r){var e,u,o,i,a,l,f,c=0,p=false,s=true;if(!pr(n))throw new $r;if(t=0>t?0:t,true===r)var h=true,s=false;else sr(r)&&(h=r.leading,p="maxWait"in r&&(le(t,r.maxWait)||0),s="trailing"in r?r.trailing:s); +var g=function(){var r=t-(Fe()-i);0>=r||r>t?(u&&Mr(u),r=f,u=l=f=_,r&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))):l=Jr(g,r)},v=function(){l&&Mr(l),u=l=f=_,(s||p!==t)&&(c=Fe(),o=n.apply(a,e),l||u||(e=a=null))};return function(){if(e=arguments,i=Fe(),a=this,f=s&&(l||!h),false===p)var r=h&&!l;else{u||h||(c=i);var y=p-(i-c),m=0>=y||y>p;m?(u&&(u=Mr(u)),c=i,o=n.apply(a,e)):u||(u=Jr(v,y))}return m&&l?l=Mr(l):l||t===p||(l=Jr(g,t)),r&&(m=true,o=n.apply(a,e)),!m||l||u||(e=a=null),o}}function er(n){if(!pr(n))throw new $r; +return function(){return!n.apply(this,arguments)}}function ur(n,t,r){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof r;if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3t||null==n)return r;n=Fr(n);do t%2&&(r+=n),t=Vr(t/2),n+=n;while(t);return r}function wr(n,t,r){var e=typeof n;return"function"==e||null==n?(typeof t=="undefined"||!("prototype"in n))&&n||U(n,t,r):"object"!=e?Or(n):jr(n)}function xr(n){return n}function jr(n){n||(n={});var t=Ie(n),r=t.length,e=t[0],u=n[e];return 1!=r||u!==u||sr(u)?function(e){for(var u=r,o=false;u--&&(o=t[u],o=Yr.call(e,o)&&mt(e[o],n[o],null,true)););return o +}:function(n){return Yr.call(n,e)?(n=n[e],u===n&&(0!==u||1/u==1/n)):false}}function kr(n,t,r){var e=true,u=t&&lr(t);t&&(r||u.length)||(null==r&&(r=t),t=n,n=o,u=lr(t)),false===r?e=false:sr(r)&&"chain"in r&&(e=r.chain),r=-1;for(var i=pr(n),a=u?u.length:0;++r(h?e(h,c):a(f,c))){for(u=o,(h||f).push(c);--u;)if(h=i[u],0>(h?e(h,c):a(t[u],c)))continue n;s.push(c)}}return s},o.invert=function(n,t){for(var r=-1,e=Ie(n),u=e.length,o={};++ro?0:o); +(Oe(c)||fr(c))&&(t.push(c),i.push(l&&120<=c.length&&be(u?c:f)))}o=t.length,n=t[0];var l=-1,p=n?n.length:0,s=[];n:for(;++l(h?e(h,c):a(f,c))){for(u=o,(h||f).push(c);--u;)if(h=i[u],0>(h?e(h,c):a(t[u],c)))continue n;s.push(c)}}return s},o.invert=function(n,t){for(var r=-1,e=Ie(n),u=e.length,o={};++ro?0:o>>>0); return ft(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},o.keys=Ie,o.keysIn=yr,o.map=Yt,o.mapValues=function(n,t,r){var e={};return t=o.createCallback(t,r,3),vt(n,function(n,r,u){e[r]=t(n,r,u)}),e},o.matches=jr,o.max=Gt,o.memoize=function(n,t){if(!pr(n))throw new $r;var r=function(){var e=r.cache,u=t?t.apply(this,arguments):"_"+arguments[0];return Yr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)};return r.cache={},r},o.merge=function(n,t,r){if(!n)return n;var e=arguments,u=e.length,o=typeof r;if("number"!=o&&"string"!=o||!e[3]||e[3][r]!==t||(u=2),3u?0:u);for(i||(t=o.createCallback(t,r,3)),ft(n,function(n,r,u){if(i)for(r=t.length,u=Ar(r);r--;)u[r]=n[t[r]]; +return n},o.range=function(n,t,r){n=+n||0,r=null==r?1:+r||0,null==t?(t=n,n=0):t=+t||0;var e=-1;t=le(0,Kr((t-n)/(r||1)));for(var u=Ar(t);++eu?0:u>>>0);for(i||(t=o.createCallback(t,r,3)),ft(n,function(n,r,u){if(i)for(r=t.length,u=Ar(r);r--;)u[r]=n[t[r]]; else u=t(n,r,u);f[++e]={a:u,b:e,c:n}}),u=f.length,f.sort(i?l:a);u--;)f[u]=f[u].c;return f},o.tap=function(n,t,r){return t.call(r,n),n},o.throttle=function(n,t,r){var e=true,u=true;if(!pr(n))throw new $r;return false===r?e=false:sr(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),it.leading=e,it.maxWait=+t,it.trailing=u,rr(n,t,it)},o.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Ar(n);for(t=U(t,r,1);++e>>0);return e?(t=Nt(n,t,r),-1r?le(0,e+r):fe(r,e-1))+1);e--;)if(n[e]===t)return e; return-1},o.mixin=kr,o.noConflict=function(){return t._=qr,this},o.noop=Cr,o.now=Fe,o.pad=function(n,t,r){n=null==n?"":Fr(n),t|=0;var e=n.length;return e=n.length)return n;var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(gr(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Wr(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index; -r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,d))},o.uniqueId=function(n){var t=++E;return Fr(null==n?"":n)+t},o.all=Kt,o.any=nr,o.detect=Vt,o.findWhere=Vt,o.foldl=Ht,o.foldr=Jt,o.include=Pt,o.inject=Ht,kr(function(){var n={};return vt(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=St,o.last=Ft,o.sample=function(n,t,r){return n&&typeof n.length!="number"&&(n=dr(n)),null==t||r?(t=0|(n&&n.length),0"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,D=/<%=([\s\S]+?)%>/g,L=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,P=/($^)/,K=/[.*+?^${}()|[\]\\]/g,M=/\bthis\b/,V=/['\n\r\t\u2028\u2029\\]/g,Z=/[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g,X=" \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",Y="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="[object Arguments]",H="[object Array]",J="[object Boolean]",Q="[object Date]",nt="[object Function]",tt="[object Number]",rt="[object Object]",et="[object RegExp]",ut="[object String]",ot={}; +}catch(h){throw h.source=c,h}return t?p(t):(p.source=c,p)},o.trim=Se,o.trimLeft=Te,o.trimRight=We,o.truncate=function(n,t){var r=30,e="...";if(t&&sr(t))var u="separator"in t?t.separator:u,r="length"in t?+t.length||0:r,e="omission"in t?Fr(t.omission):e;else null!=t&&(r=+t||0);if(n=null==n?"":Fr(n),r>=n.length)return n;var o=r-e.length;if(1>o)return e;if(r=n.slice(0,o),null==u)return r+e;if(gr(u)){if(n.slice(o).search(u)){var i,a,l=n.slice(0,o);for(u.global||(u=Wr(u.source,(z.exec(u)||"")+"g")),u.lastIndex=0;i=u.exec(l);)a=i.index; +r=r.slice(0,null==a?o:a)}}else n.indexOf(u,o)!=o&&(u=r.lastIndexOf(u),-1n.indexOf(";")?n:n.replace(T,d))},o.uniqueId=function(n){var t=++E;return Fr(null==n?"":n)+t},o.all=Kt,o.any=nr,o.detect=Vt,o.findWhere=Vt,o.foldl=Ht,o.foldr=Jt,o.include=Pt,o.inject=Ht,kr(function(){var n={};return vt(o,function(t,r){o.prototype[r]||(n[r]=t)}),n}(),false),o.first=St,o.last=Ft,o.sample=function(n,t,r){if(n&&typeof n.length!="number"&&(n=dr(n)),null==t||r){var e=(e=n&&n.length,-1>>0); +return 0"']/g,F=/<%-([\s\S]+?)%>/g,$=/<%([\s\S]+?)%>/g,D=/<%=([\s\S]+?)%>/g,L=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,B=/^\s*function[ \n\r\t]+\w/,q=/^0[xX]/,U=/[\xC0-\xFF]/g,P=/($^)/,K=/[.*+?^${}()|[\]\\]/g,M=/\bthis\b/,V=/['\n\r\t\u2028\u2029\\]/g,Z=/[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g,X=" \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",Y="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),G="[object Arguments]",H="[object Array]",J="[object Boolean]",Q="[object Date]",nt="[object Function]",tt="[object Number]",rt="[object Object]",et="[object RegExp]",ut="[object String]",ot={}; ot[nt]=false,ot[G]=ot[H]=ot[J]=ot[Q]=ot[tt]=ot[rt]=ot[et]=ot[ut]=true;var it={leading:false,maxWait:0,trailing:false},at={configurable:false,enumerable:false,value:null,writable:false},lt={"&":"&","<":"<",">":">",'"':""","'":"'"},ft={"&":"&","<":"<",">":">",""":'"',"'":"'"},ct={\u00c0:"A",\u00c1:"A",\u00c2:"A",\u00c3:"A",\u00c4:"A",\u00c5:"A",\u00e0:"a",\u00e1:"a",\u00e2:"a",\u00e3:"a",\u00e4:"a",\u00e5:"a",\u00c7:"C",\u00e7:"c",\u00d0:"D",\u00f0:"d",\u00c8:"E",\u00c9:"E",\u00ca:"E",\u00cb:"E",\u00e8:"e",\u00e9:"e",\u00ea:"e",\u00eb:"e",\u00cc:"I",\u00cd:"I",\u00ce:"I",\u00cf:"I",\u00ec:"i",\u00ed:"i",\u00ee:"i",\u00ef:"i",\u00d1:"N",\u00f1:"n",\u00d2:"O",\u00d3:"O",\u00d4:"O",\u00d5:"O",\u00d6:"O",\u00d8:"O",\u00f2:"o",\u00f3:"o",\u00f4:"o",\u00f5:"o",\u00f6:"o",\u00f8:"o",\u00d9:"U",\u00da:"U",\u00db:"U",\u00dc:"U",\u00f9:"u",\u00fa:"u",\u00fb:"u",\u00fc:"u",\u00dd:"Y",\u00fd:"y",\u00ff:"y",\u00c6:"AE",\u00e6:"ae",\u00de:"Th",\u00fe:"th",\u00df:"ss","\xd7":" ","\xf7":" "},pt={"function":true,object:true},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ht=pt[typeof window]&&window||this,gt=pt[typeof exports]&&exports&&!exports.nodeType&&exports,pt=pt[typeof module]&&module&&!module.nodeType&&module,vt=gt&&pt&&typeof global=="object"&&global; !vt||vt.global!==vt&&vt.window!==vt&&vt.self!==vt||(ht=vt);var vt=pt&&pt.exports===gt&>,yt=b();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ht._=yt, define(function(){return yt})):gt&&pt?vt?(pt.exports=yt)._=yt:gt._=yt:ht._=yt}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 0781599a8..19353c572 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -159,7 +159,7 @@ * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { - var index = (fromIndex | 0) - 1, + var index = (+fromIndex || 0) - 1, length = array ? array.length : 0; while (++index < length) { @@ -617,7 +617,7 @@ * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (fromIndex | 0) - 1, + var index = (+fromIndex || 0) - 1, length = array ? array.length : 0, result = []; @@ -978,9 +978,9 @@ callback = createCallback(callback, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { var value = collection[index]; setter(result, value, callback(value, index, collection), collection); @@ -1346,7 +1346,7 @@ function indexOf(array, value, fromIndex) { var length = array ? array.length : 0; if (typeof fromIndex == 'number') { - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) | 0; + fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : (fromIndex || 0); } else if (fromIndex) { var index = sortedIndex(array, value); return (length && array[index] === value) ? index : -1; @@ -1519,13 +1519,13 @@ var index = -1, length = array ? array.length : 0; - start |= 0; + start = +start || 0; if (start < 0) { start = nativeMax(length + start, 0); } else if (start > length) { start = length; } - end = typeof end == 'undefined' ? length : (end | 0); + end = typeof end == 'undefined' ? length : (+end || 0); if (end < 0) { end = nativeMax(length + end, 0); } else if (end > length) { @@ -1943,10 +1943,10 @@ */ function contains(collection, target) { var indexOf = getIndexOf(), - length = (collection && collection.length) | 0, + length = (length = collection && collection.length, length > -1 && length >>> 0), result = false; - if (length > 0) { + if (length) { return indexOf(collection, target) > -1; } baseEach(collection, function(value) { @@ -2039,9 +2039,9 @@ predicate = createCallback(predicate, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { if (!predicate(collection[index], index, collection)) { return false; @@ -2100,9 +2100,9 @@ predicate = createCallback(predicate, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { var value = collection[index]; if (predicate(value, index, collection)) { @@ -2163,8 +2163,8 @@ * // => { 'name': 'fred', 'age': 40, 'blocked': true } */ function find(collection, predicate, thisArg) { - var length = (collection && collection.length) | 0; - if (length > 0) { + var length = (length = collection && collection.length, length > -1 && length >>> 0); + if (length) { var index = findIndex(collection, predicate, thisArg); return index > -1 ? collection[index] : undefined; } @@ -2200,10 +2200,10 @@ */ function forEach(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); - if (length > 0) { + if (length) { while (++index < length) { if (callback(collection[index], index, collection) === breakIndicator) { break; @@ -2327,8 +2327,8 @@ var args = slice(arguments, 2), index = -1, isFunc = typeof methodName == 'function', - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); @@ -2377,10 +2377,10 @@ */ function map(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); callback = createCallback(callback, thisArg, 3); - if (length > 0) { + if (length) { var result = Array(length); while (++index < length) { result[index] = callback(collection[index], index, collection); @@ -2444,9 +2444,9 @@ callback = null; } var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (callback == null && length > 0) { + if (callback == null && length) { while (++index < length) { var value = collection[index]; if (value > result) { @@ -2517,9 +2517,9 @@ callback = null; } var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (callback == null && length > 0) { + if (callback == null && length) { while (++index < length) { var value = collection[index]; if (value < result) { @@ -2645,9 +2645,9 @@ callback = createCallback(callback, thisArg, 4); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { if (noaccum && length) { accumulator = collection[++index]; } @@ -2761,7 +2761,7 @@ collection = values(collection); } if (n == null || guard) { - var length = (collection && collection.length) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); @@ -2786,8 +2786,8 @@ */ function shuffle(collection) { var index = -1, - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { var rand = baseRandom(0, ++index); @@ -2870,9 +2870,9 @@ predicate = createCallback(predicate, thisArg, 3); var index = -1, - length = (collection && collection.length) | 0; + length = (length = collection && collection.length, length > -1 && length >>> 0); - if (length > 0) { + if (length) { while (++index < length) { if (predicate(collection[index], index, collection)) { return true; @@ -2937,8 +2937,8 @@ */ function sortBy(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); callback = createCallback(callback, thisArg, 3); baseEach(collection, function(value, key, collection) { diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index b3d7c47d5..87005cb24 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,38 +3,38 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.6.0 underscorejs.org/LICENSE * Build: `lodash underscore -o ./dist/lodash.underscore.js` */ -;(function(){function n(n,r,t){t=(0|t)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(te||typeof t=="undefined"){t=1;break n}if(tu(r,i)&&o.push(i)}return o}function p(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number"&&-1(t|=0)?0:t;t--&&r(n[t],t,n)!==ar;);else for(var t=at(n),e=t.length;e--;){var u=t[e]; -if(r(n[u],u,n)===ar)break}return n}function g(n,r,t,e){e=(0|e)-1;for(var u=n?n.length:0,o=[];++eo(f,c)&&(t&&f.push(c),i.push(a))}return i}function m(n,r){return function(t,e,u){var o=r?[[],[]]:{}; -e=nr(e,u,3),u=-1;var i=0|(t&&t.length);if(0r?0:r)}function x(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0|(0>e?Lr(0,u+e):e);else if(e)return e=E(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function A(n,r,t){return T(n,null==r||t?1:0>r?0:r)}function T(n,r,t){var e=-1,u=n?n.length:0;for(r|=0,0>r?r=Lr(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:0|t,0>t?t=Lr(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1,t(n[e])u&&(u=t);else r=nr(r,t,3),p(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function $(n,r,t,e){var u=3>arguments.length;r=nr(r,e,4);var o=-1,i=0|(n&&n.length);if(0arguments.length;return r=nr(r,e,4),s(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function M(n){var r=-1,t=0|(n&&n.length),e=Array(0>t?0:t);return p(n,function(n){var t;t=++r,t=0+Dr(Yr()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function D(n,r,t){var e;r=nr(r,t,3),t=-1;var u=0|(n&&n.length);if(0arguments.length?_(n,ir,null,r):_(n,ir|fr,null,r,T(arguments,2)) -}function z(n,r,t){var e,u,o,i,f,a,c,l=0,p=false,s=true;if(!J(n))throw new TypeError;if(r=0>r?0:r,true===t)var g=true,s=false;else K(t)&&(g=t.leading,p="maxWait"in t&&(Lr(r,t.maxWait)||0),s="trailing"in t?t.trailing:s);var h=function(){var t=r-(ct()-i);0>=t||t>r?(u&&clearTimeout(u),t=c,u=a=c=or,t&&(l=ct(),o=n.apply(f,e),a||u||(e=f=null))):a=setTimeout(h,t)},v=function(){a&&clearTimeout(a),u=a=c=or,(s||p!==r)&&(l=ct(),o=n.apply(f,e),a||u||(e=f=null))};return function(){if(e=arguments,i=ct(),f=this,c=s&&(a||!g),false===p)var t=g&&!a; -else{u||g||(l=i);var y=p-(i-l),m=0>=y||y>p;m?(u&&(u=clearTimeout(u)),l=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o}}function C(n){if(!J(n))throw new TypeError;return function(){return!n.apply(this,arguments)}}function P(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t;for("number"!=i&&"string"!=i||!e[3]||e[3][t]!==r||(o=2);++u"']/g,sr=/($^)/,gr=/[.*+?^${}()|[\]\\]/g,hr=/['\n\r\t\u2028\u2029\\]/g,vr="[object Arguments]",yr="[object Array]",mr="[object Boolean]",_r="[object Date]",dr="[object Number]",br="[object Object]",wr="[object RegExp]",jr="[object String]",xr={"&":"&","<":"<",">":">",'"':""","'":"'"},Ar={"&":"&","<":"<",">":">",""":'"',"'":"'"},Tr={"function":true,object:true},Er={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Or=Tr[typeof window]&&window||this,Sr=Tr[typeof exports]&&exports&&!exports.nodeType&&exports,kr=Tr[typeof module]&&module&&!module.nodeType&&module,Nr=Sr&&kr&&typeof global=="object"&&global; +e=nr(e,u,3),u=-1;var i=(i=t&&t.length,-1>>0);if(i)for(;++ur?0:r)}function x(r,t,e){var u=r?r.length:0;if(typeof e=="number")e=0>e?Lr(0,u+e):e||0;else if(e)return e=E(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function A(n,r,t){return T(n,null==r||t?1:0>r?0:r)}function T(n,r,t){var e=-1,u=n?n.length:0;for(r=+r||0,0>r?r=Lr(u+r,0):r>u&&(r=u),t=typeof t=="undefined"?u:+t||0,0>t?t=Lr(u+t,0):t>u&&(t=u),u=r>t?0:t-r,t=Array(u);++e>>1,t(n[e])>>0),u=false;return e?-1>>0);if(u){for(;++t>>0);if(u)for(;++t>>0);if(e){n:{var e=-1,u=n?n.length:0;for(r=nr(r,t,3);++e>>0);if(r=r&&typeof t=="undefined"?r:a(r,t,3),u)for(;++e>>0);if(r=nr(r,t,3),u)for(var o=Array(u);++e>>0);if(null==r&&i)for(;++ou&&(u=t);else r=nr(r,t,3),p(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function $(n,r,t,e){var u=3>arguments.length;r=nr(r,e,4);var o=-1,i=(i=n&&n.length,-1>>0); +if(i)for(u&&i&&(t=n[++o]);++oarguments.length;return r=nr(r,e,4),s(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function M(n){var r=-1,t=n&&n.length,e=Array(0>t?0:t>>>0);return p(n,function(n){var t;t=++r,t=0+Dr(Yr()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function D(n,r,t){var e;r=nr(r,t,3),t=-1;var u=(u=n&&n.length,-1>>0);if(u){for(;++targuments.length?_(n,ir,null,r):_(n,ir|fr,null,r,T(arguments,2))}function z(n,r,t){var e,u,o,i,f,a,c,l=0,p=false,s=true;if(!J(n))throw new TypeError;if(r=0>r?0:r,true===t)var g=true,s=false;else K(t)&&(g=t.leading,p="maxWait"in t&&(Lr(r,t.maxWait)||0),s="trailing"in t?t.trailing:s);var h=function(){var t=r-(ct()-i);0>=t||t>r?(u&&clearTimeout(u),t=c,u=a=c=or,t&&(l=ct(),o=n.apply(f,e),a||u||(e=f=null))):a=setTimeout(h,t)},v=function(){a&&clearTimeout(a),u=a=c=or,(s||p!==r)&&(l=ct(),o=n.apply(f,e),a||u||(e=f=null)) +};return function(){if(e=arguments,i=ct(),f=this,c=s&&(a||!g),false===p)var t=g&&!a;else{u||g||(l=i);var y=p-(i-l),m=0>=y||y>p;m?(u&&(u=clearTimeout(u)),l=i,o=n.apply(f,e)):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o}}function C(n){if(!J(n))throw new TypeError;return function(){return!n.apply(this,arguments)}}function P(n,r,t){if(!n)return n;var e=arguments,u=0,o=e.length,i=typeof t;for("number"!=i&&"string"!=i||!e[3]||e[3][t]!==r||(o=2);++u"']/g,sr=/($^)/,gr=/[.*+?^${}()|[\]\\]/g,hr=/['\n\r\t\u2028\u2029\\]/g,vr="[object Arguments]",yr="[object Array]",mr="[object Boolean]",_r="[object Date]",dr="[object Number]",br="[object Object]",wr="[object RegExp]",jr="[object String]",xr={"&":"&","<":"<",">":">",'"':""","'":"'"},Ar={"&":"&","<":"<",">":">",""":'"',"'":"'"},Tr={"function":true,object:true},Er={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Or=Tr[typeof window]&&window||this,Sr=Tr[typeof exports]&&exports&&!exports.nodeType&&exports,kr=Tr[typeof module]&&module&&!module.nodeType&&module,Nr=Sr&&kr&&typeof global=="object"&&global; !Nr||Nr.global!==Nr&&Nr.window!==Nr&&Nr.self!==Nr||(Or=Nr);var qr=kr&&kr.exports===Sr&&Sr,Fr=Array.prototype,Br=Object.prototype,Rr=Or._,$r=Br.toString,Ir=RegExp("^"+(null==$r?"":($r+"").replace(gr,"\\$&")).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mr=Math.ceil,Dr=Math.floor,Wr=Function.prototype.toString,zr=Br.hasOwnProperty,Cr=Fr.push,Pr=Br.propertyIsEnumerable,Ur=Fr.splice,Vr=b(Vr=Object.create)&&Vr,Gr=b(Gr=Array.isArray)&&Gr,Hr=Or.isFinite,Jr=Or.isNaN,Kr=b(Kr=Object.keys)&&Kr,Lr=Math.max,Qr=Math.min,Xr=b(Xr=Date.now)&&Xr,Yr=Math.random; i.prototype=o.prototype;var Zr={};!function(){var n={0:1,length:1};Zr.spliceObjects=(Ur.call(n,0,1),!n[0])}(1),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Vr||(f=function(){function n(){}return function(r){if(K(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Or.Object()}}());var nt=A,rt=m(function(n,r,t){zr.call(n,t)?n[t]++:n[t]=1}),tt=m(function(n,r,t){zr.call(n,t)?n[t].push(r):n[t]=[r]}),et=m(function(n,r,t){n[t]=r }),ut=m(function(n,r,t){n[t?0:1].push(r)},true),ot=B,it=N;H(arguments)||(H=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&zr.call(n,"callee")&&!Pr.call(n,"callee")||false});var ft=Gr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&$r.call(n)==yr||false};J(/x/)&&(J=function(n){return typeof n=="function"&&"[object Function]"==$r.call(n)});var at=Kr?function(n){return K(n)?Kr(n):[]}:w,ct=Xr||function(){return(new Date).getTime()};o.after=function(n,r){if(!J(r))throw new TypeError; return function(){return 1>--n?r.apply(this,arguments):void 0}},o.bind=W,o.bindAll=function(n){for(var r=1r?0:r)},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=at(n),e=t.length,u={};++ro?0:o); -return p(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},o.keys=at,o.map=B,o.matches=tr,o.max=R,o.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):"_"+arguments[0];return zr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=typeof r;"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null);var o=-1,i=0|(n&&n.length);if(null==r&&0o?0:o);for(t=nr(t,e,3),p(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!J(n))throw new TypeError;return false===t?e=false:K(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),z(n,r,{leading:e,maxWait:r,trailing:u})},o.times=function(n,r,t){n=-1<(n=+n)?n:0; -var e=-1,u=Array(n);for(r=a(r,t,1);++er?0:r);++nr?0:r)},o.intersection=function(){for(var n=[],r=-1,t=arguments.length;++ri(a,e)){for(r=t;--r;)if(0>i(n[r],e))continue n;a.push(e)}return a},o.invert=function(n){for(var r=-1,t=at(n),e=t.length,u={};++ro?0:o>>>0); +return p(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},o.keys=at,o.map=B,o.matches=tr,o.max=R,o.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):"_"+arguments[0];return zr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},o.min=function(n,r,t){var e=1/0,u=e,o=typeof r;"number"!=o&&"string"!=o||!t||t[r]!==n||(r=null);var o=-1,i=(i=n&&n.length,-1>>0);if(null==r&&i)for(;++oo?0:o>>>0);for(t=nr(t,e,3),p(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(r);o--;)i[o]=i[o].c;return i},o.tap=function(n,r){return r(n),n},o.throttle=function(n,r,t){var e=true,u=true;if(!J(n))throw new TypeError;return false===t?e=false:K(t)&&(e="leading"in t?t.leading:e,u="trailing"in t?t.trailing:u),z(n,r,{leading:e,maxWait:r,trailing:u}) +},o.times=function(n,r,t){n=-1<(n=+n)?n:0;var e=-1,u=Array(n);for(r=a(r,t,1);++er?0:r);++nt?Lr(0,e+t):Qr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=er,o.noConflict=function(){return Or._=Rr,this},o.now=ct,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+Dr(Yr()*(r-n+1))},o.reduce=$,o.reduceRight=I,o.result=function(n,r){if(null!=n){var t=n[r];return J(t)?n[r]():t}},o.size=function(n){var r=n?n.length:0;return typeof r=="number"&&-1n.indexOf(";")?n:n.replace(lr,u))},o.uniqueId=function(n){var r=++cr+"";return n?n+r:r},o.all=k,o.any=D,o.detect=q,o.findWhere=q,o.foldl=$,o.foldr=I,o.include=S,o.inject=$,o.first=j,o.last=function(n,r,t){var e=n?n.length:0;return null==r||t?n?n[e-1]:or:(r=e-r,T(n,0>r?0:r))},o.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=Z(n)),null==r||t?(r=0|(n&&n.length),0n.indexOf(";")?n:n.replace(lr,u))},o.uniqueId=function(n){var r=++cr+"";return n?n+r:r},o.all=k,o.any=D,o.detect=q,o.findWhere=q,o.foldl=$,o.foldr=I,o.include=S,o.inject=$,o.first=j,o.last=function(n,r,t){var e=n?n.length:0;return null==r||t?n?n[e-1]:or:(r=e-r,T(n,0>r?0:r))},o.sample=function(n,r,t){if(n&&typeof n.length!="number"&&(n=Z(n)),null==r||t){var e=(e=n&&n.length,-1>>0); +return 0 length) { start = length; } - end = typeof end == 'undefined' ? length : (end | 0); + end = typeof end == 'undefined' ? length : (+end || 0); if (end < 0) { end = nativeMax(length + end, 0); } else if (end > length) { @@ -3558,10 +3558,10 @@ * // => true */ function contains(collection, target, fromIndex) { - var length = collection ? collection.length : 0; - fromIndex = (typeof fromIndex == 'number' && fromIndex) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); + fromIndex = (typeof fromIndex == 'number' && +fromIndex) || 0; - if (typeof length == 'number' && length > -1) { + if (length) { if (typeof collection == 'string' || !isArray(collection) && isString(collection)) { if (fromIndex >= length) { return false; @@ -3571,7 +3571,7 @@ : collection.indexOf(target, fromIndex) > -1; } var indexOf = getIndexOf(); - fromIndex = fromIndex < 0 ? nativeMax(0, (length | 0) + fromIndex) : fromIndex; + fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex; return indexOf(collection, target, fromIndex) > -1; } var index = -1, @@ -4016,8 +4016,8 @@ var args = slice(arguments, 2), index = -1, isFunc = typeof methodName == 'function', - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); @@ -4066,8 +4066,8 @@ */ function map(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); callback = lodash.createCallback(callback, thisArg, 3); if (isArray(collection)) { @@ -4455,7 +4455,7 @@ collection = collection.split(''); } if (n == null || guard) { - var length = (collection && collection.length) | 0; + var length = (length = collection && collection.length, length > -1 && length >>> 0); return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } var result = shuffle(collection); @@ -4480,8 +4480,8 @@ */ function shuffle(collection) { var index = -1, - length = (collection && collection.length) | 0, - result = Array(length < 0 ? 0 : length); + length = collection && collection.length, + result = Array(length < 0 ? 0 : length >>> 0); baseEach(collection, function(value) { var rand = baseRandom(0, ++index); @@ -4631,9 +4631,9 @@ */ function sortBy(collection, callback, thisArg) { var index = -1, - length = (collection && collection.length) | 0, + length = collection && collection.length, multi = callback && isArray(callback), - result = Array(length < 0 ? 0 : length); + result = Array(length < 0 ? 0 : length >>> 0); if (!multi) { callback = lodash.createCallback(callback, thisArg, 3); @@ -6949,7 +6949,7 @@ target = String(target); var length = string.length; - position = (typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), length) : length) - target.length; + position = (typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), length) : length) - target.length; return position >= 0 && string.indexOf(target, position) == position; } @@ -7202,7 +7202,7 @@ */ function startsWith(string, target, position) { string = string == null ? '' : String(string); - position = typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), string.length) : 0; + position = typeof position == 'number' ? nativeMin(nativeMax(+position || 0, 0), string.length) : 0; return string.lastIndexOf(target, position) == position; } @@ -7508,11 +7508,11 @@ if (options && isObject(options)) { var separator = 'separator' in options ? options.separator : separator; - length = 'length' in options ? options.length | 0 : length; + length = 'length' in options ? +options.length || 0 : length; omission = 'omission' in options ? String(options.omission) : omission; } else if (options != null) { - length = options | 0; + length = +options || 0; } string = string == null ? '' : String(string); if (length >= string.length) {