From eaa9430e261b24e4f4350aca66577979ff93fae6 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 21 Jul 2013 23:50:34 -0700 Subject: [PATCH] Update docs and builds. Former-commit-id: 27acae75d0412c0e94caa857d861522cbbc6b1a8 --- dist/lodash.compat.js | 57 +++++----- dist/lodash.compat.min.js | 84 +++++++------- dist/lodash.js | 57 +++++----- dist/lodash.min.js | 76 ++++++------- dist/lodash.underscore.js | 16 +-- dist/lodash.underscore.min.js | 6 +- doc/README.md | 208 +++++++++++++++++----------------- 7 files changed, 258 insertions(+), 246 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 2c549125f..eba775cc8 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -1369,10 +1369,11 @@ * @returns {Function} Returns the new bound function. */ function createBound(func, thisArg, partialArgs, partialRightArgs, isPartial, isAlt) { - var isFunc = isFunction(func); + var isBindKey = isAlt && !isPartial, + isFunc = isFunction(func); - // except for `_.bindKey`, throw when `func` is not a function - if (!isFunc && (isPartial || !isAlt)) { + // throw if `func` is not a function when not behaving as `_.bindKey` + if (!isFunc && !isBindKey) { throw new TypeError; } var args = func.__bindData__, @@ -1381,19 +1382,25 @@ if (args) { push.apply(args[2], partialArgs); push.apply(args[3], partialRightArgs); + + // add `thisArg` to previous `_.partial` and `_.partialRight` arguments if (!isPartial && args[4]) { args[1] = thisArg; args[4] = false; + args[5] = isAlt; } return createBound.apply(null, args); } - // juggle arguments for `_.bindKey` - if (!isPartial && isAlt) { + // take a snapshot of `arguments` before juggling + args = nativeSlice.call(arguments); + + // juggle arguments for `_.bindKey` behavior + if (isBindKey) { thisArg = func; } // use `Function#bind` if it exists and is fast // (in V8 `Function#bind` is slower except when partially applied) - if (!isPartial && !isAlt && (support.fastBind || (nativeBind && partialArgs.length))) { + if (!isPartial && !isAlt && !partialRightArgs.length && (support.fastBind || (nativeBind && partialArgs.length))) { var bound = nativeBind.call.apply(nativeBind, concat.call(arrayRef, func, thisArg, partialArgs)); } else { @@ -1403,7 +1410,7 @@ var args = arguments, thisBinding = isPartial ? this : thisArg; - if (!isFunc) { + if (isBindKey) { func = thisArg[key]; } if (partialArgs.length || partialRightArgs.length) { @@ -1422,7 +1429,7 @@ return func.apply(thisBinding, args); }; } - setBindData(bound, nativeSlice.call(arguments)); + setBindData(bound, args); return bound; } @@ -1525,23 +1532,6 @@ return result; } - /** - * Checks if `func` references the `this` keyword. - * - * @private - * @param {Function} func The function to inspect. - * @returns {Boolean} Returns `true` if `this` is referenced, else `false`. - */ - function hasThis(func) { - var result = func.__bindData__; - if (typeof result != 'undefined') { - return result === true || (result && result[4]); - } - result = !reThis || reThis.test(fnToString.call(func)); - setBindData(func, result); - return result; - } - /** * Sets `this` binding data on a given function. * @@ -4810,6 +4800,7 @@ } var type = typeof func; if (type != 'function') { + // handle "_.pluck" style callback shorthands if (type != 'object') { return function(object) { return object[func]; @@ -4819,7 +4810,10 @@ key = props[0], a = func[key]; + // handle "_.where" style callback shorthands if (props.length == 1 && a === a && !isObject(a)) { + // fast path the common case of passing an object with a single + // property containing a primitive value return function(object) { var b = object[key]; return a === b && (a !== 0 || (1 / a == 1 / b)); @@ -4837,9 +4831,20 @@ return result; }; } - if (typeof thisArg == 'undefined' || !hasThis(func)) { + var bindData = func.__bindData__; + if (typeof bindData == 'undefined') { + // checks if `func` references the `this` keyword and stores the result + bindData = !reThis || reThis.test(fnToString.call(func)); + setBindData(func, bindData); + } + if (typeof thisArg == 'undefined' || !bindData) { return func; } + else if (bindData !== true) { + // exit early if already bound or leverage bind optimizations if + // created by `_.partial` or `_.partialRight` + return bindData[4] ? bind(func, thisArg) : func; + } if (argCount === 1) { return function(value) { return func.call(thisArg, value); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 373d699f5..1587da503 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -5,47 +5,47 @@ */ ;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n?n.length:0;++rt||typeof n=="undefined")return 1;if(nr?0:r);++e=O&&i===t,v=u||p?l():c;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),c))}for(;++ai(v,y))&&((u||p)&&v.push(y),c.push(h))}return p?(s(v.b),g(v)):u&&s(v),c}function at(n,t,r,e,u,a){var o=mt(n);if(!o&&(u||!a))throw new tr;var i=n.__bindData__,l=t;if(i)return yr.apply(i[2],r),yr.apply(i[3],e),!u&&i[4]&&(i[1]=t,i[4]=b),at.apply(d,i); -!u&&a&&(t=n);var f=u||a||!(Fr.fastBind||jr&&r.length)?function(){var a=arguments,i=u?this:t;return o||(n=t[l]),(r.length||e.length)&&(a=cr.apply(r,a),yr.apply(a,e)),this instanceof f?(i=it(n.prototype),a=n.apply(i,a),dt(a)?a:i):n.apply(i,a)}:jr.call.apply(jr,cr.call(rr,n,t,r));return pt(f,Br.call(arguments)),f}function ot(){var n=f();n.g=T,n.b=n.c=n.f=n.h="",n.e="r",n.i=m,n.j=m;for(var t,r=0;t=arguments[r];r++)for(var e in t)n[e]=t[e];r=n.a,n.d=/^[^,]+/.exec(r)[0],t=Vt,r="return function("+r+"){",e="var m,r="+n.d+",C="+n.e+";if(!r)return C;"+n.h+";",n.b?(e+="var s=r.length;m=-1;if("+n.b+"){",Fr.unindexedChars&&(e+="if(q(r)){r=r.split('')}"),e+="while(++mk;k++)e+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+n.f+"}"; -e+="}"}return(n.b||Fr.nonEnumArgs)&&(e+="}"),e+=n.c+";return C",t=t("i,j,l,indicatorObject,n,o,q,t,u,y,z,w,G,H,J",r+e+"}"),g(n),t(J,er,hr,w,vt,Tr,_t,n.j&&Lr,_,ur,Y,zr,Q,ar,_r)}function it(n){return dt(n)?Cr(n):{}}function lt(n){return Hr[n]}function ft(){var n=(n=_.indexOf)===Dt?t:n;return n}function ct(n){var t=n.__bindData__;return typeof t!="undefined"?t===m||t&&t[4]:(t=!$||$.test(gr.call(n)),pt(n,t),t)}function pt(n,t){pr(n,"__bindData__",{configurable:b,enumerable:b,value:t,writable:b})}function st(n){var t,r; -return!n||_r.call(n)!=U||(t=n.constructor,mt(t)&&!(t instanceof t))||!Fr.argsClass&&vt(n)||!Fr.nodeClass&&c(n)?b:Fr.ownLast?(Qr(n,function(n,t,e){return r=hr.call(e,t),b}),r!==false):(Qr(n,function(n,t){r=t}),r===y||hr.call(n,r))}function gt(n){return Jr[n]}function vt(n){return n&&typeof n=="object"?_r.call(n)==W:b}function ht(n){var t=[];return Qr(n,function(n,r){mt(n)&&t.push(r)}),t.sort()}function yt(n){for(var t=-1,r=Lr(n),e=r.length,u={};++tr?Er(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(_t(n)?n.indexOf(t,r):u(n,t,r)):Gr(n,function(n){return++ea&&(a=i)}}else t=!t&&_t(n)?u:_.createCallback(t,r),Gr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function At(n,t,r,e){var u=3>arguments.length;if(t=_.createCallback(t,e,4),Tr(n)){var a=-1,o=n.length;for(u&&(r=n[++a]);++aarguments.length;if(typeof a!="number")var i=Lr(n),a=i.length;else Fr.unindexedChars&&_t(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),Ot(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l)}),r}function Bt(n,t,r){var e;if(t=_.createCallback(t,r),Tr(n)){r=-1;for(var u=n.length;++r=O&&u===t; -if(f){var c=o(i);c?(u=r,i=c):f=b}for(;++eu(i,c)&&l.push(c);return f&&g(i),l}function Nt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=-1;for(t=_.createCallback(t,r);++ae?Er(0,u+e):e||0}else if(e)return e=Ft(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function zt(n,t,r){if(typeof t!="number"&&t!=d){var e=0,u=-1,a=n?n.length:0; -for(t=_.createCallback(t,r);++u>>1,r(n[e])r?0:r);++tf&&(i=n.apply(l,o)); -else{var r=new Ut;!s&&!h&&(c=r);var e=p-(r-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:D,variable:"",imports:{_:_}};var $r={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Jr=yt(Hr),Kr=Zt("("+Lr(Jr).join("|")+")","g"),Mr=Zt("["+Lr(Hr).join("")+"]","g"),Ur=ot($r,{h:$r.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]"}),Vr=ot($r),Qr=ot(Rr,qr,{i:b}),Xr=ot(Rr,qr); -mt(/x/)&&(mt=function(n){return typeof n=="function"&&_r.call(n)==K});var Yr=vr?function(n){if(!n||_r.call(n)!=U||!Fr.argsClass&&vt(n))return b;var t=n.valueOf,r=typeof t=="function"&&(r=vr(t))&&vr(r);return r?n==r||vr(n)==r:st(n)}:st,Zr=Et;Nr&&tt&&typeof dr=="function"&&(Lt=Tt(dr,e));var ne=8==Ar(S+"08")?Ar:function(n,t){return Ar(_t(n)?n.replace(z,""):n,t||0)};return _.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=Ur,_.at=function(n){var t=-1,r=Z(arguments,m,b,1),e=r.length,u=Kt(e); -for(Fr.unindexedChars&&_t(n)&&(n=n.split(""));++t=O&&o(a?e[a]:h)}n:for(;++f(m?r(m,y):c(h,y))){for(a=u,(m||h).push(y);--a;)if(m=i[a],0>(m?r(m,y):c(e[a],y)))continue n; -v.push(y)}}for(;u--;)(m=i[u])&&g(m);return s(i),s(h),v},_.invert=yt,_.invoke=function(n,t){var r=Br.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Kt(typeof a=="number"?a:0);return Ot(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},_.keys=Lr,_.map=Et,_.max=St,_.memoize=function(n,t){function r(){var e=r.cache,u=x+(t?t.apply(this,arguments):arguments[0]);return hr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},_.merge=function(n){var t=arguments,r=2;if(!dt(n))return n; -if("number"!=typeof t[2]&&(r=t.length),3e(o,r))&&(a[r]=n)}),a},_.once=function(n){var t,r;return function(){return t?r:(t=m,r=n.apply(this,arguments),n=d,r)}},_.pairs=function(n){for(var t=-1,r=Lr(n),e=r.length,u=Kt(e);++tr?Er(0,e+r):Sr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Ht,_.noConflict=function(){return e._=or,this -},_.parseInt=ne,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0;var r=Ir();return n%1||t%1?n+Sr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+sr(r*(t-n+1))},_.reduce=At,_.reduceRight=It,_.result=function(n,t){var r=n?n[t]:y;return mt(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Lr(n).length},_.some=Bt,_.sortedIndex=Ft,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Vr({},r,e);var u,a=Vr({},r.imports,e.imports),e=Lr(a),a=jt(a),o=0,l=r.interpolate||F,f="__p+='",l=Zt((r.escape||F).source+"|"+l.source+"|"+(l===D?P:F).source+"|"+(r.evaluate||F).source+"|$","g"); -n.replace(l,function(t,r,e,a,l,c){return e||(e=a),f+=n.slice(o,c).replace(R,i),r&&(f+="'+__e("+r+")+'"),l&&(u=m,f+="';"+l+";__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),o=c+t.length,t}),f+="';\n",l=r=r.variable,l||(r="obj",f="with("+r+"){"+f+"}"),f=(u?f.replace(A,""):f).replace(I,"$1").replace(B,"$1;"),f="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=Vt(e,"return "+f).apply(y,a) -}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},_.unescape=function(n){return n==d?"":nr(n).replace(Kr,gt)},_.uniqueId=function(n){var t=++C;return nr(n==d?"":n)+t},_.all=wt,_.any=Bt,_.detect=xt,_.findWhere=xt,_.foldl=At,_.foldr=It,_.include=Ct,_.inject=At,Xr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return yr.apply(t,arguments),n.apply(_,t)})}),_.first=Nt,_.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++ -}else if(e=t,e==d||r)return n[u-1];return v(n,Er(0,u-e))}},_.take=Nt,_.head=Nt,Xr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new j(e)})}),_.VERSION="1.3.1",_.prototype.toString=function(){return nr(this.__wrapped__)},_.prototype.value=Jt,_.prototype.valueOf=Jt,Gr(["join","pop","shift"],function(n){var t=rr[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Gr(["push","reverse","sort","unshift"],function(n){var t=rr[n]; -_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Gr(["concat","slice","splice"],function(n){var t=rr[n];_.prototype[n]=function(){return new j(t.apply(this.__wrapped__,arguments))}}),Fr.spliceObjects||Gr(["pop","shift","splice"],function(n){var t=rr[n],r="splice"==n;_.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new j(e):e}}),_}var y,m=!0,d=null,b=!1,_=[],j=[],C=0,w={},x=+new Date+"",O=75,E=40,S=" \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",A=/\b__p\+='';/g,I=/\b(__p\+=)''\+/g,B=/(__e\(.*?\)|\b__t\))\+'';/g,P=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,N=/\w*$/,D=/<%=([\s\S]+?)%>/g,z=RegExp("^["+S+"]*0+(?=.$)"),F=/($^)/,$=($=/\bthis\b/)&&$.test(h)&&$,R=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),T="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),W="[object Arguments]",L="[object Array]",G="[object Boolean]",H="[object Date]",J="[object Error]",K="[object Function]",M="[object Number]",U="[object Object]",V="[object RegExp]",Q="[object String]",X={}; +}function c(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function p(){}function s(n){n.length=0,_.lengthr?0:r);++e=O&&i===t,v=u||p?l():c;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),c))}for(;++ai(v,y))&&((u||p)&&v.push(y),c.push(h))}return p?(s(v.b),g(v)):u&&s(v),c}function at(n,t,r,e,u,a){var o=a&&!u;if(!yt(n)&&!o)throw new nr;var i=n.__bindData__,l=t;if(i)return hr.apply(i[2],r),hr.apply(i[3],e),!u&&i[4]&&(i[1]=t,i[4]=b,i[5]=a),at.apply(d,i); +i=Ir.call(arguments),o&&(t=n);var f=u||a||e.length||!(zr.fastBind||_r&&r.length)?function(){var a=arguments,i=u?this:t;return o&&(n=t[l]),(r.length||e.length)&&(a=fr.apply(r,a),hr.apply(a,e)),this instanceof f?(i=it(n.prototype),a=n.apply(i,a),mt(a)?a:i):n.apply(i,a)}:_r.call.apply(_r,fr.call(tr,n,t,r));return ct(f,i),f}function ot(){var n=f();n.g=T,n.b=n.c=n.f=n.h="",n.e="r",n.i=m,n.j=m;for(var t,r=0;t=arguments[r];r++)for(var e in t)n[e]=t[e];r=n.a,n.d=/^[^,]+/.exec(r)[0],t=Ut,r="return function("+r+"){",e="var m,r="+n.d+",C="+n.e+";if(!r)return C;"+n.h+";",n.b?(e+="var s=r.length;m=-1;if("+n.b+"){",zr.unindexedChars&&(e+="if(q(r)){r=r.split('')}"),e+="while(++mk;k++)e+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+n.f+"}"; +e+="}"}return(n.b||zr.nonEnumArgs)&&(e+="}"),e+=n.c+";return C",t=t("i,j,l,indicatorObject,n,o,q,t,u,y,z,w,G,H,J",r+e+"}"),g(n),t(J,rr,vr,w,gt,qr,bt,n.j&&Wr,_,er,Y,Dr,Q,ur,br)}function it(n){return mt(n)?jr(n):{}}function lt(n){return Gr[n]}function ft(){var n=(n=_.indexOf)===Nt?t:n;return n}function ct(n,t){cr(n,"__bindData__",{configurable:b,enumerable:b,value:t,writable:b})}function pt(n){var t,r;return!n||br.call(n)!=U||(t=n.constructor,yt(t)&&!(t instanceof t))||!zr.argsClass&>(n)||!zr.nodeClass&&c(n)?b:zr.ownLast?(Vr(n,function(n,t,e){return r=vr.call(e,t),b +}),r!==false):(Vr(n,function(n,t){r=t}),r===y||vr.call(n,r))}function st(n){return Hr[n]}function gt(n){return n&&typeof n=="object"?br.call(n)==W:b}function vt(n){var t=[];return Vr(n,function(n,r){yt(n)&&t.push(r)}),t.sort()}function ht(n){for(var t=-1,r=Wr(n),e=r.length,u={};++tr?Or(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(bt(n)?n.indexOf(t,r):u(n,t,r)):Lr(n,function(n){return++ea&&(a=i)}}else t=!t&&bt(n)?u:_.createCallback(t,r),Lr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function St(n,t,r,e){var u=3>arguments.length;if(t=_.createCallback(t,e,4),qr(n)){var a=-1,o=n.length;for(u&&(r=n[++a]);++aarguments.length;if(typeof a!="number")var i=Wr(n),a=i.length;else zr.unindexedChars&&bt(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),xt(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l)}),r}function It(n,t,r){var e;if(t=_.createCallback(t,r),qr(n)){r=-1;for(var u=n.length;++r=O&&u===t; +if(f){var c=o(i);c?(u=r,i=c):f=b}for(;++eu(i,c)&&l.push(c);return f&&g(i),l}function Pt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=-1;for(t=_.createCallback(t,r);++ae?Or(0,u+e):e||0}else if(e)return e=zt(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function Dt(n,t,r){if(typeof t!="number"&&t!=d){var e=0,u=-1,a=n?n.length:0; +for(t=_.createCallback(t,r);++u>>1,r(n[e])r?0:r);++tf&&(i=n.apply(l,o)); +else{var r=new Mt;!s&&!h&&(c=r);var e=p-(r-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:D,variable:"",imports:{_:_}};var Fr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Hr=ht(Gr),Jr=Yt("("+Wr(Hr).join("|")+")","g"),Kr=Yt("["+Wr(Gr).join("")+"]","g"),Mr=ot(Fr,{h:Fr.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]"}),Ur=ot(Fr),Vr=ot($r,Rr,{i:b}),Qr=ot($r,Rr); +yt(/x/)&&(yt=function(n){return typeof n=="function"&&br.call(n)==K});var Xr=gr?function(n){if(!n||br.call(n)!=U||!zr.argsClass&>(n))return b;var t=n.valueOf,r=typeof t=="function"&&(r=gr(t))&&gr(r);return r?n==r||gr(n)==r:pt(n)}:pt,Yr=Ot;Pr&&tt&&typeof mr=="function"&&(Wt=qt(mr,e));var Zr=8==Sr(S+"08")?Sr:function(n,t){return Sr(bt(n)?n.replace(z,""):n,t||0)};return _.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=Mr,_.at=function(n){var t=-1,r=Z(arguments,m,b,1),e=r.length,u=Jt(e); +for(zr.unindexedChars&&bt(n)&&(n=n.split(""));++t=O&&o(a?e[a]:h)}n:for(;++f(m?r(m,y):c(h,y))){for(a=u,(m||h).push(y);--a;)if(m=i[a],0>(m?r(m,y):c(e[a],y)))continue n; +v.push(y)}}for(;u--;)(m=i[u])&&g(m);return s(i),s(h),v},_.invert=ht,_.invoke=function(n,t){var r=Ir.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Jt(typeof a=="number"?a:0);return xt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},_.keys=Wr,_.map=Ot,_.max=Et,_.memoize=function(n,t){function r(){var e=r.cache,u=x+(t?t.apply(this,arguments):arguments[0]);return vr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},_.merge=function(n){var t=arguments,r=2;if(!mt(n))return n; +if("number"!=typeof t[2]&&(r=t.length),3e(o,r))&&(a[r]=n)}),a},_.once=function(n){var t,r;return function(){return t?r:(t=m,r=n.apply(this,arguments),n=d,r)}},_.pairs=function(n){for(var t=-1,r=Wr(n),e=r.length,u=Jt(e);++tr?Or(0,e+r):Er(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Gt,_.noConflict=function(){return e._=ar,this +},_.parseInt=Zr,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0;var r=Ar();return n%1||t%1?n+Er(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+pr(r*(t-n+1))},_.reduce=St,_.reduceRight=At,_.result=function(n,t){var r=n?n[t]:y;return yt(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Wr(n).length},_.some=It,_.sortedIndex=zt,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Ur({},r,e);var u,a=Ur({},r.imports,e.imports),e=Wr(a),a=_t(a),o=0,l=r.interpolate||F,f="__p+='",l=Yt((r.escape||F).source+"|"+l.source+"|"+(l===D?P:F).source+"|"+(r.evaluate||F).source+"|$","g"); +n.replace(l,function(t,r,e,a,l,c){return e||(e=a),f+=n.slice(o,c).replace(R,i),r&&(f+="'+__e("+r+")+'"),l&&(u=m,f+="';"+l+";__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),o=c+t.length,t}),f+="';\n",l=r=r.variable,l||(r="obj",f="with("+r+"){"+f+"}"),f=(u?f.replace(A,""):f).replace(I,"$1").replace(B,"$1;"),f="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=Ut(e,"return "+f).apply(y,a) +}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},_.unescape=function(n){return n==d?"":Zt(n).replace(Jr,st)},_.uniqueId=function(n){var t=++C;return Zt(n==d?"":n)+t},_.all=Ct,_.any=It,_.detect=kt,_.findWhere=kt,_.foldl=St,_.foldr=At,_.include=jt,_.inject=St,Qr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return hr.apply(t,arguments),n.apply(_,t)})}),_.first=Pt,_.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++ +}else if(e=t,e==d||r)return n[u-1];return v(n,Or(0,u-e))}},_.take=Pt,_.head=Pt,Qr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new j(e)})}),_.VERSION="1.3.1",_.prototype.toString=function(){return Zt(this.__wrapped__)},_.prototype.value=Ht,_.prototype.valueOf=Ht,Lr(["join","pop","shift"],function(n){var t=tr[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Lr(["push","reverse","sort","unshift"],function(n){var t=tr[n]; +_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Lr(["concat","slice","splice"],function(n){var t=tr[n];_.prototype[n]=function(){return new j(t.apply(this.__wrapped__,arguments))}}),zr.spliceObjects||Lr(["pop","shift","splice"],function(n){var t=tr[n],r="splice"==n;_.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new j(e):e}}),_}var y,m=!0,d=null,b=!1,_=[],j=[],C=0,w={},x=+new Date+"",O=75,E=40,S=" \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",A=/\b__p\+='';/g,I=/\b(__p\+=)''\+/g,B=/(__e\(.*?\)|\b__t\))\+'';/g,P=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,N=/\w*$/,D=/<%=([\s\S]+?)%>/g,z=RegExp("^["+S+"]*0+(?=.$)"),F=/($^)/,$=($=/\bthis\b/)&&$.test(h)&&$,R=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),T="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),W="[object Arguments]",L="[object Array]",G="[object Boolean]",H="[object Date]",J="[object Error]",K="[object Function]",M="[object Number]",U="[object Object]",V="[object RegExp]",Q="[object String]",X={}; X[K]=b,X[W]=X[L]=X[G]=X[H]=X[M]=X[U]=X[V]=X[Q]=m;var Y={"boolean":b,"function":m,object:m,number:b,string:b,undefined:b},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=Y[typeof exports]&&exports,tt=Y[typeof module]&&module&&module.exports==nt&&module,rt=Y[typeof global]&&global;!rt||rt.global!==rt&&rt.window!==rt||(n=rt);var et=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=et, define(function(){return et})):nt&&!nt.nodeType?tt?(tt.exports=et)._=et:nt._=et:n._=et }(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index feffdcf50..79a4e65da 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -1071,10 +1071,11 @@ * @returns {Function} Returns the new bound function. */ function createBound(func, thisArg, partialArgs, partialRightArgs, isPartial, isAlt) { - var isFunc = isFunction(func); + var isBindKey = isAlt && !isPartial, + isFunc = isFunction(func); - // except for `_.bindKey`, throw when `func` is not a function - if (!isFunc && (isPartial || !isAlt)) { + // throw if `func` is not a function when not behaving as `_.bindKey` + if (!isFunc && !isBindKey) { throw new TypeError; } var args = func.__bindData__, @@ -1083,19 +1084,25 @@ if (args) { push.apply(args[2], partialArgs); push.apply(args[3], partialRightArgs); + + // add `thisArg` to previous `_.partial` and `_.partialRight` arguments if (!isPartial && args[4]) { args[1] = thisArg; args[4] = false; + args[5] = isAlt; } return createBound.apply(null, args); } - // juggle arguments for `_.bindKey` - if (!isPartial && isAlt) { + // take a snapshot of `arguments` before juggling + args = nativeSlice.call(arguments); + + // juggle arguments for `_.bindKey` behavior + if (isBindKey) { thisArg = func; } // use `Function#bind` if it exists and is fast // (in V8 `Function#bind` is slower except when partially applied) - if (!isPartial && !isAlt && (support.fastBind || (nativeBind && partialArgs.length))) { + if (!isPartial && !isAlt && !partialRightArgs.length && (support.fastBind || (nativeBind && partialArgs.length))) { var bound = nativeBind.call.apply(nativeBind, concat.call(arrayRef, func, thisArg, partialArgs)); } else { @@ -1105,7 +1112,7 @@ var args = arguments, thisBinding = isPartial ? this : thisArg; - if (!isFunc) { + if (isBindKey) { func = thisArg[key]; } if (partialArgs.length || partialRightArgs.length) { @@ -1124,7 +1131,7 @@ return func.apply(thisBinding, args); }; } - setBindData(bound, nativeSlice.call(arguments)); + setBindData(bound, args); return bound; } @@ -1163,23 +1170,6 @@ return result; } - /** - * Checks if `func` references the `this` keyword. - * - * @private - * @param {Function} func The function to inspect. - * @returns {Boolean} Returns `true` if `this` is referenced, else `false`. - */ - function hasThis(func) { - var result = func.__bindData__; - if (typeof result != 'undefined') { - return result === true || (result && result[4]); - } - result = !reThis || reThis.test(fnToString.call(func)); - setBindData(func, result); - return result; - } - /** * Sets `this` binding data on a given function. * @@ -4467,6 +4457,7 @@ } var type = typeof func; if (type != 'function') { + // handle "_.pluck" style callback shorthands if (type != 'object') { return function(object) { return object[func]; @@ -4476,7 +4467,10 @@ key = props[0], a = func[key]; + // handle "_.where" style callback shorthands if (props.length == 1 && a === a && !isObject(a)) { + // fast path the common case of passing an object with a single + // property containing a primitive value return function(object) { var b = object[key]; return a === b && (a !== 0 || (1 / a == 1 / b)); @@ -4494,9 +4488,20 @@ return result; }; } - if (typeof thisArg == 'undefined' || !hasThis(func)) { + var bindData = func.__bindData__; + if (typeof bindData == 'undefined') { + // checks if `func` references the `this` keyword and stores the result + bindData = !reThis || reThis.test(fnToString.call(func)); + setBindData(func, bindData); + } + if (typeof thisArg == 'undefined' || !bindData) { return func; } + else if (bindData !== true) { + // exit early if already bound or leverage bind optimizations if + // created by `_.partial` or `_.partialRight` + return bindData[4] ? bind(func, thisArg) : func; + } if (argCount === 1) { return function(value) { return func.call(thisArg, value); diff --git a/dist/lodash.min.js b/dist/lodash.min.js index de66a8525..0e74ac7cc 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -5,44 +5,44 @@ */ ;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++et||typeof n=="undefined")return 1;if(ne?0:e);++r=j&&i===t,g=u||v?f():s;if(v){var y=o(g);y?(i=e,g=y):(v=b,g=u?g:(c(g),s))}for(;++ai(g,h))&&((u||v)&&g.push(h),s.push(y))}return v?(c(g.b),p(g)):u&&c(g),s}function at(n,t,e,r,u,a){var o=yt(n);if(!o&&(u||!a))throw new ne;var i=n.__bindData__,f=t;if(i)return ve.apply(i[2],e),ve.apply(i[3],r),!u&&i[4]&&(i[1]=t,i[4]=b),at.apply(h,i);!u&&a&&(t=n);var l=u||a||!(Ne.fastBind||be&&e.length)?function(){var a=arguments,i=u?this:t; -return o||(n=t[f]),(e.length||r.length)&&(a=ie.apply(e,a),ve.apply(a,r)),this instanceof l?(i=ht(n.prototype)?me(n.prototype):{},a=n.apply(i,a),ht(a)?a:i):n.apply(i,a)}:be.call.apply(be,ie.call(te,n,t,e));return lt(l,Ee.call(arguments)),l}function ot(n){return De[n]}function it(){var n=(n=Y.indexOf)===Bt?t:n;return n}function ft(n){var t=n.__bindData__;return typeof t!="undefined"?t===y||t&&t[4]:(t=!B||B.test(ce.call(n)),lt(n,t),t)}function lt(n,t){fe(n,"__bindData__",{configurable:b,enumerable:b,value:t,writable:b}) -}function ct(n){var t,e;return n&&he.call(n)==K&&(t=n.constructor,!yt(t)||t instanceof t)?(w(n,function(n,t){e=t}),e===g||se.call(n,e)):b}function pt(n){return Fe[n]}function st(n){return n&&typeof n=="object"?he.call(n)==R:b}function vt(n){var t=[];return w(n,function(n,e){yt(n)&&t.push(e)}),t.sort()}function gt(n){for(var t=-1,e=Be(n),r=e.length,u={};++te?we(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(mt(n)?n.indexOf(t,e):u(n,t,e)):d(n,function(n){return++ra&&(a=i)}}else t=!t&&mt(n)?u:Y.createCallback(t,e),Ct(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function Et(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Vt(r);++earguments.length;t=Y.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length;if(typeof u!="number")var o=Be(n),u=o.length;return t=Y.createCallback(t,r,4),Ct(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=b,n[i]):t(e,n[i],i,f)}),e}function It(n,t,e){var r;t=Y.createCallback(t,e),e=-1;var u=n?n.length:0; -if(typeof u=="number")for(;++e=j&&u===t;if(l){var c=o(i);c?(u=e,i=c):l=b}for(;++ru(i,c)&&f.push(c);return l&&p(i),f}function $t(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=h){var a=-1;for(t=Y.createCallback(t,e);++ar?we(0,u+r):r||0}else if(r)return r=Ft(n,e),n[r]===e?r:-1;return n?t(n,e,r):-1}function Dt(n,t,e){if(typeof t!="number"&&t!=h){var r=0,u=-1,a=n?n.length:0;for(t=Y.createCallback(t,e);++u>>1,e(n[r])e?0:e);++tl&&(i=n.apply(f,o));else{var e=new Ht;!s&&!m&&(c=e);var r=p-(e-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:I,variable:"",imports:{_:Y}};var $e=de,Be=je?function(n){return ht(n)?je(n):[]}:Q,De={"&":"&","<":"<",">":">",'"':""","'":"'"},Fe=gt(De),Re=Yt("("+Be(Fe).join("|")+")","g"),Te=Yt("["+Be(De).join("")+"]","g");Ae&&L&&typeof ge=="function"&&(Pt=zt(ge,r));var qe=8==xe(C+"08")?xe:function(n,t){return xe(mt(n)?n.replace(N,""):n,t||0) -};return Y.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},Y.assign=J,Y.at=function(n){for(var t=-1,e=tt(arguments,y,b,1),r=e.length,u=Vt(r);++t=j&&o(a?r[a]:y)}n:for(;++l(b?e(b,h):s(y,h))){for(a=u,(b||y).push(h);--a;)if(b=i[a],0>(b?e(b,h):s(r[a],h)))continue n;g.push(h)}}for(;u--;)(b=i[u])&&p(b);return c(i),c(y),g},Y.invert=gt,Y.invoke=function(n,t){var e=Ee.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Vt(typeof a=="number"?a:0);return Ct(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},Y.keys=Be,Y.map=xt,Y.max=Ot,Y.memoize=function(n,t){function e(){var r=e.cache,u=k+(t?t.apply(this,arguments):arguments[0]); -return se.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},Y.merge=function(n){var t=arguments,e=2;if(!ht(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(o,e))&&(a[e]=n)}),a},Y.once=function(n){var t,e;return function(){return t?e:(t=y,e=n.apply(this,arguments),n=h,e)}},Y.pairs=function(n){for(var t=-1,e=Be(n),r=e.length,u=Vt(r);++te?we(0,r+e):Ce(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Y.mixin=Mt,Y.noConflict=function(){return r._=re,this},Y.parseInt=qe,Y.random=function(n,t){n==h&&t==h&&(t=1),n=+n||0,t==h?(t=n,n=0):t=+t||0;var e=Oe();return n%1||t%1?n+Ce(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+le(e*(t-n+1))},Y.reduce=St,Y.reduceRight=At,Y.result=function(n,t){var e=n?n[t]:g; -return yt(e)?n[t]():e},Y.runInContext=v,Y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Be(n).length},Y.some=It,Y.sortedIndex=Ft,Y.template=function(n,t,e){var r=Y.templateSettings;n||(n=""),e=H({},e,r);var u,a=H({},e.imports,r.imports),r=Be(a),a=dt(a),o=0,f=e.interpolate||$,l="__p+='",f=Yt((e.escape||$).source+"|"+f.source+"|"+(f===I?S:$).source+"|"+(e.evaluate||$).source+"|$","g");n.replace(f,function(t,e,r,a,f,c){return r||(r=a),l+=n.slice(o,c).replace(D,i),e&&(l+="'+__e("+e+")+'"),f&&(u=y,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),o=c+t.length,t -}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(x,""):l).replace(O,"$1").replace(E,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=Jt(r,"return "+l).apply(g,a)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Y.unescape=function(n){return n==h?"":Zt(n).replace(Re,pt)},Y.uniqueId=function(n){var t=++_;return Zt(n==h?"":n)+t -},Y.all=kt,Y.any=It,Y.detect=wt,Y.findWhere=wt,Y.foldl=St,Y.foldr=At,Y.include=_t,Y.inject=St,d(Y,function(n,t){Y.prototype[t]||(Y.prototype[t]=function(){var t=[this.__wrapped__];return ve.apply(t,arguments),n.apply(Y,t)})}),Y.first=$t,Y.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=h){var a=u;for(t=Y.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==h||e)return n[u-1];return s(n,we(0,u-r))}},Y.take=$t,Y.head=$t,d(Y,function(n,t){Y.prototype[t]||(Y.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return t==h||e&&typeof t!="function"?r:new Z(r)})}),Y.VERSION="1.3.1",Y.prototype.toString=function(){return Zt(this.__wrapped__)},Y.prototype.value=Ut,Y.prototype.valueOf=Ut,Ct(["join","pop","shift"],function(n){var t=te[n];Y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Ct(["push","reverse","sort","unshift"],function(n){var t=te[n];Y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ct(["concat","slice","splice"],function(n){var t=te[n];Y.prototype[n]=function(){return new Z(t.apply(this.__wrapped__,arguments)) +}function c(n){n.length=0,m.lengthe?0:e);++r=j&&i===t,g=u||v?f():s;if(v){var y=o(g);y?(i=e,g=y):(v=b,g=u?g:(c(g),s))}for(;++ai(g,h))&&((u||v)&&g.push(h),s.push(y))}return v?(c(g.b),p(g)):u&&c(g),s}function at(n,t,e,r,u,a){var o=a&&!u;if(!gt(n)&&!o)throw new Zt;var i=n.__bindData__,f=t;if(i)return se.apply(i[2],e),se.apply(i[3],r),!u&&i[4]&&(i[1]=t,i[4]=b,i[5]=a),at.apply(h,i);i=Oe.call(arguments),o&&(t=n);var l=u||a||r.length||!(Ie.fastBind||he&&e.length)?function(){var a=arguments,i=u?this:t; +return o&&(n=t[f]),(e.length||r.length)&&(a=oe.apply(e,a),se.apply(a,r)),this instanceof l?(i=yt(n.prototype)?be(n.prototype):{},a=n.apply(i,a),yt(a)?a:i):n.apply(i,a)}:he.call.apply(he,oe.call(ne,n,t,e));return ft(l,i),l}function ot(n){return Be[n]}function it(){var n=(n=Y.indexOf)===$t?t:n;return n}function ft(n,t){ie(n,"__bindData__",{configurable:b,enumerable:b,value:t,writable:b})}function lt(n){var t,e;return n&&ye.call(n)==K&&(t=n.constructor,!gt(t)||t instanceof t)?(w(n,function(n,t){e=t}),e===g||pe.call(n,e)):b +}function ct(n){return De[n]}function pt(n){return n&&typeof n=="object"?ye.call(n)==R:b}function st(n){var t=[];return w(n,function(n,e){gt(n)&&t.push(e)}),t.sort()}function vt(n){for(var t=-1,e=$e(n),r=e.length,u={};++te?je(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(bt(n)?n.indexOf(t,e):u(n,t,e)):d(n,function(n){return++ra&&(a=i)}}else t=!t&&bt(n)?u:Y.createCallback(t,e),wt(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function Ot(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ut(r);++earguments.length;t=Y.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length;if(typeof u!="number")var o=$e(n),u=o.length;return t=Y.createCallback(t,r,4),wt(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=b,n[i]):t(e,n[i],i,f)}),e}function At(n,t,e){var r;t=Y.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=j&&u===t; +if(l){var c=o(i);c?(u=e,i=c):l=b}for(;++ru(i,c)&&f.push(c);return l&&p(i),f}function Nt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=h){var a=-1;for(t=Y.createCallback(t,e);++ar?je(0,u+r):r||0}else if(r)return r=Dt(n,e),n[r]===e?r:-1;return n?t(n,e,r):-1}function Bt(n,t,e){if(typeof t!="number"&&t!=h){var r=0,u=-1,a=n?n.length:0; +for(t=Y.createCallback(t,e);++u>>1,e(n[r])e?0:e);++tl&&(i=n.apply(f,o)); +else{var e=new Gt;!s&&!m&&(c=e);var r=p-(e-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:I,variable:"",imports:{_:Y}};var Ne=me,$e=ke?function(n){return yt(n)?ke(n):[]}:Q,Be={"&":"&","<":"<",">":">",'"':""","'":"'"},De=vt(Be),Fe=Xt("("+$e(De).join("|")+")","g"),Re=Xt("["+$e(Be).join("")+"]","g");Se&&L&&typeof ve=="function"&&(Wt=qt(ve,r));var Te=8==Ce(C+"08")?Ce:function(n,t){return Ce(bt(n)?n.replace(N,""):n,t||0) +};return Y.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},Y.assign=J,Y.at=function(n){for(var t=-1,e=tt(arguments,y,b,1),r=e.length,u=Ut(r);++t=j&&o(a?r[a]:y)}n:for(;++l(b?e(b,h):s(y,h))){for(a=u,(b||y).push(h);--a;)if(b=i[a],0>(b?e(b,h):s(r[a],h)))continue n;g.push(h)}}for(;u--;)(b=i[u])&&p(b);return c(i),c(y),g},Y.invert=vt,Y.invoke=function(n,t){var e=Oe.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ut(typeof a=="number"?a:0);return wt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},Y.keys=$e,Y.map=Ct,Y.max=xt,Y.memoize=function(n,t){function e(){var r=e.cache,u=k+(t?t.apply(this,arguments):arguments[0]); +return pe.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},Y.merge=function(n){var t=arguments,e=2;if(!yt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(o,e))&&(a[e]=n)}),a},Y.once=function(n){var t,e;return function(){return t?e:(t=y,e=n.apply(this,arguments),n=h,e)}},Y.pairs=function(n){for(var t=-1,e=$e(n),r=e.length,u=Ut(r);++te?je(0,r+e):we(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Y.mixin=Kt,Y.noConflict=function(){return r._=ee,this},Y.parseInt=Te,Y.random=function(n,t){n==h&&t==h&&(t=1),n=+n||0,t==h?(t=n,n=0):t=+t||0;var e=xe();return n%1||t%1?n+we(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+fe(e*(t-n+1))},Y.reduce=Et,Y.reduceRight=St,Y.result=function(n,t){var e=n?n[t]:g; +return gt(e)?n[t]():e},Y.runInContext=v,Y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$e(n).length},Y.some=At,Y.sortedIndex=Dt,Y.template=function(n,t,e){var r=Y.templateSettings;n||(n=""),e=H({},e,r);var u,a=H({},e.imports,r.imports),r=$e(a),a=mt(a),o=0,f=e.interpolate||$,l="__p+='",f=Xt((e.escape||$).source+"|"+f.source+"|"+(f===I?S:$).source+"|"+(e.evaluate||$).source+"|$","g");n.replace(f,function(t,e,r,a,f,c){return r||(r=a),l+=n.slice(o,c).replace(D,i),e&&(l+="'+__e("+e+")+'"),f&&(u=y,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),o=c+t.length,t +}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(x,""):l).replace(O,"$1").replace(E,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=Ht(r,"return "+l).apply(g,a)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Y.unescape=function(n){return n==h?"":Yt(n).replace(Fe,ct)},Y.uniqueId=function(n){var t=++_;return Yt(n==h?"":n)+t +},Y.all=_t,Y.any=At,Y.detect=jt,Y.findWhere=jt,Y.foldl=Et,Y.foldr=St,Y.include=dt,Y.inject=Et,d(Y,function(n,t){Y.prototype[t]||(Y.prototype[t]=function(){var t=[this.__wrapped__];return se.apply(t,arguments),n.apply(Y,t)})}),Y.first=Nt,Y.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=h){var a=u;for(t=Y.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==h||e)return n[u-1];return s(n,je(0,u-r))}},Y.take=Nt,Y.head=Nt,d(Y,function(n,t){Y.prototype[t]||(Y.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); +return t==h||e&&typeof t!="function"?r:new Z(r)})}),Y.VERSION="1.3.1",Y.prototype.toString=function(){return Yt(this.__wrapped__)},Y.prototype.value=Mt,Y.prototype.valueOf=Mt,wt(["join","pop","shift"],function(n){var t=ne[n];Y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),wt(["push","reverse","sort","unshift"],function(n){var t=ne[n];Y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),wt(["concat","slice","splice"],function(n){var t=ne[n];Y.prototype[n]=function(){return new Z(t.apply(this.__wrapped__,arguments)) }}),Y}var g,y=!0,h=null,b=!1,m=[],d=[],_=0,k=+new Date+"",j=75,w=40,C=" \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",x=/\b__p\+='';/g,O=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,I=/<%=([\s\S]+?)%>/g,N=RegExp("^["+C+"]*0+(?=.$)"),$=/($^)/,B=(B=/\bthis\b/)&&B.test(v)&&B,D=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),R="[object Arguments]",T="[object Array]",q="[object Boolean]",z="[object Date]",W="[object Function]",P="[object Number]",K="[object Object]",M="[object RegExp]",U="[object String]",V={}; V[W]=b,V[R]=V[T]=V[q]=V[z]=V[P]=V[K]=V[M]=V[U]=y;var G={"boolean":b,"function":y,object:y,number:b,string:b,undefined:b},H={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},J=G[typeof exports]&&exports,L=G[typeof module]&&module&&module.exports==J&&module,Q=G[typeof global]&&global;!Q||Q.global!==Q&&Q.window!==Q||(n=Q);var X=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=X, define(function(){return X})):J&&!J.nodeType?L?(L.exports=X)._=X:J._=X:n._=X }(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 4af887c25..e5946e8df 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -546,21 +546,22 @@ * @returns {Function} Returns the new bound function. */ function createBound(func, thisArg, partialArgs, partialRightArgs, isPartial, isAlt) { - var isFunc = isFunction(func); + var isBindKey = isAlt && !isPartial, + isFunc = isFunction(func); - // except for `_.bindKey`, throw when `func` is not a function - if (!isFunc && (isPartial || !isAlt)) { + // throw if `func` is not a function when not behaving as `_.bindKey` + if (!isFunc && !isBindKey) { throw new TypeError; } var key = thisArg; - // juggle arguments for `_.bindKey` - if (!isPartial && isAlt) { + // juggle arguments for `_.bindKey` behavior + if (isBindKey) { thisArg = func; } // use `Function#bind` if it exists and is fast // (in V8 `Function#bind` is slower except when partially applied) - if (!isPartial && !isAlt && (support.fastBind || (nativeBind && partialArgs.length))) { + if (!isPartial && !isAlt && !partialRightArgs.length && (support.fastBind || (nativeBind && partialArgs.length))) { var bound = nativeBind.call.apply(nativeBind, concat.call(arrayRef, func, thisArg, partialArgs)); } else { @@ -570,7 +571,7 @@ var args = arguments, thisBinding = isPartial ? this : thisArg; - if (!isFunc) { + if (isBindKey) { func = thisArg[key]; } if (partialArgs.length || partialRightArgs.length) { @@ -3475,6 +3476,7 @@ } var type = typeof func; if (type != 'function') { + // handle "_.pluck" style callback shorthands if (type != 'object') { return function(object) { return object[func]; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index b98a43328..4305cf9a5 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -6,9 +6,9 @@ ;!function(n){function t(n,t){var r;if(n&&ht[typeof n])for(r in n)if(Et.call(n,r)&&t(n[r],r,n)===et)break}function r(n,t){var r;if(n&&ht[typeof n])for(r in n)if(t(n[r],r,n)===et)break}function e(n){var t,r=[];if(!n||!ht[typeof n])return r;for(t in n)Et.call(n,t)&&r.push(t);return r}function u(n,t,r){r=(r||0)-1;for(var e=n?n.length:0;++rt||typeof n=="undefined")return 1;if(nu(a,c))&&(r&&a.push(c),o.push(f))}return o}function v(n,t,r,e){var u=[],i=A(n);if(!i)throw new TypeError;var o=!e&&(zt.fastBind||Ft&&r.length)?Ft.call.apply(Ft,At.call(bt,n,t,r)):function(){var a=arguments,f=e?this:t;return i||(n=t[t]),(r.length||u.length)&&(a=At.apply(r,a),Tt.apply(a,u)),this instanceof o?(f=g(n.prototype),a=n.apply(f,a),O(a)?a:f):n.apply(f,a) -};return o}function g(n){return O(n)?Nt(n):{}}function h(n){return Ut[n]}function y(){var n=(n=f.indexOf)===U?u:n;return n}function m(n){return Vt[n]}function _(n){return n&&typeof n=="object"?St.call(n)==at:tt}function d(n){if(!n)return n;for(var t=1,r=arguments.length;tu(a,c))&&(r&&a.push(c),o.push(f))}return o}function v(n,t,r,e){var u=[];if(!A(n))throw new TypeError;var i=e||u.length||!(zt.fastBind||Ft&&r.length)?function(){var o=arguments,a=e?this:t;return(r.length||u.length)&&(o=At.apply(r,o),Tt.apply(o,u)),this instanceof i?(a=g(n.prototype),o=n.apply(a,o),O(o)?o:a):n.apply(a,o) +}:Ft.call.apply(Ft,At.call(bt,n,t,r));return i}function g(n){return O(n)?Nt(n):{}}function h(n){return Ut[n]}function y(){var n=(n=f.indexOf)===U?u:n;return n}function m(n){return Vt[n]}function _(n){return n&&typeof n=="object"?St.call(n)==at:tt}function d(n){if(!n)return n;for(var t=1,r=arguments.length;te&&(e=r,u=n)});else for(;++iu&&(u=r);return u}function M(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;r=K(r,u,4);var o=-1,a=n.length;if(typeof a=="number")for(i&&(e=n[++o]);++oarguments.length; diff --git a/doc/README.md b/doc/README.md index 5cf473372..efc3f685d 100644 --- a/doc/README.md +++ b/doc/README.md @@ -218,7 +218,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3771 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3761 "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. @@ -242,7 +242,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3800 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3790 "View in source") [Ⓣ][1] Creates an array excluding all values of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -267,7 +267,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3850 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3840 "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. @@ -295,7 +295,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3920 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3910 "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)*. @@ -355,7 +355,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3982 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3972 "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)*. @@ -398,7 +398,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4019 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4009 "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. @@ -430,7 +430,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#L4086 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4076 "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)*. @@ -487,7 +487,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4119 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4109 "View in source") [Ⓣ][1] Creates an array of unique values present in all passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -511,7 +511,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#L4221 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4211 "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). @@ -568,7 +568,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4262 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4252 "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. @@ -597,7 +597,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#L4303 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4293 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -635,7 +635,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4382 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4372 "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)*. @@ -695,7 +695,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4446 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4436 "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)*. @@ -744,7 +744,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4477 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4467 "View in source") [Ⓣ][1] Creates an array of unique values, in order, of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -768,7 +768,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#L4524 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4514 "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 the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -815,7 +815,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4552 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4542 "View in source") [Ⓣ][1] Creates an array excluding all passed values using strict equality for comparisons, i.e. `===`. @@ -840,7 +840,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4572 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4562 "View in source") [Ⓣ][1] Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. @@ -867,7 +867,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4602 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4592 "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`. @@ -958,7 +958,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5725 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5730 "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. @@ -988,7 +988,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5742 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5747 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1009,7 +1009,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5759 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5764 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1040,7 +1040,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2756 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2746 "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. @@ -1068,7 +1068,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2798 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2788 "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. @@ -1106,7 +1106,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2853 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2843 "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)*. @@ -1142,7 +1142,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2905 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2895 "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)*. @@ -1188,7 +1188,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2966 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2956 "View in source") [Ⓣ][1] Iterates over elements of 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)*. @@ -1234,7 +1234,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3023 "View in source") [Ⓣ][1] Iterates over elements of 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)*. @@ -1283,7 +1283,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3080 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3070 "View in source") [Ⓣ][1] Iterates over elements of a `collection`, executing the `callback` for each element. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1315,7 +1315,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3130 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3120 "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)*. @@ -1352,7 +1352,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3163 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3153 "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`. @@ -1381,7 +1381,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3215 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3205 "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)*. @@ -1426,7 +1426,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3272 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3262 "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)*. @@ -1468,7 +1468,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3341 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3331 "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)*. @@ -1510,7 +1510,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3391 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3381 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1540,7 +1540,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3423 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3413 "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)*. @@ -1578,7 +1578,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#L3466 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3456 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over elements of a `collection` from right to left. @@ -1609,7 +1609,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#L3526 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3516 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1652,7 +1652,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3547 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3537 "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. @@ -1676,7 +1676,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3580 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3570 "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. @@ -1706,7 +1706,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3627 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3617 "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)*. @@ -1752,7 +1752,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3683 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3673 "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)*. @@ -1789,7 +1789,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3719 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3709 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1813,7 +1813,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3753 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3743 "View in source") [Ⓣ][1] Performs a deep comparison of each element in a `collection` to the given `properties` object, returning an array of all elements that have equivalent property values. @@ -1853,7 +1853,7 @@ _.where(stooges, { 'quotes': ['Poifect!'] }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4639 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4629 "View in source") [Ⓣ][1] Creates a function this is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. @@ -1881,7 +1881,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4669 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4659 "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. @@ -1912,7 +1912,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4687 "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. @@ -1943,7 +1943,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4743 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4733 "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. @@ -1984,7 +1984,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4766 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4756 "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. @@ -2011,7 +2011,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4825 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4815 "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`. @@ -2065,7 +2065,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4920 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4925 "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. @@ -2106,7 +2106,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5017 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5022 "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. @@ -2131,7 +2131,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5043 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5048 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2158,7 +2158,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5068 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5073 "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. The result cache is exposed as the `cache` property on the memoized function. @@ -2184,7 +2184,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5098 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5103 "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. @@ -2210,7 +2210,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5133 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5138 "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. @@ -2237,7 +2237,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5164 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5169 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2274,7 +2274,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5199 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5204 "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. @@ -2308,7 +2308,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5240 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5245 "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. @@ -2344,7 +2344,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1790 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1780 "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)*. @@ -2382,7 +2382,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1843 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1833 "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)*. @@ -2429,7 +2429,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1895 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1885 "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)*. @@ -2475,7 +2475,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1919 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1909 "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. @@ -2501,7 +2501,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1941 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1931 "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. @@ -2529,7 +2529,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#L1982 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1972 "View in source") [Ⓣ][1] Iterates over own and inherited enumerable properties of a given `object`, 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`. @@ -2565,7 +2565,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2007 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1997 "View in source") [Ⓣ][1] Iterates over own enumerable properties of a given `object`, 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`. @@ -2593,7 +2593,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2024 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2014 "View in source") [Ⓣ][1] Creates a sorted array of property names of all enumerable properties, own and inherited, of `object` that have function values. @@ -2620,7 +2620,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2049 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2039 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2645,7 +2645,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2066 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2056 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2669,7 +2669,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1648 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1638 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2696,7 +2696,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1674 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1664 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2723,7 +2723,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2092 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2082 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2747,7 +2747,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2109 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2099 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2771,7 +2771,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2126 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2116 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2795,7 +2795,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2151 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2141 "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". @@ -2825,7 +2825,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2208 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2198 "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)*. @@ -2870,7 +2870,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2240 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2230 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2908,7 +2908,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2257 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2247 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2932,7 +2932,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2320 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2310 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2967,7 +2967,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2342 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2332 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -2994,7 +2994,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2361 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2351 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3020,7 +3020,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2287 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2277 "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('')`)* @@ -3050,7 +3050,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2389 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2379 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3085,7 +3085,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2414 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2404 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3109,7 +3109,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2421 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3133,7 +3133,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2448 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2438 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3157,7 +3157,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1708 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1698 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3181,7 +3181,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2503 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2493 "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)*. @@ -3237,7 +3237,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2559 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2549 "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)*. @@ -3268,7 +3268,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2594 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2584 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3292,7 +3292,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2633 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2623 "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)*. @@ -3323,7 +3323,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2688 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2678 "View in source") [Ⓣ][1] An alternative to `_.reduce`, this method transforms an `object` to a 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`. @@ -3360,7 +3360,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#L2721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2711 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3391,7 +3391,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5264 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5269 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3415,7 +3415,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5282 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5287 "View in source") [Ⓣ][1] This method returns the first argument passed to it. @@ -3440,7 +3440,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5308 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5313 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3470,7 +3470,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5343 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5348 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3490,7 +3490,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5372 "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. @@ -3517,7 +3517,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5390 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5395 "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. @@ -3545,7 +3545,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5434 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5439 "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. @@ -3598,7 +3598,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5525 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5530 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3686,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5650 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5655 "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)*. @@ -3718,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5677 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5682 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3742,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5702 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3795,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5940 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5945 "View in source") [Ⓣ][1] *(String)*: The semantic version number.