From b1b06a38af08dfccd3f0084d905a4274b3426ecc Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 7 Jul 2013 15:18:26 -0700 Subject: [PATCH] Rebuild docs and dist. Former-commit-id: fdba90c6b602eef0c36190e889ebc3fb2ec6c622 --- dist/lodash.compat.js | 48 ++++++----------- dist/lodash.compat.min.js | 60 +++++++++++----------- dist/lodash.js | 48 ++++++----------- dist/lodash.min.js | 56 ++++++++++---------- dist/lodash.underscore.js | 48 ++++++----------- dist/lodash.underscore.min.js | 4 +- doc/README.md | 97 ++++++++++++++--------------------- 7 files changed, 143 insertions(+), 218 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 43f4c9a37..39550a421 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -4449,32 +4449,6 @@ */ var uniq = overloadWrapper(basicUniq); - /** - * The inverse of `_.zip`, this method splits groups of elements into arrays - * composed of elements from each group at their corresponding indexes. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @returns {Array} Returns a new array of the composed arrays. - * @example - * - * _.unzip([['moe', 30, true], ['larry', 40, false]]); - * // => [['moe', 'larry'], [30, 40], [true, false]]; - */ - function unzip() { - var array = arguments.length > 1 ? arguments : arguments[0], - index = -1, - length = array ? max(pluck(array, 'length')) : 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = pluck(array, index); - } - return result; - } - /** * Creates an array with all occurrences of the passed values removed using * strict equality for comparisons, i.e. `===`. @@ -4495,13 +4469,13 @@ } /** - * Groups the elements of each array at their corresponding indexes. Useful for - * separate data sources that are coordinated through matching array indexes. - * For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix - * in a similar fashion. + * 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. * * @static * @memberOf _ + * @alias unzip * @category Arrays * @param {Array} [array1, array2, ...] Arrays to process. * @returns {Array} Returns a new array of grouped elements. @@ -4510,8 +4484,16 @@ * _.zip(['moe', 'larry'], [30, 40], [true, false]); * // => [['moe', 30, true], ['larry', 40, false]] */ - function zip(array) { - return array ? unzip(arguments) : []; + function zip() { + var array = arguments.length > 1 ? arguments : arguments[0], + index = -1, + length = array ? max(pluck(array, 'length')) : 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = pluck(array, index); + } + return result; } /** @@ -5727,7 +5709,6 @@ lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; - lodash.unzip = unzip; lodash.values = values; lodash.where = where; lodash.without = without; @@ -5745,6 +5726,7 @@ lodash.select = filter; lodash.tail = rest; lodash.unique = uniq; + lodash.unzip = zip; // add functions to `lodash.prototype` mixin(lodash); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index e637b6a8d..99599653e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,48 +4,48 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nr?0:r);++e=E&&i===t,v=u||p?l():f;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),f))}for(;++ai(v,m))&&((u||p)&&v.push(m),f.push(h))}return p?(s(v.array),g(v)):u&&s(v),f}function et(n,t,r,e){function u(){var e=arguments,c=o?this:t; -return a||(n=t[i]),r.length&&(e=e.length?(e=Br.call(e),l?e.concat(r):r.concat(e)):r),this instanceof u?(c=it(n.prototype),e=n.apply(c,e),bt(e)?e:c):n.apply(c,e)}var a=dt(n),o=!r,i=t;if(o){var l=e;r=t}else if(!a){if(!e)throw new rr;t=n}return u}function at(){var n=c(),t=x.o;n.g=G,n.b=n.c=n.f=n.h="",n.e="r",n.i=y,n.j=!!t;for(var r,e=0;r=arguments[e];e++)for(var u in r)n[u]=r[u];e=n.a,n.d=/^[^,]+/.exec(e)[0],r=Qt,e="return function("+e+"){",u="var m,r="+n.d+",C="+n.e+";if(!r)return C;"+n.h+";",n.b?(u+="var s=r.length;m=-1;if("+n.b+"){",$r.unindexedChars&&(u+="if(q(r)){r=r.split('')}"),u+="while(++m=E&&i===t,v=u||p?l():f;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),f))}for(;++ai(v,y))&&((u||p)&&v.push(y),f.push(h))}return p?(s(v.array),g(v)):u&&s(v),f}function et(n,t,r,e){function u(){var e=arguments,c=o?this:t; +return a||(n=t[i]),r.length&&(e=e.length?(e=Br.call(e),l?e.concat(r):r.concat(e)):r),this instanceof u?(c=it(n.prototype),e=n.apply(c,e),bt(e)?e:c):n.apply(c,e)}var a=dt(n),o=!r,i=t;if(o){var l=e;r=t}else if(!a){if(!e)throw new rr;t=n}return u}function at(){var n=c(),t=x.o;n.g=G,n.b=n.c=n.f=n.h="",n.e="r",n.i=m,n.j=!!t;for(var r,e=0;r=arguments[e];e++)for(var u in r)n[u]=r[u];e=n.a,n.d=/^[^,]+/.exec(e)[0],r=Qt,e="return function("+e+"){",u="var m,r="+n.d+",C="+n.e+";if(!r)return C;"+n.h+";",n.b?(u+="var s=r.length;m=-1;if("+n.b+"){",$r.unindexedChars&&(u+="if(q(r)){r=r.split('')}"),u+="while(++mk;k++)u+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(u+="||(!v[m]&&r[m]!==y[m])"),u+="){"+n.f+"}"; -u+="}"}return(n.b||$r.nonEnumArgs)&&(u+="}"),u+=n.c+";return C",r=r("i,j,l,indicatorObject,n,o,q,t,u,y,z,w,G,H,J",e+u+"}"),g(n),r(U,ur,hr,w,gt,Tr,Ct,t,_,ar,tt,Fr,Z,or,_r)}function it(n){return bt(n)?jr(n):{}}function lt(n){return Hr[n]}function ct(){var n=(n=_.indexOf)===$t?t:n;return n}function ft(n){return function(t,r,e,u){return typeof r!="boolean"&&r!=d&&(u=e,e=u&&u[r]===t?m:r,r=b),e!=d&&(e=_.createCallback(e,u)),n(t,r,e,u)}}function pt(n){var t,r;return!n||_r.call(n)!=X||(t=n.constructor,dt(t)&&!(t instanceof t))||!$r.argsClass&>(n)||!$r.nodeClass&&f(n)?b:$r.ownLast?(Ur(n,function(n,t,e){return r=hr.call(e,t),b -}),r!==false):(Ur(n,function(n,t){r=t}),r===m||hr.call(n,r))}function st(n){return Jr[n]}function gt(n){return n&&typeof n=="object"?_r.call(n)==H:b}function vt(n,t,r,e,u,a){var o=n;if(typeof t!="boolean"&&t!=d&&(e=r,r=t,t=b),typeof r=="function"){if(r=typeof e=="undefined"?r:_.createCallback(r,e,1),o=r(o),typeof o!="undefined")return o;o=n}if(e=bt(o)){var i=_r.call(o);if(!nt[i]||!$r.nodeClass&&f(o))return o;var c=Tr(o)}if(!e||!t)return e?c?v(o):Kr({},o):o;switch(e=zr[i],i){case K:case M:return new e(+o); -case Q:case Z:return new e(o);case Y:return e(o.source,$.exec(o))}i=!u,u||(u=l()),a||(a=l());for(var p=u.length;p--;)if(u[p]==n)return a[p];return o=c?e(o.length):{},c&&(hr.call(n,"index")&&(o.index=n.index),hr.call(n,"input")&&(o.input=n.input)),u.push(n),a.push(o),(c?Gr:Vr)(n,function(n,e){o[e]=vt(n,t,r,m,u,a)}),i&&(s(u),s(a)),o}function ht(n){var t=[];return Ur(n,function(n,r){dt(n)&&t.push(r)}),t.sort()}function mt(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<(Ct(n)?n.indexOf(t,r):u(n,t,r)):Gr(n,function(n){return++er?Er(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(Ct(n)?n.indexOf(t,r):u(n,t,r)):Gr(n,function(n){return++ea&&(a=i)}}else t=!t&&Ct(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 Bt(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 $r.unindexedChars&&Ct(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),St(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l) }),r}function Pt(n,t,r){var e;if(t=_.createCallback(t,r),Tr(n)){r=-1;for(var u=n.length;++r=E&&u===t;if(c){var f=o(i);f?(u=r,i=f):c=b}for(;++eu(i,f)&&l.push(f);return c&&g(i),l}function Ft(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=Dt(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function qt(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);++tc&&(i=n.apply(l,o));else{var r=new Vt;!s&&!h&&(f=r);var e=p-(r-f);0c&&(i=n.apply(l,o));else{var r=new Vt;!s&&!h&&(f=r);var e=p-(r-f);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:q,variable:"",imports:{_:_}};var qr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Jr=mt(Hr),Kr=at(qr,{h:qr.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]"}),Mr=at(qr),Ur=at(Dr,Rr,{i:b}),Vr=at(Dr,Rr); +var t=new p;p.prototype=d}return t||{}}),$r.argsClass||(gt=function(n){return n&&typeof n=="object"?hr.call(n,"callee"):b});var Tr=wr||function(n){return n&&typeof n=="object"?_r.call(n)==J:b},Wr=at({a:"x",e:"[]",h:"if(!(z[typeof x]))return C",f:"C.push(m)"}),Lr=x.o=Or?function(n){return bt(n)?$r.enumPrototypes&&typeof n=="function"||$r.nonEnumArgs&&n.length&>(n)?Wr(n):Or(n):[]}:Wr,Gr=at(Dr),Hr={"&":"&","<":"<",">":">",'"':""","'":"'"},Jr=yt(Hr),Kr=at(qr,{h:qr.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]"}),Mr=at(qr),Ur=at(Dr,Rr,{i:b}),Vr=at(Dr,Rr); dt(/x/)&&(dt=function(n){return typeof n=="function"&&_r.call(n)==V});var Qr=vr?function(n){if(!n||_r.call(n)!=X||!$r.argsClass&>(n))return b;var t=n.valueOf,r=typeof t=="function"&&(r=vr(t))&&vr(r);return r?n==r||vr(n)==r:pt(n)}:pt,Xr=At,Yr=ft(S),Zr=ft(rt);Pr&&ut&&typeof dr=="function"&&(Gt=Wt(dr,e));var ne=8==Ar(A+"08")?Ar:function(n,t){return Ar(Ct(n)?n.replace(D,""):n,t||0)};return _.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=Kr,_.at=function(n){var t=-1,r=pr.apply(er,Br.call(arguments,1)),e=r.length,u=Mt(e); for($r.unindexedChars&&Ct(n)&&(n=n.split(""));++t=E&&o(a?e[a]:h)}n:for(;++c(y?r(y,m):f(h,m))){for(a=u,(y||h).push(m);--a;)if(y=i[a],0>(y?r(y,m):f(e[a],m)))continue n;v.push(m)}}for(;u--;)(y=i[u])&&g(y);return s(i),s(h),v},_.invert=mt,_.invoke=function(n,t){var r=Br.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Mt(typeof a=="number"?a:0); +return t[0]}},_.countBy=function(n,t,r){var e={};return t=_.createCallback(t,r),St(n,function(n,r,u){r=tr(t(n,r,u)),hr.call(e,r)?e[r]++:e[r]=1}),e},_.createCallback=function(n,t,r){if(n==d)return Ht;var e=typeof n;if("function"!=e){if("object"!=e)return function(t){return t[n]};var u=Lr(n);return function(t){for(var r=u.length,e=b;r--&&(e=mt(t[u[r]],n[u[r]],w)););return e}}return typeof t=="undefined"||T&&!T.test(gr.call(n))?n:1===r?function(r){return n.call(t,r)}:2===r?function(r,e){return n.call(t,r,e) +}:4===r?function(r,e,u,a){return n.call(t,r,e,u,a)}:function(r,e,u){return n.call(t,r,e,u)}},_.debounce=Lt,_.defaults=Mr,_.defer=Gt,_.delay=function(n,t){var r=Br.call(arguments,2);return br(function(){n.apply(y,r)},t)},_.difference=zt,_.filter=Ot,_.flatten=Yr,_.forEach=St,_.forIn=Ur,_.forOwn=Vr,_.functions=ht,_.groupBy=function(n,t,r){var e={};return t=_.createCallback(t,r),St(n,function(n,r,u){r=tr(t(n,r,u)),(hr.call(e,r)?e[r]:e[r]=[]).push(n)}),e},_.initial=function(n,t,r){if(!n)return[];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 e=t==d||r?1:t||e;return v(n,0,Sr(Er(0,u-e),u))},_.intersection=function(n){for(var e=arguments,u=e.length,a=-1,i=l(),c=-1,f=ct(),p=n?n.length:0,v=[],h=l();++a=E&&o(a?e[a]:h)}n:for(;++c(m?r(m,y):f(h,y))){for(a=u,(m||h).push(y);--a;)if(m=i[a],0>(m?r(m,y):f(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=Mt(typeof a=="number"?a:0); return St(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},_.keys=Lr,_.map=At,_.max=It,_.memoize=function(n,t){function r(){var e=r.cache,u=O+(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=jt,_.min=function(n,t,r){var e=1/0,a=e;if(!t&&Tr(n)){r=-1;for(var o=n.length;++re(o,r))&&(a[r]=n)}),a},_.once=function(n){var t,r;return function(){return t?r:(t=y,r=n.apply(this,arguments),n=d,r)}},_.pairs=function(n){for(var t=-1,r=Lr(n),e=r.length,u=Mt(e);++te(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=Mt(e);++tr?Er(0,e+r):Sr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Jt,_.noConflict=function(){return e._=ir,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=Bt,_.reduceRight=Nt,_.result=function(n,t){var r=n?n[t]:m; -return dt(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Lr(n).length},_.some=Pt,_.sortedIndex=Dt,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Mr({},r,e);var u,a=Mr({},r.imports,e.imports),e=Lr(a),a=wt(a),o=0,l=r.interpolate||R,c="__p+='",l=nr((r.escape||R).source+"|"+l.source+"|"+(l===q?F:R).source+"|"+(r.evaluate||R).source+"|$","g");n.replace(l,function(t,r,e,a,l,f){return e||(e=a),c+=n.slice(o,f).replace(W,i),r&&(c+="'+__e("+r+")+'"),l&&(u=y,c+="';"+l+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t -}),c+="';\n",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(I,""):c).replace(B,"$1").replace(N,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var f=Qt(e,"return "+c).apply(m,a)}catch(p){throw p.source=c,p}return t?f(t):(f.source=c,f)},_.unescape=function(n){return n==d?"":tr(n).replace(P,st)},_.uniqueId=function(n){var t=++j;return tr(n==d?"":n)+t -},_.all=xt,_.any=Pt,_.detect=Et,_.findWhere=Et,_.foldl=Bt,_.foldr=Nt,_.include=kt,_.inject=Bt,Vr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return mr.apply(t,arguments),n.apply(_,t)})}),_.first=Ft,_.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=Ft,_.head=Ft,Vr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +for(t=_.createCallback(t,r),St(n,function(n,r,u){var a=o[++e]=c();a.l=t(n,r,u),a.m=e,a.n=n}),u=o.length,o.sort(a);u--;)n=o[u],o[u]=n.n,g(n);return o},_.tap=function(n,t){return t(n),n},_.throttle=function(n,t,r){var e=m,u=m;return r===false?e=b:bt(r)&&(e="leading"in r?r.leading:e,u="trailing"in r?r.trailing:u),r=c(),r.leading=e,r.maxWait=t,r.trailing=u,n=Lt(n,t,r),g(r),n},_.times=function(n,t,r){n=-1<(n=+n)?n:0;var e=-1,u=Mt(n);for(t=_.createCallback(t,r,1);++er?Er(0,e+r):Sr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Jt,_.noConflict=function(){return e._=ir,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=Bt,_.reduceRight=Nt,_.result=function(n,t){var r=n?n[t]:y; +return dt(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Lr(n).length},_.some=Pt,_.sortedIndex=Dt,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Mr({},r,e);var u,a=Mr({},r.imports,e.imports),e=Lr(a),a=wt(a),o=0,l=r.interpolate||R,c="__p+='",l=nr((r.escape||R).source+"|"+l.source+"|"+(l===q?F:R).source+"|"+(r.evaluate||R).source+"|$","g");n.replace(l,function(t,r,e,a,l,f){return e||(e=a),c+=n.slice(o,f).replace(W,i),r&&(c+="'+__e("+r+")+'"),l&&(u=m,c+="';"+l+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t +}),c+="';\n",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(I,""):c).replace(B,"$1").replace(N,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var f=Qt(e,"return "+c).apply(y,a)}catch(p){throw p.source=c,p}return t?f(t):(f.source=c,f)},_.unescape=function(n){return n==d?"":tr(n).replace(P,st)},_.uniqueId=function(n){var t=++j;return tr(n==d?"":n)+t +},_.all=xt,_.any=Pt,_.detect=Et,_.findWhere=Et,_.foldl=Bt,_.foldr=Nt,_.include=kt,_.inject=Bt,Vr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return yr.apply(t,arguments),n.apply(_,t)})}),_.first=Ft,_.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=Ft,_.head=Ft,Vr(_,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 C(e)})}),_.VERSION="1.3.1",_.prototype.toString=function(){return tr(this.__wrapped__)},_.prototype.value=Kt,_.prototype.valueOf=Kt,Gr(["join","pop","shift"],function(n){var t=er[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Gr(["push","reverse","sort","unshift"],function(n){var t=er[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Gr(["concat","slice","splice"],function(n){var t=er[n];_.prototype[n]=function(){return new C(t.apply(this.__wrapped__,arguments)) -}}),$r.spliceObjects||Gr(["pop","shift","splice"],function(n){var t=er[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 C(e):e}}),_}var m,y=!0,d=null,b=!1,_=[],C=[],j=0,w={},x={},O=+new Date+"",E=75,S=40,A=" \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",I=/\b__p\+='';/g,B=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,z=/[&<>"']/g,F=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$=/\w*$/,q=/<%=([\s\S]+?)%>/g,D=RegExp("^["+A+"]*0+(?=.$)"),R=/($^)/,T=(T=/\bthis\b/)&&T.test(h)&&T,W=/['\n\r\t\u2028\u2029\\]/g,L="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),G="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),H="[object Arguments]",J="[object Array]",K="[object Boolean]",M="[object Date]",U="[object Error]",V="[object Function]",Q="[object Number]",X="[object Object]",Y="[object RegExp]",Z="[object String]",nt={}; -nt[V]=b,nt[H]=nt[J]=nt[K]=nt[M]=nt[Q]=nt[X]=nt[Y]=nt[Z]=y;var tt={"boolean":b,"function":y,object:y,number:b,string:b,undefined:b},rt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},et=tt[typeof exports]&&exports,ut=tt[typeof module]&&module&&module.exports==et&&module,at=tt[typeof global]&&global;!at||at.global!==at&&at.window!==at||(n=at);var ot=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=ot, define(function(){return ot})):et&&!et.nodeType?ut?(ut.exports=ot)._=ot:et._=ot:n._=ot +}}),$r.spliceObjects||Gr(["pop","shift","splice"],function(n){var t=er[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 C(e):e}}),_}var y,m=!0,d=null,b=!1,_=[],C=[],j=0,w={},x={},O=+new Date+"",E=75,S=40,A=" \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",I=/\b__p\+='';/g,B=/\b(__p\+=)''\+/g,N=/(__e\(.*?\)|\b__t\))\+'';/g,P=/&(?:amp|lt|gt|quot|#39);/g,z=/[&<>"']/g,F=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$=/\w*$/,q=/<%=([\s\S]+?)%>/g,D=RegExp("^["+A+"]*0+(?=.$)"),R=/($^)/,T=(T=/\bthis\b/)&&T.test(h)&&T,W=/['\n\r\t\u2028\u2029\\]/g,L="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),G="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),H="[object Arguments]",J="[object Array]",K="[object Boolean]",M="[object Date]",U="[object Error]",V="[object Function]",Q="[object Number]",X="[object Object]",Y="[object RegExp]",Z="[object String]",nt={}; +nt[V]=b,nt[H]=nt[J]=nt[K]=nt[M]=nt[Q]=nt[X]=nt[Y]=nt[Z]=m;var tt={"boolean":b,"function":m,object:m,number:b,string:b,undefined:b},rt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},et=tt[typeof exports]&&exports,ut=tt[typeof module]&&module&&module.exports==et&&module,at=tt[typeof global]&&global;!at||at.global!==at&&at.window!==at||(n=at);var ot=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=ot, define(function(){return ot})):et&&!et.nodeType?ut?(ut.exports=ot)._=ot:et._=ot:n._=ot }(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index e5ff1b4da..2c0be0368 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -4110,32 +4110,6 @@ */ var uniq = overloadWrapper(basicUniq); - /** - * The inverse of `_.zip`, this method splits groups of elements into arrays - * composed of elements from each group at their corresponding indexes. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @returns {Array} Returns a new array of the composed arrays. - * @example - * - * _.unzip([['moe', 30, true], ['larry', 40, false]]); - * // => [['moe', 'larry'], [30, 40], [true, false]]; - */ - function unzip() { - var array = arguments.length > 1 ? arguments : arguments[0], - index = -1, - length = array ? max(pluck(array, 'length')) : 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = pluck(array, index); - } - return result; - } - /** * Creates an array with all occurrences of the passed values removed using * strict equality for comparisons, i.e. `===`. @@ -4156,13 +4130,13 @@ } /** - * Groups the elements of each array at their corresponding indexes. Useful for - * separate data sources that are coordinated through matching array indexes. - * For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix - * in a similar fashion. + * 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. * * @static * @memberOf _ + * @alias unzip * @category Arrays * @param {Array} [array1, array2, ...] Arrays to process. * @returns {Array} Returns a new array of grouped elements. @@ -4171,8 +4145,16 @@ * _.zip(['moe', 'larry'], [30, 40], [true, false]); * // => [['moe', 30, true], ['larry', 40, false]] */ - function zip(array) { - return array ? unzip(arguments) : []; + function zip() { + var array = arguments.length > 1 ? arguments : arguments[0], + index = -1, + length = array ? max(pluck(array, 'length')) : 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = pluck(array, index); + } + return result; } /** @@ -5388,7 +5370,6 @@ lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; - lodash.unzip = unzip; lodash.values = values; lodash.where = where; lodash.without = without; @@ -5406,6 +5387,7 @@ lodash.select = filter; lodash.tail = rest; lodash.unique = uniq; + lodash.unzip = zip; // add functions to `lodash.prototype` mixin(lodash); diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 595bbf1d6..617f5d049 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -5,44 +5,44 @@ * Underscore.js 1.4.4 underscorejs.org/LICENSE */ ;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n.length;++et||typeof n=="undefined")return 1;if(ne?0:e);++rt||typeof n=="undefined")return 1;if(ne?0:e);++r=C&&i===t,g=u||v?f():s;if(v){var y=o(g);y?(i=e,g=y):(v=m,g=u?g:(l(g),s))}for(;++ai(g,h))&&((u||v)&&g.push(h),s.push(y))}return v?(l(g.array),p(g)):u&&l(g),s}function ot(n,t,e,r){function u(){var r=arguments,c=o?this:t; -return a||(n=t[i]),e.length&&(r=r.length?(r=Se.call(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(c=bt(n.prototype)?de(n.prototype):{},r=n.apply(c,r),bt(r)?r:c):n.apply(c,r)}var a=mt(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new ee;t=n}return u}function it(n){return Be[n]}function ft(){var n=(n=et.indexOf)===Tt?t:n;return n}function ct(n){return function(t,e,r,u){return typeof e!="boolean"&&e!=h&&(u=r,r=u&&u[e]===t?g:e,e=m),r!=h&&(r=et.createCallback(r,u)),n(t,e,r,u)}}function lt(n){var t,e; -return n&&me.call(n)==G&&(t=n.constructor,!mt(t)||t instanceof t)?(x(n,function(n,t){e=t}),e===g||ve.call(n,e)):m}function pt(n){return Fe[n]}function st(n){return n&&typeof n=="object"?me.call(n)==W:m}function vt(n,t,e,r,u,a){var o=n;if(typeof t!="boolean"&&t!=h&&(r=e,e=t,t=m),typeof e=="function"){if(e=typeof r=="undefined"?e:et.createCallback(e,r,1),o=e(o),typeof o!="undefined")return o;o=n}if(r=bt(o)){var i=me.call(o);if(!L[i])return o;var c=Ne(o)}if(!r||!t)return r?c?s(o):Y({},o):o;switch(r=Ae[i],i){case K:case M:return new r(+o); -case V:case J:return new r(o);case H:return r(o.source,B.exec(o))}i=!u,u||(u=f()),a||(a=f());for(var p=u.length;p--;)if(u[p]==n)return a[p];return o=c?r(o.length):{},c&&(ve.call(n,"index")&&(o.index=n.index),ve.call(n,"input")&&(o.input=n.input)),u.push(n),a.push(o),(c?Et:d)(n,function(n,r){o[r]=vt(n,t,e,g,u,a)}),i&&(l(u),l(a)),o}function gt(n){var t=[];return x(n,function(n,e){mt(n)&&t.push(e)}),t.sort()}function yt(n){for(var t=-1,e=$e(n),r=e.length,u={};++te?Ce(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(_t(n)?n.indexOf(t,e):u(n,t,e)):d(n,function(n){return++r=C&&i===t,g=u||v?f():s;if(v){var y=o(g);y?(i=e,g=y):(v=b,g=u?g:(l(g),s))}for(;++ai(g,h))&&((u||v)&&g.push(h),s.push(y))}return v?(l(g.array),p(g)):u&&l(g),s}function ot(n,t,e,r){function u(){var r=arguments,c=o?this:t; +return a||(n=t[i]),e.length&&(r=r.length?(r=Se.call(r),f?r.concat(e):e.concat(r)):e),this instanceof u?(c=mt(n.prototype)?de(n.prototype):{},r=n.apply(c,r),mt(r)?r:c):n.apply(c,r)}var a=bt(n),o=!e,i=t;if(o){var f=r;e=t}else if(!a){if(!r)throw new ee;t=n}return u}function it(n){return Be[n]}function ft(){var n=(n=et.indexOf)===Tt?t:n;return n}function ct(n){return function(t,e,r,u){return typeof e!="boolean"&&e!=h&&(u=r,r=u&&u[e]===t?g:e,e=b),r!=h&&(r=et.createCallback(r,u)),n(t,e,r,u)}}function lt(n){var t,e; +return n&&be.call(n)==G&&(t=n.constructor,!bt(t)||t instanceof t)?(x(n,function(n,t){e=t}),e===g||ve.call(n,e)):b}function pt(n){return Fe[n]}function st(n){return n&&typeof n=="object"?be.call(n)==W:b}function vt(n,t,e,r,u,a){var o=n;if(typeof t!="boolean"&&t!=h&&(r=e,e=t,t=b),typeof e=="function"){if(e=typeof r=="undefined"?e:et.createCallback(e,r,1),o=e(o),typeof o!="undefined")return o;o=n}if(r=mt(o)){var i=be.call(o);if(!L[i])return o;var c=Ne(o)}if(!r||!t)return r?c?s(o):Y({},o):o;switch(r=Ae[i],i){case K:case M:return new r(+o); +case V:case J:return new r(o);case H:return r(o.source,B.exec(o))}i=!u,u||(u=f()),a||(a=f());for(var p=u.length;p--;)if(u[p]==n)return a[p];return o=c?r(o.length):{},c&&(ve.call(n,"index")&&(o.index=n.index),ve.call(n,"input")&&(o.input=n.input)),u.push(n),a.push(o),(c?Et:d)(n,function(n,r){o[r]=vt(n,t,e,g,u,a)}),i&&(l(u),l(a)),o}function gt(n){var t=[];return x(n,function(n,e){bt(n)&&t.push(e)}),t.sort()}function yt(n){for(var t=-1,e=$e(n),r=e.length,u={};++te?Ce(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(_t(n)?n.indexOf(t,e):u(n,t,e)):d(n,function(n){return++ra&&(a=i) -}}else t=!t&&_t(n)?u:et.createCallback(t,e),Et(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function It(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ht(r);++earguments.length;t=et.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=et.createCallback(t,r,4),Et(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=m,n[i]):t(e,n[i],i,f)}),e}function Bt(n,t,e){var r;t=et.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=C&&u===t;if(c){var l=o(i);l?(u=e,i=l):c=m}for(;++ru(i,l)&&f.push(l); +}}else t=!t&&_t(n)?u:et.createCallback(t,e),Et(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function It(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ht(r);++earguments.length;t=et.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=et.createCallback(t,r,4),Et(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=b,n[i]):t(e,n[i],i,f)}),e}function Bt(n,t,e){var r;t=et.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=C&&u===t;if(c){var l=o(i);l?(u=e,i=l):c=b}for(;++ru(i,l)&&f.push(l); return c&&p(i),f}function Rt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=h){var a=-1;for(t=et.createCallback(t,e);++ar?Ce(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 qt(n,t,e){if(typeof t!="number"&&t!=h){var r=0,u=-1,a=n?n.length:0;for(t=et.createCallback(t,e);++u>>1,e(n[r])e?0:e);++tc&&(i=n.apply(f,o));else{var e=new Lt;!s&&!b&&(l=e);var r=p-(e-l);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:F,variable:"",imports:{_:et}};var Ne=_e,$e=j.o=we?function(n){return bt(n)?we(n):[]}:nt,Be={"&":"&","<":"<",">":">",'"':""","'":"'"},Fe=yt(Be),Jt=ct(ut),Yt=ct(at);return Xt&&Z&&typeof ye=="function"&&(Mt=Pt(ye,r)),ye=8==Oe(O+"08")?Oe:function(n,t){return Oe(_t(n)?n.replace(R,""):n,t||0) +return s(n,r)}function Dt(n,t,e,r){var u=0,a=n?n.length:u;for(e=e?et.createCallback(e,r,1):Ut,t=e(t);u>>1,e(n[r])e?0:e);++tc&&(i=n.apply(f,o));else{var e=new Lt;!s&&!m&&(l=e);var r=p-(e-l);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:F,variable:"",imports:{_:et}};var Ne=_e,$e=j.o=we?function(n){return mt(n)?we(n):[]}:nt,Be={"&":"&","<":"<",">":">",'"':""","'":"'"},Fe=yt(Be),Jt=ct(ut),Yt=ct(at);return Xt&&Z&&typeof ye=="function"&&(Mt=Pt(ye,r)),ye=8==Oe(O+"08")?Oe:function(n,t){return Oe(_t(n)?n.replace(R,""):n,t||0) },et.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},et.assign=Y,et.at=function(n){for(var t=-1,e=ce.apply(re,Se.call(arguments,1)),r=e.length,u=Ht(r);++t=C&&o(a?r[a]:y)}n:for(;++c(m?e(m,h):s(y,h))){for(a=u,(m||y).push(h);--a;)if(m=i[a],0>(m?e(m,h):s(r[a],h)))continue n; -g.push(h)}}for(;u--;)(m=i[u])&&p(m);return l(i),l(y),g},et.invert=yt,et.invoke=function(n,t){var e=Se.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ht(typeof a=="number"?a:0);return Et(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},et.keys=$e,et.map=St,et.max=At,et.memoize=function(n,t){function e(){var r=e.cache,u=w+(t?t.apply(this,arguments):arguments[0]);return ve.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},et.merge=kt,et.min=function(n,t,e){var r=1/0,a=r; +}),r},et.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&t!=h){var a=u;for(t=et.createCallback(t,e);a--&&t(n[a],a,n);)r++}else r=t==h||e?1:t||r;return s(n,0,xe(Ce(0,u-r),u))},et.intersection=function(n){for(var r=arguments,u=r.length,a=-1,i=f(),c=-1,s=ft(),v=n?n.length:0,g=[],y=f();++a=C&&o(a?r[a]:y)}n:for(;++c(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 l(i),l(y),g},et.invert=yt,et.invoke=function(n,t){var e=Se.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ht(typeof a=="number"?a:0);return Et(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},et.keys=$e,et.map=St,et.max=At,et.memoize=function(n,t){function e(){var r=e.cache,u=w+(t?t.apply(this,arguments):arguments[0]);return ve.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},et.merge=kt,et.min=function(n,t,e){var r=1/0,a=r; if(!t&&Ne(n)){e=-1;for(var o=n.length;++er(o,e))&&(a[e]=n)}),a},et.once=function(n){var t,e;return function(){return t?e:(t=y,e=n.apply(this,arguments),n=h,e)}},et.pairs=function(n){for(var t=-1,e=$e(n),r=e.length,u=Ht(r);++te?Ce(0,r+e):xe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},et.mixin=Vt,et.noConflict=function(){return r._=ae,this},et.parseInt=ye,et.random=function(n,t){n==h&&t==h&&(t=1),n=+n||0,t==h?(t=n,n=0):t=+t||0;var e=Ee();return n%1||t%1?n+xe(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+le(e*(t-n+1))},et.reduce=Nt,et.reduceRight=$t,et.result=function(n,t){var e=n?n[t]:g; -return mt(e)?n[t]():e},et.runInContext=v,et.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$e(n).length},et.some=Bt,et.sortedIndex=Dt,et.template=function(n,t,e){var r=et.templateSettings;n||(n=""),e=X({},e,r);var u,a=X({},e.imports,r.imports),r=$e(a),a=jt(a),o=0,f=e.interpolate||T,c="__p+='",f=ne((e.escape||T).source+"|"+f.source+"|"+(f===F?$:T).source+"|"+(e.evaluate||T).source+"|$","g");n.replace(f,function(t,e,r,a,f,l){return r||(r=a),c+=n.slice(o,l).replace(D,i),e&&(c+="'+__e("+e+")+'"),f&&(u=y,c+="';"+f+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),o=l+t.length,t +return bt(e)?n[t]():e},et.runInContext=v,et.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$e(n).length},et.some=Bt,et.sortedIndex=Dt,et.template=function(n,t,e){var r=et.templateSettings;n||(n=""),e=X({},e,r);var u,a=X({},e.imports,r.imports),r=$e(a),a=jt(a),o=0,f=e.interpolate||T,c="__p+='",f=ne((e.escape||T).source+"|"+f.source+"|"+(f===F?$:T).source+"|"+(e.evaluate||T).source+"|$","g");n.replace(f,function(t,e,r,a,f,l){return r||(r=a),c+=n.slice(o,l).replace(D,i),e&&(c+="'+__e("+e+")+'"),f&&(u=y,c+="';"+f+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),o=l+t.length,t }),c+="';\n",f=e=e.variable,f||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(E,""):c).replace(S,"$1").replace(A,"$1;"),c="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var l=Qt(r,"return "+c).apply(g,a)}catch(p){throw p.source=c,p}return t?l(t):(l.source=c,l)},et.unescape=function(n){return n==h?"":te(n).replace(I,pt)},et.uniqueId=function(n){var t=++_;return te(n==h?"":n)+t },et.all=Ct,et.any=Bt,et.detect=Ot,et.findWhere=Ot,et.foldl=Nt,et.foldr=$t,et.include=wt,et.inject=Nt,d(et,function(n,t){et.prototype[t]||(et.prototype[t]=function(){var t=[this.__wrapped__];return ge.apply(t,arguments),n.apply(et,t)})}),et.first=Rt,et.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=h){var a=u;for(t=et.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==h||e)return n[u-1];return s(n,Ce(0,u-r))}},et.take=Rt,et.head=Rt,d(et,function(n,t){et.prototype[t]||(et.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); return t==h||e&&typeof t!="function"?r:new rt(r)})}),et.VERSION="1.3.1",et.prototype.toString=function(){return te(this.__wrapped__)},et.prototype.value=Gt,et.prototype.valueOf=Gt,Et(["join","pop","shift"],function(n){var t=re[n];et.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Et(["push","reverse","sort","unshift"],function(n){var t=re[n];et.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Et(["concat","slice","splice"],function(n){var t=re[n];et.prototype[n]=function(){return new rt(t.apply(this.__wrapped__,arguments)) -}}),et}var g,y=!0,h=null,m=!1,b=[],d=[],_=0,k={},j={},w=+new Date+"",C=75,x=40,O=" \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",E=/\b__p\+='';/g,S=/\b(__p\+=)''\+/g,A=/(__e\(.*?\)|\b__t\))\+'';/g,I=/&(?:amp|lt|gt|quot|#39);/g,N=/[&<>"']/g,$=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,B=/\w*$/,F=/<%=([\s\S]+?)%>/g,R=RegExp("^["+O+"]*0+(?=.$)"),T=/($^)/,q=(q=/\bthis\b/)&&q.test(v)&&q,D=/['\n\r\t\u2028\u2029\\]/g,z="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),W="[object Arguments]",P="[object Array]",K="[object Boolean]",M="[object Date]",U="[object Function]",V="[object Number]",G="[object Object]",H="[object RegExp]",J="[object String]",L={}; -L[U]=m,L[W]=L[P]=L[K]=L[M]=L[V]=L[G]=L[H]=L[J]=y;var Q={"boolean":m,"function":y,object:y,number:m,string:m,undefined:m},X={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Y=Q[typeof exports]&&exports,Z=Q[typeof module]&&module&&module.exports==Y&&module,nt=Q[typeof global]&&global;!nt||nt.global!==nt&&nt.window!==nt||(n=nt);var tt=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=tt, define(function(){return tt})):Y&&!Y.nodeType?Z?(Z.exports=tt)._=tt:Y._=tt:n._=tt +}}),et}var g,y=!0,h=null,b=!1,m=[],d=[],_=0,k={},j={},w=+new Date+"",C=75,x=40,O=" \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",E=/\b__p\+='';/g,S=/\b(__p\+=)''\+/g,A=/(__e\(.*?\)|\b__t\))\+'';/g,I=/&(?:amp|lt|gt|quot|#39);/g,N=/[&<>"']/g,$=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,B=/\w*$/,F=/<%=([\s\S]+?)%>/g,R=RegExp("^["+O+"]*0+(?=.$)"),T=/($^)/,q=(q=/\bthis\b/)&&q.test(v)&&q,D=/['\n\r\t\u2028\u2029\\]/g,z="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),W="[object Arguments]",P="[object Array]",K="[object Boolean]",M="[object Date]",U="[object Function]",V="[object Number]",G="[object Object]",H="[object RegExp]",J="[object String]",L={}; +L[U]=b,L[W]=L[P]=L[K]=L[M]=L[V]=L[G]=L[H]=L[J]=y;var Q={"boolean":b,"function":y,object:y,number:b,string:b,undefined:b},X={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Y=Q[typeof exports]&&exports,Z=Q[typeof module]&&module&&module.exports==Y&&module,nt=Q[typeof global]&&global;!nt||nt.global!==nt&&nt.window!==nt||(n=nt);var tt=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=tt, define(function(){return tt})):Y&&!Y.nodeType?Z?(Z.exports=tt)._=tt:Y._=tt:n._=tt }(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index ec7a76f9a..19d3b3a9e 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -3178,32 +3178,6 @@ return result; } - /** - * The inverse of `_.zip`, this method splits groups of elements into arrays - * composed of elements from each group at their corresponding indexes. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @returns {Array} Returns a new array of the composed arrays. - * @example - * - * _.unzip([['moe', 30, true], ['larry', 40, false]]); - * // => [['moe', 'larry'], [30, 40], [true, false]]; - */ - function unzip() { - var array = arguments.length > 1 ? arguments : arguments[0], - index = -1, - length = array ? max(pluck(array, 'length')) : 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = pluck(array, index); - } - return result; - } - /** * Creates an array with all occurrences of the passed values removed using * strict equality for comparisons, i.e. `===`. @@ -3224,13 +3198,13 @@ } /** - * Groups the elements of each array at their corresponding indexes. Useful for - * separate data sources that are coordinated through matching array indexes. - * For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix - * in a similar fashion. + * 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. * * @static * @memberOf _ + * @alias unzip * @category Arrays * @param {Array} [array1, array2, ...] Arrays to process. * @returns {Array} Returns a new array of grouped elements. @@ -3239,8 +3213,16 @@ * _.zip(['moe', 'larry'], [30, 40], [true, false]); * // => [['moe', 30, true], ['larry', 40, false]] */ - function zip(array) { - return array ? unzip(arguments) : []; + function zip() { + var array = arguments.length > 1 ? arguments : arguments[0], + index = -1, + length = array ? max(pluck(array, 'length')) : 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = pluck(array, index); + } + return result; } /** @@ -4344,7 +4326,6 @@ lodash.toArray = toArray; lodash.union = union; lodash.uniq = uniq; - lodash.unzip = unzip; lodash.values = values; lodash.where = where; lodash.without = without; @@ -4361,6 +4342,7 @@ lodash.select = filter; lodash.tail = rest; lodash.unique = uniq; + lodash.unzip = zip; // add Underscore compat lodash.chain = chain; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index a5297e2a4..2263aa9d6 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -27,8 +27,8 @@ var e=0,u=n.length;if(typeof t!="number"&&null!=t){var i=u;for(t=G(t,r);i--&&t(n }),o},i.keys=$t,i.map=S,i.max=N,i.memoize=function(n,t){var r={};return function(){var e=X+(t?t.apply(this,arguments):arguments[0]);return jt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},i.min=function(n,t,r){var e=1/0,u=e,i=-1,o=n?n.length:0;if(t||typeof o!="number")t=G(t,r),F(n,function(n,r,i){r=t(n,r,i),rt(r,u)&&(e[u]=n)}),e},i.once=function(n){var t,r; return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},i.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?Nt(0,e+r):Bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},i.mixin=K,i.noConflict=function(){return n._=yt,this},i.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=kt();return n%1||t%1?n+Bt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1))},i.reduce=k,i.reduceRight=q,i.result=function(n,t){var r=n?n[t]:void 0; return d(r)?n[t]():r},i.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},i.some=D,i.sortedIndex=C,i.template=function(n,t,r){var u=i.templateSettings;n||(n=""),r=g({},r,u);var o=0,a="__p+='",u=r.variable;n.replace(RegExp((r.escape||nt).source+"|"+(r.interpolate||nt).source+"|"+(r.evaluate||nt).source+"|$","g"),function(t,r,u,i,f){return a+=n.slice(o,f).replace(tt,e),r&&(a+="'+_['escape']("+r+")+'"),i&&(a+="';"+i+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),o=f+t.length,t diff --git a/doc/README.md b/doc/README.md index 27f0c8460..4fdccdd2f 100644 --- a/doc/README.md +++ b/doc/README.md @@ -27,7 +27,7 @@ * [`_.union`](#_unionarray1-array2-) * [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg) * [`_.unique`](#_uniqarray--issortedfalse-callbackidentity-thisarg) -* [`_.unzip`](#_unziparray) +* [`_.unzip`](#_ziparray1-array2-) * [`_.without`](#_withoutarray--value1-value2-) * [`_.zip`](#_ziparray1-array2-) * [`_.zipObject`](#_zipobjectkeys--values) @@ -812,34 +812,10 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - - -### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4485 "View in source") [Ⓣ][1] - -The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. - -#### Arguments -1. `array` *(Array)*: The array to process. - -#### Returns -*(Array)*: Returns a new array of the composed arrays. - -#### Example -```js -_.unzip([['moe', 30, true], ['larry', 40, false]]); -// => [['moe', 'larry'], [30, 40], [true, false]]; -``` - -* * * - - - - ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4512 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4486 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -864,9 +840,12 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4532 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4506 "View in source") [Ⓣ][1] -Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. +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. + +#### Aliases +*unzip* #### Arguments 1. `[array1, array2, ...]` *(Array)*: Arrays to process. @@ -888,7 +867,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4554 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4536 "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`. @@ -979,7 +958,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5657 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5639 "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. @@ -1009,7 +988,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5674 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5656 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1009,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5691 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5673 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1871,7 +1850,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4591 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4573 "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. @@ -1899,7 +1878,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4621 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4603 "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. @@ -1930,7 +1909,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4652 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4634 "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. @@ -1961,7 +1940,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4698 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4680 "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. @@ -2002,7 +1981,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4703 "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. @@ -2029,7 +2008,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4780 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4762 "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`. @@ -2083,7 +2062,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4865 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4847 "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. @@ -2124,7 +2103,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4962 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4944 "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. @@ -2149,7 +2128,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4988 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4970 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2176,7 +2155,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5013 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4995 "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. @@ -2202,7 +2181,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5043 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5025 "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. @@ -2228,7 +2207,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5078 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5060 "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. @@ -2255,7 +2234,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5109 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5091 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2292,7 +2271,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5144 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5126 "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. @@ -2326,7 +2305,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5185 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5167 "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. @@ -3407,7 +3386,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5209 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5191 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3431,7 +3410,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5227 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5209 "View in source") [Ⓣ][1] This method returns the first argument passed to it. @@ -3456,7 +3435,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5253 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5235 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3486,7 +3465,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5282 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5264 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3506,7 +3485,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5306 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5288 "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. @@ -3533,7 +3512,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5329 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5311 "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. @@ -3561,7 +3540,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5373 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5355 "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. @@ -3614,7 +3593,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5457 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5439 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3696,7 +3675,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5582 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5564 "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)*. @@ -3728,7 +3707,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5609 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5591 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3752,7 +3731,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5629 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5611 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3805,7 +3784,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5872 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5854 "View in source") [Ⓣ][1] *(String)*: The semantic version number.