diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 4c2e3cac2..9e455822d 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -66,6 +66,9 @@ /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis; + /** Used to match unescaped characters in compiled string literals */ var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; @@ -489,8 +492,8 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - defineProperty = reNative.test(defineProperty = Object.defineProperty) && defineProperty, floor = Math.floor, + fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayRef.push, @@ -501,6 +504,15 @@ toString = objectProto.toString, unshift = arrayRef.unshift; + var defineProperty = (function() { + try { + var o = {}, + func = reNative.test(func = Object.defineProperty) && func, + result = func(o, o, o) && func; + } catch(e) { } + return result; + }()); + /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, @@ -1037,6 +1049,16 @@ if (typeof thisArg == 'undefined') { return func; } + var bindData = !func.name || func.__bindData__; + if (typeof bindData == 'undefined') { + // checks if `func` references the `this` keyword and stores the result + bindData = !reThis || reThis.test(fnToString.call(func)); + setBindData(func, bindData); + } + // exit early if there are no `this` references or `func` is bound + if (bindData !== true && !(bindData && bindData[1] & 1)) { + return func; + } switch (argCount) { case 1: return function(value) { return func.call(thisArg, value); @@ -1442,6 +1464,26 @@ bitmask &= ~32; isPartialRight = partialRightArgs = false; } + var bindData = func && func.__bindData__; + if (bindData) { + if (isBind && !(bindData[1] & 1)) { + bindData[4] = thisArg; + } + if (!isBind && bindData[1] & 1) { + bitmask |= 8; + } + if (isCurry && !(bindData[1] & 4)) { + bindData[5] = arity; + } + if (isPartial) { + push.apply(bindData[2] || (bindData[2] = []), partialArgs); + } + if (isPartialRight) { + push.apply(bindData[3] || (bindData[3] = []), partialRightArgs); + } + bindData[1] |= bitmask; + return createBound.apply(null, bindData); + } // use `Function#bind` if it exists and is fast // (in V8 `Function#bind` is slower except when partially applied) if (isBind && !(isBindKey || isCurry || isPartialRight) && @@ -1486,6 +1528,7 @@ return func.apply(thisBinding, args); }; } + setBindData(bound, nativeSlice.call(arguments)); return bound; } @@ -1985,7 +2028,7 @@ * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the key of the found element, else `undefined`. + * @returns {string|undefined} Returns the key of the found element, else `undefined`. * @example * * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { @@ -2017,7 +2060,7 @@ * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the key of the found element, else `undefined`. + * @returns {string|undefined} Returns the key of the found element, else `undefined`. * @example * * _.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { @@ -4129,7 +4172,7 @@ * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the index of the found element, else `-1`. + * @returns {number} Returns the index of the found element, else `-1`. * @example * * _.findIndex(['apple', 'banana', 'beet'], function(food) { @@ -4162,7 +4205,7 @@ * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the index of the found element, else `-1`. + * @returns {number} Returns the index of the found element, else `-1`. * @example * * _.findLastIndex(['apple', 'banana', 'beet'], function(food) { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 4397fa895..cb067d53d 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,52 +4,53 @@ * Build: `lodash -o ./dist/lodash.compat.js` */ ;!function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++r=C&&f===n,h=u||g?i():c; -if(g){var v=o(h);v?(f=t,h=v):(g=d,h=u?h:(p(h),c))}for(;++af(h,y))&&((u||g)&&h.push(y),c.push(v))}return g?(p(h.b),s(h)):u&&p(h),c}function ot(n){return function(t,e,r){var u={};if(e=b.createCallback(e,r,3),qe(t)){r=-1;for(var o=t.length;++rk;k++)r+="n='"+n.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",n.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+n.g+"}"; -r+="}"}return(n.b||Te.nonEnumArgs)&&(r+="}"),r+=n.c+";return E",t=t("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",e+r+"}"),s(n),t(X,W,ie,me,j,gt,qe,_t,n.f,fe,Q,Le,U,le,ke)}function ft(n){return dt(n)?Ee(n):{}}function lt(n){return He[n]}function ct(){var t=(t=b.indexOf)===$t?n:t;return t}function pt(n){var t,e;return!n||ke.call(n)!=M||(t=n.constructor,mt(t)&&!(t instanceof t))||!Te.argsClass&>(n)||!Te.nodeClass&&l(n)?d:Te.ownLast?(nr(n,function(n,t,r){return e=me.call(r,t),d}),e!==false):(nr(n,function(n,t){e=t -}),e===v||me.call(n,e))}function st(n){return Ue[n]}function gt(n){return n&&typeof n=="object"?ke.call(n)==L:d}function ht(n,t,e){var r=We(n),u=r.length;for(t=X(t,e,3);u--&&(e=r[u],!(t(n[e],e,n)===false)););return n}function vt(n){var t=[];return nr(n,function(n,e){mt(n)&&t.push(e)}),t.sort()}function yt(n){for(var t=-1,e=We(n),r=e.length,u={};++te?Be(0,o+e):e)||0,o&&typeof o=="number"?a=-1<(_t(n)?n.indexOf(t,e):u(n,t,e)):Xe(n,function(n){return++ro&&(o=i)}}else t=!t&&_t(n)?r:b.createCallback(t,e,3),Xe(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function It(n,t,e,r){var u=3>arguments.length;if(t=X(t,r,4),qe(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=X(t,r,4),Ot(n,function(n,r,o){e=u?(u=d,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Qt(typeof e=="number"?e:0); -return Et(n,function(n){var e=Ut(++t);r[t]=r[e],r[e]=n}),r}function Nt(n,t,e){var r;if(t=b.createCallback(t,e,3),qe(n)){e=-1;for(var u=n.length;++e=C&&u===n;if(l){var c=o(i);c?(u=t,i=c):l=d}for(;++ru(i,c)&&f.push(c);return l&&s(i),f -}function Dt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=m){var o=-1;for(t=b.createCallback(t,e,3);++or?Be(0,u+r):r||0}else if(r)return r=Lt(t,e),t[r]===e?r:-1;return n(t,e,r)}function zt(n,t,e){if(typeof t!="number"&&t!=m){var r=0,u=-1,o=n?n.length:0;for(t=b.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++tl&&(a=n.apply(f,o)); -else{!s&&!v&&(c=i);var e=p-(i-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:b}},Ee||(ft=function(n){if(dt(n)){c.prototype=n;var t=new c;c.prototype=m}return t||{}}),Te.argsClass||(gt=function(n){return n&&typeof n=="object"?me.call(n,"callee"):d});var qe=Oe||function(n){return n&&typeof n=="object"?ke.call(n)==T:d},Ke=it({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),We=Ie?function(n){return dt(n)?Te.enumPrototypes&&typeof n=="function"||Te.nonEnumArgs&&n.length&>(n)?Ke(n):Ie(n):[] -}:Ke,Ge={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:We,g:"if(e(t[n],n,g)===false)return E"},Je={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Ue=yt(He),Ve=re("("+We(Ue).join("|")+")","g"),Qe=re("["+We(He).join("")+"]","g"),Xe=it(Ge),Ye=it(Je,{i:Je.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]"}),Ze=it(Je),nr=it(Ge,Me,{j:d}),tr=it(Ge,Me); -mt(/x/)&&(mt=function(n){return typeof n=="function"&&ke.call(n)==G});var er=ye?function(n){if(!n||ke.call(n)!=M||!Te.argsClass&>(n))return d;var t=n.valueOf,e=typeof t=="function"&&(e=ye(t))&&ye(e);return e?n==e||ye(n)==e:pt(n)}:pt,rr=ot(function(n,t,e){me.call(n,e)?n[e]++:n[e]=1}),ur=ot(function(n,t,e){(me.call(n,e)?n[e]:n[e]=[]).push(t)}),or=ot(function(n,t,e){n[e]=t}),ar=St;$e&&nt&&typeof _e=="function"&&(Jt=function(n){if(!mt(n))throw new oe;return _e.apply(e,arguments)});var ir=8==Ne(O+"08")?Ne:function(n,t){return Ne(_t(n)?n.replace(R,""):n,t||0) -};return b.after=function(n,t){if(!mt(t))throw new oe;return function(){return 1>--n?t.apply(this,arguments):void 0}},b.assign=Ye,b.at=function(n){var t=arguments,e=-1,r=Z(t,y,d,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Qt(t);for(Te.unindexedChars&&_t(n)&&(n=n.split(""));++e=C&&o(a?r[a]:v)}n:for(;++l(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=f[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&s(m);return p(f),p(v),h},b.invert=yt,b.invoke=function(n,t){var e=Fe.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Qt(typeof o=="number"?o:0);return Et(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},b.keys=We,b.map=St,b.max=At,b.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):x+arguments[0]; -return me.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!mt(n))throw new oe;return e.cache={},e},b.merge=function(n){var t=arguments,e=2;if(!dt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},b.once=function(n){var t,e;if(!mt(n))throw new oe;return function(){return t?e:(t=y,e=n.apply(this,arguments),n=m,e)}},b.pairs=function(n){for(var t=-1,e=We(n),r=e.length,u=Qt(r);++te?Be(0,r+e):Pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},b.mixin=Ht,b.noConflict=function(){return e._=ce,this},b.parseInt=ir,b.random=Ut,b.reduce=It,b.reduceRight=Bt,b.result=function(n,t){var e=n?n[t]:v;return mt(e)?n[t]():e},b.runInContext=h,b.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:We(n).length},b.some=Nt,b.sortedIndex=Lt,b.template=function(n,t,e){var r=b.templateSettings; -n||(n=""),e=Ze({},e,r);var u,o=Ze({},e.imports,r.imports),r=We(o),o=wt(o),i=0,f=e.interpolate||F,l="__p+='",f=re((e.escape||F).source+"|"+f.source+"|"+(f===N?B:F).source+"|"+(e.evaluate||F).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(D,a),e&&(l+="'+__e("+e+")+'"),f&&(u=y,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(S,""):l).replace(A,"$1").replace(I,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var c=Zt(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},b.unescape=function(n){return n==m?"":ue(n).replace(Ve,st)},b.uniqueId=function(n){var t=++w;return ue(n==m?"":n)+t},b.all=kt,b.any=Nt,b.detect=Ct,b.findWhere=Ct,b.foldl=It,b.foldr=Bt,b.include=jt,b.inject=It,tr(b,function(n,t){b.prototype[t]||(b.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return de.apply(t,arguments),t=n.apply(b,t),e?new _(t,e):t})}),b.first=Dt,b.last=function(n,t,e){if(n){var r=0,u=n.length; -if(typeof t!="number"&&t!=m){var o=u;for(t=b.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,r==m||e)return n[u-1];return g(n,Be(0,u-r))}},b.sample=function(n,t,e){return qe(n)||(n=Rt(n)),t==m||e?n[Ut(n.length-1)]:(n=Pt(n),n.length=Pe(Be(0,t),n.length),n)},b.take=Dt,b.head=Dt,tr(b,function(n,t){var e="sample"!==t;b.prototype[t]||(b.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||t!=m&&(!r||e&&typeof t=="function")?new _(o,u):o})}),b.VERSION="1.3.1",b.prototype.chain=function(){return this.__chain__=y,this -},b.prototype.toString=function(){return ue(this.__wrapped__)},b.prototype.value=Vt,b.prototype.valueOf=Vt,Xe(["join","pop","shift"],function(n){var t=ae[n];b.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new _(e,n):e}}),Xe(["push","reverse","sort","unshift"],function(n){var t=ae[n];b.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Xe(["concat","slice","splice"],function(n){var t=ae[n];b.prototype[n]=function(){return new _(t.apply(this.__wrapped__,arguments),this.__chain__) -}}),Te.spliceObjects||Xe(["pop","shift","splice"],function(n){var t=ae[n],e="splice"==n;b.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new _(u,n):u}}),b}var v,y=!0,m=null,d=!1,b=[],_=[],w=0,j={},x=+new Date+"",C=75,E=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",S=/\b__p\+='';/g,A=/\b(__p\+=)''\+/g,I=/(__e\(.*?\)|\b__t\))\+'';/g,B=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,P=/\w*$/,N=/<%=([\s\S]+?)%>/g,R=RegExp("^["+O+"]*0+(?=.$)"),F=/($^)/,D=/['\n\r\t\u2028\u2029\\]/g,$="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),z="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",q="[object Boolean]",K="[object Date]",W="[object Error]",G="[object Function]",J="[object Number]",M="[object Object]",H="[object RegExp]",U="[object String]",V={}; -V[G]=d,V[L]=V[T]=V[q]=V[K]=V[J]=V[M]=V[H]=V[U]=y;var Q={"boolean":d,"function":y,object:y,number:d,string:d,undefined:d},X={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Y=Q[typeof window]&&window||this,Z=Q[typeof exports]&&exports,nt=Q[typeof module]&&module&&module.exports==Z&&module,tt=Q[typeof global]&&global;!tt||tt.global!==tt&&tt.window!==tt||(Y=tt);var et=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Y._=et, define(function(){return et -})):Z&&!Z.nodeType?nt?(nt.exports=et)._=et:Z._=et:Y._=et}.call(this); \ No newline at end of file +}function u(n,t){var e=n.l,r=t.l;if(e!==r){if(e>r||typeof e=="undefined")return 1;if(ee?0:e);++r=C&&f===n,h=u||g?i():c; +if(g){var v=o(h);v?(f=t,h=v):(g=d,h=u?h:(p(h),c))}for(;++af(h,y))&&((u||g)&&h.push(y),c.push(v))}return g?(p(h.b),s(h)):u&&p(h),c}function at(n){return function(t,e,r){var u={};if(e=_.createCallback(e,r,3),Ge(t)){r=-1;for(var o=t.length;++rk;k++)r+="n='"+n.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",n.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+n.g+"}"; +r+="}"}return(n.b||Ke.nonEnumArgs)&&(r+="}"),r+=n.c+";return E",t=t("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",e+r+"}"),s(n),t(Y,G,fe,de,j,ht,Ge,wt,n.f,le,X,qe,V,ce,xe)}function lt(n){return _t(n)?Se(n):{}}function ct(n){return Qe[n]}function pt(){var t=(t=_.indexOf)===zt?n:t;return t}function st(n){var t,e;return!n||xe.call(n)!=H||(t=n.constructor,dt(t)&&!(t instanceof t))||!Ke.argsClass&&ht(n)||!Ke.nodeClass&&l(n)?d:Ke.ownLast?(rr(n,function(n,t,r){return e=de.call(r,t),d}),e!==false):(rr(n,function(n,t){e=t +}),e===v||de.call(n,e))}function gt(n){return Xe[n]}function ht(n){return n&&typeof n=="object"?xe.call(n)==T:d}function vt(n,t,e){var r=Me(n),u=r.length;for(t=Y(t,e,3);u--&&(e=r[u],!(t(n[e],e,n)===false)););return n}function yt(n){var t=[];return rr(n,function(n,e){dt(n)&&t.push(e)}),t.sort()}function mt(n){for(var t=-1,e=Me(n),r=e.length,u={};++te?Pe(0,o+e):e)||0,o&&typeof o=="number"?a=-1<(wt(n)?n.indexOf(t,e):u(n,t,e)):nr(n,function(n){return++ro&&(o=i)}}else t=!t&&wt(n)?r:_.createCallback(t,e,3),nr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Bt(n,t,e,r){var u=3>arguments.length;if(t=Y(t,r,4),Ge(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Y(t,r,4),St(n,function(n,r,o){e=u?(u=d,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0); +return Ot(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function Nt(n,t,e){var r;if(t=_.createCallback(t,e,3),Ge(n)){e=-1;for(var u=n.length;++e=C&&u===n;if(l){var c=o(i);c?(u=t,i=c):l=d}for(;++ru(i,c)&&f.push(c);return l&&s(i),f +}function $t(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=m){var o=-1;for(t=_.createCallback(t,e,3);++or?Pe(0,u+r):r||0}else if(r)return r=Tt(t,e),t[r]===e?r:-1;return n(t,e,r)}function Lt(n,t,e){if(typeof t!="number"&&t!=m){var r=0,u=-1,o=n?n.length:0;for(t=_.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++tl&&(a=n.apply(f,o)); +else{!s&&!v&&(c=i);var e=p-(i-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:P,variable:"",imports:{_:_}},Se||(lt=function(n){if(_t(n)){c.prototype=n;var t=new c;c.prototype=m}return t||{}});var We=Ee?function(n,t){var e=f();e.value=t,Ee(n,"__bindData__",e),s(e)}:c;Ke.argsClass||(ht=function(n){return n&&typeof n=="object"?de.call(n,"callee"):d});var Ge=Ae||function(n){return n&&typeof n=="object"?xe.call(n)==q:d +},Je=ft({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),Me=De?function(n){return _t(n)?Ke.enumPrototypes&&typeof n=="function"||Ke.nonEnumArgs&&n.length&&ht(n)?Je(n):De(n):[]}:Je,He={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:Me,g:"if(e(t[n],n,g)===false)return E"},Ue={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Xe=mt(Qe),Ye=ue("("+Me(Xe).join("|")+")","g"),Ze=ue("["+Me(Qe).join("")+"]","g"),nr=ft(He),tr=ft(Ue,{i:Ue.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]"}),er=ft(Ue),rr=ft(He,Ve,{j:d}),ur=ft(He,Ve); +dt(/x/)&&(dt=function(n){return typeof n=="function"&&xe.call(n)==J});var or=me?function(n){if(!n||xe.call(n)!=H||!Ke.argsClass&&ht(n))return d;var t=n.valueOf,e=typeof t=="function"&&(e=me(t))&&me(e);return e?n==e||me(n)==e:st(n)}:st,ar=at(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),ir=at(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),fr=at(function(n,t,e){n[e]=t}),lr=At;Le&&tt&&typeof we=="function"&&(Mt=function(n){if(!dt(n))throw new ae;return we.apply(e,arguments)});var cr=8==Re(O+"08")?Re:function(n,t){return Re(wt(n)?n.replace(N,""):n,t||0) +};return _.after=function(n,t){if(!dt(t))throw new ae;return function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=tr,_.at=function(n){var t=arguments,e=-1,r=nt(t,y,d,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);for(Ke.unindexedChars&&wt(n)&&(n=n.split(""));++e=C&&o(a?r[a]:v)}n:for(;++l(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=f[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&s(m);return p(f),p(v),h},_.invert=mt,_.invoke=function(n,t){var e=$e.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return Ot(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},_.keys=Me,_.map=At,_.max=It,_.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):x+arguments[0]; +return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!dt(n))throw new ae;return e.cache={},e},_.merge=function(n){var t=arguments,e=2;if(!_t(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},_.once=function(n){var t,e;if(!dt(n))throw new ae;return function(){return t?e:(t=y,e=n.apply(this,arguments),n=m,e)}},_.pairs=function(n){for(var t=-1,e=Me(n),r=e.length,u=Xt(r);++te?Pe(0,r+e):Ne(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},_.mixin=Ut,_.noConflict=function(){return e._=pe,this},_.parseInt=cr,_.random=Vt,_.reduce=Bt,_.reduceRight=Dt,_.result=function(n,t){var e=n?n[t]:v;return dt(e)?n[t]():e},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Me(n).length},_.some=Nt,_.sortedIndex=Tt,_.template=function(n,t,e){var r=_.templateSettings; +n||(n=""),e=er({},e,r);var u,o=er({},e.imports,r.imports),r=Me(o),o=jt(o),i=0,f=e.interpolate||R,l="__p+='",f=ue((e.escape||R).source+"|"+f.source+"|"+(f===P?B:R).source+"|"+(e.evaluate||R).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace($,a),e&&(l+="'+__e("+e+")+'"),f&&(u=y,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(S,""):l).replace(A,"$1").replace(I,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +try{var c=ne(r,"return "+l).apply(v,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},_.unescape=function(n){return n==m?"":oe(n).replace(Ye,gt)},_.uniqueId=function(n){var t=++w;return oe(n==m?"":n)+t},_.all=xt,_.any=Nt,_.detect=Et,_.findWhere=Et,_.foldl=Bt,_.foldr=Dt,_.include=kt,_.inject=Bt,ur(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return _e.apply(t,arguments),t=n.apply(_,t),e?new b(t,e):t})}),_.first=$t,_.last=function(n,t,e){if(n){var r=0,u=n.length; +if(typeof t!="number"&&t!=m){var o=u;for(t=_.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,r==m||e)return n[u-1];return g(n,Pe(0,u-r))}},_.sample=function(n,t,e){return Ge(n)||(n=Rt(n)),t==m||e?n[Vt(n.length-1)]:(n=Pt(n),n.length=Ne(Pe(0,t),n.length),n)},_.take=$t,_.head=$t,ur(_,function(n,t){var e="sample"!==t;_.prototype[t]||(_.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||t!=m&&(!r||e&&typeof t=="function")?new b(o,u):o})}),_.VERSION="1.3.1",_.prototype.chain=function(){return this.__chain__=y,this +},_.prototype.toString=function(){return oe(this.__wrapped__)},_.prototype.value=Qt,_.prototype.valueOf=Qt,nr(["join","pop","shift"],function(n){var t=ie[n];_.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new b(e,n):e}}),nr(["push","reverse","sort","unshift"],function(n){var t=ie[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),nr(["concat","slice","splice"],function(n){var t=ie[n];_.prototype[n]=function(){return new b(t.apply(this.__wrapped__,arguments),this.__chain__) +}}),Ke.spliceObjects||nr(["pop","shift","splice"],function(n){var t=ie[n],e="splice"==n;_.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new b(u,n):u}}),_}var v,y=!0,m=null,d=!1,_=[],b=[],w=0,j={},x=+new Date+"",C=75,E=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",S=/\b__p\+='';/g,A=/\b(__p\+=)''\+/g,I=/(__e\(.*?\)|\b__t\))\+'';/g,B=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,D=/\w*$/,P=/<%=([\s\S]+?)%>/g,N=RegExp("^["+O+"]*0+(?=.$)"),R=/($^)/,F=(F=/\bthis\b/)&&F.test(h)&&F,$=/['\n\r\t\u2028\u2029\\]/g,z="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),T="[object Arguments]",q="[object Array]",K="[object Boolean]",W="[object Date]",G="[object Error]",J="[object Function]",M="[object Number]",H="[object Object]",U="[object RegExp]",V="[object String]",Q={}; +Q[J]=d,Q[T]=Q[q]=Q[K]=Q[W]=Q[M]=Q[H]=Q[U]=Q[V]=y;var X={"boolean":d,"function":y,object:y,number:d,string:d,undefined:d},Y={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Z=X[typeof window]&&window||this,nt=X[typeof exports]&&exports,tt=X[typeof module]&&module&&module.exports==nt&&module,et=X[typeof global]&&global;!et||et.global!==et&&et.window!==et||(Z=et);var rt=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Z._=rt, define(function(){return rt +})):nt&&!nt.nodeType?tt?(tt.exports=rt)._=rt:nt._=rt:Z._=rt}.call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index e128e1ae5..a14abed33 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -457,7 +457,6 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - defineProperty = reNative.test(defineProperty = Object.defineProperty) && defineProperty, floor = Math.floor, fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, @@ -470,6 +469,15 @@ toString = objectProto.toString, unshift = arrayRef.unshift; + var defineProperty = (function() { + try { + var o = {}, + func = reNative.test(func = Object.defineProperty) && func, + result = func(o, o, o) && func; + } catch(e) { } + return result; + }()); + /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, @@ -1659,7 +1667,7 @@ * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the key of the found element, else `undefined`. + * @returns {string|undefined} Returns the key of the found element, else `undefined`. * @example * * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { @@ -1691,7 +1699,7 @@ * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the key of the found element, else `undefined`. + * @returns {string|undefined} Returns the key of the found element, else `undefined`. * @example * * _.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { @@ -3339,7 +3347,18 @@ * _.pluck(stooges, 'name'); * // => ['moe', 'larry'] */ - var pluck = map; + function pluck(collection, property) { + var index = -1, + length = collection ? collection.length : 0; + + if (typeof length == 'number') { + var result = Array(length); + while (++index < length) { + result[index] = collection[index][property]; + } + } + return result || map(collection, property); + } /** * Reduces a collection to a value which is the accumulated result of running @@ -3809,7 +3828,7 @@ * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the index of the found element, else `-1`. + * @returns {number} Returns the index of the found element, else `-1`. * @example * * _.findIndex(['apple', 'banana', 'beet'], function(food) { @@ -3842,7 +3861,7 @@ * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the index of the found element, else `-1`. + * @returns {number} Returns the index of the found element, else `-1`. * @example * * _.findLastIndex(['apple', 'banana', 'beet'], function(food) { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 490229647..458702738 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,50 +3,50 @@ * Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;!function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++r=j&&f===n,h=u||v?a():s;if(v){var g=o(h);g?(f=t,h=g):(v=m,h=u?h:(c(h),s)) -}for(;++if(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(c(h.b),p(h)):u&&c(h),s}function at(n){return function(t,e,r){var u={};e=Z.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++re?Ae(0,o+e):e)||0,o&&typeof o=="number"?i=-1<(dt(n)?n.indexOf(t,e):u(n,t,e)):b(n,function(n){return++ro&&(o=a)}}else t=!t&&dt(n)?r:Z.createCallback(t,e,3),Ot(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function At(n,t,e,r){if(!n)return e;var u=3>arguments.length;t=et(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -return t=et(t,r,4),Et(n,function(n,r,o){e=u?(u=m,n):t(e,n,r,o)}),e}function Rt(n){var t=-1,e=n?n.length:0,r=Qt(typeof e=="number"?e:0);return Ot(n,function(n){var e=Ht(++t);r[t]=r[e],r[e]=n}),r}function Bt(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=j&&u===n; -if(l){var c=o(a);c?(u=t,a=c):l=m}for(;++ru(a,c)&&f.push(c);return l&&p(a),f}function Ft(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=y){var o=-1;for(t=Z.createCallback(t,e,3);++or?Ae(0,u+r):r||0}else if(r)return r=qt(t,e),t[r]===e?r:-1;return n(t,e,r)}function zt(n,t,e){if(typeof t!="number"&&t!=y){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);++tl&&(i=n.apply(f,o)); -else{!s&&!_&&(c=a);var e=p-(a-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:A,variable:"",imports:{_:Z}}; -var qe=se?function(n,t){var e=f();e.value=t,se(n,"__bindData__",e),p(e)}:l,We=Oe||function(n){return n&&typeof n=="object"?je.call(n)==T:m},Pe=Se?function(n){return _t(n)?Se(n):[]}:X,Ke={"&":"&","<":"<",">":">",'"':""","'":"'"},Le=yt(Ke),Me=re("("+Pe(Le).join("|")+")","g"),Ue=re("["+Pe(Ke).join("")+"]","g"),Ve=at(function(n,t,e){ye.call(n,e)?n[e]++:n[e]=1}),Ge=at(function(n,t,e){(ye.call(n,e)?n[e]:n[e]=[]).push(t)}),He=at(function(n,t,e){n[e]=t}),Je=It;Fe&&Q&&typeof be=="function"&&(Ut=function(n){if(!mt(n))throw new oe; -return be.apply(e,arguments)});var Qe=8==Re(x+"08")?Re:function(n,t){return Re(dt(n)?n.replace(N,""):n,t||0)};return Z.after=function(n,t){if(!mt(t))throw new oe;return function(){return 1>--n?t.apply(this,arguments):void 0}},Z.assign=J,Z.at=function(n){for(var t=arguments,e=-1,r=rt(t,g,m,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Qt(t);++e=j&&o(i?r[i]:g)}n:for(;++l(m?t(m,y):s(g,y))){for(i=u,(m||g).push(y);--i;)if(m=f[i],0>(m?t(m,y):s(r[i],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&p(m);return c(f),c(g),h},Z.invert=yt,Z.invoke=function(n,t){var e=$e.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,i=Qt(typeof o=="number"?o:0);return Ot(n,function(n){i[++r]=(u?t:n[t]).apply(n,e)}),i},Z.keys=Pe,Z.map=It,Z.max=St,Z.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):w+arguments[0]; -return ye.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!mt(n))throw new oe;return e.cache={},e},Z.merge=function(n){var t=arguments,e=2;if(!_t(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(i,e))&&(o[e]=n)}),o},Z.once=function(n){var t,e;if(!mt(n))throw new oe;return function(){return t?e:(t=g,e=n.apply(this,arguments),n=y,e)}},Z.pairs=function(n){for(var t=-1,e=Pe(n),r=e.length,u=Qt(r);++te?Ae(0,r+e):Ne(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Z.mixin=Gt,Z.noConflict=function(){return e._=fe,this},Z.parseInt=Qe,Z.random=Ht,Z.reduce=At,Z.reduceRight=Nt,Z.result=function(n,t){var e=n?n[t]:h;return mt(e)?n[t]():e},Z.runInContext=v,Z.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Pe(n).length},Z.some=Bt,Z.sortedIndex=qt,Z.template=function(n,t,e){var r=Z.templateSettings; -n||(n=""),e=G({},e,r);var u,o=G({},e.imports,r.imports),r=Pe(o),o=wt(o),a=0,f=e.interpolate||R,l="__p+='",f=re((e.escape||R).source+"|"+f.source+"|"+(f===A?I:R).source+"|"+(e.evaluate||R).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(a,c).replace($,i),e&&(l+="'+__e("+e+")+'"),f&&(u=g,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),a=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(C,""):l).replace(O,"$1").replace(E,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var c=Zt(r,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Z.unescape=function(n){return n==y?"":ue(n).replace(Me,st)},Z.uniqueId=function(n){var t=++d;return ue(n==y?"":n)+t},Z.all=kt,Z.any=Bt,Z.detect=Ct,Z.findWhere=Ct,Z.foldl=At,Z.foldr=Nt,Z.include=jt,Z.inject=At,b(Z,function(n,t){Z.prototype[t]||(Z.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return _e.apply(t,arguments),t=n.apply(Z,t),e?new nt(t,e):t})}),Z.first=Ft,Z.last=function(n,t,e){if(n){var r=0,u=n.length; -if(typeof t!="number"&&t!=y){var o=u;for(t=Z.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,r==y||e)return n[u-1];return s(n,Ae(0,u-r))}},Z.sample=function(n,t,e){return We(n)||(n=$t(n)),t==y||e?n[Ht(n.length-1)]:(n=Rt(n),n.length=Ne(Ae(0,t),n.length),n)},Z.take=Ft,Z.head=Ft,b(Z,function(n,t){var e="sample"!==t;Z.prototype[t]||(Z.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||t!=y&&(!r||e&&typeof t=="function")?new nt(o,u):o})}),Z.VERSION="1.3.1",Z.prototype.chain=function(){return this.__chain__=g,this -},Z.prototype.toString=function(){return ue(this.__wrapped__)},Z.prototype.value=Jt,Z.prototype.valueOf=Jt,Ot(["join","pop","shift"],function(n){var t=ie[n];Z.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new nt(e,n):e}}),Ot(["push","reverse","sort","unshift"],function(n){var t=ie[n];Z.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ot(["concat","slice","splice"],function(n){var t=ie[n];Z.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__) -}}),Z}var h,g=!0,y=null,m=!1,_=[],b=[],d=0,w=+new Date+"",j=75,k=40,x=" \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",C=/\b__p\+='';/g,O=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,I=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,S=/\w*$/,A=/<%=([\s\S]+?)%>/g,N=RegExp("^["+x+"]*0+(?=.$)"),R=/($^)/,B=(B=/\bthis\b/)&&B.test(v)&&B,$=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),F="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",W="[object Function]",P="[object Number]",K="[object Object]",L="[object RegExp]",M="[object String]",U={}; +;!function(){function n(n,t,r){r=(r||0)-1;for(var e=n?n.length:0;++re||typeof r=="undefined")return 1;if(rr?0:r);++e=j&&f===n,h=u||v?i():s;if(v){var g=o(h);g?(f=t,h=g):(v=m,h=u?h:(c(h),s)) +}for(;++af(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(c(h.b),p(h)):u&&c(h),s}function it(n){return function(t,r,e){var u={};r=Z.createCallback(r,e,3),e=-1;var o=t?t.length:0;if(typeof o=="number")for(;++er?Nr(0,o+r):r)||0,o&&typeof o=="number"?a=-1<(dt(n)?n.indexOf(t,r):u(n,t,r)):b(n,function(n){return++eo&&(o=i)}}else t=!t&&dt(n)?e:Z.createCallback(t,r,3),Ot(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function At(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Xt(e);++rarguments.length;t=rt(t,e,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(r=n[++o]);++oarguments.length;return t=rt(t,e,4),Et(n,function(n,e,o){r=u?(u=m,n):t(r,n,e,o)}),r}function Bt(n){var t=-1,r=n?n.length:0,e=Xt(typeof r=="number"?r:0);return Ot(n,function(n){var r=Jt(++t);e[t]=e[r],e[r]=n}),e}function $t(n,t,r){var e;t=Z.createCallback(t,r,3),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r=j&&u===n;if(l){var c=o(i);c?(u=t,i=c):l=m}for(;++eu(i,c)&&f.push(c);return l&&p(i),f}function Tt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=y){var o=-1;for(t=Z.createCallback(t,r,3);++oe?Nr(0,u+e):e||0}else if(e)return e=Wt(t,r),t[e]===r?e:-1;return n(t,r,e) +}function qt(n,t,r){if(typeof t!="number"&&t!=y){var e=0,u=-1,o=n?n.length:0;for(t=Z.createCallback(t,r,3);++u>>1,r(n[e])r?0:r);++tl&&(a=n.apply(f,o));else{!s&&!_&&(c=i);var r=p-(i-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:A,variable:"",imports:{_:Z}};var Wr=xr?function(n,t){var r=f();r.value=t,xr(n,"__bindData__",r),p(r)}:l,Pr=Er||function(n){return n&&typeof n=="object"?jr.call(n)==T:m},Kr=Ar?function(n){return _t(n)?Ar(n):[]}:X,Lr={"&":"&","<":"<",">":">",'"':""","'":"'"},Mr=yt(Lr),Ur=ur("("+Kr(Mr).join("|")+")","g"),Vr=ur("["+Kr(Lr).join("")+"]","g"),Gr=it(function(n,t,r){yr.call(n,r)?n[r]++:n[r]=1 +}),Hr=it(function(n,t,r){(yr.call(n,r)?n[r]:n[r]=[]).push(t)}),Jr=it(function(n,t,r){n[r]=t});Tr&&Q&&typeof br=="function"&&(Vt=function(n){if(!mt(n))throw new ar;return br.apply(r,arguments)});var Qr=8==Br(x+"08")?Br:function(n,t){return Br(dt(n)?n.replace(N,""):n,t||0)};return Z.after=function(n,t){if(!mt(t))throw new ar;return function(){return 1>--n?t.apply(this,arguments):void 0}},Z.assign=J,Z.at=function(n){for(var t=arguments,r=-1,e=et(t,g,m,1),t=t[2]&&t[2][t[1]]===n?1:e.length,u=Xt(t);++r=j&&o(a?e[a]:g)}n:for(;++l(m?t(m,y):s(g,y))){for(a=u,(m||g).push(y);--a;)if(m=f[a],0>(m?t(m,y):s(e[a],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&p(m);return c(f),c(g),h +},Z.invert=yt,Z.invoke=function(n,t){var r=Dr.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return Ot(n,function(n){a[++e]=(u?t:n[t]).apply(n,r)}),a},Z.keys=Kr,Z.map=It,Z.max=St,Z.memoize=function(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):w+arguments[0];return yr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}if(!mt(n))throw new ar;return r.cache={},r},Z.merge=function(n){var t=arguments,r=2;if(!_t(n))return n;if("number"!=typeof t[2]&&(r=t.length),3e(a,r))&&(o[r]=n) +}),o},Z.once=function(n){var t,r;if(!mt(n))throw new ar;return function(){return t?r:(t=g,r=n.apply(this,arguments),n=y,r)}},Z.pairs=function(n){for(var t=-1,r=Kr(n),e=r.length,u=Xt(e);++tr?Nr(0,e+r):Rr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},Z.mixin=Ht,Z.noConflict=function(){return r._=lr,this +},Z.parseInt=Qr,Z.random=Jt,Z.reduce=Nt,Z.reduceRight=Rt,Z.result=function(n,t){var r=n?n[t]:h;return mt(r)?n[t]():r},Z.runInContext=v,Z.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Kr(n).length},Z.some=$t,Z.sortedIndex=Wt,Z.template=function(n,t,r){var e=Z.templateSettings;n||(n=""),r=G({},r,e);var u,o=G({},r.imports,e.imports),e=Kr(o),o=wt(o),i=0,f=r.interpolate||R,l="__p+='",f=ur((r.escape||R).source+"|"+f.source+"|"+(f===A?I:R).source+"|"+(r.evaluate||R).source+"|$","g");n.replace(f,function(t,r,e,o,f,c){return e||(e=o),l+=n.slice(i,c).replace($,a),r&&(l+="'+__e("+r+")+'"),f&&(u=g,l+="';"+f+";__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),i=c+t.length,t +}),l+="';\n",f=r=r.variable,f||(r="obj",l="with("+r+"){"+l+"}"),l=(u?l.replace(C,""):l).replace(O,"$1").replace(E,"$1;"),l="function("+r+"){"+(f?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=nr(e,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Z.unescape=function(n){return n==y?"":or(n).replace(Ur,st)},Z.uniqueId=function(n){var t=++d;return or(n==y?"":n)+t +},Z.all=kt,Z.any=$t,Z.detect=Ct,Z.findWhere=Ct,Z.foldl=Nt,Z.foldr=Rt,Z.include=jt,Z.inject=Nt,b(Z,function(n,t){Z.prototype[t]||(Z.prototype[t]=function(){var t=[this.__wrapped__],r=this.__chain__;return _r.apply(t,arguments),t=n.apply(Z,t),r?new nt(t,r):t})}),Z.first=Tt,Z.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=y){var o=u;for(t=Z.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,e==y||r)return n[u-1];return s(n,Nr(0,u-e))}},Z.sample=function(n,t,r){return Pr(n)||(n=Dt(n)),t==y||r?n[Jt(n.length-1)]:(n=Bt(n),n.length=Rr(Nr(0,t),n.length),n) +},Z.take=Tt,Z.head=Tt,b(Z,function(n,t){var r="sample"!==t;Z.prototype[t]||(Z.prototype[t]=function(t,e){var u=this.__chain__,o=n(this.__wrapped__,t,e);return u||t!=y&&(!e||r&&typeof t=="function")?new nt(o,u):o})}),Z.VERSION="1.3.1",Z.prototype.chain=function(){return this.__chain__=g,this},Z.prototype.toString=function(){return or(this.__wrapped__)},Z.prototype.value=Qt,Z.prototype.valueOf=Qt,Ot(["join","pop","shift"],function(n){var t=ir[n];Z.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments); +return n?new nt(r,n):r}}),Ot(["push","reverse","sort","unshift"],function(n){var t=ir[n];Z.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ot(["concat","slice","splice"],function(n){var t=ir[n];Z.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Z}var h,g=!0,y=null,m=!1,_=[],b=[],d=0,w=+new Date+"",j=75,k=40,x=" \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",C=/\b__p\+='';/g,O=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,I=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,S=/\w*$/,A=/<%=([\s\S]+?)%>/g,N=RegExp("^["+x+"]*0+(?=.$)"),R=/($^)/,B=(B=/\bthis\b/)&&B.test(v)&&B,$=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),F="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",W="[object Function]",P="[object Number]",K="[object Object]",L="[object RegExp]",M="[object String]",U={}; U[W]=m,U[F]=U[T]=U[z]=U[q]=U[P]=U[K]=U[L]=U[M]=g;var V={"boolean":m,"function":g,object:g,number:m,string:m,undefined:m},G={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},H=V[typeof window]&&window||this,J=V[typeof exports]&&exports,Q=V[typeof module]&&module&&module.exports==J&&module,X=V[typeof global]&&global;!X||X.global!==X&&X.window!==X||(H=X);var Y=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(H._=Y, define(function(){return Y})):J&&!J.nodeType?Q?(Q.exports=Y)._=Y:J._=Y:H._=Y }.call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index f458439ab..5f2e99730 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -2264,7 +2264,18 @@ * _.pluck(stooges, 'name'); * // => ['moe', 'larry'] */ - var pluck = map; + function pluck(collection, property) { + var index = -1, + length = collection ? collection.length : 0; + + if (typeof length == 'number') { + var result = Array(length); + while (++index < length) { + result[index] = collection[index][property]; + } + } + return result || map(collection, property); + } /** * Reduces a collection to a value which is the accumulated result of running @@ -2616,7 +2627,11 @@ * _.where(stooges, { 'quotes': ['Poifect!'] }); * // => [{ 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }] */ - var where = filter; + function where(collection, properties, first) { + return (first && isEmpty(properties)) + ? undefined + : (first ? find : filter)(collection, properties); + } /*--------------------------------------------------------------------------*/ diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 2c0da652a..2df2e1beb 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,35 +3,36 @@ * Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` */ -;!function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(tu(f,l))&&(t&&f.push(l),o.push(a))}return o}function c(n){return function(r,t,e){var u={};t=V(t,e,3),e=-1;var i=r?r.length:0;if(typeof i=="number")for(;++ee&&(e=t,u=n)});else for(;++iu&&(u=t);return u}function k(n,r,t,e){if(!n)return t;var u=3>arguments.length;r=o(r,e,4);var i=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++i]);++iarguments.length;return r=o(r,e,4),R(n,function(n,e,i){t=u?(u=!1,n):r(t,n,e,i) -}),t}function M(n,r,t){var e;r=V(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,o)&&i.push(o)}return i}function I(n,r,t){if(n){var e=0,u=n.length;if(typeof r!="number"&&null!=r){var i=-1;for(r=V(r,t,3);++ie?Rr(0,u+e):e||0}else if(e)return e=C(r,t),r[e]===t?e:-1;return n(r,t,e)}function z(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,i=n?n.length:0;for(r=V(r,t,3);++u>>1,t(n[e])f&&(u=n.apply(o,e));else{!c&&!v&&(a=i);var t=l-(i-a);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Tr||(s=function(n){if(j(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),y(arguments)||(y=function(n){return n&&typeof n=="object"?wr.call(n,"callee"):!1});var Ir=Or||function(n){return n&&typeof n=="object"?xr.call(n)==tr:!1},Wr=function(n){var r,t=[]; -if(!n||!lr[typeof n])return t;for(r in n)wr.call(n,r)&&t.push(r);return t},zr=Nr?function(n){return j(n)?Nr(n):[]}:Wr,Cr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},Pr=b(Cr),Ur=RegExp("("+zr(Pr).join("|")+")","g"),Vr=RegExp("["+zr(Cr).join("")+"]","g"),Gr=function(n,r){var t;if(!n||!lr[typeof n])return n;for(t in n)if(r(n[t],t,n)===X)break;return n},Hr=function(n,r){var t;if(!n||!lr[typeof n])return n;for(t in n)if(wr.call(n,t)&&r(n[t],t,n)===X)break;return n};w(/x/)&&(w=function(n){return typeof n=="function"&&"[object Function]"==xr.call(n) -});var Jr=c(function(n,r,t){wr.call(n,t)?n[t]++:n[t]=1}),Kr=c(function(n,r,t){(wr.call(n,t)?n[t]:n[t]=[]).push(r)}),Lr=B,Qr=S;u.after=function(n,r){if(!w(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=U,u.bindAll=function(n){for(var r=1u(o,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;o.push(f)}}return o},u.invert=b,u.invoke=function(n,r){var t=kr.call(arguments,2),e=-1,u=typeof r=="function",i=n?n.length:0,o=Array(typeof i=="number"?i:0); -return N(n,function(n){o[++e]=(u?r:n[r]).apply(n,t)}),o},u.keys=zr,u.map=B,u.max=D,u.memoize=function(n,r){var t={};return function(){var e=Y+(r?r.apply(this,arguments):arguments[0]);return wr.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,i=-1,o=n?n.length:0;if(r||typeof o!="number")r=V(r,t,3),N(n,function(n,t,i){t=r(n,t,i),tr(t,u)&&(e[u]=n) -}),e},u.once=function(n){var r,t;if(!w(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=zr(n),e=t.length,u=Array(e);++rr?0:r);++nt?Rr(0,e+t):Br(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=J,u.noConflict=function(){return pr._=mr,this},u.random=K,u.reduce=k,u.reduceRight=q,u.result=function(n,r){var t=n?n[r]:L; -return w(t)?n[r]():t},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:zr(n).length},u.some=M,u.sortedIndex=C,u.template=function(n,r,e){var i=u,o=i.templateSettings;n||(n=""),e=_({},e,o);var f=0,a="__p+='",o=e.variable;n.replace(RegExp((e.escape||Z).source+"|"+(e.interpolate||Z).source+"|"+(e.evaluate||Z).source+"|$","g"),function(r,e,u,i,o){return a+=n.slice(f,o).replace(nr,t),e&&(a+="'+_.escape("+e+")+'"),i&&(a+="';"+i+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=o+r.length,r -}),a+="';\n",o||(o="obj",a="with("+o+"||{}){"+a+"}"),a="function("+o+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var l=Function("_","return "+a)(i)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Ur,g)},u.uniqueId=function(n){var r=++Q+"";return n?n+r:r},u.all=O,u.any=M,u.detect=F,u.findWhere=function(n,r){return Qr(n,r,!0)},u.foldl=k,u.foldr=q,u.include=T,u.inject=k,u.first=I,u.last=function(n,r,t){if(n){var e=0,u=n.length; -if(typeof r!="number"&&null!=r){var i=u;for(r=V(r,t,3);i--&&r(n[i],i,n);)e++}else if(e=r,null==e||t)return n[u-1];return kr.call(n,Rr(0,u-e))}},u.take=I,u.head=I,J(u),u.VERSION="1.3.1",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var r=gr[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!$r.spliceObjects&&0===n.length&&delete n[0],this -}}),N(["concat","join","slice"],function(n){var r=gr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(pr._=u, define(function(){return u})):sr&&!sr.nodeType?vr?(vr.exports=u)._=u:sr._=u:pr._=u}.call(this); \ No newline at end of file +;!function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(tu(f,l))&&(t&&f.push(l),o.push(a))}return o}function c(n){return function(r,t,e){var u={};t=J(t,e,3),e=-1;var i=r?r.length:0;if(typeof i=="number")for(;++ee&&(e=t,u=n)});else for(;++iu&&(u=t);return u}function q(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=o(r,e,4); +var i=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++i]);++iarguments.length;return r=o(r,e,4),B(n,function(n,e,i){t=u?(u=!1,n):r(t,n,e,i)}),t}function I(n,r,t){var e;r=J(r,t,3),t=-1;var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,o)&&i.push(o)}return i}function C(n,r,t){if(n){var e=0,u=n.length;if(typeof r!="number"&&null!=r){var i=-1;for(r=J(r,t,3);++ie?kr(0,u+e):e||0}else if(e)return e=V(r,t),r[e]===t?e:-1;return n(r,t,e)}function U(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,i=n?n.length:0;for(r=J(r,t,3);++u>>1,t(n[e])f&&(u=n.apply(o,e)); +else{!c&&!v&&(a=i);var t=l-(i-a);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Fr||(s=function(n){if(x(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),y(arguments)||(y=function(n){return n&&typeof n=="object"?Er.call(n,"callee"):!1});var Cr=Nr||function(n){return n&&typeof n=="object"?Tr.call(n)==ir:!1},Pr=function(n){var r,t=[]; +if(!n||!sr[typeof n])return t;for(r in n)Er.call(n,r)&&t.push(r);return t},Ur=Dr?function(n){return x(n)?Dr(n):[]}:Pr,Vr={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},Gr=b(Vr),Hr=RegExp("("+Ur(Gr).join("|")+")","g"),Jr=RegExp("["+Ur(Vr).join("")+"]","g"),Kr=function(n,r){var t;if(!n||!sr[typeof n])return n;for(t in n)if(r(n[t],t,n)===nr)break;return n},Lr=function(n,r){var t;if(!n||!sr[typeof n])return n;for(t in n)if(Er.call(n,t)&&r(n[t],t,n)===nr)break;return n};j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==Tr.call(n) +});var Qr=c(function(n,r,t){Er.call(n,t)?n[t]++:n[t]=1}),Xr=c(function(n,r,t){(Er.call(n,t)?n[t]:n[t]=[]).push(r)});u.after=function(n,r){if(!j(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=H,u.bindAll=function(n){for(var r=1u(o,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;o.push(f)}}return o},u.invert=b,u.invoke=function(n,r){var t=$r.call(arguments,2),e=-1,u=typeof r=="function",i=n?n.length:0,o=Array(typeof i=="number"?i:0); +return R(n,function(n){o[++e]=(u?r:n[r]).apply(n,t)}),o},u.keys=Ur,u.map=D,u.max=k,u.memoize=function(n,r){var t={};return function(){var e=rr+(r?r.apply(this,arguments):arguments[0]);return Er.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,i=-1,o=n?n.length:0;if(r||typeof o!="number")r=J(r,t,3),R(n,function(n,t,i){t=r(n,t,i),tr(t,u)&&(e[u]=n) +}),e},u.once=function(n){var r,t;if(!j(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?kr(0,e+t):qr(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=Q,u.noConflict=function(){return hr._=br,this},u.random=X,u.reduce=M,u.reduceRight=$,u.result=function(n,r){var t=n?n[r]:Y;return j(t)?n[r]():t},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Ur(n).length +},u.some=I,u.sortedIndex=V,u.template=function(n,r,e){var i=u,o=i.templateSettings;n||(n=""),e=_({},e,o);var f=0,a="__p+='",o=e.variable;n.replace(RegExp((e.escape||tr).source+"|"+(e.interpolate||tr).source+"|"+(e.evaluate||tr).source+"|$","g"),function(r,e,u,i,o){return a+=n.slice(f,o).replace(er,t),e&&(a+="'+_.escape("+e+")+'"),i&&(a+="';"+i+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=o+r.length,r}),a+="';\n",o||(o="obj",a="with("+o+"||{}){"+a+"}"),a="function("+o+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; +try{var l=Function("_","return "+a)(i)}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,g)},u.uniqueId=function(n){var r=++Z+"";return n?n+r:r},u.all=S,u.any=I,u.detect=N,u.findWhere=function(n,r){return W(n,r,!0)},u.foldl=M,u.foldr=$,u.include=O,u.inject=M,u.first=C,u.last=function(n,r,t){if(n){var e=0,u=n.length;if(typeof r!="number"&&null!=r){var i=u;for(r=J(r,t,3);i--&&r(n[i],i,n);)e++}else if(e=r,null==e||t)return n[u-1];return $r.call(n,kr(0,u-e)) +}},u.take=C,u.head=C,Q(u),u.VERSION="1.3.1",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},R("pop push reverse shift sort splice unshift".split(" "),function(n){var r=_r[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!zr.spliceObjects&&0===n.length&&delete n[0],this}}),R(["concat","join","slice"],function(n){var r=_r[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n +}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(hr._=u, define(function(){return u})):gr&&!gr.nodeType?yr?(yr.exports=u)._=u:gr._=u:hr._=u}.call(this); \ No newline at end of file