diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index f479d3020..6a8228c48 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -86,7 +86,7 @@ /** Used to assign default `context` object properties */ var contextProps = [ 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', - 'RegExp', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'isNaN', + 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'isNaN', 'parseInt', 'setTimeout', 'TypeError', 'window', 'WinRTError' ]; @@ -248,53 +248,7 @@ * @returns {number} Returns `0` if `value` is found, else `-1`. */ function cacheIndexOf(cache, value) { - var type = typeof value; - cache = cache.cache; - - if (type == 'boolean' || value == null) { - return cache[value] ? 0 : -1; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : '_' + value; - cache = (cache = cache[type]) && cache[key]; - - return type == 'object' - ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) - : (cache ? 0 : -1); - } - - /** - * Adds a given value to the corresponding cache object. - * - * @private - * @param {*} value The value to add to the cache. - */ - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : '_' + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - var array = typeCache[key]; - if (array) { - array.push(value); - } else { - typeCache[key] = [value]; - } - } else { - typeCache[key] = true; - } - } + return cache.has(value) ? 0 : -1; } /** @@ -388,38 +342,6 @@ return a.index - b.index; } - /** - * Creates a cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [array=[]] The array to search. - * @returns {null|Object} Returns the cache object or `null` if caching should not be used. - */ - function createCache(array) { - var index = -1, - length = array.length, - first = array[0], - mid = array[(length / 2) | 0], - last = array[length - 1]; - - if (first && typeof first == 'object' && - mid && typeof mid == 'object' && last && typeof last == 'object') { - return false; - } - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return result; - } - /** * Used by `escape` to convert characters to HTML entities. * @@ -461,18 +383,8 @@ */ function getObject() { return objectPool.pop() || { - 'array': null, - 'cache': null, 'criteria': null, - 'false': false, 'index': 0, - 'null': false, - 'number': null, - 'object': null, - 'push': null, - 'string': null, - 'true': false, - 'undefined': false, 'value': null }; } @@ -510,11 +422,7 @@ * @param {Object} object The object to release. */ function releaseObject(object) { - var cache = object.cache; - if (cache) { - releaseObject(cache); - } - object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; + object.criteria = object.value = null; if (objectPool.length < MAX_POOL_SIZE) { objectPool.push(object); } @@ -696,6 +604,7 @@ hasOwnProperty = objectProto.hasOwnProperty, push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, + Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, splice = arrayRef.splice, unshift = arrayRef.unshift; @@ -720,6 +629,7 @@ nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, nativeMin = Math.min, + nativeNow = isNative(nativeNow = Date.now) && nativeNow, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeTrim = isNative(nativeTrim = stringProto.trim) && !nativeTrim.call(whitespace) && nativeTrim, @@ -1409,17 +1319,11 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, result = []; - if (isLarge) { - var cache = createCache(values); - if (cache) { - indexOf = cacheIndexOf; - values = cache; - } else { - isLarge = false; - } + if (Set && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf) { + indexOf = cacheIndexOf; + values = createCache(values); } while (++index < length) { var value = array[index]; @@ -1427,9 +1331,6 @@ result.push(value); } } - if (isLarge) { - releaseObject(values); - } return result; } @@ -1775,15 +1676,14 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, + isLarge = Set && !isSorted && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, result = []; - var isLarge = !isSorted && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, - seen = (callback || isLarge) ? getArray() : result; - if (isLarge) { - var cache = createCache(seen); + var seen = createCache(); indexOf = cacheIndexOf; - seen = cache; + } else { + seen = callback ? getArray() : result; } while (++index < length) { var value = array[index], @@ -1799,10 +1699,7 @@ result.push(value); } } - if (isLarge) { - releaseArray(seen.array); - releaseObject(seen); - } else if (callback) { + if (!isLarge && callback) { releaseArray(seen); } return result; @@ -1840,6 +1737,24 @@ }; } + /** + * Creates a cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [array=[]] The array to search. + * @returns {Object} Returns the cache object. + */ + function createCache(array) { + var cache = new Set, + length = array ? array.length : 0; + + cache.push = cache.add; + while (length--) { + cache.push(array[length]); + } + return cache; + } + /** * Creates a function that, when called, either curries or invokes `func` * with an optional `this` binding and partially applied arguments. @@ -2490,14 +2405,14 @@ argsLength = arguments.length, caches = getArray(), indexOf = getIndexOf(), - trustIndexOf = indexOf === baseIndexOf, + largePrereq = Set && indexOf === baseIndexOf, seen = getArray(); while (++argsIndex < argsLength) { var value = arguments[argsIndex]; if (isArray(value) || isArguments(value)) { args.push(value); - caches.push(trustIndexOf && value.length >= LARGE_ARRAY_SIZE && + caches.push(largePrereq && value.length >= LARGE_ARRAY_SIZE && createCache(argsIndex ? args[argsIndex] : seen)); } } @@ -2523,12 +2438,6 @@ result.push(value); } } - while (argsLength--) { - cache = caches[argsLength]; - if (cache) { - releaseObject(cache); - } - } releaseArray(caches); releaseArray(seen); return result; @@ -7104,7 +7013,7 @@ * _.defer(function() { console.log(_.now() - stamp); }); * // => logs the number of milliseconds it took for the deferred function to be called */ - var now = isNative(now = Date.now) && now || function() { + var now = nativeNow || function() { return new Date().getTime(); }; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 5774f5506..29f303480 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,62 +3,60 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202=T&&o===t,l=[];if(i){var c=f(e);c?(o=r,e=c):i=false}for(;++uo(e,c)&&l.push(c);return i&&y(e),l}function gt(n,t,r){var e=-1,u=n,o=n?n.length:0;if(t=t&&typeof r=="undefined"?t:k(t,r,3),typeof o=="number")for(ue.unindexedChars&&ar(u)&&(u=u.split(""));++e=T&&a===t,p=u||c?s():l;for(c&&(p=f(p),a=r);++oa(p,h))&&((u||c)&&p.push(h),l.push(g)) -}return c?(v(p.g),y(p)):u&&v(p),l}function wt(n){return function(t,r,u){var o={};if(r=e.createCallback(r,u,3),se(t)){u=-1;for(var a=t.length;++uu;u++)e+="m='"+n.d[u]+"';if((!(l&&o[m])&&h.call(q,m))",n.f||(e+="||(!o[m]&&q[m]!==r[m])"),e+="){"+n.c+"}"; -e+="}"}return t("a,f,g,h,j,k,r,p,v,w,y",r+(e+"return s;")+"}")(k,ut,Cr,Dr,Et,ur,kr,ee,ft,Or,Sr)}function Ct(){var n=(n=e.indexOf)===St?t:n;return n}function kt(n){return typeof n=="function"&&Ar.test(Tr.call(n))}function Ot(n){var t,r;return!n||Sr.call(n)!=it||!Dr.call(n,"constructor")&&(t=n.constructor,er(t)&&!(t instanceof t))||!ue.argsClass&&Et(n)||!ue.nodeClass&&h(n)?false:ue.ownLast?(pe(n,function(n,t,e){return r=Dr.call(e,t),false}),false!==r):(pe(n,function(n,t){r=t}),typeof r=="undefined"||Dr.call(n,r)) -}function Et(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Sr.call(n)==nt||false}function qt(n,t,r){var u=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=-1;for(t=e.createCallback(t,r,3);++ae?Hr(0,u+e):e||0;else if(e)return e=Nt(n,r),u&&n[e]===r?e:-1;return t(n,r,e)}function At(n,t,r){if(typeof t!="number"&&null!=t){var u=0,o=-1,a=n?n.length:0; -for(t=e.createCallback(t,r,3);++ot?t=Hr(u+t,0):t>u&&(t=u),typeof r=="undefined"?r=u:0>r?r=Hr(u+r,0):r>u&&(r=u),u=r-t||0,r=gr(u);++e>>1,r(n[u])r?0:r);++t=e)return false;if(typeof n=="string"||!se(n)&&ar(n))return Kr?Kr.call(n,t,r):-1r?Hr(0,e+r):r)||0,-1a&&(a=l)}else t=null==t&&ar(n)?u:e.createCallback(t,r,3),gt(n,function(n,r,e){r=t(n,r,e),r>o&&(o=r,a=n)});return a}function Ut(n,t,r,u){var o=3>arguments.length; -if(t=e.createCallback(t,u,4),se(n)){var a=-1,i=n.length;for(o&&i&&(r=n[++a]);++aarguments.length;return t=e.createCallback(t,u,4),zt(n,function(n,e,u){r=o?(o=false,n):t(r,n,e,u)}),r}function Xt(n){var t=-1,r=n?n.length:0,e=gr(typeof r=="number"?r:0);return Wt(n,function(n){var r=dt(0,++t);e[t]=e[r],e[r]=n}),e}function Gt(n,t,r){var u;if(t=e.createCallback(t,r,3),se(n)){r=-1;for(var o=n.length;++r=y;m?(a&&(a=Nr(a)),s=l,i=n.apply(f,o)):a||(a=Lr(e,y))}return m&&c?c=Nr(c):c||t===g||(c=Lr(u,t)),r&&(m=true,i=n.apply(f,o)),!m||c||a||(o=f=null),i}}function Qt(n,t,r){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--n?t.apply(this,arguments):void 0}},e.assign=Qt,e.at=function(n,t){var r=arguments,e=-1,u=ht(r,true,false,1),o=u.length,a=typeof t;for("number"!=a&&"string"!=a||!r[2]||r[2][t]!==n||(o=1),ue.unindexedChars&&ar(n)&&(n=n.split("")),r=gr(o);++e=T&&f(e?n[e]:l)))}var i=n[0],p=-1,g=i?i.length:0,h=[];n:for(;++p(m?r(m,c):a(l,c))){for(e=u,(m||l).push(c);--e;)if(m=o[e],0>(m?r(m,c):a(n[e],c)))continue n;h.push(c) -}}for(;u--;)(m=o[u])&&y(m);return v(o),v(l),h},e.invert=function(n,t){for(var r=-1,e=he(n),u=e.length,o={};++rr?Hr(0,e+r):Jr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},e.mixin=cr,e.noConflict=function(){return n._=qr,this},e.noop=pr,e.now=de,e.parseInt=be,e.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Yr(),Jr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):dt(n,t) -},e.reduce=Ut,e.reduceRight=Vt,e.result=function(n,t,r){return null==n?r:(r="undefined"!=typeof n[t]?n[t]:r,er(r)?n[t]():r)},e.runInContext=x,e.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:he(n).length},e.some=Gt,e.sortedIndex=Nt,e.template=function(n,t,r){var u=e.templateSettings;n=wr(n||""),r=Yt({},r,u);var o,a=Yt({},r.imports,u.imports),u=he(a),a=ir(a),i=0,l=r.interpolate||H,f="__p+='",l=_r((r.escape||H).source+"|"+l.source+"|"+(l===M?U:H).source+"|"+(r.evaluate||H).source+"|$","g"); -n.replace(l,function(t,r,e,u,a,l){return e||(e=u),f+=n.slice(i,l).replace(Q,p),r&&(f+="'+__e("+r+")+'"),a&&(o=true,f+="';"+a+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),i=l+t.length,t}),f+="';",l=r=r.variable,l||(r="obj",f="with("+r+"){"+f+"}"),f=(o?f.replace(F,""):f).replace($,"$1").replace(L,"$1;"),f="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=yr(u,"return "+f).apply(C,a) -}catch(s){throw s.source=f,s}return t?c(t):(c.source=f,c)},e.trim=ve,e.trimLeft=ye,e.trimRight=me,e.unescape=function(n){return null==n?"":(n=wr(n),0>n.indexOf(";")?n:n.replace(B,j))},e.uniqueId=function(n){var t=++E;return wr(null==n?"":n)+t},e.all=$t,e.any=Gt,e.detect=Bt,e.findWhere=Bt,e.foldl=Ut,e.foldr=Vt,e.include=Ft,e.inject=Ut,cr(function(){var n={};return Zt(e,function(t,r){e.prototype[r]||(n[r]=t)}),n}(),false),e.first=qt,e.last=function(n,t,r){var u=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=o; -for(t=e.createCallback(t,r,3);a--&&t(n[a],a,n);)u++}else if(u=t,null==u||r)return n?n[o-1]:C;return u=o-u,It(n,0"']/g,z=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,M=/<%=([\s\S]+?)%>/g,U=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,V=/\w*$/,X=/^\s*function[ \n\r\t]+\w/,G=/^0[xX]/,H=/($^)/,J=/\bthis\b/,Q=/['\n\r\t\u2028\u2029\\]/g,Y="Array Boolean Date Error Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Z="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Error]",ot="[object Function]",at="[object Number]",it="[object Object]",lt="[object RegExp]",ft="[object String]",ct={}; -ct[ot]=false,ct[nt]=ct[tt]=ct[rt]=ct[et]=ct[at]=ct[it]=ct[lt]=ct[ft]=true;var pt={leading:false,maxWait:0,trailing:false},st={configurable:false,enumerable:false,value:null,writable:false},gt={"&":"&","<":"<",">":">",'"':""","'":"'"},ht={"&":"&","<":"<",">":">",""":'"',"'":"'"},vt={"function":true,object:true},yt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},mt=vt[typeof window]&&window||this,dt=vt[typeof exports]&&exports&&!exports.nodeType&&exports,bt=vt[typeof global]&&global; -!bt||bt.global!==bt&&bt.window!==bt||(mt=bt);var bt=(vt=vt[typeof module]&&module&&!module.nodeType&&module)&&vt.exports===dt&&dt,_t=x();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(mt._=_t, define(function(){return _t})):dt&&vt?bt?(vt.exports=_t)._=_t:dt._=_t:mt._=_t}).call(this); \ No newline at end of file +;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202=I&&o===t&&(o=r,e=wt(e));++uo(e,l)&&i.push(l)}return i}function st(n,t,r){var e=-1,u=n,o=n?n.length:0;if(t=t&&typeof r=="undefined"?t:N(t,r,3),typeof o=="number")for(ae.unindexedChars&&ar(u)&&(u=u.split(""));++e=I&&a===t,f=[];if(l)var p=wt(),a=r;else p=u?c():f;for(;++oa(p,h))&&((u||l)&&p.push(h),f.push(g)) +}return!l&&u&&s(p),f}function _t(n){return function(t,r,e){var o={};if(r=u.createCallback(r,e,3),he(t)){e=-1;for(var a=t.length;++eu;u++)e+="m='"+n.d[u]+"';if((!(l&&o[m])&&h.call(q,m))",n.f||(e+="||(!o[m]&&q[m]!==r[m])"),e+="){"+n.c+"}"; +e+="}"}return t("a,f,g,h,j,k,r,p,v,w,y",r+(e+"return s;")+"}")(N,tt,Cr,Dr,Et,ur,kr,oe,at,Or,Sr)}function Ct(){var n=(n=u.indexOf)===St?t:n;return n}function kt(n){return typeof n=="function"&&Ar.test(Tr.call(n))}function Ot(n){var t,r;return!n||Sr.call(n)!=ut||!Dr.call(n,"constructor")&&(t=n.constructor,er(t)&&!(t instanceof t))||!ae.argsClass&&Et(n)||!ae.nodeClass&&p(n)?false:ae.ownLast?(ge(n,function(n,t,e){return r=Dr.call(e,t),false}),false!==r):(ge(n,function(n,t){r=t}),typeof r=="undefined"||Dr.call(n,r)) +}function Et(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Sr.call(n)==Q||false}function qt(n,t,r){var e=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=-1;for(t=u.createCallback(t,r,3);++ae?Jr(0,u+e):e||0;else if(e)return e=Nt(n,r),u&&n[e]===r?e:-1;return t(n,r,e)}function At(n,t,r){if(typeof t!="number"&&null!=t){var e=0,o=-1,a=n?n.length:0; +for(t=u.createCallback(t,r,3);++ot?t=Jr(u+t,0):t>u&&(t=u),typeof r=="undefined"?r=u:0>r?r=Jr(u+r,0):r>u&&(r=u),u=r-t||0,r=gr(u);++e>>1,r(n[e])r?0:r);++t=e)return false;if(typeof n=="string"||!he(n)&&ar(n))return Mr?Mr.call(n,t,r):-1r?Jr(0,e+r):r)||0,-1a&&(a=l)}else t=null==t&&ar(n)?e:u.createCallback(t,r,3),st(n,function(n,r,e){r=t(n,r,e),r>o&&(o=r,a=n)});return a}function Ut(n,t,r,e){var o=3>arguments.length; +if(t=u.createCallback(t,e,4),he(n)){var a=-1,i=n.length;for(o&&i&&(r=n[++a]);++aarguments.length;return t=u.createCallback(t,e,4),zt(n,function(n,e,u){r=o?(o=false,n):t(r,n,e,u)}),r}function Xt(n){var t=-1,r=n?n.length:0,e=gr(typeof r=="number"?r:0);return Wt(n,function(n){var r=dt(0,++t);e[t]=e[r],e[r]=n}),e}function Gt(n,t,r){var e;if(t=u.createCallback(t,r,3),he(n)){r=-1;for(var o=n.length;++r=y;m?(a&&(a=Nr(a)),s=l,i=n.apply(f,o)):a||(a=Br(e,y))}return m&&c?c=Nr(c):c||t===g||(c=Br(u,t)),r&&(m=true,i=n.apply(f,o)),!m||c||a||(o=f=null),i}}function Qt(n,t,r){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--n?t.apply(this,arguments):void 0}},u.assign=Qt,u.at=function(n,t){var r=arguments,e=-1,u=gt(r,true,false,1),o=u.length,a=typeof t;for("number"!=a&&"string"!=a||!r[2]||r[2][t]!==n||(o=1),ae.unindexedChars&&ar(n)&&(n=n.split("")),r=gr(o);++e=I&&wt(e?n[e]:l)))}var i=n[0],p=-1,g=i?i.length:0,h=[];n:for(;++p(v?r(v,f):a(l,f))){for(e=u,(v||l).push(f);--e;)if(v=o[e],0>(v?r(v,f):a(n[e],f)))continue n;h.push(f) +}}return s(o),s(l),h},u.invert=function(n,t){for(var r=-1,e=ye(n),u=e.length,o={};++rr?Jr(0,e+r):Qr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=cr,u.noConflict=function(){return n._=qr,this},u.noop=pr,u.now=_e,u.parseInt=we,u.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=ne(),Qr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):dt(n,t) +},u.reduce=Ut,u.reduceRight=Vt,u.result=function(n,t,r){return null==n?r:(r="undefined"!=typeof n[t]?n[t]:r,er(r)?n[t]():r)},u.runInContext=_,u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ye(n).length},u.some=Gt,u.sortedIndex=Nt,u.template=function(n,t,r){var e=u.templateSettings;n=wr(n||""),r=Yt({},r,e);var o,a=Yt({},r.imports,e.imports),e=ye(a),a=ir(a),i=0,l=r.interpolate||V,c="__p+='",l=_r((r.escape||V).source+"|"+l.source+"|"+(l===W?z:V).source+"|"+(r.evaluate||V).source+"|$","g"); +n.replace(l,function(t,r,e,u,a,l){return e||(e=u),c+=n.slice(i,l).replace(G,f),r&&(c+="'+__e("+r+")+'"),a&&(o=true,c+="';"+a+";\n__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),i=l+t.length,t}),c+="';",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(o?c.replace(T,""):c).replace(P,"$1").replace(D,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var p=yr(e,"return "+c).apply(w,a) +}catch(s){throw s.source=c,s}return t?p(t):(p.source=c,p)},u.trim=me,u.trimLeft=de,u.trimRight=be,u.unescape=function(n){return null==n?"":(n=wr(n),0>n.indexOf(";")?n:n.replace(F,b))},u.uniqueId=function(n){var t=++C;return wr(null==n?"":n)+t},u.all=$t,u.any=Gt,u.detect=Bt,u.findWhere=Bt,u.foldl=Ut,u.foldr=Vt,u.include=Ft,u.inject=Ut,cr(function(){var n={};return Zt(u,function(t,r){u.prototype[r]||(n[r]=t)}),n}(),false),u.first=qt,u.last=function(n,t,r){var e=0,o=n?n.length:0;if(typeof t!="number"&&null!=t){var a=o; +for(t=u.createCallback(t,r,3);a--&&t(n[a],a,n);)e++}else if(e=t,null==e||r)return n?n[o-1]:w;return e=o-e,It(n,0"']/g,L=/<%-([\s\S]+?)%>/g,B=/<%([\s\S]+?)%>/g,W=/<%=([\s\S]+?)%>/g,z=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,K=/\w*$/,M=/^\s*function[ \n\r\t]+\w/,U=/^0[xX]/,V=/($^)/,X=/\bthis\b/,G=/['\n\r\t\u2028\u2029\\]/g,H="Array Boolean Date Error Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),J="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Q="[object Arguments]",Y="[object Array]",Z="[object Boolean]",nt="[object Date]",tt="[object Error]",rt="[object Function]",et="[object Number]",ut="[object Object]",ot="[object RegExp]",at="[object String]",it={}; +it[rt]=false,it[Q]=it[Y]=it[Z]=it[nt]=it[et]=it[ut]=it[ot]=it[at]=true;var lt={leading:false,maxWait:0,trailing:false},ft={configurable:false,enumerable:false,value:null,writable:false},ct={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},st={"function":true,object:true},gt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ht=st[typeof window]&&window||this,vt=st[typeof exports]&&exports&&!exports.nodeType&&exports,yt=st[typeof global]&&global; +!yt||yt.global!==yt&&yt.window!==yt||(ht=yt);var yt=(st=st[typeof module]&&module&&!module.nodeType&&module)&&st.exports===vt&&vt,mt=_();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ht._=mt, define(function(){return mt})):vt&&st?yt?(st.exports=mt)._=mt:vt._=mt:ht._=mt}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 0f206a255..c4d8b318a 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -86,7 +86,7 @@ /** Used to assign default `context` object properties */ var contextProps = [ 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', - 'RegExp', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'isNaN', + 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', 'isFinite', 'isNaN', 'parseInt', 'setTimeout', 'TypeError', 'window', 'WinRTError' ]; @@ -241,53 +241,7 @@ * @returns {number} Returns `0` if `value` is found, else `-1`. */ function cacheIndexOf(cache, value) { - var type = typeof value; - cache = cache.cache; - - if (type == 'boolean' || value == null) { - return cache[value] ? 0 : -1; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : '_' + value; - cache = (cache = cache[type]) && cache[key]; - - return type == 'object' - ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) - : (cache ? 0 : -1); - } - - /** - * Adds a given value to the corresponding cache object. - * - * @private - * @param {*} value The value to add to the cache. - */ - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : '_' + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - var array = typeCache[key]; - if (array) { - array.push(value); - } else { - typeCache[key] = [value]; - } - } else { - typeCache[key] = true; - } - } + return cache.has(value) ? 0 : -1; } /** @@ -381,38 +335,6 @@ return a.index - b.index; } - /** - * Creates a cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [array=[]] The array to search. - * @returns {null|Object} Returns the cache object or `null` if caching should not be used. - */ - function createCache(array) { - var index = -1, - length = array.length, - first = array[0], - mid = array[(length / 2) | 0], - last = array[length - 1]; - - if (first && typeof first == 'object' && - mid && typeof mid == 'object' && last && typeof last == 'object') { - return false; - } - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return result; - } - /** * Used by `escape` to convert characters to HTML entities. * @@ -454,18 +376,8 @@ */ function getObject() { return objectPool.pop() || { - 'array': null, - 'cache': null, 'criteria': null, - 'false': false, 'index': 0, - 'null': false, - 'number': null, - 'object': null, - 'push': null, - 'string': null, - 'true': false, - 'undefined': false, 'value': null }; } @@ -490,11 +402,7 @@ * @param {Object} object The object to release. */ function releaseObject(object) { - var cache = object.cache; - if (cache) { - releaseObject(cache); - } - object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; + object.criteria = object.value = null; if (objectPool.length < MAX_POOL_SIZE) { objectPool.push(object); } @@ -673,6 +581,7 @@ getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayRef.push, + Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, splice = arrayRef.splice, unshift = arrayRef.unshift; @@ -697,6 +606,7 @@ nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, nativeMin = Math.min, + nativeNow = isNative(nativeNow = Date.now) && nativeNow, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeTrim = isNative(nativeTrim = stringProto.trim) && !nativeTrim.call(whitespace) && nativeTrim, @@ -1185,17 +1095,11 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, result = []; - if (isLarge) { - var cache = createCache(values); - if (cache) { - indexOf = cacheIndexOf; - values = cache; - } else { - isLarge = false; - } + if (Set && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf) { + indexOf = cacheIndexOf; + values = createCache(values); } while (++index < length) { var value = array[index]; @@ -1203,9 +1107,6 @@ result.push(value); } } - if (isLarge) { - releaseObject(values); - } return result; } @@ -1517,15 +1418,14 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, + isLarge = Set && !isSorted && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, result = []; - var isLarge = !isSorted && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, - seen = (callback || isLarge) ? getArray() : result; - if (isLarge) { - var cache = createCache(seen); + var seen = createCache(); indexOf = cacheIndexOf; - seen = cache; + } else { + seen = callback ? getArray() : result; } while (++index < length) { var value = array[index], @@ -1541,10 +1441,7 @@ result.push(value); } } - if (isLarge) { - releaseArray(seen.array); - releaseObject(seen); - } else if (callback) { + if (!isLarge && callback) { releaseArray(seen); } return result; @@ -1582,6 +1479,24 @@ }; } + /** + * Creates a cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [array=[]] The array to search. + * @returns {Object} Returns the cache object. + */ + function createCache(array) { + var cache = new Set, + length = array ? array.length : 0; + + cache.push = cache.add; + while (length--) { + cache.push(array[length]); + } + return cache; + } + /** * Creates a function that, when called, either curries or invokes `func` * with an optional `this` binding and partially applied arguments. @@ -2189,14 +2104,14 @@ argsLength = arguments.length, caches = getArray(), indexOf = getIndexOf(), - trustIndexOf = indexOf === baseIndexOf, + largePrereq = Set && indexOf === baseIndexOf, seen = getArray(); while (++argsIndex < argsLength) { var value = arguments[argsIndex]; if (isArray(value) || isArguments(value)) { args.push(value); - caches.push(trustIndexOf && value.length >= LARGE_ARRAY_SIZE && + caches.push(largePrereq && value.length >= LARGE_ARRAY_SIZE && createCache(argsIndex ? args[argsIndex] : seen)); } } @@ -2222,12 +2137,6 @@ result.push(value); } } - while (argsLength--) { - cache = caches[argsLength]; - if (cache) { - releaseObject(cache); - } - } releaseArray(caches); releaseArray(seen); return result; @@ -6785,7 +6694,7 @@ * _.defer(function() { console.log(_.now() - stamp); }); * // => logs the number of milliseconds it took for the deferred function to be called */ - var now = isNative(now = Date.now) && now || function() { + var now = nativeNow || function() { return new Date().getTime(); }; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index db39b06a2..3b04def67 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,57 +3,56 @@ * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202=T&&o===t,f=[];if(a){var c=l(e);c?(o=r,e=c):a=false}for(;++uo(e,c)&&f.push(c);return a&&v(e),f}function st(n,t,r,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++e=T&&i===t,p=u||c?s():f;for(c&&(p=l(p),i=r);++oi(p,y))&&((u||c)&&p.push(y),f.push(g))}return c?(h(p.g),v(p)):u&&h(p),f}function dt(n){return function(t,r,e){var u={};r=i.createCallback(r,e,3),e=-1;var o=t?t.length:0;if(typeof o=="number")for(;++ee?Mr(0,u+e):e||0;else if(e)return e=Nt(n,r),u&&n[e]===r?e:-1;return t(n,r,e)}function At(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=i.createCallback(t,r,3);++ut?t=Mr(u+t,0):t>u&&(t=u),typeof r=="undefined"?r=u:0>r?r=Mr(u+r,0):r>u&&(r=u),u=r-t||0,r=cr(u);++e>>1,r(n[e])r?0:r);++t=e)return false;if(typeof n=="string"||!oe(n)&&er(n))return qr?qr.call(n,t,r):-1r?Mr(0,e+r):r)||0,-1o&&(o=f)}else t=null==t&&er(n)?u:i.createCallback(t,r,3),qt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function Pt(n,t,r,e){var u=3>arguments.length;t=i.createCallback(t,e,4);var o=-1,a=n?n.length:0;if(typeof a=="number")for(u&&a&&(r=n[++o]);++oarguments.length;return t=i.createCallback(t,e,4),Wt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Mt(n){var t=-1,r=n?n.length:0,e=cr(typeof r=="number"?r:0); -return qt(n,function(n){var r=yt(0,++t);e[t]=e[r],e[r]=n}),e}function Ut(n,t,r){var e;t=i.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r=y;m?(i&&(i=Er(i)),s=f,a=n.apply(l,o)):i||(i=Dr(e,y))}return m&&c?c=Er(c):c||t===g||(c=Dr(u,t)),r&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Gt(n,t,r){var e=arguments,u=0,o=e.length,i=typeof r; -if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3--n?t.apply(this,arguments):void 0}},i.assign=Gt,i.at=function(n,t){var r=arguments,e=-1,u=st(r,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!r[2]||r[2][t]!==n||(o=1),r=cr(o);++e=T&&l(e?n[e]:f)))}var a=n[0],p=-1,g=a?a.length:0,y=[];n:for(;++p(m?r(m,c):i(f,c))){for(e=u,(m||f).push(c);--e;)if(m=o[e],0>(m?r(m,c):i(n[e],c)))continue n;y.push(c) -}}for(;u--;)(m=o[u])&&v(m);return h(o),h(f),y},i.invert=function(n,t){for(var r=-1,e=ae(n),u=e.length,o={};++rr?Mr(0,e+r):Ur(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},i.mixin=ar,i.noConflict=function(){return n._=xr,this},i.noop=fr,i.now=pe,i.parseInt=se,i.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Xr(),Ur(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):yt(n,t)},i.reduce=Pt,i.reduceRight=Kt,i.result=function(n,t,r){return null==n?r:(r="undefined"!=typeof n[t]?n[t]:r,nr(r)?n[t]():r) -},i.runInContext=j,i.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ae(n).length},i.some=Ut,i.sortedIndex=Nt,i.template=function(n,t,r){var e=i.templateSettings;n=br(n||""),r=Ht({},r,e);var u,o=Ht({},r.imports,e.imports),e=ae(o),o=ur(o),a=0,f=r.interpolate||G,l="__p+='",f=mr((r.escape||G).source+"|"+f.source+"|"+(f===K?M:G).source+"|"+(r.evaluate||G).source+"|$","g");n.replace(f,function(t,r,e,o,i,f){return e||(e=o),l+=n.slice(a,f).replace(J,p),r&&(l+="'+__e("+r+")+'"),i&&(u=true,l+="';"+i+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t -}),l+="';",f=r=r.variable,f||(r="obj",l="with("+r+"){"+l+"}"),l=(u?l.replace($,""):l).replace(B,"$1").replace(q,"$1;"),l="function("+r+"){"+(f?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=gr(e,"return "+l).apply(k,o)}catch(s){throw s.source=l,s}return t?c(t):(c.source=l,c)},i.trim=fe,i.trimLeft=le,i.trimRight=ce,i.unescape=function(n){return null==n?"":(n=br(n),0>n.indexOf(";")?n:n.replace(W,w)) -},i.uniqueId=function(n){var t=++O;return br(null==n?"":n)+t},i.all=Ft,i.any=Ut,i.detect=Bt,i.findWhere=Bt,i.foldl=Pt,i.foldr=Kt,i.include=Dt,i.inject=Pt,ar(function(){var n={};return Jt(i,function(t,r){i.prototype[r]||(n[r]=t)}),n}(),false),i.first=Ct,i.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=i.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:k;return e=u-e,Et(n,0"']/g,L=/<%-([\s\S]+?)%>/g,P=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,M=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,U=/\w*$/,V=/^\s*function[ \n\r\t]+\w/,X=/^0[xX]/,G=/($^)/,H=/\bthis\b/,J=/['\n\r\t\u2028\u2029\\]/g,Q="Array Boolean Date Function Math Number Object RegExp String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),Y="[object Arguments]",Z="[object Array]",nt="[object Boolean]",tt="[object Date]",rt="[object Function]",et="[object Number]",ut="[object Object]",ot="[object RegExp]",it="[object String]",at={}; -at[rt]=false,at[Y]=at[Z]=at[nt]=at[tt]=at[et]=at[ut]=at[ot]=at[it]=true;var ft={leading:false,maxWait:0,trailing:false},lt={configurable:false,enumerable:false,value:null,writable:false},ct={"&":"&","<":"<",">":">",'"':""","'":"'"},pt={"&":"&","<":"<",">":">",""":'"',"'":"'"},st={"function":true,object:true},gt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ht=st[typeof window]&&window||this,vt=st[typeof exports]&&exports&&!exports.nodeType&&exports,yt=st[typeof global]&&global; -!yt||yt.global!==yt&&yt.window!==yt||(ht=yt);var yt=(st=st[typeof module]&&module&&!module.nodeType&&module)&&st.exports===vt&&vt,mt=j();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(ht._=mt, define(function(){return mt})):vt&&st?yt?(st.exports=mt)._=mt:vt._=mt:ht._=mt}).call(this); \ No newline at end of file +;(function(){function n(n,t){if(n!==t){if(n>t||typeof n=="undefined")return 1;if(ne||13e||8202r||13r||8202=N&&o===t&&(o=r,e=bt(e));++uo(e,f)&&a.push(f)}return a}function st(n,t,r,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++e=N&&i===t,l=[];if(f)var s=bt(),i=r;else s=u?c():l;for(;++oi(s,h))&&((u||f)&&s.push(h),l.push(g)) +}return!f&&u&&p(s),l}function dt(n){return function(t,r,e){var u={};r=y.createCallback(r,e,3),e=-1;var o=t?t.length:0;if(typeof o=="number")for(;++ee?Ur(0,u+e):e||0;else if(e)return e=Et(n,r),u&&n[e]===r?e:-1;return t(n,r,e)}function At(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=y.createCallback(t,r,3);++ut?t=Ur(u+t,0):t>u&&(t=u),typeof r=="undefined"?r=u:0>r?r=Ur(u+r,0):r>u&&(r=u),u=r-t||0,r=cr(u);++e>>1,r(n[e])r?0:r);++t=e)return false;if(typeof n=="string"||!ae(n)&&er(n))return Wr?Wr.call(n,t,r):-1r?Ur(0,e+r):r)||0,-1o&&(o=a)}else t=null==t&&er(n)?e:y.createCallback(t,r,3),qt(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function Pt(n,t,r,e){var u=3>arguments.length;t=y.createCallback(t,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number")for(u&&i&&(r=n[++o]);++oarguments.length;return t=y.createCallback(t,e,4),Wt(n,function(n,e,o){r=u?(u=false,n):t(r,n,e,o)}),r}function Mt(n){var t=-1,r=n?n.length:0,e=cr(typeof r=="number"?r:0); +return qt(n,function(n){var r=yt(0,++t);e[t]=e[r],e[r]=n}),e}function Ut(n,t,r){var e;t=y.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r=y;m?(i&&(i=Sr(i)),s=f,a=n.apply(l,o)):i||(i=Fr(e,y))}return m&&c?c=Sr(c):c||t===g||(c=Fr(u,t)),r&&(m=true,a=n.apply(l,o)),!m||c||i||(o=l=null),a}}function Gt(n,t,r){var e=arguments,u=0,o=e.length,i=typeof r; +if("number"!=i&&"string"!=i||!e[3]||e[3][r]!==t||(o=2),3--n?t.apply(this,arguments):void 0}},y.assign=Gt,y.at=function(n,t){var r=arguments,e=-1,u=st(r,true,false,1),o=u.length,i=typeof t;for("number"!=i&&"string"!=i||!r[2]||r[2][t]!==n||(o=1),r=cr(o);++e=N&&bt(e?n[e]:f)))}var a=n[0],s=-1,g=a?a.length:0,h=[];n:for(;++s(v?r(v,l):i(f,l))){for(e=u,(v||f).push(l);--e;)if(v=o[e],0>(v?r(v,l):i(n[e],l)))continue n;h.push(l)}}return p(o),p(f),h},y.invert=function(n,t){for(var r=-1,e=le(n),u=e.length,o={};++rr?Ur(0,e+r):Vr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},y.mixin=ar,y.noConflict=function(){return n._=xr,this},y.noop=fr,y.now=ge,y.parseInt=he,y.random=function(n,t,r){var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=Hr(),Vr(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):yt(n,t) +},y.reduce=Pt,y.reduceRight=Kt,y.result=function(n,t,r){return null==n?r:(r="undefined"!=typeof n[t]?n[t]:r,nr(r)?n[t]():r)},y.runInContext=b,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:le(n).length},y.some=Ut,y.sortedIndex=Et,y.template=function(n,t,r){var e=y.templateSettings;n=dr(n||""),r=Ht({},r,e);var u,o=Ht({},r.imports,e.imports),e=le(o),o=ur(o),i=0,a=r.interpolate||U,f="__p+='",a=mr((r.escape||U).source+"|"+a.source+"|"+(a===z?L:U).source+"|"+(r.evaluate||U).source+"|$","g"); +n.replace(a,function(t,r,e,o,a,c){return e||(e=o),f+=n.slice(i,c).replace(X,l),r&&(f+="'+__e("+r+")+'"),a&&(u=true,f+="';"+a+";\n__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';",a=r=r.variable,a||(r="obj",f="with("+r+"){"+f+"}"),f=(u?f.replace(T,""):f).replace(D,"$1").replace(F,"$1;"),f="function("+r+"){"+(a?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=gr(e,"return "+f).apply(_,o) +}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.trim=ce,y.trimLeft=pe,y.trimRight=se,y.unescape=function(n){return null==n?"":(n=dr(n),0>n.indexOf(";")?n:n.replace($,d))},y.uniqueId=function(n){var t=++k;return dr(null==n?"":n)+t},y.all=Ft,y.any=Ut,y.detect=Bt,y.findWhere=Bt,y.foldl=Pt,y.foldr=Kt,y.include=Dt,y.inject=Pt,ar(function(){var n={};return Jt(y,function(t,r){y.prototype[r]||(n[r]=t)}),n}(),false),y.first=Ct,y.last=function(n,t,r){var e=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u; +for(t=y.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n?n[u-1]:_;return e=u-e,St(n,0"']/g,q=/<%-([\s\S]+?)%>/g,W=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,L=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,P=/\w*$/,K=/^\s*function[ \n\r\t]+\w/,M=/^0[xX]/,U=/($^)/,V=/\bthis\b/,X=/['\n\r\t\u2028\u2029\\]/g,G="Array Boolean Date Function Math Number Object RegExp Set String _ clearTimeout document isFinite isNaN parseInt setTimeout TypeError window WinRTError".split(" "),H="[object Arguments]",J="[object Array]",Q="[object Boolean]",Y="[object Date]",Z="[object Function]",nt="[object Number]",tt="[object Object]",rt="[object RegExp]",et="[object String]",ut={}; +ut[Z]=false,ut[H]=ut[J]=ut[Q]=ut[Y]=ut[nt]=ut[tt]=ut[rt]=ut[et]=true;var ot={leading:false,maxWait:0,trailing:false},it={configurable:false,enumerable:false,value:null,writable:false},at={"&":"&","<":"<",">":">",'"':""","'":"'"},ft={"&":"&","<":"<",">":">",""":'"',"'":"'"},lt={"function":true,object:true},ct={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=lt[typeof window]&&window||this,st=lt[typeof exports]&&exports&&!exports.nodeType&&exports,gt=lt[typeof global]&&global; +!gt||gt.global!==gt&>.window!==gt||(pt=gt);var gt=(lt=lt[typeof module]&&module&&!module.nodeType&&module)&<.exports===st&&st,ht=b();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(pt._=ht, define(function(){return ht})):st&<?gt?(lt.exports=ht)._=ht:st._=ht:pt._=ht}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 576e7d30c..9f62fb0bf 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -239,6 +239,7 @@ nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, nativeMin = Math.min, + nativeNow = isNative(nativeNow = Date.now) && nativeNow, nativeRandom = Math.random; /*--------------------------------------------------------------------------*/ @@ -4765,7 +4766,7 @@ * _.defer(function() { console.log(_.now() - stamp); }); * // => logs the number of milliseconds it took for the deferred function to be called */ - var now = isNative(now = Date.now) && now || function() { + var now = nativeNow || function() { return new Date().getTime(); }; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index d114d0ef3..17c47fd4d 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -6,35 +6,35 @@ ;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined"){t=1;break n}if(te(r,i)&&o.push(i)}return o -}function s(n,r,t,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++eu(f,c))&&(t&&f.push(c),i.push(a))}return i}function h(n){return function(r,t,e){var u={};t=X(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++eu(f,c))&&(t&&f.push(c),i.push(a))}return i}function h(n){return function(r,t,e){var u={};t=X(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++ee?Lr(0,u+e):e||0;else if(e)return e=T(r,t),u&&r[e]===t?e:-1;return n(r,t,e)}function j(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=X(r,t,3);++ur?r=Lr(u+r,0):r>u&&(r=u),typeof t=="undefined"?t=u:0>t?t=Lr(u+t,0):t>u&&(t=u),u=t-r||0,t=Array(u);++e>>1,t(n[e])u&&(u=t); -else r=X(r,t,3),N(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function R(n,r,t,e){var u=3>arguments.length;r=X(r,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number")for(u&&i&&(t=n[++o]);++oarguments.length;return r=X(r,e,4),q(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function I(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return N(n,function(n){var t;t=++r,t=0+Dr(Xr()*(t-0+1)),e[r]=e[t],e[t]=n +}function q(n,r){var t=n?n.length:0;if(typeof t=="number")for(;t--&&false!==r(n[t],t,n););else{var e=ft(n),t=e.length;U(n,function(n,u,o){return u=e?e[--t]:--t,false===r(o[u],u,o)&&ur})}}function F(n,r,t){var e=-1,u=n?n.length:0;if(r=X(r,t,3),typeof u=="number")for(var o=Array(u);++eu&&(u=t); +else r=X(r,t,3),N(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function R(n,r,t,e){var u=3>arguments.length;r=X(r,e,4);var o=-1,i=n?n.length:0;if(typeof i=="number")for(u&&i&&(t=n[++o]);++oarguments.length;return r=X(r,e,4),q(n,function(n,e,o){t=u?(u=false,n):r(t,n,e,o)}),t}function I(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return N(n,function(n){var t;t=++r,t=0+Dr(Yr()*(t-0+1)),e[r]=e[t],e[t]=n }),e}function M(n,r,t){var e;r=X(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++t=y;m?(u&&(u=clearTimeout(u)),l=i,o=n.apply(f,e)):u||(u=setTimeout(h,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(v,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o -}}function C(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=y;m?(u&&(u=clearTimeout(u)),l=i,o=n.apply(f,e)):u||(u=setTimeout(h,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(v,r)),t&&(m=true,o=n.apply(f,e)),!m||a||u||(e=f=null),o +}}function C(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,gr=/($^)/,vr=/['\n\r\t\u2028\u2029\\]/g,hr="[object Arguments]",yr="[object Array]",mr="[object Boolean]",_r="[object Date]",br="[object Number]",dr="[object Object]",wr="[object RegExp]",jr="[object String]",xr={"&":"&","<":"<",">":">",'"':""","'":"'"},Tr={"&":"&","<":"<",">":">",""":'"',"'":"'"},Ar={"function":true,object:true},Er={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Or=Ar[typeof window]&&window||this,kr=Ar[typeof exports]&&exports&&!exports.nodeType&&exports,Sr=Ar[typeof global]&&global; -!Sr||Sr.global!==Sr&&Sr.window!==Sr||(Or=Sr);var Nr=Ar[typeof module]&&module&&!module.nodeType&&module,qr=Nr&&Nr.exports===kr&&kr,Fr=Array.prototype,Br=Object.prototype,Rr=Or._,$r=Br.toString,Ir=RegExp("^"+($r+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").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=_(Vr=Object.create)&&Vr,Gr=_(Gr=Array.isArray)&&Gr,Hr=Or.isFinite,Jr=Or.isNaN,Kr=_(Kr=Object.keys)&&Kr,Lr=Math.max,Qr=Math.min,Xr=Math.random; -i.prototype=o.prototype;var Yr={};!function(){var n={0:1,length:1};Yr.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||(a=function(){function n(){}return function(r){if(J(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Or.Object()}}()),b(arguments)||(b=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&zr.call(n,"callee")&&!Pr.call(n,"callee")||false});var Zr=function(n){var r=[]; -if(!J(n))return r;for(var t in n)zr.call(n,t)&&r.push(t);return r},nt=h(function(n,r,t){zr.call(n,t)?n[t]++:n[t]=1}),rt=h(function(n,r,t){zr.call(n,t)?n[t].push(r):n[t]=[r]}),tt=h(function(n,r,t){n[t]=r}),et=F,ut=function(n,r){if(!J(n))return n;for(var t in n)if(r(n[t],t,n)===ur)break;return n},ot=Gr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&$r.call(n)==yr||false};H(/x/)&&(H=function(n){return typeof n=="function"&&"[object Function]"==$r.call(n)});var it=Kr?function(n){return J(n)?Kr(n):[] -}:Zr,ft=_(ft=Date.now)&&ft||function(){return(new Date).getTime()};o.after=function(n,r){if(!H(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=1i(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=it(n),e=t.length,u={};++rr?0:r);++nt?Lr(0,e+t):Qr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=nr,o.noConflict=function(){return Or._=Rr,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+Dr(Xr()*(r-n+1))},o.reduce=R,o.reduceRight=$,o.result=function(n,r,t){return null==n?t:(t="undefined"!=typeof n[r]?n[r]:t,H(t)?n[r]():t) -},o.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:it(n).length},o.some=M,o.sortedIndex=T,o.template=function(n,r,t){var u=o,i=u.templateSettings;n=(n||"")+"",t=P({},t,i);var f=0,a="__p+='",i=t.variable;n.replace(RegExp((t.escape||gr).source+"|"+(t.interpolate||gr).source+"|"+(t.evaluate||gr).source+"|$","g"),function(r,t,u,o,i){return a+=n.slice(f,i).replace(vr,e),t&&(a+="'+_.escape("+t+")+'"),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}"; +!Sr||Sr.global!==Sr&&Sr.window!==Sr||(Or=Sr);var Nr=Ar[typeof module]&&module&&!module.nodeType&&module,qr=Nr&&Nr.exports===kr&&kr,Fr=Array.prototype,Br=Object.prototype,Rr=Or._,$r=Br.toString,Ir=RegExp("^"+($r+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").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=_(Vr=Object.create)&&Vr,Gr=_(Gr=Array.isArray)&&Gr,Hr=Or.isFinite,Jr=Or.isNaN,Kr=_(Kr=Object.keys)&&Kr,Lr=Math.max,Qr=Math.min,Xr=_(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||(a=function(){function n(){}return function(r){if(J(r)){n.prototype=r;var t=new n;n.prototype=null}return t||Or.Object()}}()),b(arguments)||(b=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&zr.call(n,"callee")&&!Pr.call(n,"callee")||false});var nt=function(n){var r=[]; +if(!J(n))return r;for(var t in n)zr.call(n,t)&&r.push(t);return r},rt=h(function(n,r,t){zr.call(n,t)?n[t]++:n[t]=1}),tt=h(function(n,r,t){zr.call(n,t)?n[t].push(r):n[t]=[r]}),et=h(function(n,r,t){n[t]=r}),ut=F,ot=function(n,r){if(!J(n))return n;for(var t in n)if(r(n[t],t,n)===ur)break;return n},it=Gr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&$r.call(n)==yr||false};H(/x/)&&(H=function(n){return typeof n=="function"&&"[object Function]"==$r.call(n)});var ft=Kr?function(n){return J(n)?Kr(n):[] +}:nt,at=Xr||function(){return(new Date).getTime()};o.after=function(n,r){if(!H(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=1i(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=ft(n),e=t.length,u={};++rr?0:r);++nt?Lr(0,e+t):Qr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},o.mixin=nr,o.noConflict=function(){return Or._=Rr,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+Dr(Yr()*(r-n+1))},o.reduce=R,o.reduceRight=$,o.result=function(n,r,t){return null==n?t:(t="undefined"!=typeof n[r]?n[r]:t,H(t)?n[r]():t) +},o.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:ft(n).length},o.some=M,o.sortedIndex=T,o.template=function(n,r,t){var u=o,i=u.templateSettings;n=(n||"")+"",t=P({},t,i);var f=0,a="__p+='",i=t.variable;n.replace(RegExp((t.escape||gr).source+"|"+(t.interpolate||gr).source+"|"+(t.evaluate||gr).source+"|$","g"),function(r,t,u,o,i){return a+=n.slice(f,i).replace(vr,e),t&&(a+="'+_.escape("+t+")+'"),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+="",0>n.indexOf(";")?n:n.replace(pr,u))},o.uniqueId=function(n){var r=++er+"";return n?n+r:r},o.all=O,o.any=M,o.detect=S,o.findWhere=function(n,r){return D(n,r,true)},o.foldl=R,o.foldr=$,o.include=E,o.inject=R,o.first=d,o.last=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=X(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:tr; -return e=u-e,x(n,0 -1 ? 0 : -1) - : (cache ? 0 : -1); - } - - /** - * Adds a given value to the corresponding cache object. - * - * @private - * @param {*} value The value to add to the cache. - */ - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : '_' + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - var array = typeCache[key]; - if (array) { - array.push(value); - } else { - typeCache[key] = [value]; - } - } else { - typeCache[key] = true; - } - } + return cache.has(value) ? 0 : -1; } /** @@ -387,38 +341,6 @@ return a.index - b.index; } - /** - * Creates a cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [array=[]] The array to search. - * @returns {null|Object} Returns the cache object or `null` if caching should not be used. - */ - function createCache(array) { - var index = -1, - length = array.length, - first = array[0], - mid = array[(length / 2) | 0], - last = array[length - 1]; - - if (first && typeof first == 'object' && - mid && typeof mid == 'object' && last && typeof last == 'object') { - return false; - } - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return result; - } - /** * Used by `escape` to convert characters to HTML entities. * @@ -460,18 +382,8 @@ */ function getObject() { return objectPool.pop() || { - 'array': null, - 'cache': null, 'criteria': null, - 'false': false, 'index': 0, - 'null': false, - 'number': null, - 'object': null, - 'push': null, - 'string': null, - 'true': false, - 'undefined': false, 'value': null }; } @@ -509,11 +421,7 @@ * @param {Object} object The object to release. */ function releaseObject(object) { - var cache = object.cache; - if (cache) { - releaseObject(cache); - } - object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; + object.criteria = object.value = null; if (objectPool.length < MAX_POOL_SIZE) { objectPool.push(object); } @@ -695,6 +603,7 @@ hasOwnProperty = objectProto.hasOwnProperty, push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, + Set = isNative(Set = context.Set) && Set, setTimeout = context.setTimeout, splice = arrayRef.splice, unshift = arrayRef.unshift; @@ -719,6 +628,7 @@ nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, nativeMax = Math.max, nativeMin = Math.min, + nativeNow = isNative(nativeNow = Date.now) && nativeNow, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeTrim = isNative(nativeTrim = stringProto.trim) && !nativeTrim.call(whitespace) && nativeTrim, @@ -1424,17 +1334,11 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, result = []; - if (isLarge) { - var cache = createCache(values); - if (cache) { - indexOf = cacheIndexOf; - values = cache; - } else { - isLarge = false; - } + if (Set && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf) { + indexOf = cacheIndexOf; + values = createCache(values); } while (++index < length) { var value = array[index]; @@ -1442,13 +1346,9 @@ result.push(value); } } - if (isLarge) { - releaseObject(values); - } return result; } - /** * Iterates `arguments` objects, arrays, objects, and strings consistently * across environments, executing the callback for each element in the @@ -1791,15 +1691,14 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, + isLarge = Set && !isSorted && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, result = []; - var isLarge = !isSorted && length >= LARGE_ARRAY_SIZE && indexOf === baseIndexOf, - seen = (callback || isLarge) ? getArray() : result; - if (isLarge) { - var cache = createCache(seen); + var seen = createCache(); indexOf = cacheIndexOf; - seen = cache; + } else { + seen = callback ? getArray() : result; } while (++index < length) { var value = array[index], @@ -1815,10 +1714,7 @@ result.push(value); } } - if (isLarge) { - releaseArray(seen.array); - releaseObject(seen); - } else if (callback) { + if (!isLarge && callback) { releaseArray(seen); } return result; @@ -1856,6 +1752,24 @@ }; } + /** + * Creates a cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [array=[]] The array to search. + * @returns {Object} Returns the cache object. + */ + function createCache(array) { + var cache = new Set, + length = array ? array.length : 0; + + cache.push = cache.add; + while (length--) { + cache.push(array[length]); + } + return cache; + } + /** * Creates a function that, when called, either curries or invokes `func` * with an optional `this` binding and partially applied arguments. @@ -2507,14 +2421,14 @@ argsLength = arguments.length, caches = getArray(), indexOf = getIndexOf(), - trustIndexOf = indexOf === baseIndexOf, + largePrereq = Set && indexOf === baseIndexOf, seen = getArray(); while (++argsIndex < argsLength) { var value = arguments[argsIndex]; if (isArray(value) || isArguments(value)) { args.push(value); - caches.push(trustIndexOf && value.length >= LARGE_ARRAY_SIZE && + caches.push(largePrereq && value.length >= LARGE_ARRAY_SIZE && createCache(argsIndex ? args[argsIndex] : seen)); } } @@ -2540,12 +2454,6 @@ result.push(value); } } - while (argsLength--) { - cache = caches[argsLength]; - if (cache) { - releaseObject(cache); - } - } releaseArray(caches); releaseArray(seen); return result; @@ -7123,7 +7031,7 @@ * _.defer(function() { console.log(_.now() - stamp); }); * // => logs the number of milliseconds it took for the deferred function to be called */ - var now = isNative(now = Date.now) && now || function() { + var now = nativeNow || function() { return new Date().getTime(); };