From db29699927980ee536fa172c67d2e19e8e0efc18 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 8 Feb 2013 08:42:04 -0800 Subject: [PATCH] Reduced `_.pluck`. Former-commit-id: e413c1a6d0df383cb1ca51ab2203d3e380f71177 --- dist/lodash.compat.js | 7 +-- dist/lodash.compat.min.js | 72 +++++++++++----------- dist/lodash.js | 7 +-- dist/lodash.min.js | 66 ++++++++++---------- dist/lodash.underscore.js | 7 +-- dist/lodash.underscore.min.js | 56 ++++++++--------- doc/README.md | 110 +++++++++++++++++----------------- lodash.js | 7 +-- 8 files changed, 164 insertions(+), 168 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 0f8850bc0..b3367c8c2 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -611,7 +611,7 @@ * @returns {Function} Returns a callback function. */ function createCallback(func, thisArg, argCount) { - if (!func) { + if (func == null) { return identity; } var type = typeof func; @@ -2731,6 +2731,7 @@ * * @static * @memberOf _ + * @type Function * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {String} property The property to pluck. @@ -2745,9 +2746,7 @@ * _.pluck(stooges, 'name'); * // => ['moe', 'larry'] */ - function pluck(collection, property) { - return map(collection, property + ''); - } + var pluck = map; /** * Reduces a `collection` to a value that is the accumulated result of running diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index bf063e75f..a5a59218e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,39 +3,39 @@ * Lo-Dash 1.0.0-rc.3 lodash.com/license * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||ft);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(ne;e++)r+="i='"+t.k[e]+"';if(","constructor"==t.k[e]&&(r+="!(f&&f.prototype===m)&&"),r+="h.call(m,i)){"+t.h+"}"; -return(t.b||t.i)&&(r+="}"),r+=t.c+";return t",Function("e,h,j,k,l,q,o","return function("+n+"){"+r+"}")(f,At,h,pr,A,er,$t)}function c(n){return"\\"+ur[n]}function l(n){return vr[n]}function p(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function s(){}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++er?Ft(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):C(n,t,r)):ar(n,function(n){return++eo&&(o=a)}}else t=!t&&A(n)?u:f(t,r),ar(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function I(n,t){return F(n,t+"")}function T(n,t,r,e){var u=3>arguments.length;if(t=f(t,e,4),pr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var a=sr(n),o=a.length;else Yt&&A(n)&&(u=n.split(""));return t=f(t,e,4),$(n,function(n,e,f){e=a?a[--o]:--o,r=i?(i=X,u[e]):t(r,u[e],e,f)}),r}function M(n,t,r){var e;if(t=f(t,r),pr(n)){r=-1;for(var u=n.length;++rr?Ft(0,u+r):r||0)-1;else if(r)return e=L(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])C(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function V(n,t){return Gt||kt&&2/g,mt=/($^)/,_t=/[&<>"']/g,dt=/['\n\r\t\u2028\u2029\\]/g,bt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),wt=Math.ceil,jt=et.concat,xt=Math.floor,Ot=gt.test(Ot=Object.getPrototypeOf)&&Ot,At=ut.hasOwnProperty,St=et.push,Et=ut.toString,kt=gt.test(kt=v.bind)&&kt,qt=gt.test(qt=Array.isArray)&&qt,Nt=n.isFinite,Rt=n.isNaN,$t=gt.test($t=Object.keys)&&$t,Ft=Math.max,Dt=Math.min,It=Math.random,Tt="[object Arguments]",Bt="[object Array]",Mt="[object Boolean]",Pt="[object Date]",zt="[object Number]",Ct="[object Object]",Kt="[object RegExp]",Lt="[object String]",Ut=!!n.attachEvent,Vt=kt&&!/\n|true/.test(kt+Ut),Gt=kt&&!Vt,Ht=$t&&(Ut||Vt),Jt=(Jt={0:1,length:1},et.splice.call(Jt,0,1),Jt[0]),Qt=Q; -(function(){function n(){this.x=1}var t=[];n.prototype={valueOf:1,y:1};for(var r in new n)t.push(r);for(r in arguments)Qt=!r;nt=!/valueOf/.test(t),tt=n.propertyIsEnumerable("prototype"),rt="x"!=t[0]})(1);var Wt=arguments.constructor==Object,Xt=!h(arguments),Yt="xx"!="x"[0]+Object("x")[0];try{var Zt=Et.call(document)==Ct&&!({toString:0}+"")}catch(nr){}var tr={"[object Function]":X};tr[Tt]=tr[Bt]=tr[Mt]=tr[Pt]=tr[zt]=tr[Ct]=tr[Kt]=tr[Lt]=Q;var rr={};rr[Bt]=Array,rr[Mt]=Boolean,rr[Pt]=Date,rr[Ct]=Object,rr[zt]=Number,rr[Kt]=RegExp,rr[Lt]=String; -var er={"boolean":X,"function":Q,object:Q,number:X,string:X,undefined:X},ur={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:yt,variable:"",imports:{_:r}};var or={a:"p,v,g",l:"var a=0,b=typeof g=='number'?2:arguments.length;while(++a":">",'"':""","'":"'"},gr=b(vr),hr=a(or),yr=a(or,{h:"if(t[i]==null)"+or.h});j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==Et.call(n)});var mr=Ot?function(n){if(!n||typeof n!="object")return X; -var t=n.valueOf,r=typeof t=="function"&&(r=Ot(t))&&Ot(r);return r?n==r||Ot(n)==r&&!h(n):y(n)}:y,_r=N;r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=hr,r.at=function(n){var t=-1,r=jt.apply(et,v(arguments,1)),e=r.length,u=Array(e);for(Yt&&A(n)&&(n=n.split(""));++tC(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;a.push(l)}}return a},r.invert=b,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return $(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=sr,r.map=F,r.max=D,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return At.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=S,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&pr(n)){r=-1;for(var i=n.length;++rC(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=Q,r=n.apply(this,arguments),n=W,r)}},r.pairs=function(n){for(var t=-1,r=sr(n),e=r.length,u=Array(e);++tr?Ft(0,e+r):Dt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=H,r.noConflict=function(){return n._=at,this},r.random=function(n,t){return n==W&&t==W&&(t=1),n=+n||0,t==W&&(t=n,n=0),n+xt(It()*((+t||0)-n+1))},r.reduce=T,r.reduceRight=B,r.result=function(n,r){var e=n?n[r]:t;return j(e)?n[r]():e},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:sr(n).length},r.some=M,r.sortedIndex=L,r.template=function(n,e,u){var o=r.templateSettings; -n||(n=""),u=yr({},u,o);var i,f=yr({},u.imports,o.imports),o=sr(f),f=E(f),a=0,l=u.interpolate||mt,p="__p+='";n.replace(RegExp((u.escape||mt).source+"|"+l.source+"|"+(l===yt?ht:mt).source+"|"+(u.evaluate||mt).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(dt,c),r&&(p+="'+__e("+r+")+'"),o&&(i=Q,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),p+="';\n",l=u=u.variable,l||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(lt,""):p).replace(pt,"$1").replace(st,"$1;"),p="function("+u+"){"+(l?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}"; -try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return e?s(e):(s.source=p,s)},r.unescape=function(n){return n==W?"":(n+"").replace(ct,g)},r.uniqueId=function(n){var t=++ot;return(n==W?"":n+"")+t},r.all=q,r.any=M,r.detect=R,r.foldl=T,r.foldr=B,r.include=k,r.inject=T,lr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return St.apply(t,arguments),n.apply(r,t)})}),r.first=P,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=u; -for(t=f(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==W||r)return n[u-1];return v(n,Ft(0,u-e))}},r.take=P,r.head=P,lr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==W||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=J,r.prototype.valueOf=J,ar(["join","pop","shift"],function(n){var t=et[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),ar(["push","reverse","sort","unshift"],function(n){var t=et[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ar(["concat","slice","splice"],function(n){var t=et[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),Jt&&ar(["pop","shift","splice"],function(n){var t=et[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r -})):Y?typeof module=="object"&&module&&module.exports==Y?(module.exports=r)._=r:Y._=r:n._=r})(this); \ No newline at end of file +;(function(n,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||it);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(ne;e++)r+="i='"+t.k[e]+"';if(","constructor"==t.k[e]&&(r+="!(f&&f.prototype===m)&&"),r+="h.call(m,i)){"+t.h+"}"; +return(t.b||t.i)&&(r+="}"),r+=t.c+";return t",Function("e,h,j,k,l,q,o","return function("+n+"){"+r+"}")(f,Ot,h,lr,A,rr,Rt)}function c(n){return"\\"+er[n]}function l(n){return sr[n]}function p(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function s(){}function v(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Array(0>r?0:r);++er?$t(0,u+r):r)||0,typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):z(n,t,r)):fr(n,function(n){return++eo&&(o=a)}}else t=!t&&A(n)?u:f(t,r),fr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function I(n,t,r,e){var u=3>arguments.length;if(t=f(t,e,4),lr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var a=pr(n),o=a.length;else Xt&&A(n)&&(u=n.split(""));return t=f(t,e,4),$(n,function(n,e,f){e=a?a[--o]:--o,r=i?(i=W,u[e]):t(r,u[e],e,f)}),r}function B(n,t,r){var e;if(t=f(t,r),lr(n)){r=-1;for(var u=n.length;++rr?$t(0,u+r):r||0)-1;else if(r)return e=K(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function U(n,t){return Vt||Et&&2/g,yt=/($^)/,mt=/[&<>"']/g,_t=/['\n\r\t\u2028\u2029\\]/g,dt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),bt=Math.ceil,wt=rt.concat,jt=Math.floor,xt=vt.test(xt=Object.getPrototypeOf)&&xt,Ot=et.hasOwnProperty,At=rt.push,St=et.toString,Et=vt.test(Et=v.bind)&&Et,kt=vt.test(kt=Array.isArray)&&kt,qt=n.isFinite,Nt=n.isNaN,Rt=vt.test(Rt=Object.keys)&&Rt,$t=Math.max,Ft=Math.min,Dt=Math.random,It="[object Arguments]",Tt="[object Array]",Bt="[object Boolean]",Mt="[object Date]",Pt="[object Number]",zt="[object Object]",Ct="[object RegExp]",Kt="[object String]",Lt=!!n.attachEvent,Ut=Et&&!/\n|true/.test(Et+Lt),Vt=Et&&!Ut,Gt=Rt&&(Lt||Ut),Ht=(Ht={0:1,length:1},rt.splice.call(Ht,0,1),Ht[0]),Jt=J; +(function(){function n(){this.x=1}var t=[];n.prototype={valueOf:1,y:1};for(var r in new n)t.push(r);for(r in arguments)Jt=!r;Z=!/valueOf/.test(t),nt=n.propertyIsEnumerable("prototype"),tt="x"!=t[0]})(1);var Qt=arguments.constructor==Object,Wt=!h(arguments),Xt="xx"!="x"[0]+Object("x")[0];try{var Yt=St.call(document)==zt&&!({toString:0}+"")}catch(Zt){}var nr={"[object Function]":W};nr[It]=nr[Tt]=nr[Bt]=nr[Mt]=nr[Pt]=nr[zt]=nr[Ct]=nr[Kt]=J;var tr={};tr[Tt]=Array,tr[Bt]=Boolean,tr[Mt]=Date,tr[zt]=Object,tr[Pt]=Number,tr[Ct]=RegExp,tr[Kt]=String; +var rr={"boolean":W,"function":J,object:J,number:W,string:W,undefined:W},er={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:ht,variable:"",imports:{_:r}};var ur={a:"p,v,g",l:"var a=0,b=typeof g=='number'?2:arguments.length;while(++a":">",'"':""","'":"'"},vr=b(sr),gr=a(ur),hr=a(ur,{h:"if(t[i]==null)"+ur.h});j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==St.call(n)});var yr=xt?function(n){if(!n||typeof n!="object")return W; +var t=n.valueOf,r=typeof t=="function"&&(r=xt(t))&&xt(r);return r?n==r||xt(n)==r&&!h(n):y(n)}:y,mr=F,_r=N;r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=gr,r.at=function(n){var t=-1,r=wt.apply(rt,v(arguments,1)),e=r.length,u=Array(e);for(Xt&&A(n)&&(n=n.split(""));++tz(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;a.push(l)}}return a},r.invert=b,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return $(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=pr,r.map=F,r.max=D,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return Ot.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=S,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&lr(n)){r=-1;for(var i=n.length;++rz(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=J,r=n.apply(this,arguments),n=Q,r)}},r.pairs=function(n){for(var t=-1,r=pr(n),e=r.length,u=Array(e);++tr?$t(0,e+r):Ft(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=G,r.noConflict=function(){return n._=ft,this},r.random=function(n,t){return n==Q&&t==Q&&(t=1),n=+n||0,t==Q&&(t=n,n=0),n+jt(Dt()*((+t||0)-n+1))},r.reduce=I,r.reduceRight=T,r.result=function(n,r){var e=n?n[r]:t;return j(e)?n[r]():e},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:pr(n).length},r.some=B,r.sortedIndex=K,r.template=function(n,e,u){var o=r.templateSettings; +n||(n=""),u=hr({},u,o);var i,f=hr({},u.imports,o.imports),o=pr(f),f=E(f),a=0,l=u.interpolate||yt,p="__p+='";n.replace(RegExp((u.escape||yt).source+"|"+l.source+"|"+(l===ht?gt:yt).source+"|"+(u.evaluate||yt).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(_t,c),r&&(p+="'+__e("+r+")+'"),o&&(i=J,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),p+="';\n",l=u=u.variable,l||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(ct,""):p).replace(lt,"$1").replace(pt,"$1;"),p="function("+u+"){"+(l?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}"; +try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return e?s(e):(s.source=p,s)},r.unescape=function(n){return n==Q?"":(n+"").replace(at,g)},r.uniqueId=function(n){var t=++ut;return(n==Q?"":n+"")+t},r.all=q,r.any=B,r.detect=R,r.foldl=I,r.foldr=T,r.include=k,r.inject=I,cr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return At.apply(t,arguments),n.apply(r,t)})}),r.first=M,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=u; +for(t=f(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==Q||r)return n[u-1];return v(n,$t(0,u-e))}},r.take=M,r.head=M,cr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==Q||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=H,r.prototype.valueOf=H,fr(["join","pop","shift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),fr(["push","reverse","sort","unshift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),fr(["concat","slice","splice"],function(n){var t=rt[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),Ht&&fr(["pop","shift","splice"],function(n){var t=rt[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r +})):X?typeof module=="object"&&module&&module.exports==X?(module.exports=r)._=r:X._=r:n._=r})(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 559119fbc..62a4b1471 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -494,7 +494,7 @@ * @returns {Function} Returns a callback function. */ function createCallback(func, thisArg, argCount) { - if (!func) { + if (func == null) { return identity; } var type = typeof func; @@ -2586,6 +2586,7 @@ * * @static * @memberOf _ + * @type Function * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {String} property The property to pluck. @@ -2600,9 +2601,7 @@ * _.pluck(stooges, 'name'); * // => ['moe', 'larry'] */ - function pluck(collection, property) { - return map(collection, property + ''); - } + var pluck = map; /** * Reduces a `collection` to a value that is the accumulated result of running diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 0e230b3aa..51d8c25b5 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,36 +4,36 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||Z);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(nr?0:r);++er?At(0,u+r):r)||0,typeof u=="number"?o=-1<(x(n)?n.indexOf(t,r):z(n,t,r)):Ht(n,function(n){return++eo&&(o=a)}}else t=!t&&x(n)?u:f(t,r),Ht(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function F(n,t){return R(n,t+"")}function D(n,t,r,e){var u=3>arguments.length;if(t=f(t,e,4),Qt(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Wt(n),u=i.length;return t=f(t,e,4),N(n,function(e,f,a){f=i?i[--u]:--u,r=o?(o=!1,n[f]):t(r,n[f],f,a)}),r}function B(n,t,r){var e;if(t=f(t,r),Qt(n)){r=-1;for(var u=n.length;++rr?At(0,u+r):r||0)-1;else if(r)return e=C(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function U(n,t){return It||dt&&2/g,ct=/($^)/,lt=/[&<>"']/g,pt=/['\n\r\t\u2028\u2029\\]/g,st=Math.ceil,vt=Q.concat,gt=Math.floor,ht=it.test(ht=Object.getPrototypeOf)&&ht,yt=W.hasOwnProperty,mt=Q.push,_t=W.toString,dt=it.test(dt=s.bind)&&dt,bt=it.test(bt=Array.isArray)&&bt,wt=n.isFinite,jt=n.isNaN,xt=it.test(xt=Object.keys)&&xt,At=Math.max,Ot=Math.min,Et=Math.random,St="[object Arguments]",qt="[object Array]",kt="[object Boolean]",Nt="[object Date]",Rt="[object Number]",$t="[object Object]",Ft="[object RegExp]",Dt="[object String]",Tt=!!n.attachEvent,Bt=dt&&!/\n|true/.test(dt+Tt),It=dt&&!Bt,Mt=xt&&(Tt||Bt),zt={"[object Function]":!1}; -zt[St]=zt[qt]=zt[kt]=zt[Nt]=zt[Rt]=zt[$t]=zt[Ft]=zt[Dt]=!0;var Pt={};Pt[qt]=Array,Pt[kt]=Boolean,Pt[Nt]=Date,Pt[$t]=Object,Pt[Rt]=Number,Pt[Ft]=RegExp,Pt[Dt]=String;var Ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Kt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:at,variable:"",imports:{_:r}};var Ut={a:"p,v,g",l:"var a=0,b=typeof g=='number'?2:arguments.length;while(++a":">",'"':""","'":"'"},Yt=_(Xt),Zt=a(Ut),nr=a(Ut,{h:"if(t[i]==null)"+Ut.h});b(/x/)&&(b=function(n){return n instanceof Function||"[object Function]"==_t.call(n)});var tr=function(n){if(!n||typeof n!="object")return!1;var t=n.valueOf,r=typeof t=="function"&&(r=ht(t))&&ht(r);if(r)n=n==r||ht(n)==r&&!g(n);else{var e=!1;!n||typeof n!="object"||g(n)?n=e:(t=n.constructor,!b(t)||t instanceof t?(Jt(n,function(n,t){e=t}),n=!1===e||yt.call(n,e)):n=e) -}return n};r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=Zt,r.at=function(n){for(var t=-1,r=vt.apply(Q,s(arguments,1)),e=r.length,u=Array(e);++tz(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;a.push(l)}}return a},r.invert=_,r.invoke=function(n,t){var r=s(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=Wt,r.map=R,r.max=$,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return yt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=A,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&Qt(n)){r=-1;for(var i=n.length;++rz(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},r.pairs=function(n){for(var t=-1,r=Wt(n),e=r.length,u=Array(e);++tr?At(0,e+r):Ot(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=G,r.noConflict=function(){return n._=nt,this},r.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+gt(Et()*((+t||0)-n+1))},r.reduce=D,r.reduceRight=T,r.result=function(n,r){var e=n?n[r]:t;return b(e)?n[r]():e},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Wt(n).length},r.some=B,r.sortedIndex=C,r.template=function(n,e,u){var o=r.templateSettings; -n||(n=""),u=nr({},u,o);var i,f=nr({},u.imports,o.imports),o=Wt(f),f=O(f),a=0,l=u.interpolate||ct,p="__p+='";n.replace(RegExp((u.escape||ct).source+"|"+l.source+"|"+(l===at?ft:ct).source+"|"+(u.evaluate||ct).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(pt,c),r&&(p+="'+__e("+r+")+'"),o&&(i=!0,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),p+="';\n",l=u=u.variable,l||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(rt,""):p).replace(et,"$1").replace(ut,"$1;"),p="function("+u+"){"+(l?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}"; -try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return e?s(e):(s.source=p,s)},r.unescape=function(n){return null==n?"":(n+"").replace(tt,v)},r.uniqueId=function(n){var t=++X;return(null==n?"":n+"")+t},r.all=S,r.any=B,r.detect=k,r.foldl=D,r.foldr=T,r.include=E,r.inject=D,Lt(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return mt.apply(t,arguments),n.apply(r,t)})}),r.first=I,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=u; -for(t=f(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return s(n,At(0,u-e))}},r.take=I,r.head=I,Lt(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return null==t||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=H,r.prototype.valueOf=H,Ht(["join","pop","shift"],function(n){var t=Q[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),Ht(["push","reverse","sort","unshift"],function(n){var t=Q[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ht(["concat","slice","splice"],function(n){var t=Q[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r})):J?typeof module=="object"&&module&&module.exports==J?(module.exports=r)._=r:J._=r:n._=r})(this); \ No newline at end of file +;(function(n,t){function r(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof r?(this.__wrapped__=n,void 0):new r(n)}function e(n,t,r){t||(t=0);var e=n.length,u=e-t>=(r||Y);if(u){var o={};for(r=t-1;++rt||typeof n=="undefined")return 1;if(nr?0:r);++er?xt(0,u+r):r)||0,typeof u=="number"?o=-1<(x(n)?n.indexOf(t,r):M(n,t,r)):Gt(n,function(n){return++eo&&(o=a)}}else t=!t&&x(n)?u:f(t,r),Gt(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function F(n,t,r,e){var u=3>arguments.length;if(t=f(t,e,4),Lt(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Qt(n),u=i.length;return t=f(t,e,4),N(n,function(e,f,a){f=i?i[--u]:--u,r=o?(o=!1,n[f]):t(r,n[f],f,a)}),r}function T(n,t,r){var e;if(t=f(t,r),Lt(n)){r=-1;for(var u=n.length;++rr?xt(0,u+r):r||0)-1;else if(r)return e=P(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])M(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function K(n,t){return Bt||_t&&2/g,at=/($^)/,ct=/[&<>"']/g,lt=/['\n\r\t\u2028\u2029\\]/g,pt=Math.ceil,st=L.concat,vt=Math.floor,gt=ot.test(gt=Object.getPrototypeOf)&>,ht=Q.hasOwnProperty,yt=L.push,mt=Q.toString,_t=ot.test(_t=s.bind)&&_t,dt=ot.test(dt=Array.isArray)&&dt,bt=n.isFinite,wt=n.isNaN,jt=ot.test(jt=Object.keys)&&jt,xt=Math.max,At=Math.min,Ot=Math.random,Et="[object Arguments]",St="[object Array]",qt="[object Boolean]",kt="[object Date]",Nt="[object Number]",Rt="[object Object]",$t="[object RegExp]",Ft="[object String]",Dt=!!n.attachEvent,Tt=_t&&!/\n|true/.test(_t+Dt),Bt=_t&&!Tt,It=jt&&(Dt||Tt),Mt={"[object Function]":!1}; +Mt[Et]=Mt[St]=Mt[qt]=Mt[kt]=Mt[Nt]=Mt[Rt]=Mt[$t]=Mt[Ft]=!0;var zt={};zt[St]=Array,zt[qt]=Boolean,zt[kt]=Date,zt[Rt]=Object,zt[Nt]=Number,zt[$t]=RegExp,zt[Ft]=String;var Pt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Ct={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:ft,variable:"",imports:{_:r}};var Kt={a:"p,v,g",l:"var a=0,b=typeof g=='number'?2:arguments.length;while(++a":">",'"':""","'":"'"},Xt=_(Wt),Yt=a(Kt),Zt=a(Kt,{h:"if(t[i]==null)"+Kt.h});b(/x/)&&(b=function(n){return n instanceof Function||"[object Function]"==mt.call(n)});var nr=function(n){if(!n||typeof n!="object")return!1;var t=n.valueOf,r=typeof t=="function"&&(r=gt(t))&>(r);if(r)n=n==r||gt(n)==r&&!g(n);else{var e=!1;!n||typeof n!="object"||g(n)?n=e:(t=n.constructor,!b(t)||t instanceof t?(Ht(n,function(n,t){e=t}),n=!1===e||ht.call(n,e)):n=e) +}return n};r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},r.assign=Yt,r.at=function(n){for(var t=-1,r=st.apply(L,s(arguments,1)),e=r.length,u=Array(e);++tM(c,l)){f&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;a.push(l)}}return a},r.invert=_,r.invoke=function(n,t){var r=s(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=Qt,r.map=R,r.max=$,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return ht.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=A,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&Lt(n)){r=-1;for(var i=n.length;++rM(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},r.pairs=function(n){for(var t=-1,r=Qt(n),e=r.length,u=Array(e);++tr?xt(0,e+r):At(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=V,r.noConflict=function(){return n._=Z,this},r.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+vt(Ot()*((+t||0)-n+1))},r.reduce=F,r.reduceRight=D,r.result=function(n,r){var e=n?n[r]:t;return b(e)?n[r]():e},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Qt(n).length},r.some=T,r.sortedIndex=P,r.template=function(n,e,u){var o=r.templateSettings; +n||(n=""),u=Zt({},u,o);var i,f=Zt({},u.imports,o.imports),o=Qt(f),f=O(f),a=0,l=u.interpolate||at,p="__p+='";n.replace(RegExp((u.escape||at).source+"|"+l.source+"|"+(l===ft?it:at).source+"|"+(u.evaluate||at).source+"|$","g"),function(t,r,e,u,o,f){return e||(e=u),p+=n.slice(a,f).replace(lt,c),r&&(p+="'+__e("+r+")+'"),o&&(i=!0,p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),a=f+t.length,t}),p+="';\n",l=u=u.variable,l||(u="obj",p="with("+u+"){"+p+"}"),p=(i?p.replace(tt,""):p).replace(rt,"$1").replace(et,"$1;"),p="function("+u+"){"+(l?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(l?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}"; +try{var s=Function(o,"return "+p).apply(t,f)}catch(v){throw v.source=p,v}return e?s(e):(s.source=p,s)},r.unescape=function(n){return null==n?"":(n+"").replace(nt,v)},r.uniqueId=function(n){var t=++W;return(null==n?"":n+"")+t},r.all=S,r.any=T,r.detect=k,r.foldl=F,r.foldr=D,r.include=E,r.inject=F,Jt(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return yt.apply(t,arguments),n.apply(r,t)})}),r.first=B,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=u; +for(t=f(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return s(n,xt(0,u-e))}},r.take=B,r.head=B,Jt(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return null==t||e&&typeof t!="function"?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=G,r.prototype.valueOf=G,Gt(["join","pop","shift"],function(n){var t=L[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),Gt(["push","reverse","sort","unshift"],function(n){var t=L[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Gt(["concat","slice","splice"],function(n){var t=L[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r})):H?typeof module=="object"&&module&&module.exports==H?(module.exports=r)._=r:H._=r:n._=r})(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 997482c82..c2edcbff2 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -376,7 +376,7 @@ * @returns {Function} Returns a callback function. */ function createCallback(func, thisArg, argCount) { - if (!func) { + if (func == null) { return identity; } var type = typeof func; @@ -2086,6 +2086,7 @@ * * @static * @memberOf _ + * @type Function * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {String} property The property to pluck. @@ -2100,9 +2101,7 @@ * _.pluck(stooges, 'name'); * // => ['moe', 'larry'] */ - function pluck(collection, property) { - return map(collection, property + ''); - } + var pluck = map; /** * Reduces a `collection` to a value that is the accumulated result of running diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index fe20d1cca..2e3a342d0 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,31 +4,31 @@ * Build: `lodash underscore -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n,t){function r(n,t){var r;if(n&&Tt[typeof n])for(r in t||(t=G),n)if(t(n[r],r,n)===nt)break}function e(n,t,r){if(n){t=t&&typeof r=="undefined"?t:a(t,r);var e=n.length;if(r=-1,typeof e=="number")for(;++rt||typeof n=="undefined")return 1;if(nr?0:r);++eo&&(o=f)}}else t=a(t,r),e(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function q(n,t){return R(n,t+"")}function B(n,t,r,u){var o=3>arguments.length;if(t=a(t,u,4),Bt(n)){var i=-1,f=n.length;for(o&&(r=n[++i]);++iarguments.length;if(typeof u!="number")var i=Dt(n),u=i.length;return t=a(t,e,4),F(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=L,n[a]):t(r,n[a],a,f) -}),r}function M(n,t,r){var u;if(t=a(t,r),Bt(n)){r=-1;for(var o=n.length;++rr?mt(0,u+r):r||0)-1;else if(r)return e=U(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])C(f,c))&&(r&&f.push(c),i.push(e))}return i}function W(n,t){return kt||vt&&2"']/g,it=/['\n\r\t\u2028\u2029\\]/g,at=Math.ceil,ft=Y.concat,ct=Math.floor,lt=X.hasOwnProperty,pt=Y.push,st=X.toString,vt=et.test(vt=p.bind)&&vt,ht=et.test(ht=Array.isArray)&&ht,gt=n.isFinite,yt=n.isNaN,_t=et.test(_t=Object.keys)&&_t,mt=Math.max,dt=Math.min,bt=Math.random,jt="[object Arguments]",wt="[object Array]",At="[object Boolean]",xt="[object Date]",Et="[object Number]",Ot="[object Object]",St="[object RegExp]",Nt="[object String]",X=!!n.attachEvent,X=vt&&!/\n|true/.test(vt+X),kt=vt&&!X,Ft=(Ft={0:1,length:1},Y.splice.call(Ft,0,1),Ft[0]),Rt=arguments.constructor==Object,Tt={"boolean":L,"function":J,object:J,number:L,string:L,undefined:L},qt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"}; -u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},v(arguments)||(v=function(n){return n?lt.call(n,"callee"):L});var Bt=ht||function(n){return Rt&&n instanceof Array||st.call(n)==wt},Dt=_t?function(n){return w(n)?_t(n):[]}:h,Mt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=m(Mt);j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==st.call(n)}),u.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},u.bind=W,u.bindAll=function(n){for(var t=ft.apply(Y,arguments),r=1C(e,o,r)&&u.push(o)}return u},u.filter=N,u.flatten=z,u.forEach=F,u.functions=_,u.groupBy=function(n,t,r){var e={}; -return t=a(t,r),F(n,function(n,r,u){r=t(n,r,u)+"",(lt.call(e,r)?e[r]:e[r]=[]).push(n)}),e},u.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else e=t==K||r?1:t||e;return p(n,0,dt(mt(0,u-e),u))},u.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++eC(o,i)){for(var a=r;--a;)if(0>C(t[a],i))continue n;o.push(i)}}return o},u.invert=m,u.invoke=function(n,t){var r=p(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return F(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},u.keys=Dt,u.map=R,u.max=T,u.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return lt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},u.min=function(n,t,r){var u=1/0,o=u;if(!t&&Bt(n)){r=-1;for(var i=n.length;++rC(t,r,1)&&(e[r]=n)}),e},u.once=function(n){var t,r;return function(){return t?r:(t=J,r=n.apply(this,arguments),n=K,r)}},u.pairs=function(n){for(var t=-1,r=Dt(n),e=r.length,u=Array(e);++tC(arguments,u,1)&&e.push(u)}return e},u.wrap=function(n,t){return function(){var r=[n];return pt.apply(r,arguments),t.apply(this,r)}},u.zip=function(n){for(var t=-1,r=n?T(q(arguments,"length")):0,e=Array(r);++tr?mt(0,e+r):dt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=H,u.noConflict=function(){return n._=tt,this},u.random=function(n,t){return n==K&&t==K&&(t=1),n=+n||0,t==K&&(t=n,n=0),n+ct(bt()*((+t||0)-n+1))},u.reduce=B,u.reduceRight=D,u.result=function(n,t){var r=n?n[t]:K;return j(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Dt(n).length -},u.some=M,u.sortedIndex=U,u.template=function(n,t,r){n||(n=""),r=y({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||ut).source+"|"+(r.interpolate||ut).source+"|"+(r.evaluate||ut).source+"|$","g"),function(t,r,u,i,a){return o+=n.slice(e,a).replace(it,f),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+t.length,t}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}"; -try{var a=Function("_","return "+o)(u)}catch(c){throw c.source=o,c}return t?a(t):(a.source=o,a)},u.unescape=function(n){return n==K?"":(n+"").replace(rt,s)},u.uniqueId=function(n){var t=++Z+"";return n?n+t:t},u.all=S,u.any=M,u.detect=k,u.foldl=B,u.foldr=D,u.include=O,u.inject=B,u.first=I,u.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==K||r)return n[u-1];return p(n,mt(0,u-e))}},u.take=I,u.head=I,u.chain=function(n){return n=new u(n),n.__chain__=J,n -},u.VERSION="1.0.0-rc.3",H(u),u.prototype.chain=function(){return this.__chain__=J,this},u.prototype.value=function(){return this.__wrapped__},e("pop push reverse shift sort splice unshift".split(" "),function(n){var t=Y[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),Ft&&0===n.length&&delete n[0],this}}),e(["concat","join","slice"],function(n){var t=Y[n];u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new u(n),n.__chain__=J),n -}}),Q?typeof module=="object"&&module&&module.exports==Q?(module.exports=u)._=u:Q._=u:n._=u})(this); \ No newline at end of file +;(function(n,t){function r(n,t){var r;if(n&&Rt[typeof n])for(r in t||(t=W),n)if(t(n[r],r,n)===Z)break}function e(n,t,r){if(n){t=t&&typeof r=="undefined"?t:a(t,r);var e=n.length;if(r=-1,typeof e=="number")for(;++rt||typeof n=="undefined")return 1;if(nr?0:r);++eo&&(o=f)}}else t=a(t,r),e(n,function(n,r,e){r=t(n,r,e),r>u&&(u=r,o=n)});return o}function q(n,t,r,u){var o=3>arguments.length;if(t=a(t,u,4),qt(n)){var i=-1,f=n.length;for(o&&(r=n[++i]);++iarguments.length;if(typeof u!="number")var i=Bt(n),u=i.length;return t=a(t,e,4),F(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=K,n[a]):t(r,n[a],a,f)}),r}function D(n,t,r){var u; +if(t=a(t,r),qt(n)){r=-1;for(var o=n.length;++rr?_t(0,u+r):r||0)-1;else if(r)return e=P(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])z(f,c))&&(r&&f.push(c),i.push(e))}return i}function V(n,t){return Nt||st&&2"']/g,ot=/['\n\r\t\u2028\u2029\\]/g,it=Math.ceil,at=X.concat,ft=Math.floor,ct=Q.hasOwnProperty,lt=X.push,pt=Q.toString,st=rt.test(st=p.bind)&&st,vt=rt.test(vt=Array.isArray)&&vt,ht=n.isFinite,gt=n.isNaN,yt=rt.test(yt=Object.keys)&&yt,_t=Math.max,mt=Math.min,dt=Math.random,bt="[object Arguments]",jt="[object Array]",wt="[object Boolean]",At="[object Date]",xt="[object Number]",Et="[object Object]",Ot="[object RegExp]",St="[object String]",Q=!!n.attachEvent,Q=st&&!/\n|true/.test(st+Q),Nt=st&&!Q,kt=(kt={0:1,length:1},X.splice.call(kt,0,1),kt[0]),Ft=arguments.constructor==Object,Rt={"boolean":K,"function":H,object:H,number:K,string:K,undefined:K},Tt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"}; +u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},v(arguments)||(v=function(n){return n?ct.call(n,"callee"):K});var qt=vt||function(n){return Ft&&n instanceof Array||pt.call(n)==jt},Bt=yt?function(n){return w(n)?yt(n):[]}:h,Dt={"&":"&","<":"<",">":">",'"':""","'":"'"},Mt=m(Dt);j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==pt.call(n)});var $t=R;u.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},u.bind=V,u.bindAll=function(n){for(var t=at.apply(X,arguments),r=1z(e,o,r)&&u.push(o)}return u},u.filter=N,u.flatten=I,u.forEach=F,u.functions=_,u.groupBy=function(n,t,r){var e={}; +return t=a(t,r),F(n,function(n,r,u){r=t(n,r,u)+"",(ct.call(e,r)?e[r]:e[r]=[]).push(n)}),e},u.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else e=t==J||r?1:t||e;return p(n,0,mt(_t(0,u-e),u))},u.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++ez(o,i)){for(var a=r;--a;)if(0>z(t[a],i))continue n;o.push(i)}}return o},u.invert=m,u.invoke=function(n,t){var r=p(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return F(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},u.keys=Bt,u.map=R,u.max=T,u.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return ct.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},u.min=function(n,t,r){var u=1/0,o=u;if(!t&&qt(n)){r=-1;for(var i=n.length;++rz(t,r,1)&&(e[r]=n)}),e},u.once=function(n){var t,r;return function(){return t?r:(t=H,r=n.apply(this,arguments),n=J,r)}},u.pairs=function(n){for(var t=-1,r=Bt(n),e=r.length,u=Array(e);++tz(arguments,u,1)&&e.push(u)}return e},u.wrap=function(n,t){return function(){var r=[n];return lt.apply(r,arguments),t.apply(this,r)}},u.zip=function(n){for(var t=-1,r=n?T($t(arguments,"length")):0,e=Array(r);++tr?_t(0,e+r):mt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=G,u.noConflict=function(){return n._=nt,this},u.random=function(n,t){return n==J&&t==J&&(t=1),n=+n||0,t==J&&(t=n,n=0),n+ft(dt()*((+t||0)-n+1))},u.reduce=q,u.reduceRight=B,u.result=function(n,t){var r=n?n[t]:J;return j(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Bt(n).length +},u.some=D,u.sortedIndex=P,u.template=function(n,t,r){n||(n=""),r=y({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||et).source+"|"+(r.interpolate||et).source+"|"+(r.evaluate||et).source+"|$","g"),function(t,r,u,i,a){return o+=n.slice(e,a).replace(ot,f),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+t.length,t}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}"; +try{var a=Function("_","return "+o)(u)}catch(c){throw c.source=o,c}return t?a(t):(a.source=o,a)},u.unescape=function(n){return n==J?"":(n+"").replace(tt,s)},u.uniqueId=function(n){var t=++Y+"";return n?n+t:t},u.all=S,u.any=D,u.detect=k,u.foldl=q,u.foldr=B,u.include=O,u.inject=q,u.first=$,u.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=u;for(t=a(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==J||r)return n[u-1];return p(n,_t(0,u-e))}},u.take=$,u.head=$,u.chain=function(n){return n=new u(n),n.__chain__=H,n +},u.VERSION="1.0.0-rc.3",G(u),u.prototype.chain=function(){return this.__chain__=H,this},u.prototype.value=function(){return this.__wrapped__},e("pop push reverse shift sort splice unshift".split(" "),function(n){var t=X[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),kt&&0===n.length&&delete n[0],this}}),e(["concat","join","slice"],function(n){var t=X[n];u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new u(n),n.__chain__=H),n +}}),L?typeof module=="object"&&module&&module.exports==L?(module.exports=u)._=u:L._=u:n._=u})(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 5eedecd84..d989396de 100644 --- a/doc/README.md +++ b/doc/README.md @@ -197,7 +197,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3135 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3134 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -221,7 +221,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3165 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3164 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -246,7 +246,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3236 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3235 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, the first elements the `callback` returns truthy for are returned. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -306,7 +306,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array, shallow)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3275 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3274 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level. @@ -334,7 +334,7 @@ _.flatten([1, [2], [3, [[4]]]], true); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3317 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3316 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -366,7 +366,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3390 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3389 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, the last elements the `callback` returns truthy for are excluded from the result. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -423,7 +423,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3424 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3423 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -447,7 +447,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3514 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3513 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, the last elements the `callback` returns truthy for are returned. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -504,7 +504,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3555 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3554 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -533,7 +533,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.object(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3585 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3584 "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`. @@ -558,7 +558,7 @@ _.object(['moe', 'larry'], [30, 40]); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3629 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3628 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -596,7 +596,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3706 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3705 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, the first elements the `callback` returns truthy for are excluded from the result. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -656,7 +656,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3770 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3769 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -705,7 +705,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3802 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3801 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -729,7 +729,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3849 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3848 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -776,7 +776,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3908 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3907 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -801,7 +801,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3939 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3938 "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. @@ -861,7 +861,7 @@ The wrapper functions `first` and `last` return wrapped values when `n` is passe ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4837 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4836 "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. @@ -891,7 +891,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4854 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4853 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -912,7 +912,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4871 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4870 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1412,7 +1412,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2756 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2757 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1442,7 +1442,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2790 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2789 "View in source") [Ⓣ][1] Reduces a `collection` to a value that is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1480,7 +1480,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2833 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2832 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1511,7 +1511,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2893 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2892 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1554,7 +1554,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2914 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2913 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1578,7 +1578,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2947 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2946 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1608,7 +1608,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2994 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2993 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1654,7 +1654,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3050 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3049 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1691,7 +1691,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3085 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3084 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1715,7 +1715,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3117 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3116 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1752,7 +1752,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3972 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3971 "View in source") [Ⓣ][1] Creates a function that is restricted to executing `func` only after it is called `n` times. The `func` is executed with the `this` binding of the created function. @@ -1780,7 +1780,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4005 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4004 "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. @@ -1811,7 +1811,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4036 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4035 "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. @@ -1842,7 +1842,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4082 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4081 "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. @@ -1883,7 +1883,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4105 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4104 "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. @@ -1910,7 +1910,7 @@ welcome('moe'); ### `_.debounce(func, wait, immediate)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4138 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4137 "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 `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -1936,7 +1936,7 @@ jQuery(window).on('resize', lazyLayout); ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4202 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4201 "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. @@ -1961,7 +1961,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4182 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4181 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -1988,7 +1988,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4226 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4225 "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. @@ -2014,7 +2014,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4253 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4252 "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. @@ -2040,7 +2040,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4288 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4287 "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. @@ -2067,7 +2067,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4320 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2106,7 +2106,7 @@ options.imports ### `_.throttle(func, wait)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4343 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4342 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2131,7 +2131,7 @@ jQuery(window).on('scroll', throttled); ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4396 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4395 "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. @@ -3137,7 +3137,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4419 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3161,7 +3161,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4438 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4437 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3186,7 +3186,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4464 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4463 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3216,7 +3216,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4488 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4487 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3236,7 +3236,7 @@ var lodash = _.noConflict(); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4511 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4510 "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. @@ -3264,7 +3264,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4549 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4548 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned. @@ -3299,7 +3299,7 @@ _.result(object, 'stuff'); ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4637 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4636 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3383,7 +3383,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4763 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4762 "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)*. @@ -3415,7 +3415,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4789 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4788 "View in source") [Ⓣ][1] The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3439,7 +3439,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4809 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4808 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3492,7 +3492,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5039 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5038 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/lodash.js b/lodash.js index c5de284a6..ab1f9e906 100644 --- a/lodash.js +++ b/lodash.js @@ -619,7 +619,7 @@ * @returns {Function} Returns a callback function. */ function createCallback(func, thisArg, argCount) { - if (!func) { + if (func == null) { return identity; } var type = typeof func; @@ -2739,6 +2739,7 @@ * * @static * @memberOf _ + * @type Function * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {String} property The property to pluck. @@ -2753,9 +2754,7 @@ * _.pluck(stooges, 'name'); * // => ['moe', 'larry'] */ - function pluck(collection, property) { - return map(collection, property + ''); - } + var pluck = map; /** * Reduces a `collection` to a value that is the accumulated result of running