From 3a698eb0ed1232ce3e322ad94b9e975e80abb4a9 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 11 Jun 2012 22:37:54 -0400 Subject: [PATCH 01/15] Make `_.escape` match `_.template`'s escape delimiter results for `null` and `undefined` values. Former-commit-id: b6717c6debf3bc308cf12b778916f5a46dbb954d --- build/pre-compile.js | 4 ++-- lodash.js | 4 ++-- test/test.js | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index 17bc43bced..4fc1bdd63e 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -202,8 +202,8 @@ // http://code.google.com/closure/compiler/docs/api-tutorial3.html#export source = source.replace(RegExp('\\.(' + propWhitelist.join('|') + ')\\b', 'g'), "['$1']"); - // remove brackets from `_.escape(__t)` in `tokenizeEscape` - source = source.replace("_['escape'](__t)", '_.escape(__t)'); + // remove brackets from `_.escape()` in `tokenizeEscape` + source = source.replace("_['escape'](\"", '_.escape("'); // remove whitespace from string literals source = source.replace(/'(?:(?=(\\?))\1.)*?'/g, function(string) { diff --git a/lodash.js b/lodash.js index 673a59bf67..081e8b0f44 100644 --- a/lodash.js +++ b/lodash.js @@ -525,7 +525,7 @@ */ function tokenizeEscape(match, value) { var index = tokenized.length; - tokenized[index] = "'+\n((__t = (" + value + ")) == null ? '' : _.escape(__t)) +\n'"; + tokenized[index] = "'+\n_.escape(" + value + ") +\n'"; return token + index; } @@ -2985,7 +2985,7 @@ * // => "Curly, Larry & Moe" */ function escape(string) { - return (string + '').replace(reUnescapedHtml, escapeHtmlChar); + return string == null ? '' : (string + '').replace(reUnescapedHtml, escapeHtmlChar); } /** diff --git a/test/test.js b/test/test.js index 1c27d23b1d..764d4d311e 100644 --- a/test/test.js +++ b/test/test.js @@ -157,6 +157,11 @@ test('should not escape the "/" character', function() { equal(_.escape('/'), '/'); }); + + test('should return empty string when passed `null` or `undefined`', function() { + equal(_.escape(null), ''); + equal(_.escape(undefined), ''); + }); }()); /*--------------------------------------------------------------------------*/ From a5873a3158b94322c9457acaa0a18b579816e7da Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 11 Jun 2012 22:49:24 -0400 Subject: [PATCH 02/15] Add comments, documentation, and update the minified build. Former-commit-id: c65665063f254b1ba9dab9c6948fedf29f1e795f --- doc/README.md | 54 +++++++++++++++++++++++++-------------------------- lodash.js | 12 ++++++++++-- lodash.min.js | 38 ++++++++++++++++++------------------ 3 files changed, 56 insertions(+), 48 deletions(-) diff --git a/doc/README.md b/doc/README.md index c5c4480894..291dc5bce6 100644 --- a/doc/README.md +++ b/doc/README.md @@ -147,7 +147,7 @@ The `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3344 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3352 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -270,7 +270,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick); ### `_.chain(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3296 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3304 "View in source") [Ⓣ][1] Wraps the value in a `lodash` chainable object. @@ -533,7 +533,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2987 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2992 "View in source") [Ⓣ][1] Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters. @@ -888,7 +888,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3006 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3011 "View in source") [Ⓣ][1] This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. @@ -1209,7 +1209,7 @@ _.isEqual(moe, clone); ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2684 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2689 "View in source") [Ⓣ][1] Checks if a `value` is a finite number. @@ -1239,7 +1239,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2701 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2706 "View in source") [Ⓣ][1] Checks if a `value` is a function. @@ -1263,7 +1263,7 @@ _.isFunction(''.concat); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2752 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2757 "View in source") [Ⓣ][1] Checks if a `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4. @@ -1296,7 +1296,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2774 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2779 "View in source") [Ⓣ][1] Checks if a `value` is `null`. @@ -1323,7 +1323,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2791 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2796 "View in source") [Ⓣ][1] Checks if a `value` is a number. @@ -1347,7 +1347,7 @@ _.isNumber(8.4 * 5; ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2722 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2727 "View in source") [Ⓣ][1] Checks if a `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)*`, and `new String('')`) @@ -1374,7 +1374,7 @@ _.isObject(1); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2808 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2813 "View in source") [Ⓣ][1] Checks if a `value` is a regular expression. @@ -1398,7 +1398,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2825 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2830 "View in source") [Ⓣ][1] Checks if a `value` is a string. @@ -1422,7 +1422,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2842 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2847 "View in source") [Ⓣ][1] Checks if a `value` is `undefined`. @@ -1446,7 +1446,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2859 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2864 "View in source") [Ⓣ][1] Produces an array of object`'s own enumerable property names. @@ -1638,7 +1638,7 @@ _.min([10, 5, 100, 2, 1000]); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3032 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3037 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -1668,7 +1668,7 @@ _('larry').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3063 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3068 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -1741,7 +1741,7 @@ hi('moe'); ### `_.pick(object [, prop1, prop2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2881 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2886 "View in source") [Ⓣ][1] Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. @@ -1942,9 +1942,9 @@ _.rest([3, 2, 1]); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3093 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3099 "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. +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. #### Arguments 1. `object` *(Object)*: The object to inspect. @@ -2001,7 +2001,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2919 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2924 "View in source") [Ⓣ][1] Gets the size of `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object. @@ -2130,7 +2130,7 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) { ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2947 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2952 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The primary purpose of this method is to "tap into" a method chain, in order to performoperations on intermediate results within the chain. @@ -2160,7 +2160,7 @@ _.chain([1,2,3,200]) ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3152 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3160 "View in source") [Ⓣ][1] A micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -2244,7 +2244,7 @@ jQuery(window).on('scroll', throttled); ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3239 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3247 "View in source") [Ⓣ][1] Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*. @@ -2354,7 +2354,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3266 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3274 "View in source") [Ⓣ][1] Generates a unique id. If `prefix` is passed, the id will be appended to it. @@ -2378,7 +2378,7 @@ _.uniqueId('contact_'); ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2965 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2970 "View in source") [Ⓣ][1] Produces an array of `object`'s own enumerable property values. @@ -2488,7 +2488,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ### `_.prototype.chain()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3314 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3322 "View in source") [Ⓣ][1] Extracts the value from a wrapped chainable object. @@ -2509,7 +2509,7 @@ _([1, 2, 3]).value(); ### `_.prototype.value()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3331 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3339 "View in source") [Ⓣ][1] Extracts the value from a wrapped chainable object. diff --git a/lodash.js b/lodash.js index 081e8b0f44..6635398990 100644 --- a/lodash.js +++ b/lodash.js @@ -2641,7 +2641,12 @@ // ensure both objects have the same number of properties if (result) { for (prop in b) { - if (hasOwnProperty.call(b, prop) && !(size--)) break; + // Adobe JS engines have an operator precedence bug that causes `!size--` + // to produce the wrong result so it must be wrapped in parentheses. + // https://github.com/documentcloud/underscore/issues/355 + if (hasOwnProperty.call(b, prop) && !(size--)) { + break; + } } result = !size; } @@ -3067,7 +3072,8 @@ /** * 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. + * it will be invoked and its result returned, else the property value is + * returned. If `object` is falsey, then `null` is returned. * * @static * @memberOf _ @@ -3091,6 +3097,8 @@ * // => 'nonsense' */ function result(object, property) { + // based on Backbone's private `getValue` function + // https://github.com/documentcloud/backbone/blob/0.9.2/backbone.js#L1419-1424 if (!object) { return null; } diff --git a/lodash.min.js b/lodash.min.js index 3f7362284a..9661393de3 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -3,30 +3,30 @@ Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE */ ;(function(e,t){"use strict";function s(e){return"[object Arguments]"==rt.call(e)}function o(e){return new u(e)}function u(e){if(e&&e._wrapped)return e;this._wrapped=e}function a(){for(var e,t,s,o=-1,u=arguments.length,a={e:"",f:"",k:"",q:"",c:{d:"",m:"++k/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var lt=Function("obj","var __p;with(obj){__p='var k,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;k=-1;';if(o){__p+='if(m===m>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&k==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var f='+l+'.constructor;';for(var k=0;k<7;k++){__p+='k=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(f&&f.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p" ),ct={a:"e,c,x",k:"e",q:"if(!c){c=j}else if(x){c=l(c,x)}",j:"c(e[k],k,e)"},ht={k:"z",j:"if(!c(e[k],k,e))return!r"},pt={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ue?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=C,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Nt(e));for( var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return(e+"").replace(B,c)},o.every=yt,o.extend=Tt -,o.filter=Y,o.find=bt,o.first=y,o.flatten=b,o.forEach=wt,o.forIn=pt,o.forOwn=ct,o.functions=Nt,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&yt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=Et,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++s -arguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++ri?1:0});s--;)o[s]=o[s].b;return o},o.sortedIndex=T,o.tap=function(e,t){return t(e),e},o.template=function(e,t,n){n||(n={});var i;i=o.templateSettings;var s=n.escape,u=n.evaluate,a=n.interpolate,n=n.variable;return s==r&&(s=i.escape),u==r&&(u=i.evaluate),a==r&&(a=i -.interpolate),s&&(e=e.replace(s,d)),a&&(e=e.replace(a,v)),u&&(e=e.replace(u,m)),e="__p='"+e.replace(j,l).replace(H,f)+"';",q.length=0,n||(n=i.variable,e="with("+n+"||{}){"+e+"}"),e="function("+n+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+e+"return __p}",i=Function("_","return "+e)(o),t?i(t):(i.source=e,i)},o.throttle=function(e,n){function r(){a=new Date,u=t,e.apply(o,i)}var i,s,o,u,a=0;return function(){var t=new Date,f=n-(t-a);return i=arguments,o=this -,0>=f?(a=t,s=e.apply(o,i)):u||(u=ft(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?nt.call(e):Lt(e)},o.union=function(){for(var e=-1,t=[],n=Z.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=N,o.uniqueId=function(e){var t=_++;return e?e+t:t},o.values=Lt,o.without=function(e){var t=[];if(!e)return t;for(var n= +){var t=r&&!a;return s=arguments,u=this,at(a),a=ft(i,n),t&&(o=e.apply(u,s)),o}},o.defaults=xt,o.defer=function(e){var n=nt.call(arguments,1);return ft(function(){return e.apply(t,n)},1)},o.delay=function(e,n){var r=nt.call(arguments,2);return ft(function(){return e.apply(t,r)},n)},o.difference=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length,i=Z.apply(t,nt.call(arguments,1));++nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(B,c)},o.every=yt,o +.extend=Tt,o.filter=Y,o.find=bt,o.first=y,o.flatten=b,o.forEach=wt,o.forIn=pt,o.forOwn=ct,o.functions=Nt,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&yt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=Et,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++sarguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++ri?1:0});s--;)o[s]=o[s].b;return o},o.sortedIndex=T,o.tap=function(e,t){return t(e),e},o.template=function(e,t,n){n||(n={});var i;i=o.templateSettings;var s=n.escape,u=n.evaluate,a=n.interpolate,n=n.variable;return s==r&&(s=i.escape),u==r&&(u=i.evaluate),a==r&& +(a=i.interpolate),s&&(e=e.replace(s,d)),a&&(e=e.replace(a,v)),u&&(e=e.replace(u,m)),e="__p='"+e.replace(j,l).replace(H,f)+"';",q.length=0,n||(n=i.variable,e="with("+n+"||{}){"+e+"}"),e="function("+n+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+e+"return __p}",i=Function("_","return "+e)(o),t?i(t):(i.source=e,i)},o.throttle=function(e,n){function r(){a=new Date,u=t,e.apply(o,i)}var i,s,o,u,a=0;return function(){var t=new Date,f=n-(t-a);return i=arguments,o= +this,0>=f?(a=t,s=e.apply(o,i)):u||(u=ft(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?nt.call(e):Lt(e)},o.union=function(){for(var e=-1,t=[],n=Z.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=N,o.uniqueId=function(e){var t=_++;return e?e+t:t},o.values=Lt,o.without=function(e){var t=[];if(!e)return t;for(var n= nt.call(arguments,1),r=-1,i=e.length;++rw(n,e[r])&&t.push(e[r]);return t},o.wrap=function(e,t){return function(){var n=[e];return arguments.length&&tt.apply(n,arguments),t.apply(this,n)}},o.zip=function(e){if(!e)return[];for(var t=-1,n=E(S(arguments,"length")),r=Array(n);++t Date: Tue, 12 Jun 2012 19:28:47 -0400 Subject: [PATCH 03/15] Ensure `sourceURL` support doesn't cause errors in Adobe's JS engine. Former-commit-id: 2ad1214e6a58832c732499b272ebfc434953213b --- build/pre-compile.js | 2 +- lodash.js | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index 4fc1bdd63e..8f00ee075d 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -217,7 +217,7 @@ source = source.replace('"\';\\n"', '"\';"'); // remove debug sourceURL in `_.template` - source = source.replace(/\+(?:\s*\/\/.*)*\s*'\/\/@ sourceURL=[^;]+/, ''); + source = source.replace(/(?:\s*\/\/.*\n)* *if *\(useSourceURL[^}]+}/, ''); // minify `_.sortBy` internal properties (function() { diff --git a/lodash.js b/lodash.js index 6635398990..43ddcb2083 100644 --- a/lodash.js +++ b/lodash.js @@ -54,6 +54,12 @@ /** Used to store tokenized template text snippets */ var tokenized = []; + /** Detect if sourceURL syntax is usable without erroring */ + try { + // Adobe's and Narwhal's JS engines will error + var useSourceURL = (Function('//@')(), true); + } catch(e){ } + /** * Used to escape characters for inclusion in HTML. * The `>` and `/` characters don't require escaping in HTML and have no @@ -2641,8 +2647,9 @@ // ensure both objects have the same number of properties if (result) { for (prop in b) { - // Adobe JS engines have an operator precedence bug that causes `!size--` - // to produce the wrong result so it must be wrapped in parentheses. + // Adobe's JS engine, embedded in applications like InDesign, has a + // bug that causes `!size--` to throw an error so it must be wrapped + // in parentheses. // https://github.com/documentcloud/underscore/issues/355 if (hasOwnProperty.call(b, prop) && !(size--)) { break; @@ -3208,11 +3215,13 @@ 'var __p, __t, __j = Array.prototype.join;\n' + 'function print() { __p += __j.call(arguments, \'\') }\n' + text + - 'return __p\n}\n' + - // add sourceURL for easier debugging - // (Narwhal requires a trailing newline to prevent a syntax error) - // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - '//@ sourceURL=/lodash/template/source[' + (templateCounter++) + ']\n'; + 'return __p\n}'; + + // add a sourceURL for easier debugging + // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl + if (useSourceURL) { + text += '\n//@ sourceURL=/lodash/template/source[' + (templateCounter++) + ']'; + } result = Function('_', 'return ' + text)(lodash); From 62e7da9d8a672cd26a1a75a4a7192950a42327ae Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 12 Jun 2012 19:29:01 -0400 Subject: [PATCH 04/15] Update docs and minified build. Former-commit-id: d0673323dc850f4e7936f00374905cd29c5d6e24 --- doc/README.md | 184 +++++++++++++++++++++++++------------------------- lodash.min.js | 52 +++++++------- 2 files changed, 118 insertions(+), 118 deletions(-) diff --git a/doc/README.md b/doc/README.md index 291dc5bce6..f17a7d9f4d 100644 --- a/doc/README.md +++ b/doc/README.md @@ -129,7 +129,7 @@ ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L134 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L140 "View in source") [Ⓣ][1] The `lodash` function. @@ -147,7 +147,7 @@ The `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3352 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3361 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -159,7 +159,7 @@ The `lodash` function. ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1795 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1801 "View in source") [Ⓣ][1] Creates a new function that is restricted to executing only after it is called `n` times. @@ -187,7 +187,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1849 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1855 "View in source") [Ⓣ][1] Creates a new 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. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`. @@ -238,7 +238,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1920 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1926 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound. @@ -270,7 +270,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick); ### `_.chain(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3304 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3313 "View in source") [Ⓣ][1] Wraps the value in a `lodash` chainable object. @@ -304,7 +304,7 @@ var youngest = _.chain(stooges) ### `_.clone(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2246 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2252 "View in source") [Ⓣ][1] Create a shallow clone of the `value`. Any nested objects or arrays will be assigned by reference and not cloned. @@ -328,7 +328,7 @@ _.clone({ 'name': 'moe' }); ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L892 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L898 "View in source") [Ⓣ][1] Produces a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -352,7 +352,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1952 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1958 "View in source") [Ⓣ][1] Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. @@ -379,7 +379,7 @@ welcome('moe'); ### `_.contains(collection, target)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L578 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L584 "View in source") [Ⓣ][1] Checks if a given `target` value is present in a `collection` using strict equality for comparisons, i.e. `===`. @@ -404,7 +404,7 @@ _.contains([1, 2, 3], 3); ### `_.debounce(func, wait, immediate)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1985 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1991 "View in source") [Ⓣ][1] Creates a new 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. @@ -430,7 +430,7 @@ jQuery(window).on('resize', lazyLayout); ### `_.defaults(object [, defaults1, defaults2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2269 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2275 "View in source") [Ⓣ][1] Assigns missing properties in `object` with default values from the defaults objects. As soon as a property is set, additional defaults of the same property will be ignored. @@ -456,7 +456,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' }); ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2050 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2056 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments are passed to `func` when it is invoked. @@ -481,7 +481,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2030 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2036 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments are passed to `func` when it is invoked. @@ -508,7 +508,7 @@ _.delay(log, 1000, 'logged later'); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L924 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L930 "View in source") [Ⓣ][1] Produces a new array of `array` values not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -533,7 +533,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2992 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2999 "View in source") [Ⓣ][1] Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters. @@ -557,7 +557,7 @@ _.escape('Curly, Larry & Moe'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L609 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -583,7 +583,7 @@ _.every([true, 1, null, 'yes'], Boolean); ### `_.extend(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2288 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2294 "View in source") [Ⓣ][1] Copies enumerable properties from the source objects to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. @@ -608,7 +608,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L624 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L630 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning an array of all values the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -634,7 +634,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }) ### `_.find(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L646 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L652 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -660,7 +660,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.first(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L960 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L966 "View in source") [Ⓣ][1] Gets the first value of the `array`. Pass `n` to return the first `n` values of the `array`. @@ -686,7 +686,7 @@ _.first([5, 4, 3, 2, 1]); ### `_.flatten(array, shallow)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L984 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L990 "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. @@ -714,7 +714,7 @@ _.flatten([1, [2], [3, [[4]]]], true); ### `_.forEach(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L673 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L679 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each value in the `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -743,7 +743,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.forIn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2317 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2323 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. @@ -779,7 +779,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2340 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2346 "View in source") [Ⓣ][1] Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. @@ -807,7 +807,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2357 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2363 "View in source") [Ⓣ][1] Produces a sorted array of the enumerable properties, own and inherited, of `object` that have function values. @@ -831,7 +831,7 @@ _.functions(_); ### `_.groupBy(array, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1029 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1035 "View in source") [Ⓣ][1] Splits `array` into sets, grouped by the result of running each value through `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to group by. @@ -863,7 +863,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2380 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2386 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -888,7 +888,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3011 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3018 "View in source") [Ⓣ][1] This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. @@ -913,7 +913,7 @@ moe === _.identity(moe); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1075 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1081 "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 `isSorted` will run a faster binary search. @@ -945,7 +945,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1115 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1121 "View in source") [Ⓣ][1] Gets all but the last value of `array`. Pass `n` to exclude the last `n` values from the result. @@ -971,7 +971,7 @@ _.initial([3, 2, 1]); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1136 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1142 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays. @@ -995,7 +995,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.invoke(array, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1178 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1184 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element of `array`. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element of `array`. @@ -1024,7 +1024,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2400 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2406 "View in source") [Ⓣ][1] Checks if a `value` is an `arguments` object. @@ -1051,7 +1051,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2426 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2432 "View in source") [Ⓣ][1] Checks if a `value` is an array. @@ -1078,7 +1078,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2443 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2449 "View in source") [Ⓣ][1] Checks if a `value` is a boolean *(`true` or `false`)* value. @@ -1102,7 +1102,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2460 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2466 "View in source") [Ⓣ][1] Checks if a `value` is a date. @@ -1126,7 +1126,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2477 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2483 "View in source") [Ⓣ][1] Checks if a `value` is a DOM element. @@ -1150,7 +1150,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2498 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2504 "View in source") [Ⓣ][1] Checks if a `value` is empty. Arrays or strings with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -1177,7 +1177,7 @@ _.isEmpty({}); ### `_.isEqual(a, b [, stack])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2532 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2538 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. @@ -1209,7 +1209,7 @@ _.isEqual(moe, clone); ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2689 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2696 "View in source") [Ⓣ][1] Checks if a `value` is a finite number. @@ -1239,7 +1239,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2706 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2713 "View in source") [Ⓣ][1] Checks if a `value` is a function. @@ -1263,7 +1263,7 @@ _.isFunction(''.concat); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2757 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2764 "View in source") [Ⓣ][1] Checks if a `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4. @@ -1296,7 +1296,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2779 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2786 "View in source") [Ⓣ][1] Checks if a `value` is `null`. @@ -1323,7 +1323,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2796 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2803 "View in source") [Ⓣ][1] Checks if a `value` is a number. @@ -1347,7 +1347,7 @@ _.isNumber(8.4 * 5; ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2727 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2734 "View in source") [Ⓣ][1] Checks if a `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)*`, and `new String('')`) @@ -1374,7 +1374,7 @@ _.isObject(1); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2813 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2820 "View in source") [Ⓣ][1] Checks if a `value` is a regular expression. @@ -1398,7 +1398,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2830 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2837 "View in source") [Ⓣ][1] Checks if a `value` is a string. @@ -1422,7 +1422,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2847 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2854 "View in source") [Ⓣ][1] Checks if a `value` is `undefined`. @@ -1446,7 +1446,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2864 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2871 "View in source") [Ⓣ][1] Produces an array of object`'s own enumerable property names. @@ -1470,7 +1470,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.last(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1212 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1218 "View in source") [Ⓣ][1] Gets the last value of the `array`. Pass `n` to return the lasy `n` values of the `array`. @@ -1496,7 +1496,7 @@ _.last([3, 2, 1]); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1238 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1244 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. @@ -1525,7 +1525,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L703 "View in source") [Ⓣ][1] Produces a new array of values by mapping each value in the `collection` through a transformation `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -1554,7 +1554,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); ### `_.max(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1278 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1284 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -1586,7 +1586,7 @@ _.max(stooges, function(stooge) { return stooge.age; }); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2073 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2079 "View in source") [Ⓣ][1] Creates a new 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. @@ -1612,7 +1612,7 @@ var fibonacci = _.memoize(function(n) { ### `_.min(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1328 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1334 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -1638,7 +1638,7 @@ _.min([10, 5, 100, 2, 1000]); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3037 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3044 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -1668,7 +1668,7 @@ _('larry').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3068 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3075 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -1688,7 +1688,7 @@ var lodash = _.noConflict(); ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2099 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2105 "View in source") [Ⓣ][1] Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call. @@ -1714,7 +1714,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2132 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2138 "View in source") [Ⓣ][1] Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the partially applied function. This method is similar `bind`, except it does **not** alter the `this` binding. @@ -1741,7 +1741,7 @@ hi('moe'); ### `_.pick(object [, prop1, prop2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2886 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2893 "View in source") [Ⓣ][1] Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. @@ -1766,7 +1766,7 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age'); ### `_.pluck(array, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1380 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1386 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in `array`. @@ -1797,7 +1797,7 @@ _.pluck(stooges, 'name'); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1423 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1429 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range. @@ -1835,7 +1835,7 @@ _.range(0); ### `_.reduce(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L731 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L737 "View in source") [Ⓣ][1] Boils down 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 `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*. @@ -1862,7 +1862,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; }); ### `_.reduceRight(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L768 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L774 "View in source") [Ⓣ][1] The right-associative version of `_.reduce`. @@ -1890,7 +1890,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L819 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L825 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. @@ -1916,7 +1916,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.rest(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1459 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1465 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result. @@ -1942,7 +1942,7 @@ _.rest([3, 2, 1]); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3099 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3106 "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. @@ -1977,7 +1977,7 @@ _.result(object, 'stuff'); ### `_.shuffle(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1480 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1486 "View in source") [Ⓣ][1] Produces a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -2001,7 +2001,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2924 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2931 "View in source") [Ⓣ][1] Gets the size of `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object. @@ -2031,7 +2031,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L843 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L849 "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 `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -2057,7 +2057,7 @@ _.some([null, 0, 'yes', false]); ### `_.sortBy(array, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1522 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1528 "View in source") [Ⓣ][1] Produces a new sorted array, ranked in ascending order by the results of running each element of `array` through `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*. @@ -2089,7 +2089,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length'); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1596 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1602 "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 `1` argument; *(value)*. @@ -2130,7 +2130,7 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) { ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2952 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2959 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The primary purpose of this method is to "tap into" a method chain, in order to performoperations on intermediate results within the chain. @@ -2160,7 +2160,7 @@ _.chain([1,2,3,200]) ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3160 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3167 "View in source") [Ⓣ][1] A micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -2219,7 +2219,7 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' }); ### `_.throttle(func, wait)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2174 "View in source") [Ⓣ][1] Creates a new 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, `func` will also be called on the trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2244,7 +2244,7 @@ jQuery(window).on('scroll', throttled); ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3247 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3256 "View in source") [Ⓣ][1] Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*. @@ -2270,7 +2270,7 @@ _.times(3, function() { this.grantWish(); }, genie); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L862 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L868 "View in source") [Ⓣ][1] Converts the `collection`, into an array. Useful for converting the `arguments` object. @@ -2294,7 +2294,7 @@ Converts the `collection`, into an array. Useful for converting the `arguments` ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1633 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1639 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays. @@ -2318,7 +2318,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1678 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1684 "View in source") [Ⓣ][1] Produces 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 value of `array` is passed through a transformation `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -2354,7 +2354,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3274 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3283 "View in source") [Ⓣ][1] Generates a unique id. If `prefix` is passed, the id will be appended to it. @@ -2378,7 +2378,7 @@ _.uniqueId('contact_'); ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2970 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2977 "View in source") [Ⓣ][1] Produces an array of `object`'s own enumerable property values. @@ -2402,7 +2402,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1727 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1733 "View in source") [Ⓣ][1] Produces a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -2427,7 +2427,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.wrap(func, wrapper [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2220 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2226 "View in source") [Ⓣ][1] Create a new function that passes the `func` function to the `wrapper` function as its first argument. Additional arguments are appended to those passed to the `wrapper` function. @@ -2457,7 +2457,7 @@ hello(); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1760 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1766 "View in source") [Ⓣ][1] Merges together the values of each of the arrays with the value at the corresponding position. 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. @@ -2488,7 +2488,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ### `_.prototype.chain()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3322 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3331 "View in source") [Ⓣ][1] Extracts the value from a wrapped chainable object. @@ -2509,7 +2509,7 @@ _([1, 2, 3]).value(); ### `_.prototype.value()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3339 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3348 "View in source") [Ⓣ][1] Extracts the value from a wrapped chainable object. @@ -2537,7 +2537,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L162 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L168 "View in source") [Ⓣ][1] *(Object)*: By default, Lo-Dash uses ERB-style template delimiters, change the following template settings to use alternative delimiters. @@ -2549,7 +2549,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L171 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L177 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -2561,7 +2561,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L180 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L186 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -2573,7 +2573,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L189 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L195 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -2585,7 +2585,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L198 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L204 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. diff --git a/lodash.min.js b/lodash.min.js index 9661393de3..bf0c5a88a2 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -2,31 +2,31 @@ Lo-Dash 0.3.1 lodash.com/license Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE */ -;(function(e,t){"use strict";function s(e){return"[object Arguments]"==rt.call(e)}function o(e){return new u(e)}function u(e){if(e&&e._wrapped)return e;this._wrapped=e}function a(){for(var e,t,s,o=-1,u=arguments.length,a={e:"",f:"",k:"",q:"",c:{d:"",m:"++k/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var lt=Function("obj","var __p;with(obj){__p='var k,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;k=-1;';if(o){__p+='if(m===m>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&k==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var f='+l+'.constructor;';for(var k=0;k<7;k++){__p+='k=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(f&&f.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p" -),ct={a:"e,c,x",k:"e",q:"if(!c){c=j}else if(x){c=l(c,x)}",j:"c(e[k],k,e)"},ht={k:"z",j:"if(!c(e[k],k,e))return!r"},pt={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ue?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=C,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Nt(e));for( -var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(B,c)},o.every=yt,o -.extend=Tt,o.filter=Y,o.find=bt,o.first=y,o.flatten=b,o.forEach=wt,o.forIn=pt,o.forOwn=ct,o.functions=Nt,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&yt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=Et,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++sarguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++r/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var ct=Function("obj","var __p;with(obj){__p='var k,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;k=-1;';if(o){__p+='if(m===m>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&k==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var f='+l+'.constructor;';for(var k=0;k<7;k++){__p+='k=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(f&&f.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p" +),ht={a:"e,c,x",k:"e",q:"if(!c){c=j}else if(x){c=l(c,x)}",j:"c(e[k],k,e)"},pt={k:"z",j:"if(!c(e[k],k,e))return!r"},dt={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ue?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=C,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Ct(e));for( +var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(B,c)},o.every=bt, +o.extend=Nt,o.filter=Z,o.find=wt,o.first=y,o.flatten=b,o.forEach=Et,o.forIn=dt,o.forOwn=ht,o.functions=Ct,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&bt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=St,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++sarguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++ri?1:0});s--;)o[s]=o[s].b;return o},o.sortedIndex=T,o.tap=function(e,t){return t(e),e},o.template=function(e,t,n){n||(n={});var i;i=o.templateSettings;var s=n.escape,u=n.evaluate,a=n.interpolate,n=n.variable;return s==r&&(s=i.escape),u==r&&(u=i.evaluate),a==r&& (a=i.interpolate),s&&(e=e.replace(s,d)),a&&(e=e.replace(a,v)),u&&(e=e.replace(u,m)),e="__p='"+e.replace(j,l).replace(H,f)+"';",q.length=0,n||(n=i.variable,e="with("+n+"||{}){"+e+"}"),e="function("+n+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+e+"return __p}",i=Function("_","return "+e)(o),t?i(t):(i.source=e,i)},o.throttle=function(e,n){function r(){a=new Date,u=t,e.apply(o,i)}var i,s,o,u,a=0;return function(){var t=new Date,f=n-(t-a);return i=arguments,o= -this,0>=f?(a=t,s=e.apply(o,i)):u||(u=ft(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?nt.call(e):Lt(e)},o.union=function(){for(var e=-1,t=[],n=Z.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=N,o.uniqueId=function(e){var t=_++;return e?e+t:t},o.values=Lt,o.without=function(e){var t=[];if(!e)return t;for(var n= -nt.call(arguments,1),r=-1,i=e.length;++rw(n,e[r])&&t.push(e[r]);return t},o.wrap=function(e,t){return function(){var n=[e];return arguments.length&&tt.apply(n,arguments),t.apply(this,n)}},o.zip=function(e){if(!e)return[];for(var t=-1,n=E(S(arguments,"length")),r=Array(n);++t=f?(a=t,s=e.apply(o,i)):u||(u=lt(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?rt.call(e):At(e)},o.union=function(){for(var e=-1,t=[],n=et.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=N,o.uniqueId=function(e){var t=_++;return e?e+t:t},o.values=At,o.without=function(e){var t=[];if(!e)return t;for( +var n=rt.call(arguments,1),r=-1,i=e.length;++rw(n,e[r])&&t.push(e[r]);return t},o.wrap=function(e,t){return function(){var n=[e];return arguments.length&&nt.apply(n,arguments),t.apply(this,n)}},o.zip=function(e){if(!e)return[];for(var t=-1,n=E(S(arguments,"length")),r=Array(n);++t Date: Tue, 12 Jun 2012 20:15:52 -0400 Subject: [PATCH 05/15] Remove the `useSourceURL` variable from the minified build. Former-commit-id: c0f02e7e87c533220a99ebe99c9ee08516fb9deb --- build.js | 4 ++-- build/pre-compile.js | 5 ++++- lodash.min.js | 52 ++++++++++++++++++++++---------------------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/build.js b/build.js index d5f279e62c..0b3fa2c0b2 100755 --- a/build.js +++ b/build.js @@ -587,10 +587,10 @@ source = removeVar(source, 'iteratorTemplate'); // remove JScript [[DontEnum]] fix from `isEqual` - source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(result *&& *hasDontEnumBug[\s\S]+?\n\1}\n/, '\n'); + source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(result *&& *hasDontEnumBug[\s\S]+?\n\1}/, ''); // remove IE `shift` and `splice` fix - source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(value.length *=== *0[\s\S]+?\n\1}\n/, '\n'); + source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(value.length *=== *0[\s\S]+?\n\1}/, ''); } else { // inline `iteratorTemplate` template diff --git a/build/pre-compile.js b/build/pre-compile.js index 8f00ee075d..d3d67945cd 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -216,7 +216,10 @@ // remove newline from double-quoted string in `_.template` source = source.replace('"\';\\n"', '"\';"'); - // remove debug sourceURL in `_.template` + // remove `useSourceURL` variable + source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *try *\{(?:\s*\/\/.*\n)* *var useSourceURL[\s\S]+?catch[^}]+}\n/, ''); + + // remove debug sourceURL use in `_.template` source = source.replace(/(?:\s*\/\/.*\n)* *if *\(useSourceURL[^}]+}/, ''); // minify `_.sortBy` internal properties diff --git a/lodash.min.js b/lodash.min.js index bf0c5a88a2..9661393de3 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -2,31 +2,31 @@ Lo-Dash 0.3.1 lodash.com/license Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE */ -;(function(e,t){"use strict";function s(e){return"[object Arguments]"==it.call(e)}function o(e){return new u(e)}function u(e){if(e&&e._wrapped)return e;this._wrapped=e}function a(){for(var e,t,s,o=-1,u=arguments.length,a={e:"",f:"",k:"",q:"",c:{d:"",m:"++k/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var ct=Function("obj","var __p;with(obj){__p='var k,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;k=-1;';if(o){__p+='if(m===m>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&k==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var f='+l+'.constructor;';for(var k=0;k<7;k++){__p+='k=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(f&&f.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p" -),ht={a:"e,c,x",k:"e",q:"if(!c){c=j}else if(x){c=l(c,x)}",j:"c(e[k],k,e)"},pt={k:"z",j:"if(!c(e[k],k,e))return!r"},dt={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ue?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=C,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Ct(e));for( -var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(B,c)},o.every=bt, -o.extend=Nt,o.filter=Z,o.find=wt,o.first=y,o.flatten=b,o.forEach=Et,o.forIn=dt,o.forOwn=ht,o.functions=Ct,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&bt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=St,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++sarguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++r/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var lt=Function("obj","var __p;with(obj){__p='var k,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;k=-1;';if(o){__p+='if(m===m>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&k==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var f='+l+'.constructor;';for(var k=0;k<7;k++){__p+='k=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(f&&f.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p" +),ct={a:"e,c,x",k:"e",q:"if(!c){c=j}else if(x){c=l(c,x)}",j:"c(e[k],k,e)"},ht={k:"z",j:"if(!c(e[k],k,e))return!r"},pt={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ue?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=C,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Nt(e));for( +var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(B,c)},o.every=yt,o +.extend=Tt,o.filter=Y,o.find=bt,o.first=y,o.flatten=b,o.forEach=wt,o.forIn=pt,o.forOwn=ct,o.functions=Nt,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&yt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=Et,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++sarguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++ri?1:0});s--;)o[s]=o[s].b;return o},o.sortedIndex=T,o.tap=function(e,t){return t(e),e},o.template=function(e,t,n){n||(n={});var i;i=o.templateSettings;var s=n.escape,u=n.evaluate,a=n.interpolate,n=n.variable;return s==r&&(s=i.escape),u==r&&(u=i.evaluate),a==r&& (a=i.interpolate),s&&(e=e.replace(s,d)),a&&(e=e.replace(a,v)),u&&(e=e.replace(u,m)),e="__p='"+e.replace(j,l).replace(H,f)+"';",q.length=0,n||(n=i.variable,e="with("+n+"||{}){"+e+"}"),e="function("+n+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+e+"return __p}",i=Function("_","return "+e)(o),t?i(t):(i.source=e,i)},o.throttle=function(e,n){function r(){a=new Date,u=t,e.apply(o,i)}var i,s,o,u,a=0;return function(){var t=new Date,f=n-(t-a);return i=arguments,o= -this,0>=f?(a=t,s=e.apply(o,i)):u||(u=lt(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?rt.call(e):At(e)},o.union=function(){for(var e=-1,t=[],n=et.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=N,o.uniqueId=function(e){var t=_++;return e?e+t:t},o.values=At,o.without=function(e){var t=[];if(!e)return t;for( -var n=rt.call(arguments,1),r=-1,i=e.length;++rw(n,e[r])&&t.push(e[r]);return t},o.wrap=function(e,t){return function(){var n=[e];return arguments.length&&nt.apply(n,arguments),t.apply(this,n)}},o.zip=function(e){if(!e)return[];for(var t=-1,n=E(S(arguments,"length")),r=Array(n);++t=f?(a=t,s=e.apply(o,i)):u||(u=ft(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?nt.call(e):Lt(e)},o.union=function(){for(var e=-1,t=[],n=Z.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=N,o.uniqueId=function(e){var t=_++;return e?e+t:t},o.values=Lt,o.without=function(e){var t=[];if(!e)return t;for(var n= +nt.call(arguments,1),r=-1,i=e.length;++rw(n,e[r])&&t.push(e[r]);return t},o.wrap=function(e,t){return function(){var n=[e];return arguments.length&&tt.apply(n,arguments),t.apply(this,n)}},o.zip=function(e){if(!e)return[];for(var t=-1,n=E(S(arguments,"length")),r=Array(n);++t Date: Tue, 12 Jun 2012 23:44:21 -0400 Subject: [PATCH 06/15] Indicate slow paths in perf.js. Former-commit-id: 561e4f0957934b25422f7f515678705be4af726f --- perf/perf.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/perf/perf.js b/perf/perf.js index 75a1696b19..8d5b91dd98 100644 --- a/perf/perf.js +++ b/perf/perf.js @@ -238,7 +238,7 @@ ); suites.push( - Benchmark.Suite('each array thisArg') + Benchmark.Suite('each array thisArg (slow path)') .add('Lo-Dash', function() { var result = []; lodash.each(numbers, function(num, index) { @@ -416,7 +416,7 @@ ); suites.push( - Benchmark.Suite('map thisArg') + Benchmark.Suite('map thisArg (slow path)') .add('Lo-Dash', function() { lodash.map(objects, function(value, index) { return this['key' + index] + value.num; @@ -502,7 +502,7 @@ ); suites.push( - Benchmark.Suite('sortBy callback thisArg') + Benchmark.Suite('sortBy callback thisArg (slow path)') .add('Lo-Dash', function() { lodash.sortBy(numbers, function(num) { return this.sin(num); }, Math); }) @@ -534,7 +534,7 @@ ); suites.push( - Benchmark.Suite('sortedIndex callback') + Benchmark.Suite('sortedIndex callback (slow path)') .add('Lo-Dash', function() { lodash.sortedIndex(words, 'twenty-five', function(value) { return wordToNumber[value]; From fbdadec5e59a92c57b57fe425d379ad59a3a7e1d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 12 Jun 2012 23:45:06 -0400 Subject: [PATCH 07/15] Add `_.throttle` unit test for recursive calls. Former-commit-id: 7208516b56905c83df73aef6b02cee0101602349 --- doc/README.md | 2 +- lodash.js | 8 ++++---- test/test.js | 22 ++++++++++++++++++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/doc/README.md b/doc/README.md index f17a7d9f4d..b776a9db60 100644 --- a/doc/README.md +++ b/doc/README.md @@ -2221,7 +2221,7 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' }); ### `_.throttle(func, wait)` # [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2174 "View in source") [Ⓣ][1] -Creates a new 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, `func` will also be called on the trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. +Creates a new 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. #### Arguments 1. `func` *(Function)*: The function to throttle. diff --git a/lodash.js b/lodash.js index 43ddcb2083..c531b11853 100644 --- a/lodash.js +++ b/lodash.js @@ -2155,10 +2155,10 @@ /** * Creates a new 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, `func` will also be called on the trailing edge - * of the `wait` timeout. Subsequent calls to the throttled function will - * return the result of the last `func` call. + * 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. * * @static * @memberOf _ diff --git a/test/test.js b/test/test.js index 764d4d311e..78711a495a 100644 --- a/test/test.js +++ b/test/test.js @@ -642,6 +642,23 @@ } ok(counter > 1); }); + + asyncTest('supports recursive calls', function() { + var counter = 0; + var throttled = _.throttle(function() { + counter++; + if (counter < 4) { + throttled(); + } + }, 100); + + setTimeout(function() { + ok(counter > 1); + QUnit.start(); + }, 220); + + throttled(); + }); }()); /*--------------------------------------------------------------------------*/ @@ -790,6 +807,7 @@ /*--------------------------------------------------------------------------*/ // explicitly call `QUnit.start()` for Narwhal, Rhino, and RingoJS - QUnit.start(); - + if (!window.document) { + QUnit.start(); + } }(typeof global == 'object' && global || this)); From aef130b396d18f96b380ed332c91ef991b427a50 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 13 Jun 2012 00:21:03 -0400 Subject: [PATCH 08/15] Update submodules. Former-commit-id: 801d3c7413cb5906b4a517639098a6a32d015cba --- vendor/benchmark.js | 2 +- vendor/qunit-clib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/benchmark.js b/vendor/benchmark.js index 7e889ce6ad..ccf5dba9d1 160000 --- a/vendor/benchmark.js +++ b/vendor/benchmark.js @@ -1 +1 @@ -Subproject commit 7e889ce6ad3b130e6f82810c3a5fbe378717f556 +Subproject commit ccf5dba9d1d6ff6f36e2ba6a56356caa267e03b9 diff --git a/vendor/qunit-clib b/vendor/qunit-clib index 2ed9f21633..8b294472e6 160000 --- a/vendor/qunit-clib +++ b/vendor/qunit-clib @@ -1 +1 @@ -Subproject commit 2ed9f216330249d01c972a51d736266b003cc696 +Subproject commit 8b294472e63a338260909d8563111aa96944cf8a From ee2d0ddf8a19d11b14ad609dc135921cd41a1c15 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 13 Jun 2012 15:15:20 -0400 Subject: [PATCH 09/15] Ensure custom builds generate lodash.custom files. Former-commit-id: c89ee640688f6f598bb2d3834f714f0edc4ce7a4 --- build.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build.js b/build.js index 0b3fa2c0b2..fee4cb3388 100755 --- a/build.js +++ b/build.js @@ -217,9 +217,6 @@ /** Flag used to specify a mobile build */ var isMobile = process.argv.indexOf('mobile') > -1; - /** Flag used to specify a custom build */ - var isCustom = filterType || isBackbone || isMobile; - /*--------------------------------------------------------------------------*/ /** @@ -618,7 +615,7 @@ source = source.replace(/(?:(?:\s*\/\/.*)*\s*lodash\._[^=]+=.+\n)+/g, '\n'); // begin the minification process - if (isCustom) { + if (filterType || isBackbone || isMobile) { fs.writeFileSync(path.join(__dirname, 'lodash.custom.js'), source); minify(source, 'lodash.custom.min', function(result) { fs.writeFileSync(path.join(__dirname, 'lodash.custom.min.js'), result); From e5555dd26aa7fcb402d2c08923f22d202e69a1a8 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 13 Jun 2012 15:26:46 -0400 Subject: [PATCH 10/15] =?UTF-8?q?Move=20`=5F.tap`=20to=20the=20"Chaining"?= =?UTF-8?q?=20category,=20and=20deprecate=20`=5F(=E2=80=A6).chain`,=20`=5F?= =?UTF-8?q?.isNull`,=20`=5F.isUndefined`,=20`=5F.result`,=20and=20`=5F.siz?= =?UTF-8?q?e`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 64ee67758b8730fd70cbb28af4230bb336b91214 --- doc/README.md | 60 ++++++++++++++++++++--------------------- lodash.js | 75 +++++++++++++++++++++++++++------------------------ 2 files changed, 70 insertions(+), 65 deletions(-) diff --git a/doc/README.md b/doc/README.md index b776a9db60..fe0baaaa02 100644 --- a/doc/README.md +++ b/doc/README.md @@ -147,7 +147,7 @@ The `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3361 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3366 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -270,15 +270,15 @@ jQuery('#lodash_button').on('click', buttonView.onClick); ### `_.chain(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3313 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3291 "View in source") [Ⓣ][1] -Wraps the value in a `lodash` chainable object. +Wraps the value in a `lodash` wrapper object. #### Arguments 1. `value` *(Mixed)*: The value to wrap. #### Returns -*(Object)*: Returns the `lodash` chainable object. +*(Object)*: Returns the wrapper object. #### Example ~~~ js @@ -432,7 +432,7 @@ jQuery(window).on('resize', lazyLayout); ### `_.defaults(object [, defaults1, defaults2, ...])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2275 "View in source") [Ⓣ][1] -Assigns missing properties in `object` with default values from the defaults objects. As soon as a property is set, additional defaults of the same property will be ignored. +Assigns missing properties on `object` with default values from the defaults objects. Once a property is set, additional defaults of the same property will be ignored. #### Arguments 1. `object` *(Object)*: The object to populate. @@ -533,7 +533,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2999 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2976 "View in source") [Ⓣ][1] Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters. @@ -888,7 +888,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3018 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2995 "View in source") [Ⓣ][1] This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. @@ -1296,7 +1296,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2786 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2787 "View in source") [Ⓣ][1] Checks if a `value` is `null`. @@ -1323,7 +1323,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2803 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2804 "View in source") [Ⓣ][1] Checks if a `value` is a number. @@ -1374,7 +1374,7 @@ _.isObject(1); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2820 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2821 "View in source") [Ⓣ][1] Checks if a `value` is a regular expression. @@ -1398,7 +1398,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2837 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2838 "View in source") [Ⓣ][1] Checks if a `value` is a string. @@ -1422,7 +1422,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2854 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2856 "View in source") [Ⓣ][1] Checks if a `value` is `undefined`. @@ -1446,7 +1446,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2871 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2873 "View in source") [Ⓣ][1] Produces an array of object`'s own enumerable property names. @@ -1638,7 +1638,7 @@ _.min([10, 5, 100, 2, 1000]); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3044 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3021 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -1668,7 +1668,7 @@ _('larry').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3075 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3052 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -1741,7 +1741,7 @@ hi('moe'); ### `_.pick(object [, prop1, prop2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2893 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2895 "View in source") [Ⓣ][1] Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. @@ -1942,7 +1942,7 @@ _.rest([3, 2, 1]); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3106 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3084 "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. @@ -2001,7 +2001,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2931 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2934 "View in source") [Ⓣ][1] Gets the size of `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object. @@ -2130,9 +2130,9 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) { ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3318 "View in source") [Ⓣ][1] -Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The primary purpose of this method is to "tap into" a method chain, in order to performoperations on intermediate results within the chain. +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. #### Arguments 1. `value` *(Mixed)*: The value to pass to `callback`. @@ -2160,7 +2160,7 @@ _.chain([1,2,3,200]) ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3167 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3145 "View in source") [Ⓣ][1] A micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -2244,7 +2244,7 @@ jQuery(window).on('scroll', throttled); ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3256 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3234 "View in source") [Ⓣ][1] Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*. @@ -2354,7 +2354,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3283 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3261 "View in source") [Ⓣ][1] Generates a unique id. If `prefix` is passed, the id will be appended to it. @@ -2378,7 +2378,7 @@ _.uniqueId('contact_'); ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2977 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2954 "View in source") [Ⓣ][1] Produces an array of `object`'s own enumerable property values. @@ -2488,12 +2488,12 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ### `_.prototype.chain()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3331 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3336 "View in source") [Ⓣ][1] -Extracts the value from a wrapped chainable object. +Enables method chaining on the wrapper object. #### Returns -*(Mixed)*: Returns the wrapped object. +*(Mixed)*: Returns the wrapper object. #### Example ~~~ js @@ -2509,12 +2509,12 @@ _([1, 2, 3]).value(); ### `_.prototype.value()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3348 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3353 "View in source") [Ⓣ][1] -Extracts the value from a wrapped chainable object. +Extracts the wrapped value. #### Returns -*(Mixed)*: Returns the wrapped object. +*(Mixed)*: Returns the wrapped value. #### Example ~~~ js diff --git a/lodash.js b/lodash.js index c531b11853..f06744ae30 100644 --- a/lodash.js +++ b/lodash.js @@ -2256,9 +2256,9 @@ } /** - * Assigns missing properties in `object` with default values from the defaults - * objects. As soon as a property is set, additional defaults of the same - * property will be ignored. + * Assigns missing properties on `object` with default values from the defaults + * objects. Once a property is set, additional defaults of the same property + * will be ignored. * * @static * @memberOf _ @@ -2770,6 +2770,7 @@ /** * Checks if a `value` is `null`. * + * @deprecated * @static * @memberOf _ * @category Objects @@ -2841,6 +2842,7 @@ /** * Checks if a `value` is `undefined`. * + * @deprecated * @static * @memberOf _ * @category Objects @@ -2911,6 +2913,7 @@ * Gets the size of `value` by returning `value.length` if `value` is a string * or array, or the number of own enumerable properties if `value` is an object. * + * @deprecated * @static * @memberOf _ * @category Objects @@ -2935,32 +2938,6 @@ : keys(value).length; } - /** - * Invokes `interceptor` with the `value` as the first argument, and then returns - * `value`. The primary purpose of this method is to "tap into" a method chain, - * in order to performoperations on intermediate results within the chain. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to pass to `callback`. - * @param {Function} interceptor The function to invoke. - * @returns {Mixed} Returns `value`. - * @example - * - * _.chain([1,2,3,200]) - * .filter(function(num) { return num % 2 == 0; }) - * .tap(alert) - * .map(function(num) { return num * num }) - * .value(); - * // => // [2, 200] (alerted) - * // => [4, 40000] - */ - function tap(value, interceptor) { - interceptor(value); - return value; - } - /** * Produces an array of `object`'s own enumerable property values. * @@ -3082,6 +3059,7 @@ * it will be invoked and its result returned, else the property value is * returned. If `object` is falsey, then `null` is returned. * + * @deprecated * @static * @memberOf _ * @category Utilities @@ -3288,13 +3266,13 @@ /*--------------------------------------------------------------------------*/ /** - * Wraps the value in a `lodash` chainable object. + * Wraps the value in a `lodash` wrapper object. * * @static * @memberOf _ * @category Chaining * @param {Mixed} value The value to wrap. - * @returns {Object} Returns the `lodash` chainable object. + * @returns {Object} Returns the wrapper object. * @example * * var stooges = [ @@ -3317,12 +3295,39 @@ } /** - * Extracts the value from a wrapped chainable object. + * 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. + * + * @static + * @memberOf _ + * @category Chaining + * @param {Mixed} value The value to pass to `callback`. + * @param {Function} interceptor The function to invoke. + * @returns {Mixed} Returns `value`. + * @example + * + * _.chain([1,2,3,200]) + * .filter(function(num) { return num % 2 == 0; }) + * .tap(alert) + * .map(function(num) { return num * num }) + * .value(); + * // => // [2, 200] (alerted) + * // => [4, 40000] + */ + function tap(value, interceptor) { + interceptor(value); + return value; + } + + /** + * Enables method chaining on the wrapper object. * * @name chain + * @deprecated * @memberOf _ * @category Chaining - * @returns {Mixed} Returns the wrapped object. + * @returns {Mixed} Returns the wrapper object. * @example * * _([1, 2, 3]).value(); @@ -3334,12 +3339,12 @@ } /** - * Extracts the value from a wrapped chainable object. + * Extracts the wrapped value. * * @name value * @memberOf _ * @category Chaining - * @returns {Mixed} Returns the wrapped object. + * @returns {Mixed} Returns the wrapped value. * @example * * _([1, 2, 3]).value(); From 24c9b6e211fa44ee5b4ffb6563c43b698dc7ac92 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 14 Jun 2012 00:28:36 -0400 Subject: [PATCH 11/15] Move `_.pluck` and `_.invoke` back to the "Collections" category and optimize `_.sortedIndex` when a `callback` is passed. Former-commit-id: d16763e7d35660d8ba9ea976c8b2a4dc20f1211f --- build/pre-compile.js | 6 +- lodash.js | 169 +++++++++++++++++++++---------------------- test/test.js | 26 ++++++- 3 files changed, 112 insertions(+), 89 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index d3d67945cd..7f0a305020 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -8,6 +8,7 @@ /** Used to minify variables embedded in compiled strings */ var compiledVars = [ 'accumulator', + 'args', 'arrayClass', 'callback', 'className', @@ -18,14 +19,17 @@ 'hasOwnProperty', 'identity', 'index', + 'isFunc', 'iteratorBind', 'length', + 'methodName', + 'noaccum', 'object', 'objectTypes', - 'noaccum', 'property', 'result', 'skipProto', + 'slice', 'source', 'sourceIndex', 'stringClass', diff --git a/lodash.js b/lodash.js index f06744ae30..0020ad6633 100644 --- a/lodash.js +++ b/lodash.js @@ -339,6 +339,20 @@ } }; + /** Reusable iterator options for `invoke`, `map`, and `pluck` */ + var mapIteratorOptions = { + 'init': '', + 'exit': 'if (!collection) return []', + 'beforeLoop': { + 'array': 'result = Array(length)', + 'object': 'result = []' + }, + 'inLoop': { + 'array': 'result[index] = callback(collection[index], index, collection)', + 'object': 'result.push(callback(collection[index], index, collection))' + } + }; + /*--------------------------------------------------------------------------*/ /** @@ -437,13 +451,13 @@ // create the function factory var factory = Function( 'arrayClass, funcClass, hasOwnProperty, identity, iteratorBind, objectTypes, ' + - 'stringClass, toString, undefined', + 'slice, stringClass, toString, undefined', '"use strict"; return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( arrayClass, funcClass, hasOwnProperty, identity, iteratorBind, objectTypes, - stringClass, toString + slice, stringClass, toString ); } @@ -679,7 +693,40 @@ var forEach = createIterator(baseIteratorOptions, forEachIteratorOptions); /** - * Produces a new array of values by mapping each value in the `collection` + * Invokes the method named by `methodName` on each element in the `collection`. + * Additional arguments will be passed to each invoked method. If `methodName` + * is a function it will be invoked for, and `this` bound to, each element + * in the `collection`. + * + * @static + * @memberOf _ + * @category Collections + * @param {Array|Object} collection The collection to iterate over. + * @param {Function|String} methodName The name of the method to invoke or + * the function invoked per iteration. + * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the method with. + * @returns {Array} Returns a new array of values returned from each invoked method. + * @example + * + * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invoke([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + var invoke = createIterator(mapIteratorOptions, { + 'args': 'collection, methodName', + 'top': + 'var args = slice.call(arguments, 2),\n' + + ' isFunc = typeof methodName == \'function\'', + 'inLoop': { + 'array': 'result[index] = (isFunc ? methodName : collection[index][methodName]).apply(collection[index], args)', + 'object': 'result.push((isFunc ? methodName : collection[index][methodName]).apply(collection[index], args))' + } + }); + + /** + * Produces a new array of values by mapping each element in the `collection` * through a transformation `callback`. The `callback` is bound to `thisArg` * and invoked with 3 arguments; for arrays they are (value, index, array) * and for objects they are (value, key, object). @@ -700,16 +747,34 @@ * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); * // => [3, 6, 9] (order is not guaranteed) */ - var map = createIterator(baseIteratorOptions, { - 'init': '', - 'exit': 'if (!collection) return []', - 'beforeLoop': { - 'array': 'result = Array(length)', - 'object': 'result = []' - }, + var map = createIterator(baseIteratorOptions, mapIteratorOptions); + + /** + * Retrieves the value of a specified property from all elements in + * the `collection`. + * + * @static + * @memberOf _ + * @category Collections + * @param {Array|Object} collection The collection to iterate over. + * @param {String} property The property to pluck. + * @returns {Array} Returns a new array of property values. + * @example + * + * var stooges = [ + * { 'name': 'moe', 'age': 40 }, + * { 'name': 'larry', 'age': 50 }, + * { 'name': 'curly', 'age': 60 } + * ]; + * + * _.pluck(stooges, 'name'); + * // => ['moe', 'larry', 'curly'] + */ + var pluck = createIterator(mapIteratorOptions, { + 'args': 'collection, property', 'inLoop': { - 'array': 'result[index] = callback(collection[index], index, collection)', - 'object': 'result.push(callback(collection[index], index, collection))' + 'array': 'result[index] = collection[index][property]', + 'object': 'result.push(collection[index][property])' } }); @@ -1159,44 +1224,6 @@ return result; } - /** - * Invokes the method named by `methodName` on each element of `array`. - * Additional arguments will be passed to each invoked method. If `methodName` - * is a function it will be invoked for, and `this` bound to, each element - * of `array`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to iterate over. - * @param {Function|String} methodName The name of the method to invoke or - * the function invoked per iteration. - * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the method with. - * @returns {Array} Returns a new array of values returned from each invoked method. - * @example - * - * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invoke([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - function invoke(array, methodName) { - var result = []; - if (!array) { - return result; - } - var args = slice.call(arguments, 2), - index = -1, - length = array.length, - isFunc = typeof methodName == 'function'; - - while (++index < length) { - result[index] = (isFunc ? methodName : array[index][methodName]).apply(array[index], args); - } - return result; - } - /** * Gets the last value of the `array`. Pass `n` to return the lasy `n` values * of the `array`. @@ -1363,40 +1390,6 @@ return result; } - /** - * Retrieves the value of a specified property from all elements in `array`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to iterate over. - * @param {String} property The property to pluck. - * @returns {Array} Returns a new array of property values. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 }, - * { 'name': 'curly', 'age': 60 } - * ]; - * - * _.pluck(stooges, 'name'); - * // => ['moe', 'larry', 'curly'] - */ - function pluck(array, property) { - if (!array) { - return []; - } - var index = -1, - length = array.length, - result = Array(length); - - while (++index < length) { - result[index] = array[index][property]; - } - return result; - } - /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to but not including `stop`. This method is a port of Python's @@ -1608,10 +1601,14 @@ high = array.length; if (callback) { - value = callback.call(thisArg, value); + if (thisArg) { + var fn = callback; + callback = function(value) { return fn.call(thisArg, value); }; + } + value = callback(value); while (low < high) { mid = (low + high) >>> 1; - callback.call(thisArg, array[mid]) < value ? low = mid + 1 : high = mid; + callback(array[mid]) < value ? low = mid + 1 : high = mid; } } else { while (low < high) { diff --git a/test/test.js b/test/test.js index 78711a495a..f879363bc7 100644 --- a/test/test.js +++ b/test/test.js @@ -378,6 +378,17 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.invoke'); + + (function() { + test('should work with an object for `collection`', function() { + var object = { 'a': 1, 'b': 2, 'c': 3 }; + deepEqual(_.invoke(object, 'toFixed', 1), ['1.0', '2.0', '3.0']); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.isEmpty'); (function() { @@ -520,6 +531,17 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.pluck'); + + (function() { + test('should work with an object for `collection`', function() { + var object = { 'a': [1], 'b': [1, 2], 'c': [1, 2, 3] }; + deepEqual(_.pluck(object, 'length'), [1, 2, 3]); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.reduceRight'); (function() { @@ -743,12 +765,10 @@ 'indexOf', 'initial', 'intersection', - 'invoke', 'last', 'lastIndexOf', 'max', 'min', - 'pluck', 'range', 'rest', 'shuffle', @@ -782,7 +802,9 @@ 'filter', 'find', 'forEach', + 'invoke', 'map', + 'pluck', 'reduce', 'reduceRight', 'reject', From 3223e4ffa5c2bbc6b2f261963350dc956849b620 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 14 Jun 2012 00:29:14 -0400 Subject: [PATCH 12/15] Update documentation and minified build. Former-commit-id: 5472dccceb33c3575c538190472dde0e82bcfcde --- doc/README.md | 190 +++++++++++++++++++++++++------------------------- lodash.min.js | 56 +++++++-------- 2 files changed, 123 insertions(+), 123 deletions(-) diff --git a/doc/README.md b/doc/README.md index fe0baaaa02..3d21a50b59 100644 --- a/doc/README.md +++ b/doc/README.md @@ -38,7 +38,7 @@ * [`_.indexOf`](#_indexofarray-value--fromindex0) * [`_.initial`](#_initialarray--n-guard) * [`_.intersection`](#_intersectionarray1-array2-) -* [`_.invoke`](#_invokearray-methodname--arg1-arg2-) +* [`_.invoke`](#_invokecollection-methodname--arg1-arg2-) * [`_.isArguments`](#_isargumentsvalue) * [`_.isArray`](#_isarrayvalue) * [`_.isBoolean`](#_isbooleanvalue) @@ -67,7 +67,7 @@ * [`_.once`](#_oncefunc) * [`_.partial`](#_partialfunc--arg1-arg2-) * [`_.pick`](#_pickobject--prop1-prop2-) -* [`_.pluck`](#_pluckarray-property) +* [`_.pluck`](#_pluckcollection-property) * [`_.range`](#_rangestart0-end--step1) * [`_.reduce`](#_reducecollection-callback--accumulator-thisarg) * [`_.reduceRight`](#_reducerightcollection-callback--accumulator-thisarg) @@ -147,7 +147,7 @@ The `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3366 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3363 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -159,7 +159,7 @@ The `lodash` function. ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1801 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1798 "View in source") [Ⓣ][1] Creates a new function that is restricted to executing only after it is called `n` times. @@ -187,7 +187,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1855 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1852 "View in source") [Ⓣ][1] Creates a new 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. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`. @@ -238,7 +238,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1926 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1923 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound. @@ -270,7 +270,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick); ### `_.chain(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3291 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3288 "View in source") [Ⓣ][1] Wraps the value in a `lodash` wrapper object. @@ -304,7 +304,7 @@ var youngest = _.chain(stooges) ### `_.clone(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2252 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2249 "View in source") [Ⓣ][1] Create a shallow clone of the `value`. Any nested objects or arrays will be assigned by reference and not cloned. @@ -328,7 +328,7 @@ _.clone({ 'name': 'moe' }); ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L898 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L963 "View in source") [Ⓣ][1] Produces a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -352,7 +352,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1958 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1955 "View in source") [Ⓣ][1] Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. @@ -379,7 +379,7 @@ welcome('moe'); ### `_.contains(collection, target)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L584 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L598 "View in source") [Ⓣ][1] Checks if a given `target` value is present in a `collection` using strict equality for comparisons, i.e. `===`. @@ -404,7 +404,7 @@ _.contains([1, 2, 3], 3); ### `_.debounce(func, wait, immediate)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1991 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1988 "View in source") [Ⓣ][1] Creates a new 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. @@ -430,7 +430,7 @@ jQuery(window).on('resize', lazyLayout); ### `_.defaults(object [, defaults1, defaults2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2275 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2272 "View in source") [Ⓣ][1] Assigns missing properties on `object` with default values from the defaults objects. Once a property is set, additional defaults of the same property will be ignored. @@ -456,7 +456,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' }); ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2056 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2053 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments are passed to `func` when it is invoked. @@ -481,7 +481,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2036 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2033 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments are passed to `func` when it is invoked. @@ -508,7 +508,7 @@ _.delay(log, 1000, 'logged later'); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L930 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L995 "View in source") [Ⓣ][1] Produces a new array of `array` values not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -533,7 +533,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2976 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2973 "View in source") [Ⓣ][1] Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters. @@ -557,7 +557,7 @@ _.escape('Curly, Larry & Moe'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L609 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L623 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -583,7 +583,7 @@ _.every([true, 1, null, 'yes'], Boolean); ### `_.extend(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2294 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2291 "View in source") [Ⓣ][1] Copies enumerable properties from the source objects to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. @@ -608,7 +608,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L630 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L644 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning an array of all values the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -634,7 +634,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }) ### `_.find(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L652 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L666 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -660,7 +660,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.first(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L966 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1031 "View in source") [Ⓣ][1] Gets the first value of the `array`. Pass `n` to return the first `n` values of the `array`. @@ -686,7 +686,7 @@ _.first([5, 4, 3, 2, 1]); ### `_.flatten(array, shallow)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L990 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1055 "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. @@ -714,7 +714,7 @@ _.flatten([1, [2], [3, [[4]]]], true); ### `_.forEach(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L679 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L693 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each value in the `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -743,7 +743,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.forIn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2323 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2320 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. @@ -779,7 +779,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2346 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2343 "View in source") [Ⓣ][1] Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. @@ -807,7 +807,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2363 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2360 "View in source") [Ⓣ][1] Produces a sorted array of the enumerable properties, own and inherited, of `object` that have function values. @@ -831,7 +831,7 @@ _.functions(_); ### `_.groupBy(array, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1035 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1100 "View in source") [Ⓣ][1] Splits `array` into sets, grouped by the result of running each value through `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to group by. @@ -863,7 +863,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2386 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2383 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -888,7 +888,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2992 "View in source") [Ⓣ][1] This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. @@ -913,7 +913,7 @@ moe === _.identity(moe); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1081 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1146 "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 `isSorted` will run a faster binary search. @@ -945,7 +945,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1121 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1186 "View in source") [Ⓣ][1] Gets all but the last value of `array`. Pass `n` to exclude the last `n` values from the result. @@ -971,7 +971,7 @@ _.initial([3, 2, 1]); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1142 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1207 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays. @@ -994,13 +994,13 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); -### `_.invoke(array, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1184 "View in source") [Ⓣ][1] +### `_.invoke(collection, methodName [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L717 "View in source") [Ⓣ][1] -Invokes the method named by `methodName` on each element of `array`. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element of `array`. +Invokes the method named by `methodName` on each element in the `collection`. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`. #### Arguments -1. `array` *(Array)*: The array to iterate over. +1. `collection` *(Array|Object)*: The collection to iterate over. 2. `methodName` *(Function|String)*: The name of the method to invoke or the function invoked per iteration. 3. `[arg1, arg2, ...]` *(Mixed)*: Arguments to invoke the method with. @@ -1024,7 +1024,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2406 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2403 "View in source") [Ⓣ][1] Checks if a `value` is an `arguments` object. @@ -1051,7 +1051,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2432 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2429 "View in source") [Ⓣ][1] Checks if a `value` is an array. @@ -1078,7 +1078,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2449 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2446 "View in source") [Ⓣ][1] Checks if a `value` is a boolean *(`true` or `false`)* value. @@ -1102,7 +1102,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2466 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2463 "View in source") [Ⓣ][1] Checks if a `value` is a date. @@ -1126,7 +1126,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2483 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2480 "View in source") [Ⓣ][1] Checks if a `value` is a DOM element. @@ -1150,7 +1150,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2504 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2501 "View in source") [Ⓣ][1] Checks if a `value` is empty. Arrays or strings with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -1177,7 +1177,7 @@ _.isEmpty({}); ### `_.isEqual(a, b [, stack])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2538 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2535 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. @@ -1209,7 +1209,7 @@ _.isEqual(moe, clone); ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2696 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2693 "View in source") [Ⓣ][1] Checks if a `value` is a finite number. @@ -1239,7 +1239,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2713 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2710 "View in source") [Ⓣ][1] Checks if a `value` is a function. @@ -1263,7 +1263,7 @@ _.isFunction(''.concat); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2764 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2761 "View in source") [Ⓣ][1] Checks if a `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4. @@ -1296,7 +1296,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2787 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2784 "View in source") [Ⓣ][1] Checks if a `value` is `null`. @@ -1323,7 +1323,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2804 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2801 "View in source") [Ⓣ][1] Checks if a `value` is a number. @@ -1347,7 +1347,7 @@ _.isNumber(8.4 * 5; ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2734 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2731 "View in source") [Ⓣ][1] Checks if a `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)*`, and `new String('')`) @@ -1374,7 +1374,7 @@ _.isObject(1); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2821 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2818 "View in source") [Ⓣ][1] Checks if a `value` is a regular expression. @@ -1398,7 +1398,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2838 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2835 "View in source") [Ⓣ][1] Checks if a `value` is a string. @@ -1422,7 +1422,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2856 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2853 "View in source") [Ⓣ][1] Checks if a `value` is `undefined`. @@ -1446,7 +1446,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2873 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2870 "View in source") [Ⓣ][1] Produces an array of object`'s own enumerable property names. @@ -1470,7 +1470,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.last(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1218 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1245 "View in source") [Ⓣ][1] Gets the last value of the `array`. Pass `n` to return the lasy `n` values of the `array`. @@ -1496,7 +1496,7 @@ _.last([3, 2, 1]); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1244 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1271 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. @@ -1525,9 +1525,9 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L703 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L750 "View in source") [Ⓣ][1] -Produces a new array of values by mapping each value in the `collection` through a transformation `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. +Produces a new array of values by mapping each element in the `collection` through a transformation `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -1554,7 +1554,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); ### `_.max(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1284 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1311 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -1586,7 +1586,7 @@ _.max(stooges, function(stooge) { return stooge.age; }); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2079 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2076 "View in source") [Ⓣ][1] Creates a new 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. @@ -1612,7 +1612,7 @@ var fibonacci = _.memoize(function(n) { ### `_.min(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1334 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1361 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -1638,7 +1638,7 @@ _.min([10, 5, 100, 2, 1000]); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3021 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3018 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -1668,7 +1668,7 @@ _('larry').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3052 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3049 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -1688,7 +1688,7 @@ var lodash = _.noConflict(); ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2105 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2102 "View in source") [Ⓣ][1] Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call. @@ -1714,7 +1714,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2138 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2135 "View in source") [Ⓣ][1] Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the partially applied function. This method is similar `bind`, except it does **not** alter the `this` binding. @@ -1741,7 +1741,7 @@ hi('moe'); ### `_.pick(object [, prop1, prop2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2895 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2892 "View in source") [Ⓣ][1] Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. @@ -1765,13 +1765,13 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age'); -### `_.pluck(array, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1386 "View in source") [Ⓣ][1] +### `_.pluck(collection, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L773 "View in source") [Ⓣ][1] -Retrieves the value of a specified property from all elements in `array`. +Retrieves the value of a specified property from all elements in the `collection`. #### Arguments -1. `array` *(Array)*: The array to iterate over. +1. `collection` *(Array|Object)*: The collection to iterate over. 2. `property` *(String)*: The property to pluck. #### Returns @@ -1797,7 +1797,7 @@ _.pluck(stooges, 'name'); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1429 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1422 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range. @@ -1835,7 +1835,7 @@ _.range(0); ### `_.reduce(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L737 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L802 "View in source") [Ⓣ][1] Boils down 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 `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*. @@ -1862,7 +1862,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; }); ### `_.reduceRight(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L774 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L839 "View in source") [Ⓣ][1] The right-associative version of `_.reduce`. @@ -1890,7 +1890,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L825 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L890 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. @@ -1916,7 +1916,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.rest(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1465 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1458 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result. @@ -1942,7 +1942,7 @@ _.rest([3, 2, 1]); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3084 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3081 "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. @@ -1977,7 +1977,7 @@ _.result(object, 'stuff'); ### `_.shuffle(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1486 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1479 "View in source") [Ⓣ][1] Produces a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -2001,7 +2001,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2934 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2931 "View in source") [Ⓣ][1] Gets the size of `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object. @@ -2031,7 +2031,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L849 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L914 "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 `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -2057,7 +2057,7 @@ _.some([null, 0, 'yes', false]); ### `_.sortBy(array, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1528 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1521 "View in source") [Ⓣ][1] Produces a new sorted array, ranked in ascending order by the results of running each element of `array` through `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*. @@ -2089,7 +2089,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length'); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1602 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1595 "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 `1` argument; *(value)*. @@ -2130,7 +2130,7 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) { ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3318 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3315 "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. @@ -2160,7 +2160,7 @@ _.chain([1,2,3,200]) ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3145 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3142 "View in source") [Ⓣ][1] A micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -2219,7 +2219,7 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' }); ### `_.throttle(func, wait)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2174 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2171 "View in source") [Ⓣ][1] Creates a new 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. @@ -2244,7 +2244,7 @@ jQuery(window).on('scroll', throttled); ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3234 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3231 "View in source") [Ⓣ][1] Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*. @@ -2270,7 +2270,7 @@ _.times(3, function() { this.grantWish(); }, genie); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L868 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L933 "View in source") [Ⓣ][1] Converts the `collection`, into an array. Useful for converting the `arguments` object. @@ -2294,7 +2294,7 @@ Converts the `collection`, into an array. Useful for converting the `arguments` ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1639 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1636 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays. @@ -2318,7 +2318,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1684 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1681 "View in source") [Ⓣ][1] Produces 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 value of `array` is passed through a transformation `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -2354,7 +2354,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3261 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3258 "View in source") [Ⓣ][1] Generates a unique id. If `prefix` is passed, the id will be appended to it. @@ -2378,7 +2378,7 @@ _.uniqueId('contact_'); ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2954 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2951 "View in source") [Ⓣ][1] Produces an array of `object`'s own enumerable property values. @@ -2402,7 +2402,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1733 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1730 "View in source") [Ⓣ][1] Produces a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -2427,7 +2427,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.wrap(func, wrapper [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2226 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2223 "View in source") [Ⓣ][1] Create a new function that passes the `func` function to the `wrapper` function as its first argument. Additional arguments are appended to those passed to the `wrapper` function. @@ -2457,7 +2457,7 @@ hello(); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1766 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1763 "View in source") [Ⓣ][1] Merges together the values of each of the arrays with the value at the corresponding position. 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. @@ -2488,7 +2488,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ### `_.prototype.chain()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3336 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3333 "View in source") [Ⓣ][1] Enables method chaining on the wrapper object. @@ -2509,7 +2509,7 @@ _([1, 2, 3]).value(); ### `_.prototype.value()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3353 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3350 "View in source") [Ⓣ][1] Extracts the wrapped value. diff --git a/lodash.min.js b/lodash.min.js index 9661393de3..3fca0f3d8a 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -2,31 +2,31 @@ Lo-Dash 0.3.1 lodash.com/license Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE */ -;(function(e,t){"use strict";function s(e){return"[object Arguments]"==rt.call(e)}function o(e){return new u(e)}function u(e){if(e&&e._wrapped)return e;this._wrapped=e}function a(){for(var e,t,s,o=-1,u=arguments.length,a={e:"",f:"",k:"",q:"",c:{d:"",m:"++k/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var lt=Function("obj","var __p;with(obj){__p='var k,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;k=-1;';if(o){__p+='if(m===m>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&k==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var f='+l+'.constructor;';for(var k=0;k<7;k++){__p+='k=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(f&&f.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p" -),ct={a:"e,c,x",k:"e",q:"if(!c){c=j}else if(x){c=l(c,x)}",j:"c(e[k],k,e)"},ht={k:"z",j:"if(!c(e[k],k,e))return!r"},pt={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ue?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=C,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Nt(e));for( -var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(B,c)},o.every=yt,o -.extend=Tt,o.filter=Y,o.find=bt,o.first=y,o.flatten=b,o.forEach=wt,o.forIn=pt,o.forOwn=ct,o.functions=Nt,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&yt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=Et,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++sarguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++ri?1:0});s--;)o[s]=o[s].b;return o},o.sortedIndex=T,o.tap=function(e,t){return t(e),e},o.template=function(e,t,n){n||(n={});var i;i=o.templateSettings;var s=n.escape,u=n.evaluate,a=n.interpolate,n=n.variable;return s==r&&(s=i.escape),u==r&&(u=i.evaluate),a==r&& -(a=i.interpolate),s&&(e=e.replace(s,d)),a&&(e=e.replace(a,v)),u&&(e=e.replace(u,m)),e="__p='"+e.replace(j,l).replace(H,f)+"';",q.length=0,n||(n=i.variable,e="with("+n+"||{}){"+e+"}"),e="function("+n+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+e+"return __p}",i=Function("_","return "+e)(o),t?i(t):(i.source=e,i)},o.throttle=function(e,n){function r(){a=new Date,u=t,e.apply(o,i)}var i,s,o,u,a=0;return function(){var t=new Date,f=n-(t-a);return i=arguments,o= -this,0>=f?(a=t,s=e.apply(o,i)):u||(u=ft(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?nt.call(e):Lt(e)},o.union=function(){for(var e=-1,t=[],n=Z.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=N,o.uniqueId=function(e){var t=_++;return e?e+t:t},o.values=Lt,o.without=function(e){var t=[];if(!e)return t;for(var n= -nt.call(arguments,1),r=-1,i=e.length;++rw(n,e[r])&&t.push(e[r]);return t},o.wrap=function(e,t){return function(){var n=[e];return arguments.length&&tt.apply(n,arguments),t.apply(this,n)}},o.zip=function(e){if(!e)return[];for(var t=-1,n=E(S(arguments,"length")),r=Array(n);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var ft=Function("obj","var __p;with(obj){__p='var l,u';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var o='+g+'.length;l=-1;';if(o){__p+='if(o===o>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var v=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(v&&l==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var g='+l+'.constructor;';for(var k=0;k<7;k++){__p+='l=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(g&&g.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return u'}return __p" +),lt={a:"f,d,B",k:"f",q:"if(!d){d=k}else if(B){d=n(d,B)}",j:"d(f[l],l,f)"},ct={k:"D",j:"if(!d(f[l],l,f))return!u"},ht={a:"r",k:"r",q:"for(var x,y=1,o=arguments.length;ye?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=N,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Ct(e));for(var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(H,c)},o.every=yt,o.extend=Nt,o.filter=G,o.find=bt,o.first=y,o.flatten=b,o.forEach=wt,o.forIn=ht,o.forOwn=lt,o.functions=Ct,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&yt(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},o.map=St,o.max=E,o.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Z.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},o.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length;if(!t){for(;++sarguments.length&&(t=e||0,e=0);for(var r=-1,i=Math.max(Math.ceil((t-e)/n),0),s=Array(i);++ri?1:0});s--;)o[s]=o[s].b;return o},o.sortedIndex=x,o.tap=function(e,t){return t(e),e},o.template=function(e,t,n){n||(n={});var i;i=o.templateSettings;var s=n.escape,u=n.evaluate,a=n.interpolate,n=n.variable;return s== +r&&(s=i.escape),u==r&&(u=i.evaluate),a==r&&(a=i.interpolate),s&&(e=e.replace(s,d)),a&&(e=e.replace(a,v)),u&&(e=e.replace(u,m)),e="__p='"+e.replace(B,l).replace(P,f)+"';",I.length=0,n||(n=i.variable,e="with("+n+"||{}){"+e+"}"),e="function("+n+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+e+"return __p}",i=Function("_","return "+e)(o),t?i(t):(i.source=e,i)},o.throttle=function(e,n){function r(){a=new Date,u=t,e.apply(o,i)}var i,s,o,u,a=0;return function(){var t=new +Date,f=n-(t-a);return i=arguments,o=this,0>=f?(a=t,s=e.apply(o,i)):u||(u=at(r,f)),s}},o.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?tt.call(e):At(e)},o.union=function(){for(var e=-1,t=[],n=Y.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},o.uniq=T,o.uniqueId=function(e){var t=M++;return e?e+t:t},o.values=At,o.without=function( +e){var t=[];if(!e)return t;for(var n=tt.call(arguments,1),r=-1,i=e.length;++rw(n,e[r])&&t.push(e[r]);return t},o.wrap=function(e,t){return function(){var n=[e];return arguments.length&&et.apply(n,arguments),t.apply(this,n)}},o.zip=function(e){if(!e)return[];for(var t=-1,n=E(xt(arguments,"length")),r=Array(n);++t Date: Thu, 14 Jun 2012 01:06:08 -0400 Subject: [PATCH 13/15] Tweak `_.sortedIndex` for Chrome optimizations. Former-commit-id: d1d9f1bd1ecfd3bcde98aa51423e05e128f6ffd4 --- lodash.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index 0020ad6633..35da13999c 100644 --- a/lodash.js +++ b/lodash.js @@ -1602,8 +1602,7 @@ if (callback) { if (thisArg) { - var fn = callback; - callback = function(value) { return fn.call(thisArg, value); }; + callback = bind(callback, thisArg); } value = callback(value); while (low < high) { From 2a0b2238960617de5463959a0bcd01b888c058da Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 14 Jun 2012 02:01:00 -0400 Subject: [PATCH 14/15] Simplify dependencies in build.js. Former-commit-id: 2d154d1dfb4d639aa32c5e9aeaeea6942965aee7 --- build.js | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/build.js b/build.js index fee4cb3388..52cf7facbd 100755 --- a/build.js +++ b/build.js @@ -106,25 +106,24 @@ 'clone': ['extend', 'isArray'], 'compact': [], 'compose': [], - 'contains': ['createIterator'], - 'createIterator': [], + 'contains': [], 'debounce': [], - 'defaults': ['createIterator'], + 'defaults': [], 'defer': [], 'delay': [], 'difference': ['indexOf'], 'escape': [], - 'every': ['createIterator', 'identity'], - 'extend': ['createIterator'], - 'filter': ['createIterator', 'identity'], - 'find': ['createIterator'], + 'every': ['identity'], + 'extend': [], + 'filter': ['identity'], + 'find': [], 'first': [], 'flatten': ['isArray'], - 'forEach': ['createIterator'], - 'forIn': ['createIterator'], - 'forOwn': ['createIterator'], - 'functions': ['createIterator'], - 'groupBy': ['createIterator'], + 'forEach': [], + 'forIn': [], + 'forOwn': [], + 'functions': [], + 'groupBy': [], 'has': [], 'identity': [], 'indexOf': ['sortedIndex'], @@ -136,7 +135,7 @@ 'isBoolean': [], 'isDate': [], 'isElement': [], - 'isEmpty': ['createIterator'], + 'isEmpty': [], 'isEqual': [], 'isFinite': [], 'isFunction': [], @@ -147,10 +146,10 @@ 'isRegExp': [], 'isString': [], 'isUndefined': [], - 'keys': ['createIterator'], + 'keys': [], 'last': [], 'lastIndexOf': [], - 'map': ['createIterator', 'identity'], + 'map': ['identity'], 'max': [], 'memoize': [], 'min': [], @@ -161,16 +160,16 @@ 'pick': [], 'pluck': [], 'range': [], - 'reduce': ['createIterator'], + 'reduce': [], 'reduceRight': ['keys'], - 'reject': ['createIterator', 'identity'], + 'reject': ['identity'], 'rest': [], 'result': [], 'shuffle': [], 'size': ['keys'], - 'some': ['createIterator', 'identity'], + 'some': ['identity'], 'sortBy': [], - 'sortedIndex': ['identity'], + 'sortedIndex': ['bind'], 'tap': [], 'template': ['escape'], 'throttle': [], @@ -179,7 +178,7 @@ 'union': ['indexOf'], 'uniq': ['identity', 'indexOf'], 'uniqueId': [], - 'values': ['createIterator'], + 'values': [], 'without': ['indexOf'], 'wrap': [], 'zip': ['max', 'pluck'] From 6ce9df8504b4b9c628f10ecf89cb160b03166753 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 14 Jun 2012 02:38:42 -0400 Subject: [PATCH 15/15] Bump to v0.3.2. Former-commit-id: ff3cac0ce890b46a45c8738d559f68ac63b80caf --- README.md | 115 +++++++----------------- doc/README.md | 216 ++++++++++++++++++++++----------------------- doc/parse.php | 4 +- lodash.js | 38 ++++---- lodash.min.js | 20 ++--- package.json | 2 +- perf/perf.js | 2 +- test/backbone.html | 1 - vendor/backbone | 2 +- 9 files changed, 177 insertions(+), 223 deletions(-) diff --git a/README.md b/README.md index 177bc7df4e..1714f2ddcf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v0.3.1 +# Lo-Dash v0.3.2 A drop-in replacement for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#closed-underscorejs-issues), and [additional features](https://github.com/bestiejs/lodash#features). @@ -6,8 +6,8 @@ Lo-Dash’s performance is gained by avoiding slower native methods, instead opt ## Download - * [Development source](https://raw.github.com/bestiejs/lodash/v0.3.1/lodash.js) - * [Production source](https://raw.github.com/bestiejs/lodash/v0.3.1/lodash.min.js) + * [Development source](https://raw.github.com/bestiejs/lodash/v0.3.2/lodash.js) + * [Production source](https://raw.github.com/bestiejs/lodash/v0.3.2/lodash.min.js) * For optimal performance, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need ## Dive in @@ -39,7 +39,7 @@ For more information check out these screencasts over Lo-Dash: ## Support -Lo-Dash has been tested in at least Chrome 5-19, Firefox 1.5-13, IE 6-9, Opera 9.25-11.64, Safari 3.0.4-5.1.3, Node.js 0.4.8-0.6.18, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC3. +Lo-Dash has been tested in at least Chrome 5-19, Firefox 1.5-13, IE 6-9, Opera 9.25-12, Safari 3.0.4-5.1.3, Node.js 0.4.8-0.6.18, Narwhal 0.3.2, RingoJS 0.8, and Rhino 1.7RC3. ## Custom builds @@ -150,21 +150,22 @@ git submodule update --init ## Closed Underscore.js issues - * Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L266-272)] - * Ensure "Arrays" category methods allow falsey `array` arguments [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L714-748)] - * Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L237-243), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L533-542), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L661-664)] - * Ensure `_(...)` returns passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L106-109)] - * Ensure `_.groupBy` adds values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L317-324)] - * Ensure `_.sortedIndex` supports arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L586-595)] - * Ensure `_.throttle` works when called in tight loops [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L629-639)] - * Fix Firefox, IE, Opera, and Safari object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L175-187), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L277-302), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L379-390), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L398-400), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L418-438), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L554-556)] + * Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L271-276)] + * Ensure "Arrays" category methods allow falsey `array` arguments [[test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L758-790)] + * Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L242-248), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L560-569), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L705-708)] + * Ensure `_(…)` returns passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L106-109)] + * Ensure `_.escape` returns an empty string when passed `null` or `undefined` [[#407](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L161-164)] + * Ensure `_.groupBy` adds values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L322-329)] + * Ensure `_.sortedIndex` supports arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L613-622)] + * Ensure `_.throttle` works when called in tight loops [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L656-666)] + * Fix Firefox, IE, Opera, and Safari object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L180-192), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L282-307), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L395-406), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L414-416), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L434-454), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L581-583)] * Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)] - * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L88-94)] - * Register as AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L72-86)] - * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L232-235)] - * `_isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L408-410)] - * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L521-531)] - * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/801e8a5b3a963157fceaad15075690f59c22de9c/test/test.js#L550-552)] + * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L88-94)] + * Register as AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L72-86)] + * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L237-240)] + * `_isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L424-426)] + * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L548-558)] + * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/1ba47a7c2a35552796f0c75dc2b46660e230f842/test/test.js#L577-579)] ## Optimized methods (50+) @@ -220,70 +221,20 @@ git submodule update --init * `_.without` * `_.wrap` * `_.zip` - * plus all `_(...)` method wrappers - -## Changelog - -### v0.3.1 - - * Added `backbone` build option - * Ensured "Arrays" category methods allow falsey `array` arguments - * Removed `_.isArguments` fallback from the `mobile` build - * Simplified `_.pluck`, `_.values` and `_(...)` method wrappers - -### v0.3.0 - - * Added `category` build option - * Added `fromIndex` argument to `_.indexOf` and `_.lastIndexOf` - * Added `//@ sourceURL` support to `_.template` - * Added `thisArg` argument to `_.sortedIndex` and `_.uniq` - * Added `_.forIn` and `_.forOwn` methods - * Ensured array-like objects with invalid `length` properties are treated like regular objects - * Ensured `_.sortedIndex` supports arrays with high `length` values - * Fixed `prototype` property iteration bug in `_.keys` for Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 - * Optimized `_.times` and `this` bindings in iterator methods - -### v0.2.2 - - * Added `mobile` build option - * Ensured `_.find` returns `undefined` for unmatched values - * Ensured `_.templateSettings.variable` is compatible with Underscore.js - * Optimized `_.escape` - * Reduced dependencies in `_.find` - -### v0.2.1 - - * Adjusted the Lo-Dash export order for r.js - * Ensured `_.groupBy` values are added to own, not inherited, properties - * Made `_.bind` follow ES5 spec to support a popular Backbone.js pattern - * Removed the alias `intersect` - * Simplified `_.bind`, `_.flatten`, `_.groupBy`, `_.max`, and `_.min` - -### v0.2.0 - - * Added custom build options - * Added default `_.templateSettings.variable` value - * Added *"lazy bind"* support to `_.bind` - * Added native method overwrite detection to avoid bad native shims - * Added support for more AMD build optimizers and aliasing as the *"underscore"* module - * Added `thisArg` argument to `_.groupBy` - * Added whitespace to compiled strings - * Added `_.partial` method - * Commented the `iterationFactory` options object - * Ensured `_(...)` returns passed wrapper instances - * Ensured `_.max` and `_.min` support extremely large arrays - * Ensured `_.throttle` works in tight loops - * Fixed IE < 9 `[DontEnum]` bug and Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1’s `prototype` property iteration bug - * Inlined `_.isFunction` calls. - * Made `_.debounce`’ed functions match `_.throttle`’ed functions’ return value behavior - * Made `_.escape` no longer translate the *">"* character - * Fixed `clearTimeout` typo - * Simplified all methods in the *"Arrays"* category - * Optimized `_.debounce`, `_.escape`, `_.flatten`, `_.forEach`, `_.groupBy`, `_.intersection`, `_.invoke`, `_.isObject`, `_.max`, `_.min`, `_.pick`, `_.shuffle`, `_.sortedIndex`, `_.template`, `_.throttle`, `_.union`, `_.uniq` - -### v0.1.0 - - * Initial release + * plus all `_(…)` method wrappers + +## Release Notes + +### v0.3.2 + + * Deprecated `_(…).chain`, `_.isFinite`, `_.isNaN`, `_.isNull`, `_.isUndefined`, `_.result`, and `_.size` + * Ensured `_.escape` returns an empty string when passed `null` or `undefined` + * Ensured `sourceURL` support doesn't cause errors in Adobe's JS engine. + * Fixed regression in generating custom builds + * Moved `_.invoke` and `_.pluck` back to the *"Collections"* category + * Moved `_.tap` to the *"Chaining"* category + +The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog). ## BestieJS diff --git a/doc/README.md b/doc/README.md index 3d21a50b59..ceab12c141 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v0.3.1 +# Lo-Dash v0.3.2 @@ -129,7 +129,7 @@ ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L140 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L140 "View in source") [Ⓣ][1] The `lodash` function. @@ -147,7 +147,7 @@ The `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3363 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3366 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -159,7 +159,7 @@ The `lodash` function. ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1798 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1797 "View in source") [Ⓣ][1] Creates a new function that is restricted to executing only after it is called `n` times. @@ -187,7 +187,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1852 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1851 "View in source") [Ⓣ][1] Creates a new 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. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`. @@ -238,7 +238,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1923 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1922 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound. @@ -270,7 +270,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick); ### `_.chain(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3288 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3291 "View in source") [Ⓣ][1] Wraps the value in a `lodash` wrapper object. @@ -304,7 +304,7 @@ var youngest = _.chain(stooges) ### `_.clone(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2249 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2248 "View in source") [Ⓣ][1] Create a shallow clone of the `value`. Any nested objects or arrays will be assigned by reference and not cloned. @@ -328,7 +328,7 @@ _.clone({ 'name': 'moe' }); ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L963 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L963 "View in source") [Ⓣ][1] Produces a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -352,7 +352,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1955 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1954 "View in source") [Ⓣ][1] Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. @@ -379,7 +379,7 @@ welcome('moe'); ### `_.contains(collection, target)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L598 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L598 "View in source") [Ⓣ][1] Checks if a given `target` value is present in a `collection` using strict equality for comparisons, i.e. `===`. @@ -404,7 +404,7 @@ _.contains([1, 2, 3], 3); ### `_.debounce(func, wait, immediate)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1988 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1987 "View in source") [Ⓣ][1] Creates a new 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. @@ -430,7 +430,7 @@ jQuery(window).on('resize', lazyLayout); ### `_.defaults(object [, defaults1, defaults2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2272 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2271 "View in source") [Ⓣ][1] Assigns missing properties on `object` with default values from the defaults objects. Once a property is set, additional defaults of the same property will be ignored. @@ -456,7 +456,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' }); ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2053 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2052 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments are passed to `func` when it is invoked. @@ -481,7 +481,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2032 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments are passed to `func` when it is invoked. @@ -508,7 +508,7 @@ _.delay(log, 1000, 'logged later'); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L995 "View in source") [Ⓣ][1] Produces a new array of `array` values not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -533,7 +533,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2973 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2976 "View in source") [Ⓣ][1] Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters. @@ -557,7 +557,7 @@ _.escape('Curly, Larry & Moe'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L623 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L623 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -583,7 +583,7 @@ _.every([true, 1, null, 'yes'], Boolean); ### `_.extend(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2291 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2290 "View in source") [Ⓣ][1] Copies enumerable properties from the source objects to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. @@ -608,7 +608,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L644 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L644 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning an array of all values the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -634,7 +634,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }) ### `_.find(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L666 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L666 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -660,7 +660,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.first(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1031 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1031 "View in source") [Ⓣ][1] Gets the first value of the `array`. Pass `n` to return the first `n` values of the `array`. @@ -686,7 +686,7 @@ _.first([5, 4, 3, 2, 1]); ### `_.flatten(array, shallow)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1055 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1055 "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. @@ -714,7 +714,7 @@ _.flatten([1, [2], [3, [[4]]]], true); ### `_.forEach(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L693 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L693 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each value in the `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -743,7 +743,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.forIn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2320 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2319 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. @@ -779,7 +779,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2343 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2342 "View in source") [Ⓣ][1] Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. @@ -807,7 +807,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2360 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2359 "View in source") [Ⓣ][1] Produces a sorted array of the enumerable properties, own and inherited, of `object` that have function values. @@ -831,7 +831,7 @@ _.functions(_); ### `_.groupBy(array, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1100 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1100 "View in source") [Ⓣ][1] Splits `array` into sets, grouped by the result of running each value through `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to group by. @@ -863,7 +863,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2383 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2382 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -888,7 +888,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2992 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2995 "View in source") [Ⓣ][1] This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. @@ -913,7 +913,7 @@ moe === _.identity(moe); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1146 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1146 "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 `isSorted` will run a faster binary search. @@ -945,7 +945,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1186 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1186 "View in source") [Ⓣ][1] Gets all but the last value of `array`. Pass `n` to exclude the last `n` values from the result. @@ -971,7 +971,7 @@ _.initial([3, 2, 1]); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1207 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays. @@ -995,7 +995,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L717 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L717 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1024,9 +1024,9 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2403 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2402 "View in source") [Ⓣ][1] -Checks if a `value` is an `arguments` object. +Checks if `value` is an `arguments` object. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1051,9 +1051,9 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2429 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2428 "View in source") [Ⓣ][1] -Checks if a `value` is an array. +Checks if `value` is an array. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1078,9 +1078,9 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2446 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2445 "View in source") [Ⓣ][1] -Checks if a `value` is a boolean *(`true` or `false`)* value. +Checks if `value` is a boolean *(`true` or `false`)* value. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1102,9 +1102,9 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2463 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2462 "View in source") [Ⓣ][1] -Checks if a `value` is a date. +Checks if `value` is a date. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1126,9 +1126,9 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2480 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2479 "View in source") [Ⓣ][1] -Checks if a `value` is a DOM element. +Checks if `value` is a DOM element. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1150,9 +1150,9 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2501 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2500 "View in source") [Ⓣ][1] -Checks if a `value` is empty. Arrays or strings with a length of `0` and objects with no own enumerable properties are considered "empty". +Checks if `value` is empty. Arrays or strings with a length of `0` and objects with no own enumerable properties are considered "empty". #### Arguments 1. `value` *(Array|Object|String)*: The value to inspect. @@ -1177,7 +1177,7 @@ _.isEmpty({}); ### `_.isEqual(a, b [, stack])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2535 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2534 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. @@ -1209,9 +1209,9 @@ _.isEqual(moe, clone); ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2693 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2695 "View in source") [Ⓣ][1] -Checks if a `value` is a finite number. +Checks if `value` is a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and other values. See http://es5.github.com/#x15.1.2.5. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1239,9 +1239,9 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2710 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2712 "View in source") [Ⓣ][1] -Checks if a `value` is a function. +Checks if `value` is a function. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1263,9 +1263,9 @@ _.isFunction(''.concat); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2761 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2764 "View in source") [Ⓣ][1] -Checks if a `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4. +Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1296,9 +1296,9 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2784 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2787 "View in source") [Ⓣ][1] -Checks if a `value` is `null`. +Checks if `value` is `null`. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1323,9 +1323,9 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2801 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2804 "View in source") [Ⓣ][1] -Checks if a `value` is a number. +Checks if `value` is a number. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1347,9 +1347,9 @@ _.isNumber(8.4 * 5; ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2731 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2733 "View in source") [Ⓣ][1] -Checks if a `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)*`, and `new String('')`) +Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)*`, and `new String('')`) #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1374,9 +1374,9 @@ _.isObject(1); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2818 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2821 "View in source") [Ⓣ][1] -Checks if a `value` is a regular expression. +Checks if `value` is a regular expression. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1398,9 +1398,9 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2835 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2838 "View in source") [Ⓣ][1] -Checks if a `value` is a string. +Checks if `value` is a string. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1422,9 +1422,9 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2853 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2856 "View in source") [Ⓣ][1] -Checks if a `value` is `undefined`. +Checks if `value` is `undefined`. #### Arguments 1. `value` *(Mixed)*: The value to check. @@ -1446,7 +1446,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2870 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2873 "View in source") [Ⓣ][1] Produces an array of object`'s own enumerable property names. @@ -1470,7 +1470,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.last(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1245 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1245 "View in source") [Ⓣ][1] Gets the last value of the `array`. Pass `n` to return the lasy `n` values of the `array`. @@ -1496,7 +1496,7 @@ _.last([3, 2, 1]); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1271 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1271 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. @@ -1525,7 +1525,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L750 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L750 "View in source") [Ⓣ][1] Produces a new array of values by mapping each element in the `collection` through a transformation `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -1554,7 +1554,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); ### `_.max(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1311 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1311 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -1586,7 +1586,7 @@ _.max(stooges, function(stooge) { return stooge.age; }); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2076 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2075 "View in source") [Ⓣ][1] Creates a new 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. @@ -1612,7 +1612,7 @@ var fibonacci = _.memoize(function(n) { ### `_.min(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1361 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1361 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -1638,7 +1638,7 @@ _.min([10, 5, 100, 2, 1000]); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3018 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3021 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -1668,7 +1668,7 @@ _('larry').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3049 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3052 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -1688,7 +1688,7 @@ var lodash = _.noConflict(); ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2102 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2101 "View in source") [Ⓣ][1] Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call. @@ -1714,7 +1714,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2135 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2134 "View in source") [Ⓣ][1] Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the partially applied function. This method is similar `bind`, except it does **not** alter the `this` binding. @@ -1741,7 +1741,7 @@ hi('moe'); ### `_.pick(object [, prop1, prop2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2892 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2895 "View in source") [Ⓣ][1] Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. @@ -1766,7 +1766,7 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L773 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L773 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1797,7 +1797,7 @@ _.pluck(stooges, 'name'); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1422 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1422 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range. @@ -1835,7 +1835,7 @@ _.range(0); ### `_.reduce(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L802 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L802 "View in source") [Ⓣ][1] Boils down 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 `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*. @@ -1862,7 +1862,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; }); ### `_.reduceRight(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L839 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L839 "View in source") [Ⓣ][1] The right-associative version of `_.reduce`. @@ -1890,7 +1890,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L890 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L890 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. @@ -1916,7 +1916,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.rest(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1458 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1458 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result. @@ -1942,7 +1942,7 @@ _.rest([3, 2, 1]); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3081 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3084 "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. @@ -1977,7 +1977,7 @@ _.result(object, 'stuff'); ### `_.shuffle(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1479 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1479 "View in source") [Ⓣ][1] Produces a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -2001,7 +2001,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2931 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2934 "View in source") [Ⓣ][1] Gets the size of `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object. @@ -2031,7 +2031,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L914 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L914 "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 `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -2057,7 +2057,7 @@ _.some([null, 0, 'yes', false]); ### `_.sortBy(array, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1521 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1521 "View in source") [Ⓣ][1] Produces a new sorted array, ranked in ascending order by the results of running each element of `array` through `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*. @@ -2089,7 +2089,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length'); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1595 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1595 "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 `1` argument; *(value)*. @@ -2130,7 +2130,7 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) { ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3315 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3318 "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. @@ -2160,7 +2160,7 @@ _.chain([1,2,3,200]) ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3142 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3145 "View in source") [Ⓣ][1] A micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -2219,7 +2219,7 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' }); ### `_.throttle(func, wait)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2171 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2170 "View in source") [Ⓣ][1] Creates a new 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. @@ -2244,7 +2244,7 @@ jQuery(window).on('scroll', throttled); ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3231 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3234 "View in source") [Ⓣ][1] Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*. @@ -2270,7 +2270,7 @@ _.times(3, function() { this.grantWish(); }, genie); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L933 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L933 "View in source") [Ⓣ][1] Converts the `collection`, into an array. Useful for converting the `arguments` object. @@ -2294,7 +2294,7 @@ Converts the `collection`, into an array. Useful for converting the `arguments` ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1636 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1635 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays. @@ -2318,7 +2318,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1681 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1680 "View in source") [Ⓣ][1] Produces 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 value of `array` is passed through a transformation `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -2354,7 +2354,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3258 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3261 "View in source") [Ⓣ][1] Generates a unique id. If `prefix` is passed, the id will be appended to it. @@ -2378,7 +2378,7 @@ _.uniqueId('contact_'); ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2951 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2954 "View in source") [Ⓣ][1] Produces an array of `object`'s own enumerable property values. @@ -2402,7 +2402,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1730 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1729 "View in source") [Ⓣ][1] Produces a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -2427,7 +2427,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.wrap(func, wrapper [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L2223 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L2222 "View in source") [Ⓣ][1] Create a new function that passes the `func` function to the `wrapper` function as its first argument. Additional arguments are appended to those passed to the `wrapper` function. @@ -2457,7 +2457,7 @@ hello(); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L1763 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L1762 "View in source") [Ⓣ][1] Merges together the values of each of the arrays with the value at the corresponding position. 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. @@ -2488,7 +2488,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ### `_.prototype.chain()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3333 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3336 "View in source") [Ⓣ][1] Enables method chaining on the wrapper object. @@ -2509,7 +2509,7 @@ _([1, 2, 3]).value(); ### `_.prototype.value()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L3350 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L3353 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -2537,7 +2537,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L168 "View in source") [Ⓣ][1] *(Object)*: By default, Lo-Dash uses ERB-style template delimiters, change the following template settings to use alternative delimiters. @@ -2549,7 +2549,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L177 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L177 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -2561,7 +2561,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L186 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L186 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -2573,7 +2573,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L195 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L195 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -2585,7 +2585,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js#L204 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js#L204 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. diff --git a/doc/parse.php b/doc/parse.php index 1cc10f05dd..240404ce79 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -21,8 +21,8 @@ // generate Markdown $markdown = docdown(array( 'path' => '../' . $file, - 'title' => 'Lo-Dash v0.3.1', - 'url' => 'https://github.com/bestiejs/lodash/blob/v0.3.1/lodash.js' + 'title' => 'Lo-Dash v0.3.2', + 'url' => 'https://github.com/bestiejs/lodash/blob/v0.3.2/lodash.js' )); // save to a .md file diff --git a/lodash.js b/lodash.js index 35da13999c..b5fa4b2f29 100644 --- a/lodash.js +++ b/lodash.js @@ -1,5 +1,5 @@ /*! - * Lo-Dash v0.3.1 + * Lo-Dash v0.3.2 * Copyright 2012 John-David Dalton * Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. * @@ -2384,7 +2384,7 @@ } /** - * Checks if a `value` is an `arguments` object. + * Checks if `value` is an `arguments` object. * * @static * @memberOf _ @@ -2410,7 +2410,7 @@ } /** - * Checks if a `value` is an array. + * Checks if `value` is an array. * * @static * @memberOf _ @@ -2430,7 +2430,7 @@ }; /** - * Checks if a `value` is a boolean (`true` or `false`) value. + * Checks if `value` is a boolean (`true` or `false`) value. * * @static * @memberOf _ @@ -2447,7 +2447,7 @@ } /** - * Checks if a `value` is a date. + * Checks if `value` is a date. * * @static * @memberOf _ @@ -2464,7 +2464,7 @@ } /** - * Checks if a `value` is a DOM element. + * Checks if `value` is a DOM element. * * @static * @memberOf _ @@ -2481,7 +2481,7 @@ } /** - * Checks if a `value` is empty. Arrays or strings with a length of `0` and + * Checks if `value` is empty. Arrays or strings with a length of `0` and * objects with no own enumerable properties are considered "empty". * * @static @@ -2671,8 +2671,11 @@ } /** - * Checks if a `value` is a finite number. + * Checks if `value` is a finite number. + * Note: This is not the same as native `isFinite`, which will return true for + * booleans and other values. See http://es5.github.com/#x15.1.2.5. * + * @deprecated * @static * @memberOf _ * @category Objects @@ -2694,7 +2697,7 @@ } /** - * Checks if a `value` is a function. + * Checks if `value` is a function. * * @static * @memberOf _ @@ -2711,7 +2714,7 @@ } /** - * Checks if a `value` is the language type of Object. + * Checks if `value` is the language type of Object. * (e.g. arrays, functions, objects, regexps, `new Number(0)`, and `new String('')`) * * @static @@ -2734,10 +2737,11 @@ } /** - * Checks if a `value` is `NaN`. + * Checks if `value` is `NaN`. * Note: This is not the same as native `isNaN`, which will return true for * `undefined` and other values. See http://es5.github.com/#x15.1.2.4. * + * @deprecated * @static * @memberOf _ * @category Objects @@ -2764,7 +2768,7 @@ } /** - * Checks if a `value` is `null`. + * Checks if `value` is `null`. * * @deprecated * @static @@ -2785,7 +2789,7 @@ } /** - * Checks if a `value` is a number. + * Checks if `value` is a number. * * @static * @memberOf _ @@ -2802,7 +2806,7 @@ } /** - * Checks if a `value` is a regular expression. + * Checks if `value` is a regular expression. * * @static * @memberOf _ @@ -2819,7 +2823,7 @@ } /** - * Checks if a `value` is a string. + * Checks if `value` is a string. * * @static * @memberOf _ @@ -2836,7 +2840,7 @@ } /** - * Checks if a `value` is `undefined`. + * Checks if `value` is `undefined`. * * @deprecated * @static @@ -3359,7 +3363,7 @@ * @memberOf _ * @type String */ - lodash.VERSION = '0.3.1'; + lodash.VERSION = '0.3.2'; // assign static methods lodash.after = after; diff --git a/lodash.min.js b/lodash.min.js index 3fca0f3d8a..63cb9e086f 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -1,22 +1,22 @@ /*! - Lo-Dash 0.3.1 lodash.com/license + Lo-Dash 0.3.2 lodash.com/license Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE */ ;(function(e,t){"use strict";function s(e){return"[object Arguments]"==nt.call(e)}function o(e){return new u(e)}function u(e){if(e&&e._wrapped)return e;this._wrapped=e}function a(){for(var e,t,s,o=-1,u=arguments.length,a={e:"",f:"",k:"",q:"",c:{d:"",m:"++l/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var ft=Function("obj","var __p;with(obj){__p='var l,u';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var o='+g+'.length;l=-1;';if(o){__p+='if(o===o>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var v=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(v&&l==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var g='+l+'.constructor;';for(var k=0;k<7;k++){__p+='l=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(g&&g.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return u'}return __p" +}function w(e,t,n){if(!e)return-1;var r=-1,i=e.length;if(n){if("number"!=typeof n)return r=x(e,t),e[r]===t?r:-1;r=(0>n?Math.max(0,i+n):n)-1}for(;++ri&&(i=e[s]);return i}for(n&&(t=h(t,n));++sr&&(r=n,i=e[s]);return i}function S(e,n,r){return e?tt.call(e,n==t||r?1:n):[]}function x(e,t,n,r){if(!e)return 0;var i=0,s=e.length;if(n){r&&(n=N(n,r));for(t=n( +t);i>>1,n(e[r])>>1,e[r]w(a,r))a.push(r),s.push(e[o]);return s}function N(e,t){function n(){var u=arguments,a=t;return s||(e=t[i]),o.length&&(u=u.length?Y.apply(o,u):o),this instanceof n?(p.prototype=e.prototype,a=new p,u=e.apply(a,u),R[typeof u]&&u!==r?u:a +):e.apply(a,u)}var i,s=nt.call(e)==V;if(s){if(rt)return rt.call.apply(rt,arguments)}else i=t,t=e;var o=tt.call(arguments,2);return n}function C(e,r,s){s||(s=[]);if(e===r)return 0!==e||1/e==1/r;if(e==t||r==t)return e===r;e._chain&&(e=e._wrapped),r._chain&&(r=r._wrapped);if(e.isEqual&&nt.call(e.isEqual)==V)return e.isEqual(r);if(r.isEqual&&nt.call(r.isEqual)==V)return r.isEqual(e);var o=nt.call(e);if(o!=nt.call(r))return i;switch(o){case K:return e==""+r;case $:return e!=+e?r!=+r:0==e?1/e==1/r:e==+ +r;case W:case X:return+e==+r;case J:return e.source==r.source&&e.global==r.global&&e.multiline==r.multiline&&e.ignoreCase==r.ignoreCase}if("object"!=typeof e||"object"!=typeof r)return i;for(var u=s.length;u--;)if(s[u]==e)return n;var u=-1,a=n,f=0;s.push(e);if(o==z){if(f=e.length,a=f==r.length)for(;f--&&(a=C(e[f],r[f],s)););}else{if("constructor"in e!="constructor"in r||e.constructor!=r.constructor)return i;for(var l in e)if(Z.call(e,l)&&(f++,!(a=Z.call(r,l)&&C(e[l],r[l],s))))break;if(a){for(l in +r)if(Z.call(r,l)&&!(f--))break;a=!f}if(a&&O)for(;7>++u&&(l=j[u],!Z.call(e,l)||!!(a=Z.call(r,l)&&C(e[l],r[l],s))););}return s.pop(),a}function k(e){return e}function L(e){wt(Ct(e),function(t){var r=o[t]=e[t];u.prototype[t]=function(){var e=[this._wrapped];return arguments.length&&et.apply(e,arguments),e=r.apply(o,e),this._chain&&(e=new u(e),e._chain=n),e}})}var n=!0,r=null,i=!1,A="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),O=!{valueOf +:0}.propertyIsEnumerable("valueOf"),M=0,_=e._,D=RegExp("^"+({}.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),P=/__token__(\d+)/g,H=/[&<"']/g,B=/['\n\r\t\u2028\u2029\\]/g,j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),F="__token__",I=[],q={"&":"&","<":"<",'"':""","'":"'"},R={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},U={"\\":"\\","'":"'","\n":"n" +,"\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},z="[object Array]",W="[object Boolean]",X="[object Date]",V="[object Function]",$="[object Number]",J="[object RegExp]",K="[object String]",Q=Array.prototype,G=Object.prototype,Y=Q.concat,Z=G.hasOwnProperty,et=Q.push,tt=Q.slice,nt=G.toString,rt=D.test(rt=tt.bind)&&/\n|Opera/.test(rt+nt.call(e.opera))&&rt,it=D.test(it=Array.isArray)&&it,st=e.isFinite,ot=D.test(ot=Object.keys)&&ot,ut=e.clearTimeout,at=e.setTimeout;o.templateSettings={escape:/<%-([\s\S]+?)%>/g +,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var ft=Function("obj","var __p;with(obj){__p='var l,u';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var o='+g+'.length;l=-1;';if(o){__p+='if(o===o>>>0){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var v=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(v&&l==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var g='+l+'.constructor;';for(var k=0;k<7;k++){__p+='l=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(g&&g.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return u'}return __p" ),lt={a:"f,d,B",k:"f",q:"if(!d){d=k}else if(B){d=n(d,B)}",j:"d(f[l],l,f)"},ct={k:"D",j:"if(!d(f[l],l,f))return!u"},ht={a:"r",k:"r",q:"for(var x,y=1,o=arguments.length;ye?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=N,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Ct(e));for(var r=t.length;ne?t():function(){if(1>--e)return t.apply(this,arguments)}},o.bind=N,o.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Ct(e));for(var r=t.length;nw(i,e[n])&&t.push(e[n]);return t},o.escape=function(e){return e==r?"":(e+"").replace(H,c)},o.every=yt,o.extend=Nt,o.filter=G,o.find=bt,o.first=y,o.flatten=b,o.forEach=wt,o.forIn=ht,o.forOwn=lt,o.functions=Ct,o.groupBy=function(e,t,n){var r={};if(!e)return r;var i,s=-1,o="function"==typeof t,u=e.length;for(o&&n&&(t=h(t,n));++sw(t,n)&&yt(s,function(e){return-1Test - \ No newline at end of file diff --git a/vendor/backbone b/vendor/backbone index 7bcd6ad514..d4d7fb97a5 160000 --- a/vendor/backbone +++ b/vendor/backbone @@ -1 +1 @@ -Subproject commit 7bcd6ad514f9d5682a2a5d5e892fc820d8ad1cce +Subproject commit d4d7fb97a5e0392578481212f93c371470e70898