Tweak docs for _.cloneDeep, _.bindAll, _.reduce, and _.sortBy.

Former-commit-id: a5d73e6ef174a743e05c0ef85414b899deea7815
This commit is contained in:
John-David Dalton
2013-02-07 23:35:34 -08:00
parent d28036ee91
commit a757b4d5dc
8 changed files with 5269 additions and 114 deletions

5114
dist/lodash.compat.js vendored Normal file

File diff suppressed because it is too large Load Diff

41
dist/lodash.compat.min.js vendored Normal file
View File

@@ -0,0 +1,41 @@
/**
* @license
* 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;++r<e;){var i=n[r]+"";(At.call(o,i)?o[i]:o[i]=[]).push(n[r])}}return function(r){if(u){var e=r+"";return At.call(o,e)&&-1<C(o[e],r)}return-1<C(n,r,t)}}function u(n){return n.charCodeAt(0)}function o(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1
}return r<e?-1:1}function i(n,t,r,e){function u(){var a=arguments,c=i?this:t;return o||(n=t[f]),r.length&&(a=a.length?(a=v(a),e?a.concat(r):r.concat(a)):r),this instanceof u?(s.prototype=n.prototype,c=new s,s.prototype=W,a=n.apply(c,a),x(a)?a:c):n.apply(c,a)}var o=j(n),i=!r,f=t;return i&&(r=t),o||(t=n),u}function f(n,r,e){if(!n)return G;var u=typeof n;if("function"!=u){if("object"!=u)return function(t){return t[n]};var o=sr(n);return function(r){for(var e=o.length,u=X;e--&&(u=w(r[o[e]],n[o[e]],t,t,it)););return u
}}return typeof r!="undefined"?1===e?function(t){return n.call(r,t)}:2===e?function(t,e){return n.call(r,t,e)}:4===e?function(t,e,u,o){return n.call(r,t,e,u,o)}:function(t,e,u){return n.call(r,t,e,u)}:n}function a(){for(var n,t={e:nt,f:tt,g:Ht,i:Qt,j:Yt,k:bt,b:"k(m)",c:"",h:"",l:"",m:Q},r=0;n=arguments[r];r++)for(var e in n)t[e]=n[e];if(n=t.a,t.d=/^[^,]+/.exec(n)[0],r="var i,m="+t.d+",t=m;if(!m)return t;"+t.l+";",t.b?(r+="var n=m.length;i=-1;if("+t.b+"){",t.j&&(r+="if(l(m)){m=m.split('')}"),r+="while(++i<n){"+t.h+"}}else{"):t.i&&(r+="var n=m.length;i=-1;if(n&&j(m)){while(++i<n){i+='';"+t.h+"}}else{"),t.f&&(r+="var u=typeof m=='function';"),t.g&&t.m?(r+="var r=-1,s=q[typeof m]?o(m):[],n=s.length;while(++r<n){i=s[r];",t.f&&(r+="if(!(u&&i=='prototype')){"),r+=t.h+"",t.f&&(r+="}")):(r+="for(i in m){",(t.f||t.m)&&(r+="if(",t.f&&(r+="!(u&&i=='prototype')"),t.f&&t.m&&(r+="&&"),t.m&&(r+="h.call(m,i)"),r+="){"),r+=t.h+";",(t.f||t.m)&&(r+="}")),r+="}",t.e)for(r+="var f=m.constructor;",e=0;7>e;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);++e<r;)u[e]=n[t+e];return u}function g(n){return gr[n]}function h(n){return Et.call(n)==Tt}function y(n){var t=X;if(!n||typeof n!="object"||h(n))return t;
var r=n.constructor;return!j(r)&&(!Zt||!p(n))||r instanceof r?rt?(cr(n,function(n,r,e){return t=!At.call(e,r),X}),t===X):(cr(n,function(n,r){t=r}),t===X||At.call(n,t)):t}function m(n){var t=[];return lr(n,function(n,r){t.push(r)}),t}function _(n,r,e,u,o,i){var a=n;if(typeof r=="function"&&(u=e,e=r,r=X),typeof e=="function"){e=typeof u=="undefined"?e:f(e,u,1);var a=e(a),c=typeof a!="undefined";c||(a=n)}if(u=x(a)){var l=Et.call(a);if(!tr[l]||Zt&&p(a))return a;var s=pr(a)}if(!u||!r)return u&&!c?s?v(a):hr({},a):a;
switch(u=rr[l],l){case Mt:case Pt:return c?a:new u(+a);case zt:case Lt:return c?a:new u(a);case Kt:return c?a:u(a.source,vt.exec(a))}for(o||(o=[]),i||(i=[]),l=o.length;l--;)if(o[l]==n)return i[l];return c||(a=s?u(a.length):{},s&&(At.call(n,"index")&&(a.index=n.index),At.call(n,"input")&&(a.input=n.input))),o.push(n),i.push(a),(s?$:lr)(c?a:n,function(n,u){a[u]=_(n,r,e,t,o,i)}),a}function d(n){var t=[];return cr(n,function(n,r){j(n)&&t.push(r)}),t.sort()}function b(n){for(var t=-1,r=sr(n),e=r.length,u={};++t<e;){var o=r[t];
u[n[o]]=o}return u}function w(n,r,e,u,o,i,a){if(e){e=typeof u=="undefined"?e:f(e,u,2);var c=e(n,r);if(typeof c!="undefined")return!!c}if(n===r)return 0!==n||1/n==1/r;u=typeof n;var l=typeof r;if(n===n&&(!n||"function"!=u&&"object"!=u)&&(!r||"function"!=l&&"object"!=l))return X;if(n==W||r==W)return n===r;if(l=Et.call(n),u=Et.call(r),l==Tt&&(l=Ct),u==Tt&&(u=Ct),l!=u)return X;switch(l){case Mt:case Pt:return+n==+r;case zt:return n!=+n?r!=+r:0==n?1/n==1/r:n==+r;case Kt:case Lt:return n==r+""}if(u=l==Bt,!u){if(n.__wrapped__||r.__wrapped__)return w(n.__wrapped__||n,r.__wrapped__||r,e,t,o,i,a);
if(l!=Ct||Zt&&(p(n)||p(r)))return X;var l=!Wt&&h(n)?Object:n.constructor,s=!Wt&&h(r)?Object:r.constructor;if(l!=s&&(!j(l)||!(l instanceof l&&j(s)&&s instanceof s)))return X}for(i||(i=[]),a||(a=[]),l=i.length;l--;)if(i[l]==n)return a[l]==r;var v=0,c=Q;if(i.push(n),a.push(r),u){if(v=r.length,c=o==it||v==n.length)for(;v--&&(c=w(n[v],r[v],e,t,o,i,a)););return c}return cr(r,function(r,u,f){return At.call(f,u)?(v++,c=At.call(n,u)&&w(n[u],r,e,t,o,i,a)):void 0}),c&&o!=it&&cr(n,function(n,t,r){return At.call(r,t)?c=-1<--v:void 0
}),c}function j(n){return typeof n=="function"}function x(n){return n?er[typeof n]:X}function O(n){return typeof n=="number"||Et.call(n)==zt}function A(n){return typeof n=="string"||Et.call(n)==Lt}function S(n,t,r){var e=arguments,u=0,o=2;if(!x(n))return n;if(r===it)var i=e[3],a=e[4],c=e[5];else a=[],c=[],typeof r!="number"&&(o=e.length,"function"==typeof e[o-2]?i=f(e[--o-1],e[o--],2):"function"==typeof e[o-1]&&(i=e[--o]));for(;++u<o;)(pr(e[u])?$:lr)(e[u],function(t,r){var e,u,o=t,f=n[r];if(t&&((u=pr(t))||mr(t))){for(o=a.length;o--;)if(e=a[o]==t){f=c[o];
break}e||(f=u?pr(f)?f:[]:mr(f)?f:{},i&&(o=i(f,t),typeof o!="undefined"&&(f=o)),a.push(t),c.push(f),i||(f=S(f,t,it,i,a,c)))}else i&&(o=i(f,t),typeof o=="undefined"&&(o=t)),typeof o!="undefined"&&(f=o);n[r]=f});return n}function E(n){for(var t=-1,r=sr(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];return u}function k(n,t,r){var e=-1,u=n?n.length:0,o=X;return r=(0>r?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++e<r?void 0:!(o=n===t)}),o}function q(n,t,r){var e=Q;
if(t=f(t,r),pr(n)){r=-1;for(var u=n.length;++r<u&&(e=!!t(n[r],r,n)););}else ar(n,function(n,r,u){return e=!!t(n,r,u)});return e}function N(n,t,r){var e=[];if(t=f(t,r),pr(n)){r=-1;for(var u=n.length;++r<u;){var o=n[r];t(o,r,n)&&e.push(o)}}else ar(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e}function R(n,t,r){var e;return t=f(t,r),$(n,function(n,r,u){return t(n,r,u)?(e=n,X):void 0}),e}function $(n,t,r){if(t&&typeof r=="undefined"&&pr(n)){r=-1;for(var e=n.length;++r<e&&t(n[r],r,n)!==X;);}else ar(n,t,r);
return n}function F(n,t,r){var e=-1,u=n?n.length:0,o=Array(typeof u=="number"?u:0);if(t=f(t,r),pr(n))for(;++e<u;)o[e]=t(n[e],e,n);else ar(n,function(n,r,u){o[++e]=t(n,r,u)});return o}function D(n,t,r){var e=-1/0,o=e;if(!t&&pr(n)){r=-1;for(var i=n.length;++r<i;){var a=n[r];a>o&&(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]);++o<i;)r=t(r,n[o],o,n)
}else ar(n,function(n,e,o){r=u?(u=X,n):t(r,n,e,o)});return r}function B(n,t,r,e){var u=n,o=n?n.length:0,i=3>arguments.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;++r<u&&!(e=t(n[r],r,n)););}else ar(n,function(n,r,u){return!(e=t(n,r,u))});return!!e}function P(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function"){var o=-1;
for(t=f(t,r);++o<u&&t(n[o],o,n);)e++}else if(e=t,e==W||r)return n[0];return v(n,0,Dt(Ft(0,e),u))}}function z(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];pr(o)?St.apply(u,t?o:z(o)):u.push(o)}return u}function C(n,t,r){var e=-1,u=n?n.length:0;if(typeof r=="number")e=(0>r?Ft(0,u+r):r||0)-1;else if(r)return e=L(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){if(typeof t=="function"){var e=0,u=-1,o=n?n.length:0;for(t=f(t,r);++u<o&&t(n[u],u,n);)e++}else e=t==W||r?1:Ft(0,t);
return v(n,e)}function L(n,t,r,e){var u=0,o=n?n.length:u;for(r=r?f(r,e,1):G,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;return u}function U(n,t,r,e){var u=-1,o=n?n.length:0,i=[],a=i;typeof t=="function"&&(e=r,r=t,t=X);var c=!t&&75<=o;if(c)var l={};for(r&&(a=[],r=f(r,e));++u<o;){e=n[u];var p=r?r(e,u,n):e;if(c)var s=p+"",s=At.call(l,s)?!(a=l[s]):a=l[s]=[];(t?!u||a[a.length-1]!==p:s||0>C(a,p))&&((r||c)&&a.push(p),i.push(e))}return i}function V(n,t){return Gt||kt&&2<arguments.length?kt.call.apply(kt,arguments):i(n,t,v(arguments,2))
}function G(n){return n}function H(n){$(d(n),function(t){var e=r[t]=n[t];r.prototype[t]=function(){var n=[this.__wrapped__];return St.apply(n,arguments),new r(e.apply(r,n))}})}function J(){return this.__wrapped__}var Q=!0,W=null,X=!1,Y=typeof exports=="object"&&exports,Z=typeof global=="object"&&global;Z.global===Z&&(n=Z);var nt,tt,rt,et=[],ut={},ot=0,it=ut,ft=30,at=n._,ct=/&(?:amp|lt|gt|quot|#x27);/g,lt=/\b__p\+='';/g,pt=/\b(__p\+=)''\+/g,st=/(__e\(.*?\)|\b__t\))\+'';/g,vt=/\w*$/,gt=RegExp("^"+(ut.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ht=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,yt=/<%=([\s\S]+?)%>/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<b){m=arguments[a];if(m&&q[typeof m]){",h:"t[i]=m[i]",c:"}}"},ir={a:"d,c,w",l:"c=c&&typeof w=='undefined'?c:e(c,w)",b:"typeof n=='number'",h:"if(c(m[i],i,d)===false)return t"},fr={l:"if(!q[typeof m])return t;"+ir.l,b:X},ar=a(ir);
Xt&&(h=function(n){return n?At.call(n,"callee"):X});var cr=a(ir,fr,{m:X}),lr=a(ir,fr),pr=qt||function(n){return Wt&&n instanceof Array||Et.call(n)==Bt},sr=$t?function(n){return x(n)?tt&&typeof n=="function"||Qt&&n.length&&h(n)?m(n):$t(n):[]}:m,vr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},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(""));++t<e;)u[t]=n[r[t]];return u},r.bind=V,r.bindAll=function(n){for(var t=jt.apply(et,arguments),r=1<t.length?0:(t=d(n),-1),e=t.length;++r<e;){var u=t[r];n[u]=V(n[u],n)}return n},r.bindKey=function(n,t){return i(n,t,v(arguments,2))
},r.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},r.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];return t[0]}},r.countBy=function(n,t,r){var e={};return t=f(t,r),$(n,function(n,r,u){r=t(n,r,u)+"",At.call(e,r)?e[r]++:e[r]=1}),e},r.debounce=function(n,t,r){function e(){f=W,r||(o=n.apply(i,u))}var u,o,i,f;return function(){var a=r&&!f;return u=arguments,i=this,clearTimeout(f),f=setTimeout(e,t),a&&(o=n.apply(i,u)),o
}},r.defaults=yr,r.defer=function(n){var r=v(arguments,1);return setTimeout(function(){n.apply(t,r)},1)},r.delay=function(n,r){var e=v(arguments,2);return setTimeout(function(){n.apply(t,e)},r)},r.difference=function(n){for(var t=-1,r=n?n.length:0,u=jt.apply(et,arguments),u=e(u,r),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.filter=N,r.flatten=z,r.forEach=$,r.forIn=cr,r.forOwn=lr,r.functions=d,r.groupBy=function(n,t,r){var e={};return t=f(t,r),$(n,function(n,r,u){r=t(n,r,u)+"",(At.call(e,r)?e[r]:e[r]=[]).push(n)
}),e},r.initial=function(n,t,r){if(!n)return[];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 e=t==W||r?1:t||e;return v(n,0,Dt(Ft(0,u-e),u))},r.intersection=function(n){var t=arguments,r=t.length,u={0:{}},o=-1,i=n?n.length:0,f=100<=i,a=[],c=a;n:for(;++o<i;){var l=n[o];if(f)var p=l+"",p=At.call(u[0],p)?!(c=u[0][p]):c=u[0][p]=[];if(p||0>C(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;++r<i;){var a=n[r];a<o&&(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},r.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var o=n[r];
t?u[o]=t[r]:u[o[0]]=o[1]}return u},r.omit=function(n,t,r){var e=typeof t=="function",u={};if(e)t=f(t,r);else var o=jt.apply(et,arguments);return cr(n,function(n,r,i){(e?!t(n,r,i):0>C(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);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},r.partial=function(n){return i(n,v(arguments,1))},r.partialRight=function(n){return i(n,v(arguments,1),W,it)
},r.pick=function(n,t,r){var e={};if(typeof t!="function")for(var u=0,o=jt.apply(et,arguments),i=x(n)?o.length:0;++u<i;){var a=o[u];a in n&&(e[a]=n[a])}else t=f(t,r),cr(n,function(n,r,u){t(n,r,u)&&(e[r]=n)});return e},r.pluck=I,r.range=function(n,t,r){n=+n||0,r=+r||1,t==W&&(t=n,n=0);var e=-1;t=Ft(0,wt((t-n)/r));for(var u=Array(t);++e<t;)u[e]=n,n+=r;return u},r.reject=function(n,t,r){return t=f(t,r),N(n,function(n,r,e){return!t(n,r,e)})},r.rest=K,r.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);
return $(n,function(n){var r=xt(It()*(++t+1));e[t]=e[r],e[r]=n}),e},r.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,i=Array(typeof u=="number"?u:0);for(t=f(t,r),$(n,function(n,r,u){i[++e]={a:t(n,r,u),b:e,c:n}}),u=i.length,i.sort(o);u--;)i[u]=i[u].c;return i},r.tap=function(n,t){return t(n),n},r.throttle=function(n,t){function r(){f=new Date,i=W,u=n.apply(o,e)}var e,u,o,i,f=0;return function(){var a=new Date,c=t-(a-f);return e=arguments,o=this,0<c?i||(i=setTimeout(r,c)):(clearTimeout(i),i=W,f=a,u=n.apply(o,e)),u
}},r.times=function(n,t,r){n=+n||0;for(var e=-1,u=Array(n);++e<n;)u[e]=t.call(r,e);return u},r.toArray=function(n){return n&&typeof n.length=="number"?Yt&&A(n)?n.split(""):v(n):E(n)},r.union=function(){return U(jt.apply(et,arguments))},r.uniq=U,r.values=E,r.where=_r,r.without=function(n){for(var t=-1,r=n?n.length:0,u=e(arguments,1),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.wrap=function(n,t){return function(){var r=[n];return St.apply(r,arguments),t.apply(this,r)}},r.zip=function(n){for(var t=-1,r=n?D(I(arguments,"length")):0,e=Array(r);++t<r;)e[t]=I(arguments,t);
return e},r.collect=F,r.drop=K,r.each=$,r.extend=hr,r.methods=d,r.select=N,r.tail=K,r.unique=U,H(r),r.clone=_,r.cloneDeep=function(n,t,r){return _(n,Q,t,r)},r.contains=k,r.escape=function(n){return n==W?"":(n+"").replace(_t,l)},r.every=q,r.find=R,r.has=function(n,t){return n?At.call(n,t):X},r.identity=G,r.indexOf=C,r.isArguments=h,r.isArray=pr,r.isBoolean=function(n){return n===Q||n===X||Et.call(n)==Mt},r.isDate=function(n){return n instanceof Date||Et.call(n)==Pt},r.isElement=function(n){return n?1===n.nodeType:X
},r.isEmpty=function(n){var t=Q;if(!n)return t;var r=Et.call(n),e=n.length;return r==Bt||r==Lt||r==Tt||Xt&&h(n)||r==Ct&&typeof e=="number"&&j(n.splice)?!e:(lr(n,function(){return t=X}),t)},r.isEqual=w,r.isFinite=function(n){return Nt(n)&&!Rt(parseFloat(n))},r.isFunction=j,r.isNaN=function(n){return O(n)&&n!=+n},r.isNull=function(n){return n===W},r.isNumber=O,r.isObject=x,r.isPlainObject=mr,r.isRegExp=function(n){return n instanceof RegExp||Et.call(n)==Kt},r.isString=A,r.isUndefined=function(n){return typeof n=="undefined"
},r.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?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);

43
dist/lodash.js vendored
View File

@@ -1053,7 +1053,7 @@
* // => false
*
* var view = {
* 'id': 'docs',
* 'label': 'docs',
* 'node': element
* };
*
@@ -2605,10 +2605,12 @@
}
/**
* Reduces a `collection` to a single value. The initial state of the reduction
* is `accumulator` and each successive step of it should be returned by the
* `callback`. The `callback` is bound to `thisArg` and invoked with four
* arguments; for arrays they are (accumulator, value, index|key, collection).
* 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).
*
* @static
* @memberOf _
@@ -2621,8 +2623,16 @@
* @returns {Mixed} Returns the accumulated value.
* @example
*
* var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
* var sum = _.reduce([1, 2, 3], function(sum, num) {
* return sum + num;
* });
* // => 6
*
* var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
* result[key] = num * 3;
* return result;
* }, {});
* // => { 'a': 3, 'b': 6, 'c': 9 }
*/
function reduce(collection, callback, accumulator, thisArg) {
var noaccum = arguments.length < 3;
@@ -2848,10 +2858,11 @@
}
/**
* Creates an array, stable sorted in ascending order by the results of
* running each element of `collection` through the `callback`. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index|key, collection).
* The `callback` argument may also be the name of a property to sort by (e.g. 'length').
* 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).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -3856,14 +3867,14 @@
* @returns {Object} Returns `object`.
* @example
*
* var buttonView = {
* 'label': 'lodash',
* 'onClick': function() { alert('clicked: ' + this.label); }
* var view = {
* 'label': 'docs',
* 'onClick': function() { alert('clicked ' + this.label); }
* };
*
* _.bindAll(buttonView);
* jQuery('#lodash_button').on('click', buttonView.onClick);
* // => When the button is clicked, `this.label` will have the correct value
* _.bindAll(view);
* jQuery('#docs').on('click', view.onClick);
* // => alerts 'clicked docs', when the button is clicked
*/
function bindAll(object) {
var funcs = concat.apply(arrayRef, arguments),

View File

@@ -1,7 +1,7 @@
/**
* @license
* Lo-Dash 1.0.0-rc.3 (Custom Build) <http://lodash.com/>
* Build: `lodash underscore -d -o ./dist/lodash.underscore.js`
* Build: `lodash underscore -o ./dist/lodash.underscore.js`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.4.4 <http://underscorejs.org/>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
@@ -2105,10 +2105,12 @@
}
/**
* Reduces a `collection` to a single value. The initial state of the reduction
* is `accumulator` and each successive step of it should be returned by the
* `callback`. The `callback` is bound to `thisArg` and invoked with four
* arguments; for arrays they are (accumulator, value, index|key, collection).
* 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).
*
* @static
* @memberOf _
@@ -2121,8 +2123,16 @@
* @returns {Mixed} Returns the accumulated value.
* @example
*
* var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
* var sum = _.reduce([1, 2, 3], function(sum, num) {
* return sum + num;
* });
* // => 6
*
* var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
* result[key] = num * 3;
* return result;
* }, {});
* // => { 'a': 3, 'b': 6, 'c': 9 }
*/
function reduce(collection, callback, accumulator, thisArg) {
var noaccum = arguments.length < 3;
@@ -2348,10 +2358,11 @@
}
/**
* Creates an array, stable sorted in ascending order by the results of
* running each element of `collection` through the `callback`. The `callback`
* is bound to `thisArg` and invoked with three arguments; (value, index|key, collection).
* The `callback` argument may also be the name of a property to sort by (e.g. 'length').
* 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).
*
* If a property name is passed for `callback`, the created "_.pluck" style
* callback will return the property value of the given element.
@@ -3334,14 +3345,14 @@
* @returns {Object} Returns `object`.
* @example
*
* var buttonView = {
* 'label': 'lodash',
* 'onClick': function() { alert('clicked: ' + this.label); }
* var view = {
* 'label': 'docs',
* 'onClick': function() { alert('clicked ' + this.label); }
* };
*
* _.bindAll(buttonView);
* jQuery('#lodash_button').on('click', buttonView.onClick);
* // => When the button is clicked, `this.label` will have the correct value
* _.bindAll(view);
* jQuery('#docs').on('click', view.onClick);
* // => alerts 'clicked docs', when the button is clicked
*/
function bindAll(object) {
var funcs = concat.apply(arrayRef, arguments),

View File

@@ -1,7 +1,7 @@
/**
* @license
* Lo-Dash 1.0.0-rc.3 (Custom Build) lodash.com/license
* Build: `lodash underscore -m -o ./dist/lodash.underscore.min.js`
* 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(;++r<e&&t(n[r],r,n)!==nt;);else for(r in n)if(lt.call(n,r)&&t(n[r],r,n)===nt)break}}function u(n){return n&&typeof n=="object"&&n.__wrapped__?n:this instanceof u?(this.__wrapped__=n,void 0):new u(n)}function o(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(n<t||typeof t=="undefined")return-1