diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index a9e9aa053..4c77260c8 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -34,7 +34,7 @@ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 200; + var largeArraySize = 75; /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, @@ -56,6 +56,9 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis; + /** Used to detect and test whitespace */ var whitespace = ( // whitespace @@ -189,6 +192,7 @@ clearTimeout = context.clearTimeout, concat = arrayProto.concat, floor = Math.floor, + fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, @@ -646,26 +650,72 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function cachedContains(array) { - var length = array.length, - isLarge = length >= largeArraySize; + function createCache(array) { + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; - if (isLarge) { - var cache = {}, - index = -1; + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; - while (++index < length) { - var key = keyPrefix + array[index]; - (cache[key] || (cache[key] = [])).push(array[index]); + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; + } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? indexOf(cache[key], value) > -1 : false) + : !!cache[key]; + } + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } } } - return function(value) { - if (isLarge) { - var key = keyPrefix + value; - return cache[key] && indexOf(cache[key], value) > -1; - } + + function simpleContains(value) { return indexOf(array, value) > -1; } + + function simplePush(value) { + array.push(value); + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'push': simplePush, 'contains' : simpleContains }; } /** @@ -3423,7 +3473,7 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = cachedContains(flattened), + contains = createCache(flattened).contains, result = []; while (++index < length) { @@ -3751,29 +3801,21 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = { '0': {} }, + cache = createCache([]), + caches = {}, index = -1, length = array ? array.length : 0, isLarge = length >= largeArraySize, - result = [], - seen = result; + result = []; outer: while (++index < length) { var value = array[index]; - if (isLarge) { - var key = keyPrefix + value; - var inited = cache[0][key] - ? !(seen = cache[0][key]) - : (seen = cache[0][key] = []); - } - if (inited || indexOf(seen, value) < 0) { - if (isLarge) { - seen.push(value); - } + if (!cache.contains(value)) { var argsIndex = argsLength; + cache.push(value); while (--argsIndex) { - if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) { + if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { continue outer; } } @@ -4161,26 +4203,20 @@ } // init value cache for large arrays var isLarge = !isSorted && length >= largeArraySize; - if (isLarge) { - var cache = {}; - } if (callback != null) { seen = []; callback = lodash.createCallback(callback, thisArg); } + if (isLarge) { + seen = createCache([]); + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; - if (isLarge) { - var key = keyPrefix + computed; - var inited = cache[key] - ? !(seen = cache[key]) - : (seen = cache[key] = []); - } if (isSorted ? !index || seen[seen.length - 1] !== computed - : inited || indexOf(seen, computed) < 0 + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); @@ -4528,27 +4564,27 @@ return result; }; } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); + if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + return func; + } + if (argCount === 1) { + return function(value) { + return func.call(thisArg, value); }; } - return func; + if (argCount === 2) { + return function(a, b) { + return func.call(thisArg, a, b); + }; + } + if (argCount === 4) { + return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } /** @@ -4585,8 +4621,8 @@ var args, result, thisArg, - timeoutId, callCount = 0, + timeoutId = null, trailing = true; function delayed() { @@ -4606,6 +4642,9 @@ return function() { args = arguments; thisArg = this; + + // avoid issues with Titanium and `undefined` timeout ids + // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); if (leading && ++callCount < 2) { @@ -4814,9 +4853,9 @@ var args, result, thisArg, - timeoutId, lastCalled = 0, leading = true, + timeoutId = null, trailing = true; function trailingCall() { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 5282039bf..fe35378b6 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,45 +4,46 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Er(n)&&tr.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,r=t>=l;if(r)for(var e={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; -e+="}"}return(t.b||wr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(A,Kt,tr,Z,Er,it,Sr,a,Mt,$,Cr,z,Ut,or)}function J(n){return at(n)?cr(n):{}}function K(n){return"\\"+q[n]}function M(n){return Ir[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function Q(){}function W(n){var t=!1;if(!n||or.call(n)!=N||!wr.argsClass&&Z(n))return t;var r=n.constructor;return(ut(r)?r instanceof r:wr.nodeClass||!U(n))?wr.ownLast?(zr(n,function(n,r,e){return t=tr.call(e,r),!1 -}),!0===t):(zr(n,function(n,r){t=r}),!1===t||tr.call(n,t)):t}function X(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=zt(0>r?0:r);++er?vr(0,u+r):r)||0,typeof u=="number"?a=-1<(it(n)?n.indexOf(t,r):jt(n,t,r)):Ar(n,function(n){return++eu&&(u=i)}}else t=!t&&it(n)?T:a.createCallback(t,r),Ar(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) -});return u}function mt(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Er(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Sr(n),o=c.length;else wr.unindexedChars&&it(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),gt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function bt(n,t,r){var e; -if(t=a.createCallback(t,r),Er(n)){r=-1;for(var u=n.length;++rr?vr(0,u+r):r||0)-1;else if(r)return e=xt(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=l;if(s)var v={};for(null!=e&&(p=[],e=a.createCallback(e,u));++ojt(p,g))&&((e||s)&&p.push(g),f.push(u))}return f}function Ot(n){for(var t=-1,r=n?yt(qr(n,"length")):0,e=zt(0>r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var jr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Br=rt(Ir),Nr=H(jr,{h:jr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Pr=H(jr),zr=H(kr,xr,{i:!1}),Fr=H(kr,xr); -ut(/x/)&&(ut=function(n){return typeof n=="function"&&or.call(n)==I});var $r=nr?function(n){if(!n||or.call(n)!=N||!wr.argsClass&&Z(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=nr(t))&&nr(r);return r?n==r||nr(n)==r:W(n)}:W,qr=ht;br&&u&&typeof ur=="function"&&(It=At(ur,e));var Dr=8==hr(m+"08")?hr:function(n,t){return hr(it(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Nr,a.at=function(n){var t=-1,r=Yt.apply(Jt,mr.call(arguments,1)),e=r.length,u=zt(e); -for(wr.unindexedChars&&it(n)&&(n=n.split(""));++t++c&&(a=n.apply(o,u)),i=ar(e,t),a}},a.defaults=Pr,a.defer=It,a.delay=function(n,t){var e=mr.call(arguments,2);return ar(function(){n.apply(r,e)},t)},a.difference=_t,a.filter=st,a.flatten=wt,a.forEach=gt,a.forIn=zr,a.forOwn=Fr,a.functions=tt,a.groupBy=function(n,t,r){var e={}; -return t=a.createCallback(t,r),gt(n,function(n,r,u){r=Gt(t(n,r,u)),(tr.call(e,r)?e[r]:e[r]=[]).push(n)}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return X(n,0,gr(vr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],f=i;n:for(;++ujt(f,p)){o&&f.push(p); -for(var v=r;--v;)if(!(e[v]||(e[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=rt,a.invoke=function(n,t){var r=mr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=zt(typeof a=="number"?a:0);return gt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Sr,a.map=ht,a.max=yt,a.memoize=function(n,t){function r(){var e=r.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return tr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},a.merge=ct,a.min=function(n,t,r){var e=1/0,u=e; -if(!t&&Er(n)){r=-1;for(var o=n.length;++rjt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Sr(n),e=r.length,u=zt(e);++tr?vr(0,e+r):gr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Nt,a.noConflict=function(){return e._=Vt,this},a.parseInt=Dr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=yr();return n%1||t%1?n+gr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+Zt(r*(t-n+1))},a.reduce=mt,a.reduceRight=dt,a.result=function(n,t){var e=n?n[t]:r; -return ut(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Sr(n).length},a.some=bt,a.sortedIndex=xt,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Pr({},e,u);var o,i=Pr({},e.imports,u.imports),u=Sr(i),i=lt(i),c=0,l=e.interpolate||b,v="__p+='",l=Lt((e.escape||b).source+"|"+l.source+"|"+(l===y?g:b).source+"|"+(e.evaluate||b).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),v+=n.slice(c,i).replace(C,K),r&&(v+="'+__e("+r+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),e&&(v+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t -}),v+="';\n",l=e=e.variable,l||(e="obj",v="with("+e+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=qt(u,"return "+v).apply(r,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Gt(n).replace(v,Y)},a.uniqueId=function(n){var t=++o;return Gt(null==n?"":n)+t -},a.all=pt,a.any=bt,a.detect=vt,a.foldl=mt,a.foldr=dt,a.include=ft,a.inject=mt,Fr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return rr.apply(t,arguments),n.apply(a,t)})}),a.first=Ct,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return X(n,vr(0,u-e))}},a.take=Ct,a.head=Ct,Fr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); -return null==t||r&&typeof t!="function"?e:new V(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Gt(this.__wrapped__)},a.prototype.value=Pt,a.prototype.valueOf=Pt,Ar(["join","pop","shift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Ar(["push","reverse","sort","unshift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ar(["concat","slice","splice"],function(n){var t=Jt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments)) -}}),wr.spliceObjects||Ar(["pop","shift","splice"],function(n){var t=Jt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new V(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=200,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=" \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",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",I="[object Function]",B="[object Number]",N="[object Object]",P="[object RegExp]",z="[object String]",F={}; -F[I]=!1,F[x]=F[E]=F[O]=F[S]=F[B]=F[N]=F[P]=F[z]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):e&&!e.nodeType?u?(u.exports=D)._=D:e._=D:n._=D}(this); \ No newline at end of file +;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Sr(n)&&er.call(n,"__wrapped__")?n:new Q(n)}function T(n){function t(n){var t=typeof n;if("boolean"==t||null==n)return s[n];var r=s[t]||(t="object",p),e="number"==t?n:l+n;return"object"==t?r[e]?-1=c,p={},s={"false":!1,"function":!1,"null":!1,number:{},object:p,string:{},"true":!1,undefined:!1};if(f){for(;++ot||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; +e+="}"}return(t.b||kr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Mt,er,nt,Sr,lt,Ir,a,Ut,q,wr,F,Vt,lr)}function K(n){return ot(n)?fr(n):{}}function M(n){return"\\"+D[n]}function U(n){return Nr[n]}function V(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function Q(n){this.__wrapped__=n}function W(){}function X(n){var t=!1;if(!n||lr.call(n)!=P||!kr.argsClass&&nt(n))return t;var r=n.constructor;return(at(r)?r instanceof r:kr.nodeClass||!V(n))?kr.ownLast?($r(n,function(n,r,e){return t=er.call(e,r),!1 +}),!0===t):($r(n,function(n,r){t=r}),!1===t||er.call(n,t)):t}function Y(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Ft(0>r?0:r);++er?hr(0,u+r):r)||0,typeof u=="number"?a=-1<(lt(n)?n.indexOf(t,r):kt(n,t,r)):Br(n,function(n){return++eu&&(u=i)}}else t=!t&<(n)?L:a.createCallback(t,r),Br(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) +});return u}function dt(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Sr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var l=Ir(n),o=l.length;else kr.unindexedChars&<(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),ht(n,function(n,e,a){e=l?l[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function _t(n,t,r){var e; +if(t=a.createCallback(t,r),Sr(n)){r=-1;for(var u=n.length;++rr?hr(0,u+r):r||0)-1;else if(r)return e=Et(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=c;for(null!=e&&(f=[],e=a.createCallback(e,u)),p&&(f=T([]));++or?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var xr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Pr=et(Nr),zr=J(xr,{h:xr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Fr=J(xr),$r=J(Er,Or,{i:!1}),qr=J(Er,Or); +at(/x/)&&(at=function(n){return typeof n=="function"&&lr.call(n)==B});var Dr=rr?function(n){if(!n||lr.call(n)!=P||!kr.argsClass&&nt(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=rr(t))&&rr(r);return r?n==r||rr(n)==r:X(n)}:X,Rr=yt;Cr&&u&&typeof or=="function"&&(Bt=It(or,e));var Tr=8==mr(d+"08")?mr:function(n,t){return mr(lt(n)?n.replace(b,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=zr,a.at=function(n){var t=-1,r=Zt.apply(Kt,br.call(arguments,1)),e=r.length,u=Ft(e); +for(kr.unindexedChars&<(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),l=ir(e,t),a}},a.defaults=Fr,a.defer=Bt,a.delay=function(n,t){var e=br.call(arguments,2);return ir(function(){n.apply(r,e)},t)},a.difference=Ct,a.filter=gt,a.flatten=wt,a.forEach=ht,a.forIn=$r,a.forOwn=qr,a.functions=rt,a.groupBy=function(n,t,r){var e={}; +return t=a.createCallback(t,r),ht(n,function(n,r,u){r=Ht(t(n,r,u)),(er.call(e,r)?e[r]:e[r]=[]).push(n)}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return Y(n,0,yr(hr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=T([]),u={},a=-1,o=n?n.length:0,i=[];n:for(;++akt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Ir(n),e=r.length,u=Ft(e);++tr?hr(0,e+r):yr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Pt,a.noConflict=function(){return e._=Qt,this},a.parseInt=Tr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=dr();return n%1||t%1?n+yr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+nr(r*(t-n+1))},a.reduce=dt,a.reduceRight=bt,a.result=function(n,t){var e=n?n[t]:r; +return at(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ir(n).length},a.some=_t,a.sortedIndex=Et,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Fr({},e,u);var o,i=Fr({},e.imports,u.imports),u=Ir(i),i=ft(i),l=0,c=e.interpolate||_,g="__p+='",c=Gt((e.escape||_).source+"|"+c.source+"|"+(c===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(c,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(l,i).replace(j,M),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),l=i+t.length,t +}),g+="';\n",c=e=e.variable,c||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(c?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Dt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Ht(n).replace(g,Z)},a.uniqueId=function(n){var t=++o;return Ht(null==n?"":n)+t +},a.all=st,a.any=_t,a.detect=vt,a.foldl=dt,a.foldr=bt,a.include=pt,a.inject=dt,qr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ur.apply(t,arguments),n.apply(a,t)})}),a.first=jt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Y(n,hr(0,u-e))}},a.take=jt,a.head=jt,qr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +return null==t||r&&typeof t!="function"?e:new Q(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Ht(this.__wrapped__)},a.prototype.value=zt,a.prototype.valueOf=zt,Br(["join","pop","shift"],function(n){var t=Kt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Br(["push","reverse","sort","unshift"],function(n){var t=Kt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Br(["concat","slice","splice"],function(n){var t=Kt[n];a.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments)) +}}),kr.spliceObjects||Br(["pop","shift","splice"],function(n){var t=Kt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new Q(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},l=+new Date+"",c=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \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",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),E="[object Arguments]",O="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; +$[B]=!1,$[E]=$[O]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 4001c35fe..dc0889f24 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -34,7 +34,7 @@ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 200; + var largeArraySize = 75; /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, @@ -56,6 +56,9 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis; + /** Used to detect and test whitespace */ var whitespace = ( // whitespace @@ -181,6 +184,7 @@ clearTimeout = context.clearTimeout, concat = arrayProto.concat, floor = Math.floor, + fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, @@ -376,26 +380,72 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function cachedContains(array) { - var length = array.length, - isLarge = length >= largeArraySize; + function createCache(array) { + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; - if (isLarge) { - var cache = {}, - index = -1; + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; - while (++index < length) { - var key = keyPrefix + array[index]; - (cache[key] || (cache[key] = [])).push(array[index]); + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; + } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? indexOf(cache[key], value) > -1 : false) + : !!cache[key]; + } + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } } } - return function(value) { - if (isLarge) { - var key = keyPrefix + value; - return cache[key] && indexOf(cache[key], value) > -1; - } + + function simpleContains(value) { return indexOf(array, value) > -1; } + + function simplePush(value) { + array.push(value); + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'push': simplePush, 'contains' : simpleContains }; } /** @@ -3099,7 +3149,7 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = cachedContains(flattened), + contains = createCache(flattened).contains, result = []; while (++index < length) { @@ -3427,29 +3477,21 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = { '0': {} }, + cache = createCache([]), + caches = {}, index = -1, length = array ? array.length : 0, isLarge = length >= largeArraySize, - result = [], - seen = result; + result = []; outer: while (++index < length) { var value = array[index]; - if (isLarge) { - var key = keyPrefix + value; - var inited = cache[0][key] - ? !(seen = cache[0][key]) - : (seen = cache[0][key] = []); - } - if (inited || indexOf(seen, value) < 0) { - if (isLarge) { - seen.push(value); - } + if (!cache.contains(value)) { var argsIndex = argsLength; + cache.push(value); while (--argsIndex) { - if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) { + if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { continue outer; } } @@ -3837,26 +3879,20 @@ } // init value cache for large arrays var isLarge = !isSorted && length >= largeArraySize; - if (isLarge) { - var cache = {}; - } if (callback != null) { seen = []; callback = lodash.createCallback(callback, thisArg); } + if (isLarge) { + seen = createCache([]); + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; - if (isLarge) { - var key = keyPrefix + computed; - var inited = cache[key] - ? !(seen = cache[key]) - : (seen = cache[key] = []); - } if (isSorted ? !index || seen[seen.length - 1] !== computed - : inited || indexOf(seen, computed) < 0 + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); @@ -4204,27 +4240,27 @@ return result; }; } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); + if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + return func; + } + if (argCount === 1) { + return function(value) { + return func.call(thisArg, value); }; } - return func; + if (argCount === 2) { + return function(a, b) { + return func.call(thisArg, a, b); + }; + } + if (argCount === 4) { + return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } /** @@ -4261,8 +4297,8 @@ var args, result, thisArg, - timeoutId, callCount = 0, + timeoutId = null, trailing = true; function delayed() { @@ -4282,6 +4318,9 @@ return function() { args = arguments; thisArg = this; + + // avoid issues with Titanium and `undefined` timeout ids + // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); if (leading && ++callCount < 2) { @@ -4490,9 +4529,9 @@ var args, result, thisArg, - timeoutId, lastCalled = 0, leading = true, + timeoutId = null, trailing = true; function trailingCall() { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 0323bf35f..2d198d4dd 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,42 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(o){function f(n){if(!n||ae.call(n)!=$)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ne(t))&&ne(e);return e?n==e||ne(n)==e:Y(n)}function z(n,t,e){if(!n||!T[typeof n])return n;t=t&&typeof e=="undefined"?t:V.createCallback(t,e);for(var r=-1,u=T[typeof n]?_e(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; -if(ne?0:e);++re?se(0,u+e):e)||0,typeof u=="number"?o=-1<(ft(n)?n.indexOf(t,e):xt(n,t,e)):z(n,function(n){return++ru&&(u=o) -}}else t=!t&&ft(n)?H:V.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function mt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Tt(r);++earguments.length;t=V.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=_e(n),u=i.length;return t=V.createCallback(t,r,4),yt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function kt(n,t,e){var r;t=V.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?se(0,u+e):e||0)-1;else if(e)return r=Et(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=V.createCallback(r,o));++ixt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function Nt(n){for(var t=-1,e=n?bt(mt(n,"length")):0,r=Tt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:V}},X.prototype=V.prototype;var de=fe,_e=pe?function(n){return ot(n)?pe(n):[]}:U,ke={"&":"&","<":"<",">":">",'"':""","'":"'"},we=rt(ke);return Pt&&i&&typeof re=="function"&&($t=At(re,o)),qt=8==ge(_+"08")?ge:function(n,t){return ge(ft(n)?n.replace(k,""):n,t||0) -},V.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},V.assign=M,V.at=function(n){for(var t=-1,e=Yt.apply(Ht,he.call(arguments,1)),r=e.length,u=Tt(r);++t++l&&(i=n.apply(f,o)),c=ue(u,t),i}},V.defaults=K,V.defer=$t,V.delay=function(n,t){var r=he.call(arguments,2); -return ue(function(){n.apply(e,r)},t)},V.difference=wt,V.filter=vt,V.flatten=jt,V.forEach=yt,V.forIn=P,V.forOwn=z,V.functions=et,V.groupBy=function(n,t,e){var r={};return t=V.createCallback(t,e),yt(n,function(n,e,u){e=Vt(t(n,e,u)),(te.call(r,e)?r[e]:r[e]=[]).push(n)}),r},V.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=V.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return Z(n,0,ve(se(0,a-r),a))},V.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; -n:for(;++uxt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=G(t[v])))(c))continue n;i.push(c)}}return i},V.invert=rt,V.invoke=function(n,t){var e=he.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Tt(typeof a=="number"?a:0);return yt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},V.keys=_e,V.map=ht,V.max=bt,V.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); -return te.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},V.merge=ct,V.min=function(n,t,e){var r=1/0,u=r;if(!t&&de(n)){e=-1;for(var a=n.length;++ext(a,e))&&(u[e]=n)}),u},V.once=function(n){var t,e; -return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},V.pairs=function(n){for(var t=-1,e=_e(n),r=e.length,u=Tt(r);++te?se(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r; -return-1},V.mixin=Ft,V.noConflict=function(){return o._=Lt,this},V.parseInt=qt,V.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=ye();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},V.reduce=dt,V.reduceRight=_t,V.result=function(n,t){var r=n?n[t]:e;return at(r)?n[t]():r},V.runInContext=t,V.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:_e(n).length},V.some=kt,V.sortedIndex=Et,V.template=function(n,t,u){var a=V.templateSettings; -n||(n=""),u=K({},u,a);var o,i=K({},u.imports,a.imports),a=_e(i),i=lt(i),f=0,c=u.interpolate||w,l="__p+='",c=Ut((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(j,Q),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var p=zt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},V.unescape=function(n){return n==u?"":Vt(n).replace(h,nt)},V.uniqueId=function(n){var t=++c;return Vt(n==u?"":n)+t},V.all=st,V.any=kt,V.detect=gt,V.foldl=dt,V.foldr=_t,V.include=pt,V.inject=dt,z(V,function(n,t){V.prototype[t]||(V.prototype[t]=function(){var t=[this.__wrapped__];return ee.apply(t,arguments),n.apply(V,t)})}),V.first=Ct,V.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; -for(t=V.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Z(n,se(0,a-r))}},V.take=Ct,V.head=Ct,z(V,function(n,t){V.prototype[t]||(V.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new X(r)})}),V.VERSION="1.2.1",V.prototype.toString=function(){return Vt(this.__wrapped__)},V.prototype.value=Rt,V.prototype.valueOf=Rt,yt(["join","pop","shift"],function(n){var t=Ht[n];V.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),yt(["push","reverse","sort","unshift"],function(n){var t=Ht[n];V.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yt(["concat","slice","splice"],function(n){var t=Ht[n];V.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments))}}),V}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \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",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Function]",A="[object Number]",$="[object Object]",B="[object RegExp]",F="[object String]",R={}; -R[S]=a,R[O]=R[E]=R[I]=R[N]=R[A]=R[$]=R[B]=R[F]=r;var T={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):o&&!o.nodeType?i?(i.exports=D)._=D:o._=D:n._=D}(this); \ No newline at end of file +;!function(n){function t(o){function f(n){if(!n||ie.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ee(t))&&ee(e);return e?n==e||ee(n)==e:Z(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?je(n):[],o=u.length;++r=s,g={},y={"false":a,"function":a,"null":a,number:{},object:g,string:{},"true":a,undefined:a};if(v){for(;++ct||typeof n=="undefined")return 1;if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(ct(n)?n.indexOf(t,e):Ot(n,t,e)):P(n,function(n){return++ru&&(u=o) +}}else t=!t&&ct(n)?J:G.createCallback(t,e),ht(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function dt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=qt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=je(n),u=i.length;return t=G.createCallback(t,r,4),ht(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=St(n,t),n[r]===t?r:-1; +for(;++r>>1,e(n[r])=s;for(r!=u&&(l=[],r=G.createCallback(r,o)),p&&(l=H([]));++ie?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,je=ve?function(n){return it(n)?ve(n):[]}:V,we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=ut(we);return Kt&&i&&typeof ae=="function"&&(Bt=$t(ae,o)),Dt=8==he(k+"08")?he:function(n,t){return he(ct(n)?n.replace(j,""):n,t||0) +},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=Zt.apply(Jt,me.call(arguments,1)),r=e.length,u=qt(r);++t++l&&(f=n.apply(c,i)),p=oe(o,t),f}},G.defaults=M,G.defer=Bt,G.delay=function(n,t){var r=me.call(arguments,2); +return oe(function(){n.apply(e,r)},t)},G.difference=wt,G.filter=gt,G.flatten=xt,G.forEach=ht,G.forIn=K,G.forOwn=P,G.functions=rt,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),ht(n,function(n,e,u){e=Gt(t(n,e,u)),(re.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return nt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=H([]),u={},a=-1,o=n?n.length:0,i=[]; +n:for(;++aOt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e) +}},G.pairs=function(n){for(var t=-1,e=je(n),r=e.length,u=qt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Rt,G.noConflict=function(){return o._=Qt,this},G.parseInt=Dt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0; +var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ne(e*(t-n+1))},G.reduce=_t,G.reduceRight=kt,G.result=function(n,t){var r=n?n[t]:e;return ot(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:je(n).length},G.some=jt,G.sortedIndex=St,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=je(i),i=pt(i),f=0,c=u.interpolate||w,l="__p+='",c=Vt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g"); +n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Pt(a,"return "+l).apply(e,i) +}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Gt(n).replace(h,tt)},G.uniqueId=function(n){var t=++c;return Gt(n==u?"":n)+t},G.all=vt,G.any=jt,G.detect=yt,G.foldl=_t,G.foldr=kt,G.include=st,G.inject=_t,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ue.apply(t,arguments),n.apply(G,t)})}),G.first=Ct,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++ +}else if(r=t,r==u||e)return n[a-1];return nt(n,ge(0,a-r))}},G.take=Ct,G.head=Ct,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Gt(this.__wrapped__)},G.prototype.value=Tt,G.prototype.valueOf=Tt,ht(["join","pop","shift"],function(n){var t=Jt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),ht(["push","reverse","sort","unshift"],function(n){var t=Jt[n]; +G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ht(["concat","slice","splice"],function(n){var t=Jt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \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",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +T[A]=a,T[E]=T[S]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 55f792e3e..9fc89d6a2 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -34,7 +34,7 @@ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 200; + var largeArraySize = 75; /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, @@ -56,6 +56,9 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(function() { return this; }) && reThis; + /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -123,6 +126,7 @@ clearTimeout = window.clearTimeout, concat = arrayProto.concat, floor = Math.floor, + fnToString = Function.prototype.toString, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, @@ -3477,27 +3481,27 @@ return result; }; } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); + if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + return func; + } + if (argCount === 1) { + return function(value) { + return func.call(thisArg, value); }; } - return func; + if (argCount === 2) { + return function(a, b) { + return func.call(thisArg, a, b); + }; + } + if (argCount === 4) { + return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } /** @@ -3534,7 +3538,7 @@ var args, result, thisArg, - timeoutId; + timeoutId = null; function delayed() { timeoutId = null; @@ -3717,8 +3721,8 @@ var args, result, thisArg, - timeoutId, - lastCalled = 0; + lastCalled = 0, + timeoutId = null; function trailingCall() { lastCalled = new Date; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index ab0b810c9..2e4e04309 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function B(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Mt(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; -t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Nt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Rt.fastBind||wt&&2"']/g,nt=/['\n\r\t\u2028\u2029\\]/g,tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Number]",it="[object Object]",at="[object RegExp]",ft="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=Array.prototype,J=Object.prototype,st=n._,vt=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,ht=n.clearTimeout,yt=pt.concat,mt=Math.floor,_t=J.hasOwnProperty,bt=pt.push,dt=n.setTimeout,jt=J.toString,wt=vt.test(wt=jt.bind)&&wt,At=vt.test(At=Object.create)&&At,xt=vt.test(xt=Array.isArray)&&xt,Ot=n.isFinite,Et=n.isNaN,St=vt.test(St=Object.keys)&&St,Nt=Math.max,Bt=Math.min,Ft=Math.random,kt=pt.slice,J=vt.test(n.attachEvent),qt=wt&&!/\n|true/.test(wt+J),Rt={}; -!function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,l(arguments)||(l=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!ct[typeof n])return r; -for(t in n)_t.call(n,t)&&r.push(t);return r},Mt=St?function(n){return _(n)?St(n):[]}:xt,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=g(Tt),It=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},zt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(_t.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==jt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=g,t.invoke=function(n,t){var r=kt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Mt,t.map=S,t.max=N,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return _t.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) -}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Mt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Nt(0,e+r):Bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=st,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Ft();return n%1||t%1?n+Bt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+mt(r*(t-n+1)) -},t.reduce=F,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Mt(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Y).source+"|"+(e.interpolate||Y).source+"|"+(e.evaluate||Y).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(nt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t -}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(c){throw c.source=i,c}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,c)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=F,t.foldr=k,t.include=w,t.inject=F,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return kt.call(n,Nt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=pt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Rt.spliceObjects&&0===n.length&&delete n[0],this -}}),E(["concat","join","slice"],function(n){var r=pt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t}(this); \ No newline at end of file +;!function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; +if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; +t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Bt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Mt.fastBind||xt&&2"']/g,tt=/['\n\r\t\u2028\u2029\\]/g,rt="[object Arguments]",et="[object Array]",ut="[object Boolean]",ot="[object Date]",it="[object Number]",at="[object Object]",ft="[object RegExp]",lt="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},pt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},st=Array.prototype,J=Object.prototype,vt=n._,ht=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,yt=n.clearTimeout,mt=st.concat,_t=Math.floor,bt=Function.prototype.toString,dt=J.hasOwnProperty,jt=st.push,wt=n.setTimeout,At=J.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Ft=n.isNaN,Nt=ht.test(Nt=Object.keys)&&Nt,Bt=Math.max,kt=Math.min,qt=Math.random,Rt=st.slice,J=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+J),Mt={}; +!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(st.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,c(arguments)||(c=function(n){return n?dt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==et:!1},Et=function(n){var t,r=[];if(!n||!ct[typeof n])return r; +for(t in n)dt.call(n,t)&&r.push(t);return r},$t=Nt?function(n){return _(n)?Nt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=h(It),Ct=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},Pt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(dt.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=h,t.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=S,t.max=F,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return dt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) +}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Bt(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=vt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+_t(r*(t-n+1)) +},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Z).source+"|"+(e.interpolate||Z).source+"|"+(e.evaluate||Z).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(tt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t +}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,l)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=B,t.foldr=k,t.include=w,t.inject=B,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Bt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=st[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this +}}),E(["concat","join","slice"],function(n){var r=st[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 89f598891..2a13d5840 100644 --- a/doc/README.md +++ b/doc/README.md @@ -217,7 +217,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3410 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3460 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -241,7 +241,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3440 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3490 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -266,7 +266,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3476 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3526 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -294,7 +294,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3546 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3596 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -354,7 +354,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3608 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3658 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -397,7 +397,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3661 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3711 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -429,7 +429,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3735 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3785 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -486,7 +486,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3769 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3819 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -510,7 +510,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3861 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3903 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -567,7 +567,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3902 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3944 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -596,7 +596,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3943 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3985 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -634,7 +634,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4022 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4064 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -694,7 +694,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4086 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4128 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -743,7 +743,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4118 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4160 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -767,7 +767,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4210 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -814,7 +814,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4226 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4262 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -838,7 +838,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4252 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4288 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -863,7 +863,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4272 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4308 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -887,7 +887,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4294 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4330 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -922,7 +922,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L309 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L313 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -978,7 +978,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5368 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5407 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1008,7 +1008,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5385 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5424 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1029,7 +1029,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5402 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5441 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1060,7 +1060,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2399 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2449 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1088,7 +1088,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2441 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1126,7 +1126,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2495 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2545 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1162,7 +1162,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2547 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2597 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1208,7 +1208,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2608 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2658 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1254,7 +1254,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2675 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2725 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1303,7 +1303,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2722 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1335,7 +1335,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2822 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1372,7 +1372,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2805 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2855 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1401,7 +1401,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2857 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2907 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1446,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2914 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2964 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1488,7 +1488,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2983 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3033 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1530,7 +1530,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1560,7 +1560,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3065 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3115 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1598,7 +1598,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3108 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3158 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1629,7 +1629,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3218 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1672,7 +1672,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3189 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3239 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1696,7 +1696,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3222 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3272 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1726,7 +1726,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3269 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3319 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1772,7 +1772,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3325 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3375 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1809,7 +1809,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3360 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3410 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1833,7 +1833,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3392 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3442 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1870,7 +1870,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4334 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4370 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1898,7 +1898,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4403 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1929,7 +1929,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4398 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4434 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1960,7 +1960,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4444 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4480 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2001,7 +2001,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4467 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4503 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2028,7 +2028,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4526 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4562 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2082,7 +2082,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4602 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4638 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2115,7 +2115,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4652 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4691 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2140,7 +2140,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4678 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4717 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2167,7 +2167,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4702 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4741 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2193,7 +2193,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4732 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4771 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2219,7 +2219,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4767 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4806 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2246,7 +2246,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4798 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4837 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2283,7 +2283,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4870 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2315,7 +2315,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4896 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4935 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2351,7 +2351,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1155 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1205 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2389,7 +2389,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1210 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1260 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2436,7 +2436,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1335 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1385 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2482,7 +2482,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1359 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1409 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2508,7 +2508,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1381 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1431 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2536,7 +2536,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1422 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1472 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2572,7 +2572,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1447 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1497 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2600,7 +2600,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1464 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1514 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2627,7 +2627,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1539 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2652,7 +2652,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1506 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2676,7 +2676,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1018 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1068 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2703,7 +2703,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1044 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1094 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2730,7 +2730,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1532 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1582 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2754,7 +2754,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1549 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1599 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2778,7 +2778,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1566 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1616 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2802,7 +2802,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1591 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1641 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2832,7 +2832,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1650 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1700 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2877,7 +2877,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1881 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2915,7 +2915,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1848 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1898 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2939,7 +2939,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1911 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1961 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2974,7 +2974,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1933 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1983 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3001,7 +3001,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1950 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2000 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3025,7 +3025,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1878 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1928 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3055,7 +3055,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1978 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2028 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3090,7 +3090,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2003 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2053 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3114,7 +3114,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2020 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2070 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3138,7 +3138,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2037 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2087 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3162,7 +3162,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1077 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1127 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3186,7 +3186,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2146 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3242,7 +3242,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2205 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2255 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3273,7 +3273,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2239 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2289 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3297,7 +3297,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2277 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2327 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3328,7 +3328,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2331 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2381 "View in source") [Ⓣ][1] Transforms an `object` to an new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback`is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3365,7 +3365,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2364 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2414 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3396,7 +3396,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4920 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3420,7 +3420,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4938 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4977 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3445,7 +3445,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4964 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5003 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3475,7 +3475,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4993 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5032 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3495,7 +3495,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5017 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5056 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3522,7 +3522,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5040 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5079 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3550,7 +3550,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5084 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5123 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3585,7 +3585,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L150 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L153 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3603,7 +3603,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5207 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3685,7 +3685,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5293 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5332 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3717,7 +3717,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5320 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5359 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3741,7 +3741,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5340 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5379 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3775,7 +3775,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L505 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L509 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3794,7 +3794,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5582 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5621 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3806,7 +3806,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L323 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L327 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3818,7 +3818,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L348 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L352 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3830,7 +3830,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L340 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L344 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3842,7 +3842,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L357 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L361 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -3854,7 +3854,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L370 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L374 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3868,7 +3868,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L378 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L382 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3880,7 +3880,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L395 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L399 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3892,7 +3892,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L406 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L410 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3906,7 +3906,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L386 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L390 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3918,7 +3918,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L424 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3932,7 +3932,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L435 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3946,7 +3946,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L457 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L461 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3958,7 +3958,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L465 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L469 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3970,7 +3970,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L473 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L477 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3982,7 +3982,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L481 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L485 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3994,7 +3994,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L493 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -4006,7 +4006,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L501 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template.