From 7bb86c4e2a23f0923d0468f7f661ba611ad627c0 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 5 Nov 2013 21:53:28 -0800 Subject: [PATCH] Fix typos and rebuild docs & builds. --- dist/lodash.compat.js | 14 +++++++-- dist/lodash.compat.min.js | 14 ++++----- dist/lodash.js | 14 +++++++-- dist/lodash.min.js | 6 ++-- dist/lodash.underscore.js | 22 ++++++++------ dist/lodash.underscore.min.js | 56 +++++++++++++++++------------------ doc/README.md | 52 ++++++++++++++++---------------- lodash.js | 3 +- 8 files changed, 100 insertions(+), 81 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 0c73a43c3..eab1f41a8 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -5679,6 +5679,7 @@ if (isCalled) { lastCalled = now(); result = func.apply(thisArg, args); + args = thisArg = null; } } else { timeoutId = setTimeout(delayed, remaining); @@ -5693,6 +5694,7 @@ if (trailing || (maxWait !== wait)) { lastCalled = now(); result = func.apply(thisArg, args); + args = thisArg = null; } }; @@ -5708,19 +5710,25 @@ if (!maxTimeoutId && !leading) { lastCalled = stamp; } - var remaining = maxWait - (stamp - lastCalled); - if (remaining <= 0) { + var remaining = maxWait - (stamp - lastCalled), + isCalled = remaining <= 0; + + if (isCalled) { if (maxTimeoutId) { maxTimeoutId = clearTimeout(maxTimeoutId); } lastCalled = stamp; result = func.apply(thisArg, args); + args = thisArg = null; } else if (!maxTimeoutId) { maxTimeoutId = setTimeout(maxDelayed, remaining); } } - if (!timeoutId && wait !== maxWait) { + if (isCalled && timeoutId) { + timeoutId = clearTimeout(timeoutId); + } + else if (!timeoutId && wait !== maxWait) { timeoutId = setTimeout(delayed, wait); } if (leadingCall) { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 0360fe791..70a834f3e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -25,11 +25,11 @@ if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&We(n)){e=-1;for(var a=n. }),e}function $t(n){var t=-1,e=n?n.length:0,r=ne(typeof e=="number"?e:0);return Dt(n,function(n){var e=ft(0,++t);r[t]=r[e],r[e]=n}),r}function Lt(n,t,e){var r;if(t=v.createCallback(t,e,3),We(n)){e=-1;for(var u=n.length;++e=_&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++ru(i,c)&&l.push(c);return f&&p(i),l}function zt(n,t,e){var r=0,u=n?n.length:0; if(typeof t!="number"&&null!=t){var o=-1;for(t=v.createCallback(t,e,3);++or?Re(0,u+r):r||0}else if(r)return r=Wt(t,e),t[r]===e?r:-1;return n(t,e,r)}function Kt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=v.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t=h; +m?(u&&(u=de(u)),c=a,o=n.apply(i,r),r=i=null):u||(u=Ee(y,h))}return m&&l?l=de(l):l||t===p||(l=Ee(v,t)),e&&(o=n.apply(i,r)),o}}function Vt(n){if(!jt(n))throw new fe;var t=s(arguments,1);return Ee(function(){n.apply(h,t)},1)}function Qt(n){return n}function Xt(n,t){var e=n,r=!t||jt(e);t||(e=y,t=n,n=v),Dt(_t(t),function(u){var o=n[u]=t[u];r&&(e.prototype[u]=function(){var t=this.__wrapped__,r=[t];return Ce.apply(r,arguments),r=o.apply(n,r),t&&typeof t=="object"&&t===r?this:(r=new e(r),r.__chain__=this.__chain__,r) +})})}function Yt(){}function Zt(){return this.__wrapped__}e=e?ut.defaults(Z.Object(),e,ut.pick(Z,R)):Z;var ne=e.Array,te=e.Boolean,ee=e.Date,re=e.Function,ue=e.Math,oe=e.Number,ae=e.Object,ie=e.RegExp,le=e.String,fe=e.TypeError,ce=[],pe=e.Error.prototype,se=ae.prototype,ge=le.prototype,he=e._,ve=se.toString,ye=ie("^"+le(ve).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),me=ue.ceil,de=e.clearTimeout,be=ue.floor,_e=re.prototype.toString,we=ye.test(we=ae.getPrototypeOf)&&we,je=se.hasOwnProperty,xe=ye.test(xe=ee.now)&&xe||function(){return+new ee +},Ce=ce.push,ke=se.propertyIsEnumerable,Ee=e.setTimeout,Oe=ce.splice,Se=typeof(Se=rt&&et&&rt.setImmediate)=="function"&&!ye.test(Se)&&Se,Ie=function(){try{var n={},t=ye.test(t=ae.defineProperty)&&t,e=t(n,n,n)&&t}catch(r){}return e}(),Ae=ye.test(Ae=ae.create)&&Ae,De=ye.test(De=ne.isArray)&&De,Ne=e.isFinite,Be=e.isNaN,Pe=ye.test(Pe=ae.keys)&&Pe,Re=ue.max,Fe=ue.min,$e=e.parseInt,Le=ue.random,Te={};Te[L]=ne,Te[T]=te,Te[z]=ee,Te[K]=re,Te[G]=ae,Te[W]=oe,Te[J]=ie,Te[M]=le;var ze={};ze[L]=ze[z]=ze[W]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ze[T]=ze[M]={constructor:!0,toString:!0,valueOf:!0},ze[q]=ze[K]=ze[J]={constructor:!0,toString:!0},ze[G]={constructor:!0},function(){for(var n=F.length;n--;){var t,e=F[n]; +for(t in ze)je.call(ze,t)&&!je.call(ze[t],e)&&(ze[t][e]=!1)}}(),y.prototype=v.prototype;var qe=v.support={};!function(){var n=function(){this.x=1},t={0:1,length:1},r=[];n.prototype={valueOf:1,y:1};for(var u in new n)r.push(u);for(u in arguments);qe.argsClass=ve.call(arguments)==$,qe.argsObject=arguments.constructor==ae&&!(arguments instanceof ne),qe.enumErrorProps=ke.call(pe,"message")||ke.call(pe,"name"),qe.enumPrototypes=ke.call(n,"prototype"),qe.funcDecomp=!ye.test(e.WinRTError)&&B.test(g),qe.funcNames=typeof re.name=="string",qe.nonEnumArgs=0!=u,qe.nonEnumShadows=!/valueOf/.test(r),qe.ownLast="x"!=r[0],qe.spliceObjects=(ce.splice.call(t,0,1),!t[0]),qe.unindexedChars="xx"!="x"[0]+ae("x")[0]; try{qe.nodeClass=!(ve.call(document)==G&&!({toString:0}+""))}catch(o){qe.nodeClass=!0}}(1),v.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:A,variable:"",imports:{_:v}},Ae||(nt=function(){function n(){}return function(t){if(xt(t)){n.prototype=t;var r=new n;n.prototype=null}return r||e.Object()}}());var Ke=Ie?function(n,t){V.value=t,Ie(n,"__bindData__",V)}:Yt;qe.argsClass||(dt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&je.call(n,"callee")&&!ke.call(n,"callee")||!1 });var We=De||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ve.call(n)==L||!1},Ge=gt({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),Je=Pe?function(n){return xt(n)?qe.enumPrototypes&&typeof n=="function"||qe.nonEnumArgs&&n.length&&dt(n)?Ge(n):Pe(n):[]}:Ge,Me={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:Je,g:"if(e(t[n],n,g)===false)return E"},He={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Qe=wt(Ve),Xe=ie("("+Je(Qe).join("|")+")","g"),Ye=ie("["+Je(Ve).join("")+"]","g"),Ze=gt(Me),nr=gt(He,{i:He.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),tr=gt(He),er=gt(Me,Ue,{j:!1}),rr=gt(Me,Ue); jt(/x/)&&(jt=function(n){return typeof n=="function"&&ve.call(n)==K});var ur=we?function(n){if(!n||ve.call(n)!=G||!qe.argsClass&&dt(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=we(t))&&we(e);return e?n==e||we(n)==e:yt(n)}:yt,or=pt(function(n,t,e){je.call(n,e)?n[e]++:n[e]=1}),ar=pt(function(n,t,e){(je.call(n,e)?n[e]:n[e]=[]).push(t)}),ir=pt(function(n,t,e){n[e]=t}),lr=Bt;Se&&(Vt=function(n){if(!jt(n))throw new fe;return Se.apply(e,arguments)});var fr=8==$e(j+"08")?$e:function(n,t){return $e(kt(n)?n.replace(D,""):n,t||0) @@ -37,8 +37,8 @@ jt(/x/)&&(jt=function(n){return typeof n=="function"&&ve.call(n)==K});var ur=we? },v.chain=function(n){return n=new y(n),n.__chain__=!0,n},v.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t=_&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):s(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):s(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&p(m);return c(l),c(v),h},v.invert=wt,v.invoke=function(n,t){var e=s(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=ne(typeof o=="number"?o:0);return Dt(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},v.keys=Je,v.map=Bt,v.max=Pt,v.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0]; -return je.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!jt(n))throw new fe;return e.cache={},e},v.merge=function(n){var t=arguments,e=2;if(!xt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3=_&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):s(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):s(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&p(m);return c(l),c(v),h},v.invert=wt,v.invoke=function(n,t){var e=s(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=ne(typeof o=="number"?o:0);return Dt(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},v.keys=Je,v.map=Bt,v.max=Pt,v.memoize=function(n,t){if(!jt(n))throw new fe;var e=function(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0]; +return je.call(r,u)?r[u]:r[u]=n.apply(this,arguments)};return e.cache={},e},v.merge=function(n){var t=arguments,e=2;if(!xt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},v.once=function(n){var t,e;if(!jt(n))throw new fe;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},v.pairs=function(n){for(var t=-1,e=Je(n),r=e.length,u=ne(r);++targuments.length;return t=Z.createCallback(t,r,4),Rt(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Bt(n){var t=-1,e=n?n.length:0,r=ne(typeof e=="number"?e:0);return Et(n,function(n){var e=lt(0,++t);r[t]=r[e],r[e]=n}),r}function Wt(n,t,e){var r;t=Z.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=_&&u===n;if(l){var p=o(a);p?(u=t,a=p):l=!1}for(;++ru(a,p)&&f.push(p);return l&&c(a),f}function zt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=Z.createCallback(t,e,3);++or?Ae(0,u+r):r||0}else if(r)return r=Lt(t,e),t[r]===e?r:-1; return n(t,e,r)}function Kt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=Z.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t=v;m?(i&&(i=ye(i)),s=f,a=n.apply(l,o),o=l=null):i||(i=ke(r,v))}return m&&c?c=ye(c):c||t===h||(c=ke(u,t)),e&&(a=n.apply(l,o)),a}}function Jt(n){if(!wt(n))throw new le;var t=p(arguments,1);return ke(function(){n.apply(v,t)},1)}function Qt(n){return n}function Xt(n,t){var e=n,r=!t||wt(e);t||(e=nt,t=n,n=Z),Et(bt(t),function(u){var o=n[u]=t[u];r&&(e.prototype[u]=function(){var t=this.__wrapped__,r=[t]; +return je.apply(r,arguments),r=o.apply(n,r),t&&typeof t=="object"&&t===r?this:(r=new e(r),r.__chain__=this.__chain__,r)})})}function Yt(){}function Zt(){return this.__wrapped__}e=e?Y.defaults(G.Object(),e,Y.pick(G,A)):G;var ne=e.Array,te=e.Boolean,ee=e.Date,re=e.Function,ue=e.Math,oe=e.Number,ie=e.Object,ae=e.RegExp,fe=e.String,le=e.TypeError,ce=[],pe=ie.prototype,se=e._,ve=pe.toString,he=ae("^"+fe(ve).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ge=ue.ceil,ye=e.clearTimeout,me=ue.floor,_e=re.prototype.toString,be=he.test(be=ie.getPrototypeOf)&&be,de=pe.hasOwnProperty,we=he.test(we=ee.now)&&we||function(){return+new ee },je=ce.push,ke=e.setTimeout,xe=ce.splice,Ce=typeof(Ce=X&&Q&&X.setImmediate)=="function"&&!he.test(Ce)&&Ce,Oe=function(){try{var n={},t=he.test(t=ie.defineProperty)&&t,e=t(n,n,n)&&t}catch(r){}return e}(),Ie=he.test(Ie=ie.create)&&Ie,Ne=he.test(Ne=ne.isArray)&&Ne,Se=e.isFinite,Ee=e.isNaN,Re=he.test(Re=ie.keys)&&Re,Ae=ue.max,De=ue.min,$e=e.parseInt,Fe=ue.random,Te={};Te[$]=ne,Te[F]=te,Te[T]=ee,Te[B]=re,Te[q]=ie,Te[W]=oe,Te[z]=ae,Te[P]=fe,nt.prototype=Z.prototype;var Be=Z.support={};Be.funcDecomp=!he.test(e.a)&&E.test(s),Be.funcNames=typeof re.name=="string",Z.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:I,variable:"",imports:{_:Z}},Ie||(rt=function(){function n(){}return function(t){if(jt(t)){n.prototype=t; var r=new n;n.prototype=null}return r||e.Object()}}());var We=Oe?function(n,t){M.value=t,Oe(n,"__bindData__",M)}:Yt,qe=Ne||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ve.call(n)==$||!1},ze=Re?function(n){return jt(n)?Re(n):[]}:J,Pe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ke=dt(Pe),Le=ae("("+ze(Ke).join("|")+")","g"),Me=ae("["+ze(Pe).join("")+"]","g"),Ue=pt(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),Ve=pt(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t) }),Ge=pt(function(n,t,e){n[e]=t});Ce&&(Jt=function(n){if(!wt(n))throw new le;return Ce.apply(e,arguments)});var He=8==$e(d+"08")?$e:function(n,t){return $e(xt(n)?n.replace(N,""):n,t||0)};return Z.after=function(n,t){if(!wt(t))throw new le;return function(){return 1>--n?t.apply(this,arguments):void 0}},Z.assign=H,Z.at=function(n){for(var t=arguments,e=-1,r=it(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=ne(t);++ee||typeof t=="undefined")return 1;if(tt?0:t);++eu(f,c))&&(t&&f.push(c),i.push(a))}return i}function g(n){return function(r,t,e){var u={};t=Q(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++eu(f,l))&&(t&&f.push(l),i.push(a))}return i}function g(n){return function(r,t,e){var u={};t=Q(t,e,3),e=-1;var o=r?r.length:0;if(typeof o=="number")for(;++eu&&(u=t);else r=null==r&&O(n)?charAtCallback:Q(r,t,3),F(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function M(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=Q(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++oarguments.length;return r=Q(r,e,4),q(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function z(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return F(n,function(n){var t;t=++r,t=0+Or(Wr()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function C(n,r,t){var e;r=Q(r,t,3),t=-1; -var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function V(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=-1;for(r=Q(r,t,3);++ie?Mr(0,u+e):e||0}else if(e)return e=J(r,t),r[e]===t?e:-1;return n(r,t,e)}function H(n,r,t){if(typeof r!="number"&&null!=r){var u=0,o=-1,i=n?n.length:0;for(r=Q(r,t,3);++o>>1,t(n[e])/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Br||(f=function(){function n(){}return function(r){if(E(r)){n.prototype=r;var t=new n;n.prototype=null}return t||yr.Object()}}()),_(arguments)||(_=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Sr.call(n,"callee")&&!Rr.call(n,"callee")||!1});var Cr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ar.call(n)==fr||!1 +if(r=Q(r,t,3),typeof u=="number")for(var o=Array(u);++eu&&(u=t);else r=Q(r,t,3),F(n,function(n,t,o){t=r(n,t,o),t>e&&(e=t,u=n)});return u}function M(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=Q(r,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(t=n[++o]);++oarguments.length;return r=Q(r,e,4),q(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function z(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return F(n,function(n){var t;t=++r,t=0+Or(Wr()*(t-0+1)),e[r]=e[t],e[t]=n}),e}function C(n,r,t){var e;r=Q(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function V(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=-1;for(r=Q(r,t,3);++ie?Mr(0,u+e):e||0}else if(e)return e=J(r,t),r[e]===t?e:-1;return n(r,t,e) +}function H(n,r,t){if(typeof r!="number"&&null!=r){var u=0,o=-1,i=n?n.length:0;for(r=Q(r,t,3);++o>>1,t(n[e])=y;m?(u&&(u=clearTimeout(u)),c=i,o=n.apply(f,e),e=f=null):u||(u=setTimeout(v,y))}return m&&a?a=clearTimeout(a):a||r===p||(a=setTimeout(h,r)),t&&(o=n.apply(f,e)),o}}function Y(n){return n}function Z(n){F(w(n),function(r){var t=u[r]=n[r];u.prototype[r]=function(){var n=[this.__wrapped__];return Rr.apply(n,arguments),n=t.apply(u,n),this.__chain__?new o(n,!0):n +}})}var nr,rr=0,tr={},er=+new Date+"",ur=/($^)/,or=/['\n\r\t\u2028\u2029\\]/g,ir="[object Arguments]",fr="[object Array]",ar="[object Boolean]",lr="[object Date]",cr="[object Number]",pr="[object Object]",sr="[object RegExp]",gr="[object String]",hr={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},vr={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},yr=hr[typeof window]&&window||this,mr=hr[typeof exports]&&exports&&!exports.nodeType&&exports,_r=hr[typeof module]&&module&&!module.nodeType&&module,dr=_r&&_r.exports===mr&&mr,br=hr[typeof global]&&global; +!br||br.global!==br&&br.window!==br||(yr=br);var wr=[],jr=Object.prototype,xr=yr._,Ar=jr.toString,Er=RegExp("^"+(Ar+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Tr=Math.ceil,Or=Math.floor,Sr=jr.hasOwnProperty,Nr=Er.test(Nr=Date.now)&&Nr||function(){return+new Date},Rr=wr.push,kr=jr.propertyIsEnumerable,Br=Er.test(Br=Object.create)&&Br,Fr=Er.test(Fr=Array.isArray)&&Fr,qr=yr.isFinite,Dr=yr.isNaN,Ir=Er.test(Ir=Object.keys)&&Ir,Mr=Math.max,$r=Math.min,Wr=Math.random; +o.prototype=u.prototype;var zr={};!function(){var n={0:1,length:1};zr.spliceObjects=(wr.splice.call(n,0,1),!n[0])}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Br||(f=function(){function n(){}return function(r){if(E(r)){n.prototype=r;var t=new n;n.prototype=null}return t||yr.Object()}}()),_(arguments)||(_=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Sr.call(n,"callee")&&!kr.call(n,"callee")||!1});var Cr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ar.call(n)==fr||!1 },Pr=function(n){var r,t=[];if(!n||!hr[typeof n])return t;for(r in n)Sr.call(n,r)&&t.push(r);return t},Ur=Ir?function(n){return E(n)?Ir(n):[]}:Pr,Vr={"&":"&","<":"<",">":">",'"':""","'":"'"},Gr=j(Vr),Hr=RegExp("("+Ur(Gr).join("|")+")","g"),Jr=RegExp("["+Ur(Vr).join("")+"]","g"),Kr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(r(n[t],t,n)===tr)break;return n},Lr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(Sr.call(n,t)&&r(n[t],t,n)===tr)break; -return n};A(/x/)&&(A=function(n){return typeof n=="function"&&"[object Function]"==Ar.call(n)});var Qr=g(function(n,r,t){Sr.call(n,t)?n[t]++:n[t]=1}),Xr=g(function(n,r,t){(Sr.call(n,t)?n[t]:n[t]=[]).push(r)}),Yr=g(function(n,r,t){n[t]=r});u.after=function(n,r){if(!A(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=L,u.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n; +return n};A(/x/)&&(A=function(n){return typeof n=="function"&&"[object Function]"==Ar.call(n)});var Qr=g(function(n,r,t){Sr.call(n,t)?n[t]++:n[t]=1}),Xr=g(function(n,r,t){(Sr.call(n,t)?n[t]:n[t]=[]).push(r)}),Yr=g(function(n,r,t){n[t]=r});u.after=function(n,r){if(!A(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=L,u.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n; i.push(f)}}return i},u.invert=j,u.invoke=function(n,r){var t=e(arguments,2),u=-1,o=typeof r=="function",i=n?n.length:0,f=Array(typeof i=="number"?i:0);return F(n,function(n){f[++u]=(o?r:n[r]).apply(n,t)}),f},u.keys=Ur,u.map=D,u.max=I,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):er+arguments[0];return Sr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e;typeof r!="function"&&t&&t[r]===n&&(r=null);var o=-1,i=n?n.length:0;if(null==r&&typeof i=="number")for(;++or(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!A(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Ur(n),e=t.length,u=Array(e);++rr?0:r);++nr(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!A(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Ur(n),e=t.length,u=Array(e);++rr?0:r);++nt?Mr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=Z,u.noConflict=function(){return yr._=xr,this},u.noop=function(){},u.random=function(n,r){return null==n&&null==r&&(r=1),n=+n||0,null==r?(r=n,n=0):r=+r||0,n+Or(Wr()*(r-n+1))},u.reduce=$,u.reduceRight=W,u.result=function(n,r){if(n){var t=n[r];return A(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0; -return typeof r=="number"?r:Ur(n).length},u.some=C,u.sortedIndex=J,u.template=function(n,r,e){var o=u,i=o.templateSettings;n=(n||"")+"",e=d({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||ur).source+"|"+(e.interpolate||ur).source+"|"+(e.evaluate||ur).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(or,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; -try{var c=Function("_","return "+a)(o)}catch(l){throw l.source=a,l}return r?c(r):(c.source=a,c)},u.unescape=function(n){return null==n?"":(n+"").replace(Hr,m)},u.uniqueId=function(n){var r=++rr+"";return n?n+r:r},u.all=N,u.any=C,u.detect=B,u.findWhere=function(n,r){return P(n,r,!0)},u.foldl=$,u.foldr=W,u.include=k,u.inject=$,u.first=V,u.last=function(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=o;for(r=Q(r,t,3);i--&&r(n[i],i,n);)u++}else if(u=r,null==u||t)return n?n[o-1]:nr; +return typeof r=="number"?r:Ur(n).length},u.some=C,u.sortedIndex=J,u.template=function(n,r,e){var o=u,i=o.templateSettings;n=(n||"")+"",e=b({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||ur).source+"|"+(e.interpolate||ur).source+"|"+(e.evaluate||ur).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(or,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";\n__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; +try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Hr,m)},u.uniqueId=function(n){var r=++rr+"";return n?n+r:r},u.all=R,u.any=C,u.detect=B,u.findWhere=function(n,r){return P(n,r,!0)},u.foldl=$,u.foldr=W,u.include=N,u.inject=$,u.first=V,u.last=function(n,r,t){var u=0,o=n?n.length:0;if(typeof r!="number"&&null!=r){var i=o;for(r=Q(r,t,3);i--&&r(n[i],i,n);)u++}else if(u=r,null==u||t)return n?n[o-1]:nr; return e(n,Mr(0,o-u))},u.sample=function(n,r,t){return n&&typeof n.length!="number"&&(n=S(n)),null==r||t?n?n[0+Or(Wr()*(n.length-1-0+1))]:nr:(n=z(n),n.length=$r(Mr(0,r),n.length),n)},u.take=V,u.head=V,Z(u),u.VERSION="2.2.1",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},F("pop push reverse shift sort splice unshift".split(" "),function(n){var r=wr[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),zr.spliceObjects||0!==n.length||delete n[0],this -}}),F(["concat","join","slice"],function(n){var r=wr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yr._=u, define(function(){return u})):mr&&_r?br?(_r.exports=u)._=u:mr._=u:yr._=u}).call(this); \ No newline at end of file +}}),F(["concat","join","slice"],function(n){var r=wr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yr._=u, define(function(){return u})):mr&&_r?dr?(_r.exports=u)._=u:mr._=u:yr._=u}).call(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index d34ec89ba..41ff3587e 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1087,7 +1087,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6553 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6561 "View in source") [Ⓣ][1] Creates a `lodash` object that wraps the given value with explicit method chaining enabled. @@ -1121,7 +1121,7 @@ var youngest = _.chain(characters) ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6579 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6587 "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. @@ -1149,7 +1149,7 @@ _([1, 2, 3, 4]) ### `_.prototype.chain()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6609 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6617 "View in source") [Ⓣ][1] Enables explicit method chaining on the wrapper object. @@ -1183,7 +1183,7 @@ _(characters).chain() ### `_.prototype.toString()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6626 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6634 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1204,7 +1204,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6643 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6651 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -2468,7 +2468,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5766 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5774 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be provided to `func` when it is invoked. @@ -2493,7 +2493,7 @@ _.defer(function() { console.log('deferred'); }); ### `_.delay(func, wait, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5800 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5808 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be provided to `func` when it is invoked. @@ -2520,7 +2520,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func, [resolver])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5845 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5853 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is provided it will be used to determine the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided 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. @@ -2563,7 +2563,7 @@ get('pebbles'); ### `_.once(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5878 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5886 "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. @@ -2589,7 +2589,7 @@ initialize(); ### `_.partial(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5916 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5924 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those provided to the new function. This method is similar to `_.bind` except it does **not** alter the `this` binding. @@ -2616,7 +2616,7 @@ hi('fred'); ### `_.partialRight(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5947 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5955 "View in source") [Ⓣ][1] This method is like `_.partial` except that `partial` arguments are appended to those provided to the new function. @@ -2653,7 +2653,7 @@ options.imports ### `_.throttle(func, wait, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5982 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5990 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Provide 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. @@ -2689,7 +2689,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6023 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6031 "View in source") [Ⓣ][1] Creates a function that provides `value` to the wrapper function as its first argument. Additional arguments provided to the function are appended to those provided to the wrapper function. The wrapper is executed with the `this` binding of the created function. @@ -3944,7 +3944,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.noop` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6146 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6154 "View in source") [Ⓣ][1] *(unknown)*: A no-operation function. @@ -3963,7 +3963,7 @@ _.noop(object) === undefined; ### `_.escape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6043 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6051 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3987,7 +3987,7 @@ _.escape('Fred, Wilma, & Pebbles'); ### `_.identity(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6061 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6069 "View in source") [Ⓣ][1] This method returns the first argument provided to it. @@ -4012,7 +4012,7 @@ _.identity(object) === object; ### `_.mixin(object, object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6088 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6096 "View in source") [Ⓣ][1] Adds function properties of a source object to the `lodash` function and chainable wrapper. @@ -4043,7 +4043,7 @@ _('fred').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6129 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6137 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -4063,7 +4063,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value, [radix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6169 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6177 "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. @@ -4090,7 +4090,7 @@ _.parseInt('08'); ### `_.random([min=0], [max=1], [floating=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6201 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6209 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided a number between `0` and the given number will be returned. If `floating` is truey or either `min` or `max` are floats a floating-point number will be returned instead of an integer. @@ -4125,7 +4125,7 @@ _.random(1.2, 5.2); ### `_.result(object, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6259 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6267 "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. @@ -4178,7 +4178,7 @@ Create a new `lodash` function using the given context object. ### `_.template(text, data, [options], [options.escape], [options.evaluate], [options.imports], [options.interpolate], [sourceURL], [variable])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6352 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6360 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -4272,7 +4272,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6475 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6483 "View in source") [Ⓣ][1] Executes the callback `n` times, returning an array of the results of each callback execution. The callback is bound to `thisArg` and invoked with one argument; *(index)*. @@ -4304,7 +4304,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6502 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6510 "View in source") [Ⓣ][1] The inverse of `_.escape` this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -4328,7 +4328,7 @@ _.unescape('Fred, Barney & Pebbles'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6522 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6530 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is provided the ID will be appended to it. @@ -4381,7 +4381,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6843 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6851 "View in source") [Ⓣ][1] *(string)*: The semantic version number. diff --git a/lodash.js b/lodash.js index c381a10f2..ce7307955 100644 --- a/lodash.js +++ b/lodash.js @@ -5743,14 +5743,13 @@ maxTimeoutId = setTimeout(maxDelayed, remaining); } } - if (isCalled & timeoutId) { + if (isCalled && timeoutId) { timeoutId = clearTimeout(timeoutId); } else if (!timeoutId && wait !== maxWait) { timeoutId = setTimeout(delayed, wait); } if (leadingCall) { - isCalled = true; result = func.apply(thisArg, args); } return result;