From cd7bf405085c0854ff5a1121b2693c420a4f34ac Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 23 Sep 2013 08:38:52 -0700 Subject: [PATCH 01/24] Have the npm packages link in the readme use the "lodash-modularized" keyword. [ci skip] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45f2cd3293..71e2c70af2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A utility library delivering consistency, [customization](http://lodash.com/cust CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash).
For smaller file sizes, create [custom builds](http://lodash.com/custom-builds) with only the features needed.
-Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-node](https://npmjs.org/package/lodash-node), and [npm packages](https://npmjs.org/browse/author/jdalton) per method. +Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-node](https://npmjs.org/package/lodash-node), and [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method. ## Dive in From e04790a628dc335cfa927928fe44b65de1cbe586 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 23 Sep 2013 09:12:50 -0700 Subject: [PATCH 02/24] Update docs to make the list of aliases more descriptive. [ci skip] --- doc/README.md | 36 +++++++++---------- .../docdown/src/DocDown/MarkdownGenerator.php | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/doc/README.md b/doc/README.md index 62a91e4a09..1e74bfa724 100644 --- a/doc/README.md +++ b/doc/README.md @@ -347,7 +347,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*head, take* +*_.head, _.take* #### Arguments 1. `array` *(Array)*: The array to query. @@ -753,7 +753,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*drop, tail* +*_.drop, _.tail* #### Arguments 1. `array` *(Array)*: The array to query. @@ -886,7 +886,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*unique* +*_.unique* #### Arguments 1. `array` *(Array)*: The array to process. @@ -954,7 +954,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. #### Aliases -*unzip* +*_.unzip* #### Arguments 1. `[array]` *(...Array)*: Arrays to process. @@ -981,7 +981,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); Creates an object composed from arrays of `keys` and `values`. Provide either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` or two arrays, one of `keys` and one of corresponding `values`. #### Aliases -*object* +*_.object* #### Arguments 1. `keys` *(Array)*: The array of keys. @@ -1177,7 +1177,7 @@ _([1, 2, 3]).toString(); Extracts the wrapped value. #### Aliases -*value* +*_.prototype.value* #### Returns *(\*)*: Returns the wrapped value. @@ -1236,7 +1236,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); Checks if a given value is present in a collection using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. #### Aliases -*include* +*_.include* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1314,7 +1314,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*all* +*_.all* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1360,7 +1360,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*select* +*_.select* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1406,7 +1406,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*detect, findWhere* +*_.detect, _.findWhere* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1479,7 +1479,7 @@ _.findLast([1, 2, 3, 4], function(num) { Iterates over elements of a collection, executing the callback for each element. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. #### Aliases -*each* +*_.each* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1511,7 +1511,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); This method is like `_.forEach` except that it iterates over elements of a `collection` from right to left. #### Aliases -*eachRight* +*_.eachRight* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1651,7 +1651,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*collect* +*_.collect* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1806,7 +1806,7 @@ _.pluck(stooges, 'name'); Reduces a collection to a value which is the accumulated result of running each element in the collection through the callback, where each successive callback execution consumes the return value of the previous execution. If `accumulator` is not provided the first element of the collection will be used as the initial `accumulator` value. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. #### Aliases -*foldl, inject* +*_.foldl, _.inject* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -1844,7 +1844,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { This method is like `_.reduce` except that it iterates over elements of a `collection` from right to left. #### Aliases -*foldr* +*_.foldr* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -2004,7 +2004,7 @@ If a property name is provided for `callback` the created "_.pluck" style callba If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*any* +*_.any* #### Arguments 1. `collection` *(Array|Object|string)*: The collection to iterate over. @@ -2693,7 +2693,7 @@ hello(); Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the assigned values. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. #### Aliases -*extend* +*_.extend* #### Arguments 1. `object` *(Object)*: The destination object. @@ -3034,7 +3034,7 @@ _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { Creates a sorted array of property names of all enumerable properties, own and inherited, of `object` that have function values. #### Aliases -*methods* +*_.methods* #### Arguments 1. `object` *(Object)*: The object to inspect. diff --git a/vendor/docdown/src/DocDown/MarkdownGenerator.php b/vendor/docdown/src/DocDown/MarkdownGenerator.php index 16ceb1198c..0cd0de247d 100644 --- a/vendor/docdown/src/DocDown/MarkdownGenerator.php +++ b/vendor/docdown/src/DocDown/MarkdownGenerator.php @@ -195,7 +195,7 @@ private function addEntries( &$result, $entries ) { if (count($aliases = $entry->getAliases())) { array_push($result, '', '#### Aliases'); foreach ($aliases as $index => $alias) { - $aliases[$index] = $alias->getName(); + $aliases[$index] = MarkdownGenerator::interpolate('#{member}#{separator}#{name}', $alias); } $result[] = '*' . implode(', ', $aliases) . '*'; } From 92409831c2ff5b6e23bdf74df591ecdd278b96bd Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 24 Sep 2013 00:10:16 -0700 Subject: [PATCH 03/24] Reduce dependency on `getObject`. --- dist/lodash.compat.js | 81 +++++++++++++++------------ dist/lodash.compat.min.js | 102 +++++++++++++++++----------------- dist/lodash.js | 35 +++++++----- dist/lodash.min.js | 94 +++++++++++++++---------------- dist/lodash.underscore.min.js | 6 +- lodash.js | 84 +++++++++++++++------------- 6 files changed, 210 insertions(+), 192 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index a0248551ac..5edf2c9811 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -111,6 +111,36 @@ cloneableClasses[numberClass] = cloneableClasses[objectClass] = cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; + /** Used as an internal `_.debounce` options object */ + var debounceOptions = { + 'leading': false, + 'maxWait': 0, + 'trailing': false + }; + + /** Used as the property descriptor for `__bindData__` */ + var descriptor = { + 'configurable': false, + 'enumerable': false, + 'value': null, + 'writable': false + }; + + /** Used as the data object for `iteratorTemplate` */ + var iteratorData = { + 'args': '', + 'array': null, + 'bottom': '', + 'firstArg': '', + 'init': '', + 'keys': null, + 'loop': '', + 'shadowedProps': null, + 'support': null, + 'top': '', + 'useHas': false + }; + /** Used to determine if values are of the language type Object */ var objectTypes = { 'boolean': false, @@ -332,34 +362,19 @@ */ function getObject() { return objectPool.pop() || { - 'args': '', 'array': null, - 'bottom': '', 'cache': null, - 'configurable': false, 'criteria': null, - 'enumerable': false, 'false': false, - 'firstArg': '', 'index': 0, - 'init': '', - 'keys': null, - 'leading': false, - 'loop': '', - 'maxWait': 0, 'null': false, 'number': null, 'object': null, 'push': null, - 'shadowedProps': null, 'string': null, - 'top': '', - 'trailing': false, 'true': false, 'undefined': false, - 'useHas': false, - 'value': null, - 'writable': false + 'value': null }; } @@ -1593,39 +1608,35 @@ * @returns {Function} Returns the compiled function. */ function createIterator() { - var data = getObject(); - // data properties - data.shadowedProps = shadowedProps; + iteratorData.shadowedProps = shadowedProps; // iterator options - data.array = data.bottom = data.loop = data.top = ''; - data.init = 'iterable'; - data.useHas = true; + iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = ''; + iteratorData.init = 'iterable'; + iteratorData.useHas = true; // merge options into a template data object for (var object, index = 0; object = arguments[index]; index++) { for (var key in object) { - data[key] = object[key]; + iteratorData[key] = object[key]; } } - var args = data.args; - data.firstArg = /^[^,]+/.exec(args)[0]; + var args = iteratorData.args; + iteratorData.firstArg = /^[^,]+/.exec(args)[0]; // create the function factory var factory = Function( 'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' + 'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' + 'objectTypes, nonEnumProps, stringClass, stringProto, toString', - 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' + 'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}' ); - releaseObject(data); - // return the compiled function return factory( baseCreateCallback, errorClass, errorProto, hasOwnProperty, - indicatorObject, isArguments, isArray, isString, data.keys, objectProto, + indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString ); } @@ -1684,10 +1695,8 @@ * @param {*} value The value to set. */ var setBindData = !defineProperty ? noop : function(func, value) { - var descriptor = getObject(); descriptor.value = value; defineProperty(func, '__bindData__', descriptor); - releaseObject(descriptor); }; /** @@ -5768,13 +5777,11 @@ leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } - options = getObject(); - options.leading = leading; - options.maxWait = wait; - options.trailing = trailing; + debounceOptions.leading = leading; + debounceOptions.maxWait = wait; + debounceOptions.trailing = trailing; - var result = debounce(func, wait, options); - releaseObject(options); + var result = debounce(func, wait, debounceOptions); return result; } diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 087902f062..7700d89a47 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -3,54 +3,54 @@ * Lo-Dash 2.1.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ -;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++r=w&&l===n,h=u||g?i():c;if(g){var v=o(h);v?(l=t,h=v):(g=!1,h=u?h:(p(h),c))}for(;++al(h,y))&&((u||g)&&h.push(y),c.push(v))}return g?(p(h.b),s(h)):u&&p(h),c}function ut(n){return function(t,e,r){var u={}; -if(e=y.createCallback(e,r,3),qe(t)){r=-1;for(var o=t.length;++rk;k++)r+="n='"+n.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",n.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+n.g+"}"; -r+="}"}return(n.b||Le.nonEnumArgs)&&(r+="}"),r+=n.c+";return E",t=t("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",e+r+"}"),s(n),t(Q,K,oe,ve,b,st,qe,bt,n.f,ae,V,ze,H,ie,we)}function it(n){return mt(n)?Ce(n):{}}function lt(n){return He[n]}function ft(){var t=(t=y.indexOf)===Rt?n:t;return t}function ct(n){var t,e;return!n||we.call(n)!=J||(t=n.constructor,yt(t)&&!(t instanceof t))||!Le.argsClass&&st(n)||!Le.nodeClass&&f(n)?!1:Le.ownLast?(nr(n,function(n,t,r){return e=ve.call(r,t),!1}),false!==e):(nr(n,function(n,t){e=t -}),typeof e=="undefined"||ve.call(n,e))}function pt(n){return Ue[n]}function st(n){return n&&typeof n=="object"&&typeof n.length=="number"&&we.call(n)==z||!1}function gt(n,t,e){var r=We(n),u=r.length;for(t=Q(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function ht(n){var t=[];return nr(n,function(n,e){yt(n)&&t.push(e)}),t.sort()}function vt(n){for(var t=-1,e=We(n),r=e.length,u={};++te?Ie(0,o+e):e)||0,qe(n)?a=-1o&&(o=i)}}else t=!t&&bt(n)?r:y.createCallback(t,e,3),Xe(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function At(n,t,e,r){var u=3>arguments.length;if(t=Q(t,r,4),qe(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Q(t,r,4),Et(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Nt(n){var t=-1,e=n?n.length:0,r=Ut(typeof e=="number"?e:0); -return Ct(n,function(n){var e=Mt(++t);r[t]=r[e],r[e]=n}),r}function Bt(n,t,e){var r;if(t=y.createCallback(t,e,3),qe(n)){e=-1;for(var u=n.length;++e=w&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++ru(i,c)&&l.push(c);return f&&s(i),l}function Pt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,e,3);++or?Ie(0,u+r):r||0}else if(r)return r=$t(t,e),t[r]===e?r:-1;return n(t,e,r)}function Ft(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=y.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:y}},Ce||(it=function(n){if(mt(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}});var Te=xe?function(n,t){var e=l();e.value=t,xe(n,"__bindData__",e),s(e)}:c;Le.argsClass||(st=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ve.call(n,"callee")||!1});var qe=Ee||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&we.call(n)==L||!1 -},Ke=at({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),We=Ae?function(n){return mt(n)?Le.enumPrototypes&&typeof n=="function"||Le.nonEnumArgs&&n.length&&st(n)?Ke(n):Ae(n):[]}:Ke,Ge={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:We,g:"if(e(t[n],n,g)===false)return E"},Je={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Ue=vt(He),Ve=te("("+We(Ue).join("|")+")","g"),Qe=te("["+We(He).join("")+"]","g"),Xe=at(Ge),Ye=at(Je,{i:Je.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),Ze=at(Je),nr=at(Ge,Me,{j:!1}),tr=at(Ge,Me); -yt(/x/)&&(yt=function(n){return typeof n=="function"&&we.call(n)==W});var er=he?function(n){if(!n||we.call(n)!=J||!Le.argsClass&&st(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=he(t))&&he(e);return e?n==e||he(n)==e:ct(n)}:ct,rr=ut(function(n,t,e){ve.call(n,e)?n[e]++:n[e]=1}),ur=ut(function(n,t,e){(ve.call(n,e)?n[e]:n[e]=[]).push(t)}),or=ut(function(n,t,e){n[e]=t}),ar=Ot;Fe&&nt&&typeof de=="function"&&(Wt=function(n){if(!yt(n))throw new re;return de.apply(e,arguments)});var ir=8==Be(x+"08")?Be:function(n,t){return Be(bt(n)?n.replace(B,""):n,t||0) -};return y.after=function(n,t){if(!yt(t))throw new re;return function(){return 1>--n?t.apply(this,arguments):void 0}},y.assign=Ye,y.at=function(n){var t=arguments,e=-1,r=Y(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Ut(t);for(Le.unindexedChars&&bt(n)&&(n=n.split(""));++e=w&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&s(m);return p(l),p(v),h},y.invert=vt,y.invoke=function(n,t){var e=Pe.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Ut(typeof o=="number"?o:0);return Ct(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},y.keys=We,y.map=Ot,y.max=St,y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):_+arguments[0]; -return ve.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!yt(n))throw new re;return e.cache={},e},y.merge=function(n){var t=arguments,e=2;if(!mt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},y.once=function(n){var t,e;if(!yt(n))throw new re;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},y.pairs=function(n){for(var t=-1,e=We(n),r=e.length,u=Ut(r);++te?Ie(0,r+e):Ne(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},y.mixin=Jt,y.noConflict=function(){return e._=le,this},y.parseInt=ir,y.random=Mt,y.reduce=At,y.reduceRight=It,y.result=function(n,t){if(n){var e=n[t];return yt(e)?n[t]():e}},y.runInContext=h,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:We(n).length},y.some=Bt,y.sortedIndex=$t,y.template=function(n,t,e){var r=y.templateSettings; -n||(n=""),e=Ze({},e,r);var u,o=Ze({},e.imports,r.imports),r=We(o),o=_t(o),i=0,l=e.interpolate||D,f="__p+='",l=te((e.escape||D).source+"|"+l.source+"|"+(l===N?S:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(R,a),e&&(f+="'+__e("+e+")+'"),l&&(u=!0,f+="';"+l+";__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';\n",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(C,""):f).replace(E,"$1").replace(O,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}"; -try{var c=Xt(r,"return "+f).apply(v,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.unescape=function(n){return null==n?"":ee(n).replace(Ve,pt)},y.uniqueId=function(n){var t=++d;return ee(null==n?"":n)+t},y.all=jt,y.any=Bt,y.detect=kt,y.findWhere=kt,y.foldl=At,y.foldr=It,y.include=wt,y.inject=At,tr(y,function(n,t){y.prototype[t]||(y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return ye.apply(t,arguments),t=n.apply(y,t),e?new m(t,e):t})}),y.first=Pt,y.last=function(n,t,e){var r=0,u=n?n.length:0; -if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return g(n,Ie(0,u-r))},y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"?n=_t(n):Le.unindexedChars&&bt(n)&&(n=n.split("")),null==t||e?n?n[Mt(r-1)]:v:(n=Nt(n),n.length=Ne(Ie(0,t),n.length),n)},y.take=Pt,y.head=Pt,tr(y,function(n,t){var e="sample"!==t;y.prototype[t]||(y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new m(o,u):o -})}),y.VERSION="2.1.0",y.prototype.chain=function(){return this.__chain__=!0,this},y.prototype.toString=function(){return ee(this.__wrapped__)},y.prototype.value=Ht,y.prototype.valueOf=Ht,Xe(["join","pop","shift"],function(n){var t=ue[n];y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new m(e,n):e}}),Xe(["push","reverse","sort","unshift"],function(n){var t=ue[n];y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Xe(["concat","slice","splice"],function(n){var t=ue[n]; -y.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Le.spliceObjects||Xe(["pop","shift","splice"],function(n){var t=ue[n],e="splice"==n;y.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new m(u,n):u}}),y}var v,y=[],m=[],d=0,b={},_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),z="[object Arguments]",L="[object Array]",T="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={}; -U[W]=!1,U[z]=U[L]=U[T]=U[q]=U[G]=U[J]=U[M]=U[H]=!0;var V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},X=V[typeof window]&&window||this,Y=V[typeof exports]&&exports&&!exports.nodeType&&exports,Z=V[typeof module]&&module&&!module.nodeType&&module,nt=Z&&Z.exports===Y&&Y,tt=V[typeof global]&&global;!tt||tt.global!==tt&&tt.window!==tt||(X=tt);var et=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(X._=et, define(function(){return et -})):Y&&Z?nt?(Z.exports=et)._=et:Y._=et:X._=et}).call(this); \ No newline at end of file +;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++r=w&&l===n,h=u||g?i():c;if(g){var v=o(h);v?(l=t,h=v):(g=!1,h=u?h:(p(h),c))}for(;++al(h,y))&&((u||g)&&h.push(y),c.push(v))}return g?(p(h.k),s(h)):u&&p(h),c}function it(n){return function(t,e,r){var u={}; +if(e=y.createCallback(e,r,3),Ge(t)){r=-1;for(var o=t.length;++rk;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}";r+="}"}return(e.b||Ke.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(Z,K,le,de,b,vt,Ge,jt,X.f,fe,Y,qe,H,ce,Ce) +}function ct(n){return _t(n)?Se(n):{}}function pt(n){return Qe[n]}function st(){var t=(t=y.indexOf)===Lt?n:t;return t}function gt(n){var t,e;return!n||Ce.call(n)!=J||(t=n.constructor,bt(t)&&!(t instanceof t))||!Ke.argsClass&&vt(n)||!Ke.nodeClass&&f(n)?!1:Ke.ownLast?(rr(n,function(n,t,r){return e=de.call(r,t),!1}),false!==e):(rr(n,function(n,t){e=t}),typeof e=="undefined"||de.call(n,e))}function ht(n){return Xe[n]}function vt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ce.call(n)==L||!1 +}function yt(n,t,e){var r=Me(n),u=r.length;for(t=Z(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function mt(n){var t=[];return rr(n,function(n,e){bt(n)&&t.push(e)}),t.sort()}function dt(n){for(var t=-1,e=Me(n),r=e.length,u={};++te?De(0,o+e):e)||0,Ge(n)?a=-1o&&(o=i)}}else t=!t&&jt(n)?r:y.createCallback(t,e,3),nr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o +}function Bt(n,t,e,r){var u=3>arguments.length;if(t=Z(t,r,4),Ge(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Z(t,r,4),At(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function Rt(n,t,e){var r;if(t=y.createCallback(t,e,3),Ge(n)){e=-1;for(var u=n.length;++e=w&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++ru(i,c)&&l.push(c);return f&&s(i),l}function $t(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,e,3);++or?De(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1; +return n(t,e,r)}function Tt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=y.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:y}},Se||(ct=function(n){if(_t(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}});var We=Ee?function(n,t){Q.value=t,Ee(n,"__bindData__",Q)}:c;Ke.argsClass||(vt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&de.call(n,"callee")||!1});var Ge=Ae||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ce.call(n)==T||!1 +},Je=ft({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),Me=Be?function(n){return _t(n)?Ke.enumPrototypes&&typeof n=="function"||Ke.nonEnumArgs&&n.length&&vt(n)?Je(n):Be(n):[]}:Je,He={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:Me,g:"if(e(t[n],n,g)===false)return E"},Ue={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Xe=dt(Qe),Ye=ue("("+Me(Xe).join("|")+")","g"),Ze=ue("["+Me(Qe).join("")+"]","g"),nr=ft(He),tr=ft(Ue,{i:Ue.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),er=ft(Ue),rr=ft(He,Ve,{j:!1}),ur=ft(He,Ve); +bt(/x/)&&(bt=function(n){return typeof n=="function"&&Ce.call(n)==W});var or=me?function(n){if(!n||Ce.call(n)!=J||!Ke.argsClass&&vt(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=me(t))&&me(e);return e?n==e||me(n)==e:gt(n)}:gt,ar=it(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),ir=it(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),lr=it(function(n,t,e){n[e]=t}),fr=It;Te&&rt&&typeof we=="function"&&(Mt=function(n){if(!bt(n))throw new ae;return we.apply(e,arguments)});var cr=8==Re(x+"08")?Re:function(n,t){return Re(jt(n)?n.replace(B,""):n,t||0) +};return y.after=function(n,t){if(!bt(t))throw new ae;return function(){return 1>--n?t.apply(this,arguments):void 0}},y.assign=tr,y.at=function(n){var t=arguments,e=-1,r=tt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);for(Ke.unindexedChars&&jt(n)&&(n=n.split(""));++e=w&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&s(m);return p(l),p(v),h},y.invert=dt,y.invoke=function(n,t){var e=$e.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return St(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},y.keys=Me,y.map=It,y.max=Nt,y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):_+arguments[0]; +return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!bt(n))throw new ae;return e.cache={},e},y.merge=function(n){var t=arguments,e=2;if(!_t(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},y.once=function(n){var t,e;if(!bt(n))throw new ae;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},y.pairs=function(n){for(var t=-1,e=Me(n),r=e.length,u=Xt(r);++te?De(0,r+e):Pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},y.mixin=Ut,y.noConflict=function(){return e._=pe,this},y.parseInt=cr,y.random=Vt,y.reduce=Bt,y.reduceRight=Dt,y.result=function(n,t){if(n){var e=n[t];return bt(e)?n[t]():e}},y.runInContext=h,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Me(n).length},y.some=Rt,y.sortedIndex=zt,y.template=function(n,t,e){var r=y.templateSettings; +n||(n=""),e=er({},e,r);var u,o=er({},e.imports,r.imports),r=Me(o),o=xt(o),i=0,l=e.interpolate||D,f="__p+='",l=ue((e.escape||D).source+"|"+l.source+"|"+(l===N?S:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(R,a),e&&(f+="'+__e("+e+")+'"),l&&(u=!0,f+="';"+l+";__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';\n",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(C,""):f).replace(E,"$1").replace(O,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}"; +try{var c=ne(r,"return "+f).apply(v,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.unescape=function(n){return null==n?"":oe(n).replace(Ye,ht)},y.uniqueId=function(n){var t=++d;return oe(null==n?"":n)+t},y.all=kt,y.any=Rt,y.detect=Ot,y.findWhere=Ot,y.foldl=Bt,y.foldr=Dt,y.include=Ct,y.inject=Bt,ur(y,function(n,t){y.prototype[t]||(y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return be.apply(t,arguments),t=n.apply(y,t),e?new m(t,e):t})}),y.first=$t,y.last=function(n,t,e){var r=0,u=n?n.length:0; +if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return g(n,De(0,u-r))},y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"?n=xt(n):Ke.unindexedChars&&jt(n)&&(n=n.split("")),null==t||e?n?n[Vt(r-1)]:v:(n=Pt(n),n.length=Pe(De(0,t),n.length),n)},y.take=$t,y.head=$t,ur(y,function(n,t){var e="sample"!==t;y.prototype[t]||(y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new m(o,u):o +})}),y.VERSION="2.1.0",y.prototype.chain=function(){return this.__chain__=!0,this},y.prototype.toString=function(){return oe(this.__wrapped__)},y.prototype.value=Qt,y.prototype.valueOf=Qt,nr(["join","pop","shift"],function(n){var t=ie[n];y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new m(e,n):e}}),nr(["push","reverse","sort","unshift"],function(n){var t=ie[n];y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),nr(["concat","slice","splice"],function(n){var t=ie[n]; +y.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Ke.spliceObjects||nr(["pop","shift","splice"],function(n){var t=ie[n],e="splice"==n;y.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new m(u,n):u}}),y}var v,y=[],m=[],d=0,b={},_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={}; +U[W]=!1,U[L]=U[T]=U[z]=U[q]=U[G]=U[J]=U[M]=U[H]=!0;var V={leading:!1,maxWait:0,trailing:!1},Q={configurable:!1,enumerable:!1,value:null,writable:!1},X={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:!1},Y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=Y[typeof window]&&window||this,tt=Y[typeof exports]&&exports&&!exports.nodeType&&exports,et=Y[typeof module]&&module&&!module.nodeType&&module,rt=et&&et.exports===tt&&tt,ut=Y[typeof global]&&global; +!ut||ut.global!==ut&&ut.window!==ut||(nt=ut);var ot=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(nt._=ot, define(function(){return ot})):tt&&et?rt?(et.exports=ot)._=ot:tt._=ot:nt._=ot}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index fe73c4486b..408074b5eb 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -101,6 +101,21 @@ cloneableClasses[numberClass] = cloneableClasses[objectClass] = cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; + /** Used as an internal `_.debounce` options object */ + var debounceOptions = { + 'leading': false, + 'maxWait': 0, + 'trailing': false + }; + + /** Used as the property descriptor for `__bindData__` */ + var descriptor = { + 'configurable': false, + 'enumerable': false, + 'value': null, + 'writable': false + }; + /** Used to determine if values are of the language type Object */ var objectTypes = { 'boolean': false, @@ -324,23 +339,17 @@ return objectPool.pop() || { 'array': null, 'cache': null, - 'configurable': false, 'criteria': null, - 'enumerable': false, 'false': false, 'index': 0, - 'leading': false, - 'maxWait': 0, 'null': false, 'number': null, 'object': null, 'push': null, 'string': null, - 'trailing': false, 'true': false, 'undefined': false, - 'value': null, - 'writable': false + 'value': null }; } @@ -1352,10 +1361,8 @@ * @param {*} value The value to set. */ var setBindData = !defineProperty ? noop : function(func, value) { - var descriptor = getObject(); descriptor.value = value; defineProperty(func, '__bindData__', descriptor); - releaseObject(descriptor); }; /** @@ -5421,13 +5428,11 @@ leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } - options = getObject(); - options.leading = leading; - options.maxWait = wait; - options.trailing = trailing; + debounceOptions.leading = leading; + debounceOptions.maxWait = wait; + debounceOptions.trailing = trailing; - var result = debounce(func, wait, options); - releaseObject(options); + var result = debounce(func, wait, debounceOptions); return result; } diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 48fc3e3285..4b4399a870 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,50 +3,50 @@ * Lo-Dash 2.1.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++r=_&&f===n,h=u||v?i():s;if(v){var g=o(h);g?(f=t,h=g):(v=!1,h=u?h:(c(h),s))}for(;++af(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(c(h.b),p(h)):u&&c(h),s}function ot(n){return function(t,e,r){var u={};e=Q.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++re?Ee(0,o+e):e)||0,ze(n)?a=-1o&&(o=i)}}else t=!t&&bt(n)?r:Q.createCallback(t,e,3),xt(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Et(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ht(r);++earguments.length;t=nt(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++oarguments.length;return t=nt(t,r,4),Ct(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Rt(n){var t=-1,e=n?n.length:0,r=Ht(typeof e=="number"?e:0);return xt(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function At(n,t,e){var r;t=Q.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=_&&u===n; -if(l){var c=o(i);c?(u=t,i=c):l=!1}for(;++ru(i,c)&&f.push(c);return l&&p(i),f}function Bt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=Q.createCallback(t,e,3);++or?Ee(0,u+r):r||0}else if(r)return r=Tt(t,e),t[r]===e?r:-1;return n(t,e,r)}function Ft(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0; -for(t=Q.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:E,variable:"",imports:{_:Q}};var Te=we?function(n,t){var e=f();e.value=t,we(n,"__bindData__",e),p(e)}:l,ze=xe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&_e.call(n)==$||!1},We=Ne?function(n){return yt(n)?Ne(n):[]}:H,qe={"&":"&","<":"<",">":">",'"':""","'":"'"},Pe=ht(qe),Ke=te("("+We(Pe).join("|")+")","g"),Le=te("["+We(qe).join("")+"]","g"),Me=ot(function(n,t,e){ve.call(n,e)?n[e]++:n[e]=1 -}),Ue=ot(function(n,t,e){(ve.call(n,e)?n[e]:n[e]=[]).push(t)}),Ve=ot(function(n,t,e){n[e]=t});Be&&J&&typeof ye=="function"&&(Lt=function(n){if(!gt(n))throw new re;return ye.apply(e,arguments)});var Ge=8==Se(w+"08")?Se:function(n,t){return Se(bt(n)?n.replace(I,""):n,t||0)};return Q.after=function(n,t){if(!gt(t))throw new re;return function(){return 1>--n?t.apply(this,arguments):void 0}},Q.assign=G,Q.at=function(n){for(var t=arguments,e=-1,r=tt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Ht(t);++e=_&&o(a?r[a]:g)}n:for(;++l(m?t(m,y):s(g,y))){for(a=u,(m||g).push(y);--a;)if(m=f[a],0>(m?t(m,y):s(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&p(m);return c(f),c(g),h},Q.invert=ht,Q.invoke=function(n,t){var e=Ae.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Ht(typeof o=="number"?o:0); -return xt(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},Q.keys=We,Q.map=Ot,Q.max=Nt,Q.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0];return ve.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!gt(n))throw new re;return e.cache={},e},Q.merge=function(n){var t=arguments,e=2;if(!yt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},Q.once=function(n){var t,e;if(!gt(n))throw new re;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e) -}},Q.pairs=function(n){for(var t=-1,e=We(n),r=e.length,u=Ht(r);++te?Ee(0,r+e):Ie(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Q.mixin=Ut,Q.noConflict=function(){return e._=ae,this},Q.parseInt=Ge,Q.random=Vt,Q.reduce=It,Q.reduceRight=St,Q.result=function(n,t){if(n){var e=n[t];return gt(e)?n[t]():e}},Q.runInContext=v,Q.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:We(n).length},Q.some=At,Q.sortedIndex=Tt,Q.template=function(n,t,e){var r=Q.templateSettings; -n||(n=""),e=U({},e,r);var u,o=U({},e.imports,r.imports),r=We(o),o=_t(o),i=0,f=e.interpolate||S,l="__p+='",f=te((e.escape||S).source+"|"+f.source+"|"+(f===E?C:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(A,a),e&&(l+="'+__e("+e+")+'"),f&&(u=!0,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(k,"$1").replace(x,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var c=Xt(r,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Q.unescape=function(n){return null==n?"":ee(n).replace(Ke,ct)},Q.uniqueId=function(n){var t=++m;return ee(null==n?"":n)+t},Q.all=wt,Q.any=At,Q.detect=kt,Q.findWhere=kt,Q.foldl=It,Q.foldr=St,Q.include=dt,Q.inject=It,y(Q,function(n,t){Q.prototype[t]||(Q.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return ge.apply(t,arguments),t=n.apply(Q,t),e?new Y(t,e):t})}),Q.first=Bt,Q.last=function(n,t,e){var r=0,u=n?n.length:0; -if(typeof t!="number"&&null!=t){var o=u;for(t=Q.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return s(n,Ee(0,u-r))},Q.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"&&(n=_t(n)),null==t||e?n?n[Vt(r-1)]:h:(n=Rt(n),n.length=Ie(Ee(0,t),n.length),n)},Q.take=Bt,Q.head=Bt,y(Q,function(n,t){var e="sample"!==t;Q.prototype[t]||(Q.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new Y(o,u):o -})}),Q.VERSION="2.1.0",Q.prototype.chain=function(){return this.__chain__=!0,this},Q.prototype.toString=function(){return ee(this.__wrapped__)},Q.prototype.value=Gt,Q.prototype.valueOf=Gt,xt(["join","pop","shift"],function(n){var t=ue[n];Q.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new Y(e,n):e}}),xt(["push","reverse","sort","unshift"],function(n){var t=ue[n];Q.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),xt(["concat","slice","splice"],function(n){var t=ue[n]; -Q.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Q}var h,g=[],y=[],m=0,b=+new Date+"",_=75,d=40,w=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,x=/(__e\(.*?\)|\b__t\))\+'';/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,N=/^function[ \n\r\t]+\w/,E=/<%=([\s\S]+?)%>/g,I=RegExp("^["+w+"]*0+(?=.$)"),S=/($^)/,R=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",$="[object Array]",F="[object Boolean]",T="[object Date]",z="[object Function]",W="[object Number]",q="[object Object]",P="[object RegExp]",K="[object String]",L={}; -L[z]=!1,L[B]=L[$]=L[F]=L[T]=L[W]=L[q]=L[P]=L[K]=!0;var M={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},U={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},V=M[typeof window]&&window||this,G=M[typeof exports]&&exports&&!exports.nodeType&&exports,H=M[typeof module]&&module&&!module.nodeType&&module,J=H&&H.exports===G&&G,Q=M[typeof global]&&global;!Q||Q.global!==Q&&Q.window!==Q||(V=Q);var X=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(V._=X, define(function(){return X -})):G&&H?J?(H.exports=X)._=X:G._=X:V._=X}).call(this); \ No newline at end of file +;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++r=_&&f===n,h=u||v?i():s;if(v){var g=o(h);g?(f=t,h=g):(v=!1,h=u?h:(c(h),s))}for(;++af(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(c(h.k),p(h)):u&&c(h),s}function it(n){return function(t,e,r){var u={};e=Y.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++re?Se(0,o+e):e)||0,ze(n)?a=-1o&&(o=i)}}else t=!t&&dt(n)?r:Y.createCallback(t,e,3),Ot(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function St(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Qt(r);++earguments.length;t=et(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++oarguments.length;return t=et(t,r,4),Nt(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Dt(n){var t=-1,e=n?n.length:0,r=Qt(typeof e=="number"?e:0);return Ot(n,function(n){var e=Ht(++t);r[t]=r[e],r[e]=n}),r}function Bt(n,t,e){var r;t=Y.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=_&&u===n; +if(l){var c=o(i);c?(u=t,i=c):l=!1}for(;++ru(i,c)&&f.push(c);return l&&p(i),f}function Ft(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=Y.createCallback(t,e,3);++or?Se(0,u+r):r||0}else if(r)return r=qt(t,e),t[r]===e?r:-1;return n(t,e,r)}function Wt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0; +for(t=Y.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:E,variable:"",imports:{_:Y}};var qe=ke?function(n,t){U.value=t,ke(n,"__bindData__",U)}:l,ze=Oe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&we.call(n)==$||!1},Pe=Ie?function(n){return bt(n)?Ie(n):[]}:Q,Ke={"&":"&","<":"<",">":">",'"':""","'":"'"},Le=yt(Ke),Me=re("("+Pe(Le).join("|")+")","g"),Ue=re("["+Pe(Ke).join("")+"]","g"),Ve=it(function(n,t,e){ge.call(n,e)?n[e]++:n[e]=1 +}),Ge=it(function(n,t,e){(ge.call(n,e)?n[e]:n[e]=[]).push(t)}),He=it(function(n,t,e){n[e]=t});Fe&&X&&typeof be=="function"&&(Ut=function(n){if(!mt(n))throw new oe;return be.apply(e,arguments)});var Je=8==Ae(w+"08")?Ae:function(n,t){return Ae(dt(n)?n.replace(I,""):n,t||0)};return Y.after=function(n,t){if(!mt(t))throw new oe;return function(){return 1>--n?t.apply(this,arguments):void 0}},Y.assign=J,Y.at=function(n){for(var t=arguments,e=-1,r=rt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Qt(t);++e=_&&o(a?r[a]:g)}n:for(;++l(m?t(m,y):s(g,y))){for(a=u,(m||g).push(y);--a;)if(m=f[a],0>(m?t(m,y):s(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&p(m);return c(f),c(g),h},Y.invert=yt,Y.invoke=function(n,t){var e=Be.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Qt(typeof o=="number"?o:0); +return Ot(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},Y.keys=Pe,Y.map=Et,Y.max=It,Y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0];return ge.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!mt(n))throw new oe;return e.cache={},e},Y.merge=function(n){var t=arguments,e=2;if(!bt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},Y.once=function(n){var t,e;if(!mt(n))throw new oe;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e) +}},Y.pairs=function(n){for(var t=-1,e=Pe(n),r=e.length,u=Qt(r);++te?Se(0,r+e):Re(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Y.mixin=Gt,Y.noConflict=function(){return e._=fe,this},Y.parseInt=Je,Y.random=Ht,Y.reduce=Rt,Y.reduceRight=At,Y.result=function(n,t){if(n){var e=n[t];return mt(e)?n[t]():e}},Y.runInContext=v,Y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Pe(n).length},Y.some=Bt,Y.sortedIndex=qt,Y.template=function(n,t,e){var r=Y.templateSettings; +n||(n=""),e=G({},e,r);var u,o=G({},e.imports,r.imports),r=Pe(o),o=wt(o),i=0,f=e.interpolate||S,l="__p+='",f=re((e.escape||S).source+"|"+f.source+"|"+(f===E?C:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(A,a),e&&(l+="'+__e("+e+")+'"),f&&(u=!0,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(k,"$1").replace(x,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +try{var c=Zt(r,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Y.unescape=function(n){return null==n?"":ue(n).replace(Me,st)},Y.uniqueId=function(n){var t=++m;return ue(null==n?"":n)+t},Y.all=kt,Y.any=Bt,Y.detect=Ct,Y.findWhere=Ct,Y.foldl=Rt,Y.foldr=At,Y.include=jt,Y.inject=Rt,y(Y,function(n,t){Y.prototype[t]||(Y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return me.apply(t,arguments),t=n.apply(Y,t),e?new nt(t,e):t})}),Y.first=Ft,Y.last=function(n,t,e){var r=0,u=n?n.length:0; +if(typeof t!="number"&&null!=t){var o=u;for(t=Y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return s(n,Se(0,u-r))},Y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"&&(n=wt(n)),null==t||e?n?n[Ht(r-1)]:h:(n=Dt(n),n.length=Re(Se(0,t),n.length),n)},Y.take=Ft,Y.head=Ft,y(Y,function(n,t){var e="sample"!==t;Y.prototype[t]||(Y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new nt(o,u):o +})}),Y.VERSION="2.1.0",Y.prototype.chain=function(){return this.__chain__=!0,this},Y.prototype.toString=function(){return ue(this.__wrapped__)},Y.prototype.value=Jt,Y.prototype.valueOf=Jt,Ot(["join","pop","shift"],function(n){var t=ae[n];Y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new nt(e,n):e}}),Ot(["push","reverse","sort","unshift"],function(n){var t=ae[n];Y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ot(["concat","slice","splice"],function(n){var t=ae[n]; +Y.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Y}var h,g=[],y=[],m=0,b=+new Date+"",_=75,d=40,w=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,x=/(__e\(.*?\)|\b__t\))\+'';/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,N=/^function[ \n\r\t]+\w/,E=/<%=([\s\S]+?)%>/g,I=RegExp("^["+w+"]*0+(?=.$)"),S=/($^)/,R=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",$="[object Array]",F="[object Boolean]",T="[object Date]",W="[object Function]",q="[object Number]",z="[object Object]",P="[object RegExp]",K="[object String]",L={}; +L[W]=!1,L[B]=L[$]=L[F]=L[T]=L[q]=L[z]=L[P]=L[K]=!0;var M={leading:!1,maxWait:0,trailing:!1},U={configurable:!1,enumerable:!1,value:null,writable:!1},V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},H=V[typeof window]&&window||this,J=V[typeof exports]&&exports&&!exports.nodeType&&exports,Q=V[typeof module]&&module&&!module.nodeType&&module,X=Q&&Q.exports===J&&J,Y=V[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(H=Y); +var Z=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(H._=Z, define(function(){return Z})):J&&Q?X?(Q.exports=Z)._=Z:J._=Z:H._=Z}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 3a75350752..d3003c859a 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,7 +3,7 @@ * Lo-Dash 2.1.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` */ -;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(te||typeof t=="undefined")return 1;if(tu(f,l))&&(t&&f.push(l),i.push(a))}return i}function c(n){return function(r,t,e){var u={};t=K(t,e,3),e=-1;var o=r?r.length:0; @@ -27,8 +27,8 @@ n[u]=p(n[u],1,null,null,n)}return n},u.chain=function(n){return n=new o(n),n.__c },1)},u.delay=function(n,r){if(!j(n))throw new TypeError;var t=zr.call(arguments,2);return setTimeout(function(){n.apply(Z,t)},r)},u.difference=C,u.filter=S,u.flatten=function(n,r){return f(n,r)},u.forEach=D,u.functions=d,u.groupBy=nt,u.indexBy=rt,u.initial=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else e=null==r||t?1:r||e;return zr.call(n,0,$r(Wr(0,u-e),u))},u.intersection=function(n){var r=arguments,t=r.length,e=-1,u=v(),o=n?n.length:0,i=[]; n:for(;++eu(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;i.push(f)}}return i},u.invert=b,u.invoke=function(n,r){var t=zr.call(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return D(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},u.keys=Hr,u.map=k,u.max=F,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Or.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0; if(r||typeof i!="number")r=K(r,t,3),D(n,function(n,t,o){t=r(n,t,o),tr(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!j(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Hr(n),e=t.length,u=Array(e);++rr?0:r);++nt?Wr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return yr._=xr,this},u.random=Y,u.reduce=M,u.reduceRight=W,u.result=function(n,r){if(n){var t=n[r];return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0; diff --git a/lodash.js b/lodash.js index 4839b62fa8..1b3e379326 100644 --- a/lodash.js +++ b/lodash.js @@ -110,6 +110,36 @@ cloneableClasses[numberClass] = cloneableClasses[objectClass] = cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; + /** Used as an internal `_.debounce` options object */ + var debounceOptions = { + 'leading': false, + 'maxWait': 0, + 'trailing': false + }; + + /** Used as the property descriptor for `__bindData__` */ + var descriptor = { + 'configurable': false, + 'enumerable': false, + 'value': null, + 'writable': false + }; + + /** Used as the data object for `iteratorTemplate` */ + var iteratorData = { + 'args': '', + 'array': null, + 'bottom': '', + 'firstArg': '', + 'init': '', + 'keys': null, + 'loop': '', + 'shadowedProps': null, + 'support': null, + 'top': '', + 'useHas': false + }; + /** Used to determine if values are of the language type Object */ var objectTypes = { 'boolean': false, @@ -331,35 +361,19 @@ */ function getObject() { return objectPool.pop() || { - 'args': '', 'array': null, - 'bottom': '', 'cache': null, - 'configurable': false, 'criteria': null, - 'enumerable': false, 'false': false, - 'firstArg': '', 'index': 0, - 'init': '', - 'keys': null, - 'leading': false, - 'loop': '', - 'maxWait': 0, 'null': false, 'number': null, 'object': null, 'push': null, - 'shadowedProps': null, 'string': null, - 'support': null, - 'top': '', - 'trailing': false, 'true': false, 'undefined': false, - 'useHas': false, - 'value': null, - 'writable': false + 'value': null }; } @@ -1611,40 +1625,36 @@ * @returns {Function} Returns the compiled function. */ function createIterator() { - var data = getObject(); - // data properties - data.shadowedProps = shadowedProps; - data.support = support; + iteratorData.shadowedProps = shadowedProps; + iteratorData.support = support; // iterator options - data.array = data.bottom = data.loop = data.top = ''; - data.init = 'iterable'; - data.useHas = true; + iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = ''; + iteratorData.init = 'iterable'; + iteratorData.useHas = true; // merge options into a template data object for (var object, index = 0; object = arguments[index]; index++) { for (var key in object) { - data[key] = object[key]; + iteratorData[key] = object[key]; } } - var args = data.args; - data.firstArg = /^[^,]+/.exec(args)[0]; + var args = iteratorData.args; + iteratorData.firstArg = /^[^,]+/.exec(args)[0]; // create the function factory var factory = Function( 'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' + 'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' + 'objectTypes, nonEnumProps, stringClass, stringProto, toString', - 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' + 'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}' ); - releaseObject(data); - // return the compiled function return factory( baseCreateCallback, errorClass, errorProto, hasOwnProperty, - indicatorObject, isArguments, isArray, isString, data.keys, objectProto, + indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto, objectTypes, nonEnumProps, stringClass, stringProto, toString ); } @@ -1703,10 +1713,8 @@ * @param {*} value The value to set. */ var setBindData = !defineProperty ? noop : function(func, value) { - var descriptor = getObject(); descriptor.value = value; defineProperty(func, '__bindData__', descriptor); - releaseObject(descriptor); }; /** @@ -5787,13 +5795,11 @@ leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } - options = getObject(); - options.leading = leading; - options.maxWait = wait; - options.trailing = trailing; + debounceOptions.leading = leading; + debounceOptions.maxWait = wait; + debounceOptions.trailing = trailing; - var result = debounce(func, wait, options); - releaseObject(options); + var result = debounce(func, wait, debounceOptions); return result; } From 7cfa7f3de4f120b52dbb3d008dea6484eb376294 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 24 Sep 2013 19:10:09 -0700 Subject: [PATCH 04/24] Use `now()` in the `compat` and `underscore` builds too. --- dist/lodash.compat.js | 9 ++-- dist/lodash.compat.min.js | 94 +++++++++++++++++------------------ dist/lodash.underscore.js | 9 ++-- dist/lodash.underscore.min.js | 64 ++++++++++++------------ lodash.js | 8 +-- 5 files changed, 93 insertions(+), 91 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 5edf2c9811..379a5eecb6 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -519,6 +519,7 @@ fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, + now = reNative.test(now = Date.now) && now || function() { return +new Date; }, push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, setImmediate = context.setImmediate, @@ -5475,7 +5476,7 @@ trailing = 'trailing' in options ? options.trailing : trailing; } var delayed = function() { - var remaining = wait - (new Date - stamp); + var remaining = wait - (now() - stamp); if (remaining <= 0) { if (maxTimeoutId) { clearTimeout(maxTimeoutId); @@ -5483,7 +5484,7 @@ var isCalled = trailingCall; maxTimeoutId = timeoutId = trailingCall = undefined; if (isCalled) { - lastCalled = +new Date; + lastCalled = now(); result = func.apply(thisArg, args); } } else { @@ -5497,14 +5498,14 @@ } maxTimeoutId = timeoutId = trailingCall = undefined; if (trailing || (maxWait !== wait)) { - lastCalled = +new Date; + lastCalled = now(); result = func.apply(thisArg, args); } }; return function() { args = arguments; - stamp = +new Date; + stamp = now(); thisArg = this; trailingCall = trailing && (timeoutId || !leading); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 7700d89a47..b58a7de5f7 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -5,52 +5,52 @@ */ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++r=w&&l===n,h=u||g?i():c;if(g){var v=o(h);v?(l=t,h=v):(g=!1,h=u?h:(p(h),c))}for(;++al(h,y))&&((u||g)&&h.push(y),c.push(v))}return g?(p(h.k),s(h)):u&&p(h),c}function it(n){return function(t,e,r){var u={}; -if(e=y.createCallback(e,r,3),Ge(t)){r=-1;for(var o=t.length;++rk;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}";r+="}"}return(e.b||Ke.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(Z,K,le,de,b,vt,Ge,jt,X.f,fe,Y,qe,H,ce,Ce) -}function ct(n){return _t(n)?Se(n):{}}function pt(n){return Qe[n]}function st(){var t=(t=y.indexOf)===Lt?n:t;return t}function gt(n){var t,e;return!n||Ce.call(n)!=J||(t=n.constructor,bt(t)&&!(t instanceof t))||!Ke.argsClass&&vt(n)||!Ke.nodeClass&&f(n)?!1:Ke.ownLast?(rr(n,function(n,t,r){return e=de.call(r,t),!1}),false!==e):(rr(n,function(n,t){e=t}),typeof e=="undefined"||de.call(n,e))}function ht(n){return Xe[n]}function vt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ce.call(n)==L||!1 -}function yt(n,t,e){var r=Me(n),u=r.length;for(t=Z(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function mt(n){var t=[];return rr(n,function(n,e){bt(n)&&t.push(e)}),t.sort()}function dt(n){for(var t=-1,e=Me(n),r=e.length,u={};++te?De(0,o+e):e)||0,Ge(n)?a=-1o&&(o=i)}}else t=!t&&jt(n)?r:y.createCallback(t,e,3),nr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o -}function Bt(n,t,e,r){var u=3>arguments.length;if(t=Z(t,r,4),Ge(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Z(t,r,4),At(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function Rt(n,t,e){var r;if(t=y.createCallback(t,e,3),Ge(n)){e=-1;for(var u=n.length;++e=w&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++ru(i,c)&&l.push(c);return f&&s(i),l}function $t(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,e,3);++or?De(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1; -return n(t,e,r)}function Tt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=y.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:y}},Se||(ct=function(n){if(_t(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}});var We=Ee?function(n,t){Q.value=t,Ee(n,"__bindData__",Q)}:c;Ke.argsClass||(vt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&de.call(n,"callee")||!1});var Ge=Ae||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ce.call(n)==T||!1 -},Je=ft({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),Me=Be?function(n){return _t(n)?Ke.enumPrototypes&&typeof n=="function"||Ke.nonEnumArgs&&n.length&&vt(n)?Je(n):Be(n):[]}:Je,He={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:Me,g:"if(e(t[n],n,g)===false)return E"},Ue={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Xe=dt(Qe),Ye=ue("("+Me(Xe).join("|")+")","g"),Ze=ue("["+Me(Qe).join("")+"]","g"),nr=ft(He),tr=ft(Ue,{i:Ue.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),er=ft(Ue),rr=ft(He,Ve,{j:!1}),ur=ft(He,Ve); -bt(/x/)&&(bt=function(n){return typeof n=="function"&&Ce.call(n)==W});var or=me?function(n){if(!n||Ce.call(n)!=J||!Ke.argsClass&&vt(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=me(t))&&me(e);return e?n==e||me(n)==e:gt(n)}:gt,ar=it(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),ir=it(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),lr=it(function(n,t,e){n[e]=t}),fr=It;Te&&rt&&typeof we=="function"&&(Mt=function(n){if(!bt(n))throw new ae;return we.apply(e,arguments)});var cr=8==Re(x+"08")?Re:function(n,t){return Re(jt(n)?n.replace(B,""):n,t||0) -};return y.after=function(n,t){if(!bt(t))throw new ae;return function(){return 1>--n?t.apply(this,arguments):void 0}},y.assign=tr,y.at=function(n){var t=arguments,e=-1,r=tt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);for(Ke.unindexedChars&&jt(n)&&(n=n.split(""));++e=w&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&s(m);return p(l),p(v),h},y.invert=dt,y.invoke=function(n,t){var e=$e.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return St(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},y.keys=Me,y.map=It,y.max=Nt,y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):_+arguments[0]; -return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!bt(n))throw new ae;return e.cache={},e},y.merge=function(n){var t=arguments,e=2;if(!_t(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},y.once=function(n){var t,e;if(!bt(n))throw new ae;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},y.pairs=function(n){for(var t=-1,e=Me(n),r=e.length,u=Xt(r);++te?De(0,r+e):Pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},y.mixin=Ut,y.noConflict=function(){return e._=pe,this},y.parseInt=cr,y.random=Vt,y.reduce=Bt,y.reduceRight=Dt,y.result=function(n,t){if(n){var e=n[t];return bt(e)?n[t]():e}},y.runInContext=h,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Me(n).length},y.some=Rt,y.sortedIndex=zt,y.template=function(n,t,e){var r=y.templateSettings; -n||(n=""),e=er({},e,r);var u,o=er({},e.imports,r.imports),r=Me(o),o=xt(o),i=0,l=e.interpolate||D,f="__p+='",l=ue((e.escape||D).source+"|"+l.source+"|"+(l===N?S:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(R,a),e&&(f+="'+__e("+e+")+'"),l&&(u=!0,f+="';"+l+";__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';\n",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(C,""):f).replace(E,"$1").replace(O,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}"; -try{var c=ne(r,"return "+f).apply(v,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.unescape=function(n){return null==n?"":oe(n).replace(Ye,ht)},y.uniqueId=function(n){var t=++d;return oe(null==n?"":n)+t},y.all=kt,y.any=Rt,y.detect=Ot,y.findWhere=Ot,y.foldl=Bt,y.foldr=Dt,y.include=Ct,y.inject=Bt,ur(y,function(n,t){y.prototype[t]||(y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return be.apply(t,arguments),t=n.apply(y,t),e?new m(t,e):t})}),y.first=$t,y.last=function(n,t,e){var r=0,u=n?n.length:0; -if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return g(n,De(0,u-r))},y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"?n=xt(n):Ke.unindexedChars&&jt(n)&&(n=n.split("")),null==t||e?n?n[Vt(r-1)]:v:(n=Pt(n),n.length=Pe(De(0,t),n.length),n)},y.take=$t,y.head=$t,ur(y,function(n,t){var e="sample"!==t;y.prototype[t]||(y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new m(o,u):o -})}),y.VERSION="2.1.0",y.prototype.chain=function(){return this.__chain__=!0,this},y.prototype.toString=function(){return oe(this.__wrapped__)},y.prototype.value=Qt,y.prototype.valueOf=Qt,nr(["join","pop","shift"],function(n){var t=ie[n];y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new m(e,n):e}}),nr(["push","reverse","sort","unshift"],function(n){var t=ie[n];y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),nr(["concat","slice","splice"],function(n){var t=ie[n]; -y.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Ke.spliceObjects||nr(["pop","shift","splice"],function(n){var t=ie[n],e="splice"==n;y.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new m(u,n):u}}),y}var v,y=[],m=[],d=0,b={},_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={}; +}function f(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function c(){}function p(n){n.length=0,y.lengthe?0:e);++r=w&&l===n,h=u||g?i():c;if(g){var v=o(h);v?(l=t,h=v):(g=!1,h=u?h:(p(h),c))}for(;++al(h,y))&&((u||g)&&h.push(y),c.push(v))}return g?(p(h.k),s(h)):u&&p(h),c}function it(n){return function(t,e,r){var u={}; +if(e=y.createCallback(e,r,3),Je(t)){r=-1;for(var o=t.length;++rk;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}";r+="}"}return(e.b||We.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(Z,K,le,de,b,vt,Je,jt,X.f,fe,Y,Ke,H,ce,ke) +}function ct(n){return _t(n)?Ae(n):{}}function pt(n){return Xe[n]}function st(){var t=(t=y.indexOf)===Lt?n:t;return t}function gt(n){var t,e;return!n||ke.call(n)!=J||(t=n.constructor,bt(t)&&!(t instanceof t))||!We.argsClass&&vt(n)||!We.nodeClass&&f(n)?!1:We.ownLast?(ur(n,function(n,t,r){return e=de.call(r,t),!1}),false!==e):(ur(n,function(n,t){e=t}),typeof e=="undefined"||de.call(n,e))}function ht(n){return Ye[n]}function vt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==L||!1 +}function yt(n,t,e){var r=He(n),u=r.length;for(t=Z(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function mt(n){var t=[];return ur(n,function(n,e){bt(n)&&t.push(e)}),t.sort()}function dt(n){for(var t=-1,e=He(n),r=e.length,u={};++te?Pe(0,o+e):e)||0,Je(n)?a=-1o&&(o=i)}}else t=!t&&jt(n)?r:y.createCallback(t,e,3),tr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o +}function Bt(n,t,e,r){var u=3>arguments.length;if(t=Z(t,r,4),Je(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Z(t,r,4),At(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function Rt(n,t,e){var r;if(t=y.createCallback(t,e,3),Je(n)){e=-1;for(var u=n.length;++e=w&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++ru(i,c)&&l.push(c);return f&&s(i),l}function $t(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,e,3);++or?Pe(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1; +return n(t,e,r)}function Tt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=y.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:y}},Ae||(ct=function(n){if(_t(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}});var Ge=Oe?function(n,t){Q.value=t,Oe(n,"__bindData__",Q)}:c;We.argsClass||(vt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&de.call(n,"callee")||!1});var Je=Ie||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==T||!1 +},Me=ft({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),He=De?function(n){return _t(n)?We.enumPrototypes&&typeof n=="function"||We.nonEnumArgs&&n.length&&vt(n)?Me(n):De(n):[]}:Me,Ue={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:He,g:"if(e(t[n],n,g)===false)return E"},Ve={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Ye=dt(Xe),Ze=ue("("+He(Ye).join("|")+")","g"),nr=ue("["+He(Xe).join("")+"]","g"),tr=ft(Ue),er=ft(Ve,{i:Ve.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),rr=ft(Ve),ur=ft(Ue,Qe,{j:!1}),or=ft(Ue,Qe); +bt(/x/)&&(bt=function(n){return typeof n=="function"&&ke.call(n)==W});var ar=me?function(n){if(!n||ke.call(n)!=J||!We.argsClass&&vt(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=me(t))&&me(e);return e?n==e||me(n)==e:gt(n)}:gt,ir=it(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),lr=it(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),fr=it(function(n,t,e){n[e]=t}),cr=It;ze&&rt&&typeof je=="function"&&(Mt=function(n){if(!bt(n))throw new ae;return je.apply(e,arguments)});var pr=8==Fe(x+"08")?Fe:function(n,t){return Fe(jt(n)?n.replace(B,""):n,t||0) +};return y.after=function(n,t){if(!bt(t))throw new ae;return function(){return 1>--n?t.apply(this,arguments):void 0}},y.assign=er,y.at=function(n){var t=arguments,e=-1,r=tt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);for(We.unindexedChars&&jt(n)&&(n=n.split(""));++e=w&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&s(m);return p(l),p(v),h},y.invert=dt,y.invoke=function(n,t){var e=Le.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return St(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},y.keys=He,y.map=It,y.max=Nt,y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):_+arguments[0]; +return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!bt(n))throw new ae;return e.cache={},e},y.merge=function(n){var t=arguments,e=2;if(!_t(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},y.once=function(n){var t,e;if(!bt(n))throw new ae;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},y.pairs=function(n){for(var t=-1,e=He(n),r=e.length,u=Xt(r);++te?Pe(0,r+e):Re(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},y.mixin=Ut,y.noConflict=function(){return e._=pe,this},y.parseInt=pr,y.random=Vt,y.reduce=Bt,y.reduceRight=Dt,y.result=function(n,t){if(n){var e=n[t];return bt(e)?n[t]():e}},y.runInContext=h,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:He(n).length},y.some=Rt,y.sortedIndex=zt,y.template=function(n,t,e){var r=y.templateSettings; +n||(n=""),e=rr({},e,r);var u,o=rr({},e.imports,r.imports),r=He(o),o=xt(o),i=0,l=e.interpolate||D,f="__p+='",l=ue((e.escape||D).source+"|"+l.source+"|"+(l===N?S:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(R,a),e&&(f+="'+__e("+e+")+'"),l&&(u=!0,f+="';"+l+";__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),f+="';\n",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(C,""):f).replace(E,"$1").replace(O,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}"; +try{var c=ne(r,"return "+f).apply(v,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.unescape=function(n){return null==n?"":oe(n).replace(Ze,ht)},y.uniqueId=function(n){var t=++d;return oe(null==n?"":n)+t},y.all=kt,y.any=Rt,y.detect=Ot,y.findWhere=Ot,y.foldl=Bt,y.foldr=Dt,y.include=Ct,y.inject=Bt,or(y,function(n,t){y.prototype[t]||(y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return _e.apply(t,arguments),t=n.apply(y,t),e?new m(t,e):t})}),y.first=$t,y.last=function(n,t,e){var r=0,u=n?n.length:0; +if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return g(n,Pe(0,u-r))},y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"?n=xt(n):We.unindexedChars&&jt(n)&&(n=n.split("")),null==t||e?n?n[Vt(r-1)]:v:(n=Pt(n),n.length=Re(Pe(0,t),n.length),n)},y.take=$t,y.head=$t,or(y,function(n,t){var e="sample"!==t;y.prototype[t]||(y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new m(o,u):o +})}),y.VERSION="2.1.0",y.prototype.chain=function(){return this.__chain__=!0,this},y.prototype.toString=function(){return oe(this.__wrapped__)},y.prototype.value=Qt,y.prototype.valueOf=Qt,tr(["join","pop","shift"],function(n){var t=ie[n];y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new m(e,n):e}}),tr(["push","reverse","sort","unshift"],function(n){var t=ie[n];y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),tr(["concat","slice","splice"],function(n){var t=ie[n]; +y.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),We.spliceObjects||tr(["pop","shift","splice"],function(n){var t=ie[n],e="splice"==n;y.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new m(u,n):u}}),y}var v,y=[],m=[],d=0,b={},_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={}; U[W]=!1,U[L]=U[T]=U[z]=U[q]=U[G]=U[J]=U[M]=U[H]=!0;var V={leading:!1,maxWait:0,trailing:!1},Q={configurable:!1,enumerable:!1,value:null,writable:!1},X={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:!1},Y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=Y[typeof window]&&window||this,tt=Y[typeof exports]&&exports&&!exports.nodeType&&exports,et=Y[typeof module]&&module&&!module.nodeType&&module,rt=et&&et.exports===tt&&tt,ut=Y[typeof global]&&global; !ut||ut.global!==ut&&ut.window!==ut||(nt=ut);var ot=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(nt._=ot, define(function(){return ot})):tt&&et?rt?(et.exports=ot)._=ot:tt._=ot:nt._=ot}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 2bc17ca12e..8d65ec68d7 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -185,6 +185,7 @@ var ceil = Math.ceil, floor = Math.floor, hasOwnProperty = objectProto.hasOwnProperty, + now = reNative.test(now = Date.now) && now || function() { return +new Date; }, push = arrayRef.push, toString = objectProto.toString, unshift = arrayRef.unshift; @@ -3791,7 +3792,7 @@ trailing = 'trailing' in options ? options.trailing : trailing; } var delayed = function() { - var remaining = wait - (new Date - stamp); + var remaining = wait - (now() - stamp); if (remaining <= 0) { if (maxTimeoutId) { clearTimeout(maxTimeoutId); @@ -3799,7 +3800,7 @@ var isCalled = trailingCall; maxTimeoutId = timeoutId = trailingCall = undefined; if (isCalled) { - lastCalled = +new Date; + lastCalled = now(); result = func.apply(thisArg, args); } } else { @@ -3813,14 +3814,14 @@ } maxTimeoutId = timeoutId = trailingCall = undefined; if (trailing || (maxWait !== wait)) { - lastCalled = +new Date; + lastCalled = now(); result = func.apply(thisArg, args); } }; return function() { args = arguments; - stamp = +new Date; + stamp = now(); thisArg = this; trailingCall = trailing && (timeoutId || !leading); diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index d3003c859a..5cea4cf322 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,35 +4,35 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` */ ;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(tu(f,l))&&(t&&f.push(l),i.push(a))}return i}function c(n){return function(r,t,e){var u={};t=K(t,e,3),e=-1;var o=r?r.length:0; -if(typeof o=="number")for(;++ee&&(e=t,u=n)});else for(;++ou&&(u=t);return u}function q(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=i(r,e,4);var o=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++o]);++oarguments.length;return r=i(r,e,4),N(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function $(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return D(n,function(n){var t=Y(++r);e[r]=e[t],e[t]=n}),e}function I(n,r,t){var e;r=K(r,t,3),t=-1; -var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function P(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=K(r,t,3);++oe?Wr(0,u+e):e||0}else if(e)return e=G(r,t),r[e]===t?e:-1;return n(r,t,e)}function V(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=K(r,t,3);++u>>1,t(n[e])/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Nr||(s=function(n){if(x(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),y(arguments)||(y=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Or.call(n,"callee")||!1 -});var Vr=kr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Sr.call(n)==fr||!1},Gr=function(n){var r,t=[];if(!n||!vr[typeof n])return t;for(r in n)Or.call(n,r)&&t.push(r);return t},Hr=Mr?function(n){return x(n)?Mr(n):[]}:Gr,Jr={"&":"&","<":"<",">":">",'"':""","'":"'"},Kr=b(Jr),Lr=RegExp("("+Hr(Kr).join("|")+")","g"),Qr=RegExp("["+Hr(Jr).join("")+"]","g"),Xr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(r(n[t],t,n)===rr)break;return n},Yr=function(n,r){var t; -if(!n||!vr[typeof n])return n;for(t in n)if(Or.call(n,t)&&r(n[t],t,n)===rr)break;return n};j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==Sr.call(n)});var Zr=c(function(n,r,t){Or.call(n,t)?n[t]++:n[t]=1}),nt=c(function(n,r,t){(Or.call(n,t)?n[t]:n[t]=[]).push(r)}),rt=c(function(n,r,t){n[t]=r});u.after=function(n,r){if(!j(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=J,u.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;i.push(f)}}return i},u.invert=b,u.invoke=function(n,r){var t=zr.call(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return D(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},u.keys=Hr,u.map=k,u.max=F,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Or.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0; -if(r||typeof i!="number")r=K(r,t,3),D(n,function(n,t,o){t=r(n,t,o),tr(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!j(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Hr(n),e=t.length,u=Array(e);++rr?0:r);++nt?Wr(0,e+t):$r(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return yr._=xr,this},u.random=Y,u.reduce=M,u.reduceRight=W,u.result=function(n,r){if(n){var t=n[r];return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0; -return typeof r=="number"?r:Hr(n).length},u.some=I,u.sortedIndex=G,u.template=function(n,r,e){var o=u,i=o.templateSettings;n||(n=""),e=_({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(or,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';\n",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; -try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Lr,g)},u.uniqueId=function(n){var r=++nr+"";return n?n+r:r},u.all=R,u.any=I,u.detect=B,u.findWhere=function(n,r){return z(n,r,!0)},u.foldl=M,u.foldr=W,u.include=O,u.inject=M,u.first=P,u.last=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:Z; -return zr.call(n,Wr(0,u-e))},u.sample=function(n,r,t){var e=n?n.length:0;return typeof e!="number"&&(n=A(n)),null==r||t?n?n[Y(e-1)]:Z:(n=$(n),n.length=$r(Wr(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.1.0",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},D("pop push reverse shift sort splice unshift".split(" "),function(n){var r=wr[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Ur.spliceObjects||0!==n.length||delete n[0],this -}}),D(["concat","join","slice"],function(n){var r=wr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yr._=u, define(function(){return u})):mr&&_r?dr?(_r.exports=u)._=u:mr._=u:yr._=u}).call(this); \ No newline at end of file +};case 2:return function(t,e){return n.call(r,t,e)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return J(n,r)}function f(n,r,t,e){e=(e||0)-1;for(var u=n?n.length:0,o=[];++eu(f,l))&&(t&&f.push(l),i.push(a))}return i}function c(n){return function(r,t,e){var u={};t=K(t,e,3),e=-1;var o=r?r.length:0; +if(typeof o=="number")for(;++ee&&(e=t,u=n)});else for(;++ou&&(u=t);return u}function q(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=i(r,e,4);var o=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++o]);++oarguments.length;return r=i(r,e,4),k(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function $(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return N(n,function(n){var t=Y(++r);e[r]=e[t],e[t]=n}),e}function I(n,r,t){var e;r=K(r,t,3),t=-1; +var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function P(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=K(r,t,3);++oe?$r(0,u+e):e||0}else if(e)return e=G(r,t),r[e]===t?e:-1;return n(r,t,e)}function V(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=K(r,t,3);++u>>1,t(n[e])/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Dr||(s=function(n){if(x(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),y(arguments)||(y=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Or.call(n,"callee")||!1 +});var Gr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Br.call(n)==fr||!1},Hr=function(n){var r,t=[];if(!n||!vr[typeof n])return t;for(r in n)Or.call(n,r)&&t.push(r);return t},Jr=Wr?function(n){return x(n)?Wr(n):[]}:Hr,Kr={"&":"&","<":"<",">":">",'"':""","'":"'"},Lr=b(Kr),Qr=RegExp("("+Jr(Lr).join("|")+")","g"),Xr=RegExp("["+Jr(Kr).join("")+"]","g"),Yr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(r(n[t],t,n)===rr)break;return n},Zr=function(n,r){var t; +if(!n||!vr[typeof n])return n;for(t in n)if(Or.call(n,t)&&r(n[t],t,n)===rr)break;return n};j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==Br.call(n)});var nt=c(function(n,r,t){Or.call(n,t)?n[t]++:n[t]=1}),rt=c(function(n,r,t){(Or.call(n,t)?n[t]:n[t]=[]).push(r)}),tt=c(function(n,r,t){n[t]=r});u.after=function(n,r){if(!j(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=J,u.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;i.push(f)}}return i},u.invert=b,u.invoke=function(n,r){var t=Cr.call(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return N(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},u.keys=Jr,u.map=D,u.max=F,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Or.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0; +if(r||typeof i!="number")r=K(r,t,3),N(n,function(n,t,o){t=r(n,t,o),tr(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!j(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Jr(n),e=t.length,u=Array(e);++rr?0:r);++nt?$r(0,e+t):Ir(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return yr._=xr,this},u.random=Y,u.reduce=M,u.reduceRight=W,u.result=function(n,r){if(n){var t=n[r];return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0; +return typeof r=="number"?r:Jr(n).length},u.some=I,u.sortedIndex=G,u.template=function(n,r,e){var o=u,i=o.templateSettings;n||(n=""),e=_({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(or,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';\n",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; +try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Qr,g)},u.uniqueId=function(n){var r=++nr+"";return n?n+r:r},u.all=R,u.any=I,u.detect=B,u.findWhere=function(n,r){return z(n,r,!0)},u.foldl=M,u.foldr=W,u.include=O,u.inject=M,u.first=P,u.last=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:Z; +return Cr.call(n,$r(0,u-e))},u.sample=function(n,r,t){var e=n?n.length:0;return typeof e!="number"&&(n=A(n)),null==r||t?n?n[Y(e-1)]:Z:(n=$(n),n.length=Ir($r(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.1.0",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var r=wr[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Vr.spliceObjects||0!==n.length||delete n[0],this +}}),N(["concat","join","slice"],function(n){var r=wr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yr._=u, define(function(){return u})):mr&&_r?dr?(_r.exports=u)._=u:mr._=u:yr._=u}).call(this); \ No newline at end of file diff --git a/lodash.js b/lodash.js index 1b3e379326..5ec69cf201 100644 --- a/lodash.js +++ b/lodash.js @@ -5493,7 +5493,7 @@ trailing = 'trailing' in options ? options.trailing : trailing; } var delayed = function() { - var remaining = wait - (new Date - stamp); + var remaining = wait - (now() - stamp); if (remaining <= 0) { if (maxTimeoutId) { clearTimeout(maxTimeoutId); @@ -5501,7 +5501,7 @@ var isCalled = trailingCall; maxTimeoutId = timeoutId = trailingCall = undefined; if (isCalled) { - lastCalled = +new Date; + lastCalled = now(); result = func.apply(thisArg, args); } } else { @@ -5515,14 +5515,14 @@ } maxTimeoutId = timeoutId = trailingCall = undefined; if (trailing || (maxWait !== wait)) { - lastCalled = +new Date; + lastCalled = now(); result = func.apply(thisArg, args); } }; return function() { args = arguments; - stamp = +new Date; + stamp = now(); thisArg = this; trailingCall = trailing && (timeoutId || !leading); From 60f63e125aa8eccdade7f8ed95d4b46e993a609c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 24 Sep 2013 20:47:46 -0700 Subject: [PATCH 05/24] Experiment with downloading rhino, ringo, narwhal via .travis.yml. --- .travis.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eaf350b998..fbcfb44a69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ node_js: - "0.6" - "0.8" - "0.10" +jdk: + - "openjdk6" env: global: - BIN="node" BUILD=false MAKE=false @@ -17,7 +19,10 @@ env: matrix: include: - node_js: "0.10" - env: BIN="istanbul" + env: + - BIN="istanbul" + - BIN="ringo" BUILD="compat" + - BIN="narwhal" BUILD="compat" git: depth: 1 branches: @@ -25,6 +30,12 @@ branches: - master before_script: - "npm install -g istanbul" + - "PACKAGE=ringojs-0.9; wget http://ringojs.org/downloads/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt && rm $PACKAGE.zip" + - "PACKAGE=ringojs-0.9; sudo ln -s /opt/$PACKAGE/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo" + - "PACKAGE=rhino-1.7R5; sudo mkdir /opt/$PACKAGE && sudo wget -O /opt/$PACKAGE/run.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/$PACKAGE-20120629.144839-4.jar" + - "PACKAGE=rhino-1.7R5; echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino" + - "PACKAGE=v0.3.2; wget https://github.com/280north/narwhal/archive/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip" + - "PACKAGE=narwhal-0.3.2; sudo ln -s /opt/$PACKAGE/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal" script: - "[ $BIN == 'istanbul' ] && $BIN cover ./test/test.js || true" - "[ $MAKE != false ] && git clone --depth=1 --branch=master git://github.com/lodash/lodash-cli.git ./node_modules/lodash-cli || true" From 374c52f71f3801fb32ec7d871bd13b7e24a0fd2a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 25 Sep 2013 09:09:04 -0700 Subject: [PATCH 06/24] Use `ln` as shorthand for `link` in the "Notes" section of the readme . [ci skip] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 71e2c70af2..9b7ce40ed4 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ The full changelog for this release is available on our [wiki](https://github.co * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` * [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins * [_.curry](http://lodash.com/docs#curry) for creating [curried](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) functions - * [_.debounce](http://lodash.com/docs#debounce) & [_.throttle](http://lodash.com/docs#throttle) accept `options` for more control + * [_.debounce](http://lodash.com/docs#debounce) & [_.throttle](http://lodash.com/docs#throttle) accept additional `options` for more control * [_.findIndex](http://lodash.com/docs#findIndex) & [_.findKey](http://lodash.com/docs#findKey) for finding indexes & keys * [_.forEach](http://lodash.com/docs#forEach) is chainable & supports exiting early * [_.forIn](http://lodash.com/docs#forIn) for iterating own & inherited properties @@ -107,7 +107,7 @@ var _ = require('lodash/dist/lodash.underscore'); **Notes:** * Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL - * If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it + * If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it * Node.js 0.10.8-0.10.11 [have](https://github.com/joyent/node/issues/5622) [bugs](https://github.com/joyent/node/issues/5688) preventing minified builds In [Rhino](http://www.mozilla.org/rhino/): From 0ea54f0458522753a287826d1f21833ee453c2c9 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 25 Sep 2013 22:51:35 -0700 Subject: [PATCH 07/24] Optimize .travis.yml narwhal, ringo, and rhino use. --- .travis.yml | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbcfb44a69..bf3a767cbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ jdk: - "openjdk6" env: global: - - BIN="node" BUILD=false MAKE=false + - BIN="node" BUILD=false MAKE=false OPTION="" matrix: - BUILD="compat" - BUILD="modern" @@ -19,28 +19,41 @@ env: matrix: include: - node_js: "0.10" - env: - - BIN="istanbul" - - BIN="ringo" BUILD="compat" - - BIN="narwhal" BUILD="compat" + env: BIN="istanbul" + - node_js: "0.10" + env: BIN="rhino" BUILD="compat" + - node_js: "0.10" + env: BIN="rhino" BUILD="legacy" MAKE=true + - node_js: "0.10" + env: BIN="rhino" BUILD="compat" OPTION="-require" + - node_js: "0.10" + env: BIN="rhino" BUILD="legacy" MAKE=true OPTION="-require" + - node_js: "0.10" + env: BIN="narwhal" BUILD="compat" + - node_js: "0.10" + env: BIN="narwhal" BUILD="legacy" MAKE=true + - node_js: "0.10" + env: BIN="ringo" BUILD="compat" + - node_js: "0.10" + env: BIN="ringo" BUILD="legacy" MAKE=true git: depth: 1 branches: only: - master before_script: - - "npm install -g istanbul" - - "PACKAGE=ringojs-0.9; wget http://ringojs.org/downloads/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt && rm $PACKAGE.zip" - - "PACKAGE=ringojs-0.9; sudo ln -s /opt/$PACKAGE/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo" - - "PACKAGE=rhino-1.7R5; sudo mkdir /opt/$PACKAGE && sudo wget -O /opt/$PACKAGE/run.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/$PACKAGE-20120629.144839-4.jar" - - "PACKAGE=rhino-1.7R5; echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino" - - "PACKAGE=v0.3.2; wget https://github.com/280north/narwhal/archive/$PACKAGE.zip && sudo unzip $PACKAGE -d /opt/ && rm $PACKAGE.zip" - - "PACKAGE=narwhal-0.3.2; sudo ln -s /opt/$PACKAGE/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal" + - "[ $BIN == 'istanbul' ] && npm install -g istanbul || true" + - "[ $BIN == 'narwhal' ] && wget https://github.com/280north/narwhal/archive/v0.3.2.zip && sudo unzip v0.3.2 -d /opt/ && rm v0.3.2.zip || true" + - "[ $BIN == 'narwhal' ] && sudo ln -s /opt/narwhal-0.3.2/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal || true" + - "[ $BIN == 'rhino' ] && sudo mkdir /opt/rhino-1.7R5 && sudo wget -O /opt/rhino-1.7R5/run.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/$PACKAGE-20120629.144839-4.jar || true" + - "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true" + - "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true" + - "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true" script: - "[ $BIN == 'istanbul' ] && $BIN cover ./test/test.js || true" - "[ $MAKE != false ] && git clone --depth=1 --branch=master git://github.com/lodash/lodash-cli.git ./node_modules/lodash-cli || true" - "[ $MAKE != false ] && mkdir ./node_modules/lodash-cli/node_modules && cd ./node_modules/lodash-cli/node_modules/ && ln -s ../../../ ./lodash && cd ../ && npm i . && cd ../../ || true" - "[ $MAKE != false ] && node ./node_modules/lodash-cli/bin/lodash $BUILD -o ./dist/lodash.$BUILD.js || true" - "[ $BUILD != false ] && cd ./test || true" - - "[ $BUILD != false ] && $BIN ./test.js ../dist/lodash.$BUILD.js || true" - - "[ $BUILD != false ] && $BIN ./test.js ../dist/lodash.$BUILD.min.js || true" + - "[ $BUILD != false ] && $BIN $OPTION ./test.js ../dist/lodash.$BUILD.js || true" + - "[ $BUILD != false ] && $BIN $OPTION ./test.js ../dist/lodash.$BUILD.min.js || true" From 9b80e3a33bd8639271e1543adc69f3c005eea405 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 25 Sep 2013 23:24:58 -0700 Subject: [PATCH 08/24] When `floating` in `_.random` avoid getting `0` too many times when using arguments like `min` of `-3` and `max` of `3`. --- lodash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodash.js b/lodash.js index 5ec69cf201..db89ed78e5 100644 --- a/lodash.js +++ b/lodash.js @@ -6016,7 +6016,7 @@ } var rand = nativeRandom(); return (floating || min % 1 || max % 1) - ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) + ? nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max) : min + floor(rand * (max - min + 1)); } From 62d038b547a3ddfe14d7cd2fd3753e73fd31eb6d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 26 Sep 2013 00:52:42 -0700 Subject: [PATCH 09/24] Fix typo in .travis.yml. --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index bf3a767cbe..529db66682 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,10 @@ matrix: include: - node_js: "0.10" env: BIN="istanbul" + - node_js: "0.10" + env: BIN="narwhal" BUILD="compat" + - node_js: "0.10" + env: BIN="narwhal" BUILD="legacy" MAKE=true - node_js: "0.10" env: BIN="rhino" BUILD="compat" - node_js: "0.10" @@ -28,10 +32,6 @@ matrix: env: BIN="rhino" BUILD="compat" OPTION="-require" - node_js: "0.10" env: BIN="rhino" BUILD="legacy" MAKE=true OPTION="-require" - - node_js: "0.10" - env: BIN="narwhal" BUILD="compat" - - node_js: "0.10" - env: BIN="narwhal" BUILD="legacy" MAKE=true - node_js: "0.10" env: BIN="ringo" BUILD="compat" - node_js: "0.10" @@ -45,7 +45,7 @@ before_script: - "[ $BIN == 'istanbul' ] && npm install -g istanbul || true" - "[ $BIN == 'narwhal' ] && wget https://github.com/280north/narwhal/archive/v0.3.2.zip && sudo unzip v0.3.2 -d /opt/ && rm v0.3.2.zip || true" - "[ $BIN == 'narwhal' ] && sudo ln -s /opt/narwhal-0.3.2/bin/narwhal /usr/local/bin/narwhal && sudo chmod +x /usr/local/bin/narwhal || true" - - "[ $BIN == 'rhino' ] && sudo mkdir /opt/rhino-1.7R5 && sudo wget -O /opt/rhino-1.7R5/run.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/$PACKAGE-20120629.144839-4.jar || true" + - "[ $BIN == 'rhino' ] && sudo mkdir /opt/rhino-1.7R5 && sudo wget -O /opt/rhino-1.7R5/js.jar https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/rhino-1.7R5-20120629.144839-4.jar || true" - "[ $BIN == 'rhino' ] && echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino || true" - "[ $BIN == 'ringo' ] && wget http://ringojs.org/downloads/ringojs-0.9.zip && sudo unzip ringojs-0.9 -d /opt && rm ringojs-0.9.zip || true" - "[ $BIN == 'ringo' ] && sudo ln -s /opt/ringojs-0.9/bin/ringo /usr/local/bin/ringo && sudo chmod +x /usr/local/bin/ringo || true" From 639178dbdca326f3d4eb28fee253609b147e886a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 26 Sep 2013 08:12:33 -0700 Subject: [PATCH 10/24] Make qunit-clib less chatty for passed tests. --- vendor/qunit-clib/qunit-clib.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/vendor/qunit-clib/qunit-clib.js b/vendor/qunit-clib/qunit-clib.js index df70255382..5842ce7ccc 100644 --- a/vendor/qunit-clib/qunit-clib.js +++ b/vendor/qunit-clib/qunit-clib.js @@ -108,15 +108,19 @@ /*------------------------------------------------------------------------*/ + /** Used to report the test module for failing tests */ + var moduleName, + modulePrinted; + /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */ var console = context.console || (context.console = { 'log': context.print }); - /** Shorten `context.QUnit.QUnit` to `context.QUnit` */ - var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit; - /** Used as a horizontal rule in console output */ var hr = '----------------------------------------'; + /** Shorten `context.QUnit.QUnit` to `context.QUnit` */ + var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit; + /** * A logging callback triggered when all testing is completed. * @@ -186,9 +190,11 @@ * @param {Object} details An object with property `name`. */ QUnit.moduleStart(function(details) { - console.log(hr); - console.log(details.name); - console.log(hr); + var newModuleName = details.name; + if (moduleName != newModuleName) { + moduleName = newModuleName; + modulePrinted = false; + } }); /** @@ -224,14 +230,17 @@ testName = details.name; if (details.failed > 0) { + if (!modulePrinted) { + modulePrinted = true; + console.log(hr); + console.log(moduleName); + console.log(hr); + } console.log(' FAIL - '+ testName); assertions.forEach(function(value) { console.log(' ' + value); }); } - else { - console.log(' PASS - ' + testName); - } assertions.length = 0; }); @@ -244,7 +253,7 @@ QUnit.config.testStats = { /** - * An array of test summaries (pipe separated). + * An array of test summaries. * * @memberOf QUnit.config.testStats * @type Array From 9749305ecde72ac1dcc21b03213c81f90d05181c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 26 Sep 2013 20:07:07 -0700 Subject: [PATCH 11/24] Make `_.clone` shallow clone dates, regexps, and boolean/number/string objects. [closes #358] --- dist/lodash.compat.js | 72 ++++++++++++++++++--------------- dist/lodash.compat.min.js | 32 +++++++-------- dist/lodash.js | 72 ++++++++++++++++++--------------- dist/lodash.min.js | 34 ++++++++-------- lodash.js | 70 ++++++++++++++++++-------------- test/test.js | 85 ++++++++++++++++++++++----------------- 6 files changed, 201 insertions(+), 164 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 379a5eecb6..ee2779581b 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -1011,41 +1011,45 @@ if (!cloneableClasses[className] || (!support.nodeClass && isNode(result))) { return result; } - var isArr = isArray(result); - } - // shallow clone - if (!isObj || !deep) { - return isObj - ? (isArr ? slice(result) : assign({}, result)) - : result; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return new ctor(+result); - - case numberClass: - case stringClass: - return new ctor(result); - - case regexpClass: - return ctor(result.source, reFlags.exec(result)); + var ctor = ctorByClass[className], + isArr = isArray(result); + + switch (className) { + case boolClass: + case dateClass: + return new ctor(+result); + + case numberClass: + case stringClass: + return new ctor(result); + + case regexpClass: + var lastIndex = result.lastIndex; + result = ctor(result.source, reFlags.exec(result)); + result.lastIndex = lastIndex; + return result; + } + } else { + return result; } - // check for circular references and return corresponding clone - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); + if (deep) { + // check for circular references and return corresponding clone + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; + var length = stackA.length; + while (length--) { + if (stackA[length] == value) { + return stackB[length]; + } } + // init cloned object + result = isArr ? ctor(result.length) : {}; + } + else { + result = isArr ? slice(result) : assign({}, result); } - // init cloned object - result = isArr ? ctor(result.length) : {}; - // add array properties assigned by `RegExp#exec` if (isArr) { if (hasOwnProperty.call(value, 'index')) { @@ -1055,6 +1059,10 @@ result.input = value.input; } } + // exit for shallow clone + if (!deep) { + return result; + } // add the source value to the stack of traversed objects // and associate it with its clone stackA.push(value); @@ -5999,7 +6007,7 @@ } var rand = nativeRandom(); return (floating || min % 1 || max % 1) - ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) + ? nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max) : min + floor(rand * (max - min + 1)); } diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index b58a7de5f7..6994ad3671 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -6,8 +6,8 @@ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++rk;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}";r+="}"}return(e.b||We.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(Z,K,le,de,b,vt,Je,jt,X.f,fe,Y,Ke,H,ce,ke) -}function ct(n){return _t(n)?Ae(n):{}}function pt(n){return Xe[n]}function st(){var t=(t=y.indexOf)===Lt?n:t;return t}function gt(n){var t,e;return!n||ke.call(n)!=J||(t=n.constructor,bt(t)&&!(t instanceof t))||!We.argsClass&&vt(n)||!We.nodeClass&&f(n)?!1:We.ownLast?(ur(n,function(n,t,r){return e=de.call(r,t),!1}),false!==e):(ur(n,function(n,t){e=t}),typeof e=="undefined"||de.call(n,e))}function ht(n){return Ye[n]}function vt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==L||!1 +}function ct(n){return _t(n)?Ie(n):{}}function pt(n){return Xe[n]}function st(){var t=(t=y.indexOf)===Lt?n:t;return t}function gt(n){var t,e;return!n||ke.call(n)!=J||(t=n.constructor,bt(t)&&!(t instanceof t))||!We.argsClass&&vt(n)||!We.nodeClass&&f(n)?!1:We.ownLast?(ur(n,function(n,t,r){return e=de.call(r,t),!1}),false!==e):(ur(n,function(n,t){e=t}),typeof e=="undefined"||de.call(n,e))}function ht(n){return Ye[n]}function vt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==L||!1 }function yt(n,t,e){var r=He(n),u=r.length;for(t=Z(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function mt(n){var t=[];return ur(n,function(n,e){bt(n)&&t.push(e)}),t.sort()}function dt(n){for(var t=-1,e=He(n),r=e.length,u={};++te?Pe(0,o+e):e)||0,Je(n)?a=-1o&&(o=i)}}else t=!t&&jt(n)?r:y.createCallback(t,e,3),tr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o -}function Bt(n,t,e,r){var u=3>arguments.length;if(t=Z(t,r,4),Je(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Z(t,r,4),At(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function Rt(n,t,e){var r;if(t=y.createCallback(t,e,3),Je(n)){e=-1;for(var u=n.length;++eo&&(o=i)}}else t=!t&&jt(n)?r:y.createCallback(t,e,3),tr(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o +}function Bt(n,t,e,r){var u=3>arguments.length;if(t=Z(t,r,4),Je(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++oarguments.length;return t=Z(t,r,4),It(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Pt(n){var t=-1,e=n?n.length:0,r=Xt(typeof e=="number"?e:0);return St(n,function(n){var e=Vt(++t);r[t]=r[e],r[e]=n}),r}function Rt(n,t,e){var r;if(t=y.createCallback(t,e,3),Je(n)){e=-1;for(var u=n.length;++e=w&&u===n;if(f){var c=o(i);c?(u=t,i=c):f=!1}for(;++ru(i,c)&&l.push(c);return f&&s(i),l}function $t(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=y.createCallback(t,e,3);++or?Pe(0,u+r):r||0}else if(r)return r=zt(t,e),t[r]===e?r:-1; return n(t,e,r)}function Tt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=y.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:y}},Ae||(ct=function(n){if(_t(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}});var Ge=Oe?function(n,t){Q.value=t,Oe(n,"__bindData__",Q)}:c;We.argsClass||(vt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&de.call(n,"callee")||!1});var Je=Ie||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==T||!1 +try{We.nodeClass=!(ke.call(document)==J&&!({toString:0}+""))}catch(o){We.nodeClass=!0}}(1),y.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:y}},Ie||(ct=function(n){if(_t(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}});var Ge=Oe?function(n,t){Q.value=t,Oe(n,"__bindData__",Q)}:c;We.argsClass||(vt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&de.call(n,"callee")||!1});var Je=Ae||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&ke.call(n)==T||!1 },Me=ft({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),He=De?function(n){return _t(n)?We.enumPrototypes&&typeof n=="function"||We.nonEnumArgs&&n.length&&vt(n)?Me(n):De(n):[]}:Me,Ue={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:He,g:"if(e(t[n],n,g)===false)return E"},Ve={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Ye=dt(Xe),Ze=ue("("+He(Ye).join("|")+")","g"),nr=ue("["+He(Xe).join("")+"]","g"),tr=ft(Ue),er=ft(Ve,{i:Ve.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),rr=ft(Ve),ur=ft(Ue,Qe,{j:!1}),or=ft(Ue,Qe); -bt(/x/)&&(bt=function(n){return typeof n=="function"&&ke.call(n)==W});var ar=me?function(n){if(!n||ke.call(n)!=J||!We.argsClass&&vt(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=me(t))&&me(e);return e?n==e||me(n)==e:gt(n)}:gt,ir=it(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),lr=it(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),fr=it(function(n,t,e){n[e]=t}),cr=It;ze&&rt&&typeof je=="function"&&(Mt=function(n){if(!bt(n))throw new ae;return je.apply(e,arguments)});var pr=8==Fe(x+"08")?Fe:function(n,t){return Fe(jt(n)?n.replace(B,""):n,t||0) +bt(/x/)&&(bt=function(n){return typeof n=="function"&&ke.call(n)==W});var ar=me?function(n){if(!n||ke.call(n)!=J||!We.argsClass&&vt(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=me(t))&&me(e);return e?n==e||me(n)==e:gt(n)}:gt,ir=it(function(n,t,e){de.call(n,e)?n[e]++:n[e]=1}),lr=it(function(n,t,e){(de.call(n,e)?n[e]:n[e]=[]).push(t)}),fr=it(function(n,t,e){n[e]=t}),cr=At;ze&&rt&&typeof je=="function"&&(Mt=function(n){if(!bt(n))throw new ae;return je.apply(e,arguments)});var pr=8==Fe(x+"08")?Fe:function(n,t){return Fe(jt(n)?n.replace(B,""):n,t||0) };return y.after=function(n,t){if(!bt(t))throw new ae;return function(){return 1>--n?t.apply(this,arguments):void 0}},y.assign=er,y.at=function(n){var t=arguments,e=-1,r=tt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Xt(t);for(We.unindexedChars&&jt(n)&&(n=n.split(""));++e=w&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&s(m);return p(l),p(v),h},y.invert=dt,y.invoke=function(n,t){var e=Le.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return St(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},y.keys=He,y.map=It,y.max=Nt,y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):_+arguments[0]; +return 1!=u.length||a!==a||_t(a)?function(t){for(var e=u.length,r=!1;e--&&(r=et(t[u[e]],n[u[e]],null,!0)););return r}:function(n){return n=n[o],a===n&&(0!==a||1/a==1/n)}},y.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,lt(n,4,null,null,null,t)},y.debounce=Jt,y.defaults=rr,y.defer=Mt,y.delay=function(n,t){if(!bt(n))throw new ae;var e=Le.call(arguments,2);return xe(function(){n.apply(v,e)},t)},y.difference=Ft,y.filter=Et,y.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(e=(r=e)&&r[t]===n?null:t,t=!1),null!=e&&(n=At(n,e,r)),tt(n,t) +},y.forEach=St,y.forEachRight=It,y.forIn=ur,y.forInRight=function(n,t,e){var r=[];ur(n,function(n,t){r.push(t,n)});var u=r.length;for(t=Z(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},y.forOwn=or,y.forOwnRight=yt,y.functions=mt,y.groupBy=lr,y.indexBy=fr,y.initial=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return g(n,0,Re(Pe(0,u-r),u))},y.intersection=function(e){for(var r=arguments,u=r.length,a=-1,l=i(),f=-1,c=st(),g=e?e.length:0,h=[],v=i();++a=w&&o(a?r[a]:v)}n:for(;++f(m?t(m,y):c(v,y))){for(a=u,(m||v).push(y);--a;)if(m=l[a],0>(m?t(m,y):c(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=l[u])&&s(m);return p(l),p(v),h},y.invert=dt,y.invoke=function(n,t){var e=Le.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Xt(typeof o=="number"?o:0);return St(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},y.keys=He,y.map=At,y.max=Nt,y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):_+arguments[0]; return de.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!bt(n))throw new ae;return e.cache={},e},y.merge=function(n){var t=arguments,e=2;if(!_t(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},y.once=function(n){var t,e;if(!bt(n))throw new ae;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},y.pairs=function(n){for(var t=-1,e=He(n),r=e.length,u=Xt(r);++te?Pe(0,r+e):Re(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},y.mixin=Ut,y.noConflict=function(){return e._=pe,this},y.parseInt=pr,y.random=Vt,y.reduce=Bt,y.reduceRight=Dt,y.result=function(n,t){if(n){var e=n[t];return bt(e)?n[t]():e}},y.runInContext=h,y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:He(n).length},y.some=Rt,y.sortedIndex=zt,y.template=function(n,t,e){var r=y.templateSettings; @@ -51,6 +51,6 @@ n||(n=""),e=rr({},e,r);var u,o=rr({},e.imports,r.imports),r=He(o),o=xt(o),i=0,l= try{var c=ne(r,"return "+f).apply(v,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},y.unescape=function(n){return null==n?"":oe(n).replace(Ze,ht)},y.uniqueId=function(n){var t=++d;return oe(null==n?"":n)+t},y.all=kt,y.any=Rt,y.detect=Ot,y.findWhere=Ot,y.foldl=Bt,y.foldr=Dt,y.include=Ct,y.inject=Bt,or(y,function(n,t){y.prototype[t]||(y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return _e.apply(t,arguments),t=n.apply(y,t),e?new m(t,e):t})}),y.first=$t,y.last=function(n,t,e){var r=0,u=n?n.length:0; if(typeof t!="number"&&null!=t){var o=u;for(t=y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:v;return g(n,Pe(0,u-r))},y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"?n=xt(n):We.unindexedChars&&jt(n)&&(n=n.split("")),null==t||e?n?n[Vt(r-1)]:v:(n=Pt(n),n.length=Re(Pe(0,t),n.length),n)},y.take=$t,y.head=$t,or(y,function(n,t){var e="sample"!==t;y.prototype[t]||(y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new m(o,u):o })}),y.VERSION="2.1.0",y.prototype.chain=function(){return this.__chain__=!0,this},y.prototype.toString=function(){return oe(this.__wrapped__)},y.prototype.value=Qt,y.prototype.valueOf=Qt,tr(["join","pop","shift"],function(n){var t=ie[n];y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new m(e,n):e}}),tr(["push","reverse","sort","unshift"],function(n){var t=ie[n];y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),tr(["concat","slice","splice"],function(n){var t=ie[n]; -y.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),We.spliceObjects||tr(["pop","shift","splice"],function(n){var t=ie[n],e="splice"==n;y.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new m(u,n):u}}),y}var v,y=[],m=[],d=0,b={},_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={}; +y.prototype[n]=function(){return new m(t.apply(this.__wrapped__,arguments),this.__chain__)}}),We.spliceObjects||tr(["pop","shift","splice"],function(n){var t=ie[n],e="splice"==n;y.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new m(u,n):u}}),y}var v,y=[],m=[],d=0,b={},_=+new Date+"",w=75,j=40,x=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",C=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,O=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,I=/\w*$/,A=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={}; U[W]=!1,U[L]=U[T]=U[z]=U[q]=U[G]=U[J]=U[M]=U[H]=!0;var V={leading:!1,maxWait:0,trailing:!1},Q={configurable:!1,enumerable:!1,value:null,writable:!1},X={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:!1},Y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=Y[typeof window]&&window||this,tt=Y[typeof exports]&&exports&&!exports.nodeType&&exports,et=Y[typeof module]&&module&&!module.nodeType&&module,rt=et&&et.exports===tt&&tt,ut=Y[typeof global]&&global; !ut||ut.global!==ut&&ut.window!==ut||(nt=ut);var ot=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(nt._=ot, define(function(){return ot})):tt&&et?rt?(et.exports=ot)._=ot:tt._=ot:nt._=ot}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 408074b5eb..ff889d568c 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -735,41 +735,45 @@ if (!cloneableClasses[className]) { return result; } - var isArr = isArray(result); - } - // shallow clone - if (!isObj || !deep) { - return isObj - ? (isArr ? slice(result) : assign({}, result)) - : result; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return new ctor(+result); - - case numberClass: - case stringClass: - return new ctor(result); - - case regexpClass: - return ctor(result.source, reFlags.exec(result)); + var ctor = ctorByClass[className], + isArr = isArray(result); + + switch (className) { + case boolClass: + case dateClass: + return new ctor(+result); + + case numberClass: + case stringClass: + return new ctor(result); + + case regexpClass: + var lastIndex = result.lastIndex; + result = ctor(result.source, reFlags.exec(result)); + result.lastIndex = lastIndex; + return result; + } + } else { + return result; } - // check for circular references and return corresponding clone - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); + if (deep) { + // check for circular references and return corresponding clone + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; + var length = stackA.length; + while (length--) { + if (stackA[length] == value) { + return stackB[length]; + } } + // init cloned object + result = isArr ? ctor(result.length) : {}; + } + else { + result = isArr ? slice(result) : assign({}, result); } - // init cloned object - result = isArr ? ctor(result.length) : {}; - // add array properties assigned by `RegExp#exec` if (isArr) { if (hasOwnProperty.call(value, 'index')) { @@ -779,6 +783,10 @@ result.input = value.input; } } + // exit for shallow clone + if (!deep) { + return result; + } // add the source value to the stack of traversed objects // and associate it with its clone stackA.push(value); @@ -5649,7 +5657,7 @@ } var rand = nativeRandom(); return (floating || min % 1 || max % 1) - ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) + ? nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max) : min + floor(rand * (max - min + 1)); } diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 4b4399a870..1874d163dc 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -8,8 +8,8 @@ }function l(){}function c(n){n.length=0,g.lengthe?0:e);++re?Se(0,o+e):e)||0,ze(n)?a=-1o&&(o=i)}}else t=!t&&dt(n)?r:Y.createCallback(t,e,3),Ot(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function St(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Qt(r);++earguments.length;t=et(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++oarguments.length;return t=et(t,r,4),Nt(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Dt(n){var t=-1,e=n?n.length:0,r=Qt(typeof e=="number"?e:0);return Ot(n,function(n){var e=Ht(++t);r[t]=r[e],r[e]=n}),r}function Bt(n,t,e){var r;t=Y.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=_&&u===n; +}),u}for(;++eo&&(o=i)}}else t=!t&&dt(n)?r:Y.createCallback(t,e,3),Ot(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function St(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Qt(r);++earguments.length;t=et(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++oarguments.length;return t=et(t,r,4),It(n,function(n,r,o){e=u?(u=!1,n):t(e,n,r,o)}),e}function Dt(n){var t=-1,e=n?n.length:0,r=Qt(typeof e=="number"?e:0);return Ot(n,function(n){var e=Ht(++t);r[t]=r[e],r[e]=n}),r}function Bt(n,t,e){var r;t=Y.createCallback(t,e,3),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=_&&u===n; if(l){var c=o(i);c?(u=t,i=c):l=!1}for(;++ru(i,c)&&f.push(c);return l&&p(i),f}function Ft(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=Y.createCallback(t,e,3);++or?Se(0,u+r):r||0}else if(r)return r=qt(t,e),t[r]===e?r:-1;return n(t,e,r)}function Wt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0; -for(t=Y.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++t>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:E,variable:"",imports:{_:Y}};var qe=ke?function(n,t){U.value=t,ke(n,"__bindData__",U)}:l,ze=Oe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&we.call(n)==$||!1},Pe=Ie?function(n){return bt(n)?Ie(n):[]}:Q,Ke={"&":"&","<":"<",">":">",'"':""","'":"'"},Le=yt(Ke),Me=re("("+Pe(Le).join("|")+")","g"),Ue=re("["+Pe(Ke).join("")+"]","g"),Ve=it(function(n,t,e){ge.call(n,e)?n[e]++:n[e]=1 -}),Ge=it(function(n,t,e){(ge.call(n,e)?n[e]:n[e]=[]).push(t)}),He=it(function(n,t,e){n[e]=t});Fe&&X&&typeof be=="function"&&(Ut=function(n){if(!mt(n))throw new oe;return be.apply(e,arguments)});var Je=8==Ae(w+"08")?Ae:function(n,t){return Ae(dt(n)?n.replace(I,""):n,t||0)};return Y.after=function(n,t){if(!mt(t))throw new oe;return function(){return 1>--n?t.apply(this,arguments):void 0}},Y.assign=J,Y.at=function(n){for(var t=arguments,e=-1,r=rt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Qt(t);++e/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:Y}};var qe=ke?function(n,t){U.value=t,ke(n,"__bindData__",U)}:l,ze=Oe||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&we.call(n)==$||!1},Pe=Ee?function(n){return bt(n)?Ee(n):[]}:Q,Ke={"&":"&","<":"<",">":">",'"':""","'":"'"},Le=yt(Ke),Me=re("("+Pe(Le).join("|")+")","g"),Ue=re("["+Pe(Ke).join("")+"]","g"),Ve=it(function(n,t,e){ge.call(n,e)?n[e]++:n[e]=1 +}),Ge=it(function(n,t,e){(ge.call(n,e)?n[e]:n[e]=[]).push(t)}),He=it(function(n,t,e){n[e]=t});Fe&&X&&typeof be=="function"&&(Ut=function(n){if(!mt(n))throw new oe;return be.apply(e,arguments)});var Je=8==Ae(w+"08")?Ae:function(n,t){return Ae(dt(n)?n.replace(E,""):n,t||0)};return Y.after=function(n,t){if(!mt(t))throw new oe;return function(){return 1>--n?t.apply(this,arguments):void 0}},Y.assign=J,Y.at=function(n){for(var t=arguments,e=-1,r=rt(t,!0,!1,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Qt(t);++e=_&&o(a?r[a]:g)}n:for(;++l(m?t(m,y):s(g,y))){for(a=u,(m||g).push(y);--a;)if(m=f[a],0>(m?t(m,y):s(r[a],y)))continue n;h.push(y)}}for(;u--;)(m=f[u])&&p(m);return c(f),c(g),h},Y.invert=yt,Y.invoke=function(n,t){var e=Be.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Qt(typeof o=="number"?o:0); -return Ot(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},Y.keys=Pe,Y.map=Et,Y.max=It,Y.memoize=function(n,t){function e(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0];return ge.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}if(!mt(n))throw new oe;return e.cache={},e},Y.merge=function(n){var t=arguments,e=2;if(!bt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},Y.once=function(n){var t,e;if(!mt(n))throw new oe;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e) }},Y.pairs=function(n){for(var t=-1,e=Pe(n),r=e.length,u=Qt(r);++te?Se(0,r+e):Re(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Y.mixin=Gt,Y.noConflict=function(){return e._=fe,this},Y.parseInt=Je,Y.random=Ht,Y.reduce=Rt,Y.reduceRight=At,Y.result=function(n,t){if(n){var e=n[t];return mt(e)?n[t]():e}},Y.runInContext=v,Y.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Pe(n).length},Y.some=Bt,Y.sortedIndex=qt,Y.template=function(n,t,e){var r=Y.templateSettings; -n||(n=""),e=G({},e,r);var u,o=G({},e.imports,r.imports),r=Pe(o),o=wt(o),i=0,f=e.interpolate||S,l="__p+='",f=re((e.escape||S).source+"|"+f.source+"|"+(f===E?C:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(A,a),e&&(l+="'+__e("+e+")+'"),f&&(u=!0,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(k,"$1").replace(x,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +n||(n=""),e=G({},e,r);var u,o=G({},e.imports,r.imports),r=Pe(o),o=wt(o),i=0,f=e.interpolate||S,l="__p+='",f=re((e.escape||S).source+"|"+f.source+"|"+(f===N?C:S).source+"|"+(e.evaluate||S).source+"|$","g");n.replace(f,function(t,e,r,o,f,c){return r||(r=o),l+=n.slice(i,c).replace(A,a),e&&(l+="'+__e("+e+")+'"),f&&(u=!0,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(j,""):l).replace(k,"$1").replace(x,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; try{var c=Zt(r,"return "+l).apply(h,o)}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},Y.unescape=function(n){return null==n?"":ue(n).replace(Me,st)},Y.uniqueId=function(n){var t=++m;return ue(null==n?"":n)+t},Y.all=kt,Y.any=Bt,Y.detect=Ct,Y.findWhere=Ct,Y.foldl=Rt,Y.foldr=At,Y.include=jt,Y.inject=Rt,y(Y,function(n,t){Y.prototype[t]||(Y.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return me.apply(t,arguments),t=n.apply(Y,t),e?new nt(t,e):t})}),Y.first=Ft,Y.last=function(n,t,e){var r=0,u=n?n.length:0; if(typeof t!="number"&&null!=t){var o=u;for(t=Y.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return s(n,Se(0,u-r))},Y.sample=function(n,t,e){var r=n?n.length:0;return typeof r!="number"&&(n=wt(n)),null==t||e?n?n[Ht(r-1)]:h:(n=Dt(n),n.length=Re(Se(0,t),n.length),n)},Y.take=Ft,Y.head=Ft,y(Y,function(n,t){var e="sample"!==t;Y.prototype[t]||(Y.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new nt(o,u):o })}),Y.VERSION="2.1.0",Y.prototype.chain=function(){return this.__chain__=!0,this},Y.prototype.toString=function(){return ue(this.__wrapped__)},Y.prototype.value=Jt,Y.prototype.valueOf=Jt,Ot(["join","pop","shift"],function(n){var t=ae[n];Y.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new nt(e,n):e}}),Ot(["push","reverse","sort","unshift"],function(n){var t=ae[n];Y.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ot(["concat","slice","splice"],function(n){var t=ae[n]; -Y.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Y}var h,g=[],y=[],m=0,b=+new Date+"",_=75,d=40,w=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,x=/(__e\(.*?\)|\b__t\))\+'';/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,N=/^function[ \n\r\t]+\w/,E=/<%=([\s\S]+?)%>/g,I=RegExp("^["+w+"]*0+(?=.$)"),S=/($^)/,R=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",$="[object Array]",F="[object Boolean]",T="[object Date]",W="[object Function]",q="[object Number]",z="[object Object]",P="[object RegExp]",K="[object String]",L={}; +Y.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Y}var h,g=[],y=[],m=0,b=+new Date+"",_=75,d=40,w=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,x=/(__e\(.*?\)|\b__t\))\+'';/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,I=/^function[ \n\r\t]+\w/,N=/<%=([\s\S]+?)%>/g,E=RegExp("^["+w+"]*0+(?=.$)"),S=/($^)/,R=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",$="[object Array]",F="[object Boolean]",T="[object Date]",W="[object Function]",q="[object Number]",z="[object Object]",P="[object RegExp]",K="[object String]",L={}; L[W]=!1,L[B]=L[$]=L[F]=L[T]=L[q]=L[z]=L[P]=L[K]=!0;var M={leading:!1,maxWait:0,trailing:!1},U={configurable:!1,enumerable:!1,value:null,writable:!1},V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},H=V[typeof window]&&window||this,J=V[typeof exports]&&exports&&!exports.nodeType&&exports,Q=V[typeof module]&&module&&!module.nodeType&&module,X=Q&&Q.exports===J&&J,Y=V[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(H=Y); var Z=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(H._=Z, define(function(){return Z})):J&&Q?X?(Q.exports=Z)._=Z:J._=Z:H._=Z}).call(this); \ No newline at end of file diff --git a/lodash.js b/lodash.js index db89ed78e5..cf3807bbf5 100644 --- a/lodash.js +++ b/lodash.js @@ -1027,41 +1027,45 @@ if (!cloneableClasses[className] || (!support.nodeClass && isNode(result))) { return result; } - var isArr = isArray(result); - } - // shallow clone - if (!isObj || !deep) { - return isObj - ? (isArr ? slice(result) : assign({}, result)) - : result; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return new ctor(+result); - - case numberClass: - case stringClass: - return new ctor(result); - - case regexpClass: - return ctor(result.source, reFlags.exec(result)); + var ctor = ctorByClass[className], + isArr = isArray(result); + + switch (className) { + case boolClass: + case dateClass: + return new ctor(+result); + + case numberClass: + case stringClass: + return new ctor(result); + + case regexpClass: + var lastIndex = result.lastIndex; + result = ctor(result.source, reFlags.exec(result)); + result.lastIndex = lastIndex; + return result; + } + } else { + return result; } - // check for circular references and return corresponding clone - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); + if (deep) { + // check for circular references and return corresponding clone + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; + var length = stackA.length; + while (length--) { + if (stackA[length] == value) { + return stackB[length]; + } } + // init cloned object + result = isArr ? ctor(result.length) : {}; + } + else { + result = isArr ? slice(result) : assign({}, result); } - // init cloned object - result = isArr ? ctor(result.length) : {}; - // add array properties assigned by `RegExp#exec` if (isArr) { if (hasOwnProperty.call(value, 'index')) { @@ -1071,6 +1075,10 @@ result.input = value.input; } } + // exit for shallow clone + if (!deep) { + return result; + } // add the source value to the stack of traversed objects // and associate it with its clone stackA.push(value); diff --git a/test/test.js b/test/test.js index 9753514e8c..76a55848f5 100644 --- a/test/test.js +++ b/test/test.js @@ -542,42 +542,22 @@ objects['an array'].length = 5; - _.forOwn(objects, function(object, key) { - test('should deep clone ' + key, function() { - var clone = _.cloneDeep(object); - strictEqual(_.isEqual(object, clone), true); + test('`_.clone` should shallow clone by default', function() { + var expected = [{ 'a': 0 }, { 'b': 1 }], + actual = _.clone(expected); - if (_.isObject(object)) { - notEqual(clone, object); - } else { - skipTest(); - } - }); - }); - - _.forOwn(nonCloneable, function(object, key) { - test('should not clone ' + key, function() { - strictEqual(_.clone(object), object); - strictEqual(_.cloneDeep(object), object); - }); + deepEqual(actual, expected); + ok(actual != expected && actual[0] === expected[0]); }); - test('should perform a shallow clone when used as `callback` for `_.map`', function() { + test('`_.clone` should perform a shallow clone when used as `callback` for `_.map`', function() { var expected = [{ 'a': [0] }, { 'b': [1] }], actual = _.map(expected, _.clone); ok(actual[0] != expected[0] && actual[0].a === expected[0].a && actual[1].b === expected[1].b); }); - test('should deep clone `index` and `input` array properties', function() { - var array = /x/.exec('x'), - actual = _.cloneDeep(array); - - strictEqual(actual.index, 0); - equal(actual.input, 'x'); - }); - - test('should deep clone objects with circular references', function() { + test('`_.cloneDeep` should deep clone objects with circular references', function() { var object = { 'foo': { 'b': { 'foo': { 'c': { } } } }, 'bar': { } @@ -590,13 +570,6 @@ ok(clone.bar.b === clone.foo.b && clone === clone.foo.b.foo.c && clone !== object); }); - test('should clone problem JScript properties (test in IE < 9)', function() { - deepEqual(_.clone(shadowedObject), shadowedObject); - notEqual(_.clone(shadowedObject), shadowedObject); - deepEqual(_.cloneDeep(shadowedObject), shadowedObject); - notEqual(_.cloneDeep(shadowedObject), shadowedObject); - }); - _.forEach([ 'clone', 'cloneDeep' @@ -605,6 +578,30 @@ var func = _[methodName], klass = new Klass; + _.forOwn(objects, function(object, key) { + test('`_.' + methodName + '` should clone ' + key, function() { + var clone = func(object); + strictEqual(_.isEqual(object, clone), true); + + if (_.isObject(object)) { + notEqual(clone, object); + } else { + strictEqual(clone, object); + } + }); + }); + + _.forOwn(nonCloneable, function(object, key) { + test('`_.' + methodName + '` should not clone ' + key, function() { + strictEqual(func(object), object); + }); + }); + + test('`_.' + methodName + '` should clone problem JScript properties (test in IE < 9)', function() { + deepEqual(func(shadowedObject), shadowedObject); + notEqual(func(shadowedObject), shadowedObject); + }); + test('`_.' + methodName + '` should pass the correct `callback` arguments', function() { var args; @@ -624,10 +621,26 @@ }); test('`_.' + methodName + '` should handle cloning if `callback` returns `undefined`', function() { - var actual = _.clone({ 'a': { 'b': 'c' } }, function() {}); + var actual = func({ 'a': { 'b': 'c' } }, function() {}); deepEqual(actual, { 'a': { 'b': 'c' } }); }); - }); + + test('`_.' + methodName + '` should deep clone `index` and `input` array properties', function() { + var array = /x/.exec('vwxyz'), + actual = func(array); + + strictEqual(actual.index, 2); + equal(actual.input, 'vwxyz'); + }); + + test('`_.' + methodName + '` should deep clone `lastIndex` regexp property', function() { + var regexp = /x/g; + regexp.test('vwxyz'); + + var actual = func(regexp); + equal(actual.lastIndex, 3); + }); + }) }(1, 2, 3)); /*--------------------------------------------------------------------------*/ From 4a369af4c727bed4d2bdc6220588e0768352423d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 26 Sep 2013 21:05:10 -0700 Subject: [PATCH 12/24] Cleanup `baseClone`. --- dist/lodash.compat.js | 40 +++++++++++++++++---------------------- dist/lodash.compat.min.js | 4 ++-- dist/lodash.js | 38 ++++++++++++++++--------------------- dist/lodash.min.js | 4 ++-- dist/lodash.underscore.js | 2 +- lodash.js | 40 +++++++++++++++++---------------------- 6 files changed, 55 insertions(+), 73 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index ee2779581b..cfe402b1e0 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -992,46 +992,41 @@ * @param {Function} [callback] The function to customize cloning values. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates clones with source counterparts. - * @returns {*} Returns the cloned `value`. + * @returns {*} Returns the cloned value. */ function baseClone(value, deep, callback, stackA, stackB) { - var result = value; - if (callback) { - result = callback(result); + var result = callback(value); if (typeof result != 'undefined') { return result; } - result = value; } // inspect [[Class]] - var isObj = isObject(result); + var isObj = isObject(value); if (isObj) { - var className = toString.call(result); - if (!cloneableClasses[className] || (!support.nodeClass && isNode(result))) { - return result; + var className = toString.call(value); + if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) { + return value; } - var ctor = ctorByClass[className], - isArr = isArray(result); - + var ctor = ctorByClass[className]; switch (className) { case boolClass: case dateClass: - return new ctor(+result); + return new ctor(+value); case numberClass: case stringClass: - return new ctor(result); + return new ctor(value); case regexpClass: - var lastIndex = result.lastIndex; - result = ctor(result.source, reFlags.exec(result)); - result.lastIndex = lastIndex; + result = ctor(value.source, reFlags.exec(value)); + result.lastIndex = value.lastIndex; return result; } } else { - return result; + return value; } + var isArr = isArray(value); if (deep) { // check for circular references and return corresponding clone var initedStack = !stackA; @@ -1044,11 +1039,10 @@ return stackB[length]; } } - // init cloned object - result = isArr ? ctor(result.length) : {}; + result = isArr ? ctor(value.length) : {}; } else { - result = isArr ? slice(result) : assign({}, result); + result = isArr ? slice(value) : assign({}, value); } // add array properties assigned by `RegExp#exec` if (isArr) { @@ -1979,7 +1973,7 @@ * @param {boolean} [deep=false] Specify a deep clone. * @param {Function} [callback] The function to customize cloning values. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the cloned `value`. + * @returns {*} Returns the cloned value. * @example * * var stooges = [ @@ -2033,7 +2027,7 @@ * @param {*} value The value to deep clone. * @param {Function} [callback] The function to customize cloning values. * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the deep cloned `value`. + * @returns {*} Returns the deep cloned value. * @example * * var stooges = [ diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 6994ad3671..a0418f02eb 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -6,8 +6,8 @@ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++er||typeof e=="undefined")return 1;if(ee?0:e);++re?0:e);++r Date: Thu, 26 Sep 2013 21:55:14 -0700 Subject: [PATCH 13/24] Remove openjdk6 from .travis.yml. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 529db66682..9dd4af0ad6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ node_js: - "0.6" - "0.8" - "0.10" -jdk: - - "openjdk6" env: global: - BIN="node" BUILD=false MAKE=false OPTION="" From 85f2bd464c6d33b814f7fed525bdee67c701051c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 26 Sep 2013 23:34:31 -0700 Subject: [PATCH 14/24] Remove "performance" & "speed" keywords from package.json. [ci skip] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dfd46da812..80163b7dc3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "homepage": "http://lodash.com/", "license": "MIT", "main": "dist/lodash.js", - "keywords": ["amd", "browser", "client", "customize", "functional", "performance", "server", "speed", "util"], + "keywords": ["amd", "browser", "client", "customize", "functional", "server", "util"], "author": "John-David Dalton (http://allyoucanleet.com/)", "contributors": [ "John-David Dalton (http://allyoucanleet.com/)", From 0f1e69a2dfe1efbcab3900445a9350e5801add39 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 28 Sep 2013 00:25:56 -0700 Subject: [PATCH 15/24] Tweak how `isModularize` is detected in test/test.js. --- test/test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test.js b/test/test.js index 76a55848f5..d427ed4ab8 100644 --- a/test/test.js +++ b/test/test.js @@ -36,6 +36,9 @@ return result; }()); + /** The basename of the Lo-Dash file to test */ + var basename = /[\w.-]+$/.exec(filePath)[0]; + /** The `ui` object */ var ui = root.ui || (root.ui = { 'buildPath': filePath, @@ -44,7 +47,7 @@ }); /** Used to indicate testing a modularized build */ - var isModularize = ui.isModularize || /\b(?:lodash-(?:amd|node)|modularize)\b/.test([ui.buildPath, ui.urlParams.build]); + var isModularize = ui.isModularize || /\b(?:commonjs|index\.js|lodash-(?:amd|node)|modularize)\b/.test([ui.buildPath, ui.urlParams.build, basename]); /*--------------------------------------------------------------------------*/ @@ -104,9 +107,6 @@ /** Use a single "load" function */ var load = !amd && typeof require == 'function' ? require : root.load; - /** The basename of the Lo-Dash file to test */ - var basename = /[\w.-]+$/.exec(filePath)[0]; - /** The unit testing framework */ var QUnit = (function() { var noop = Function.prototype; From 4b26b46f6af7ecac4e770ad88acf99287a8f4ad1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 28 Sep 2013 14:02:12 -0700 Subject: [PATCH 16/24] Remove unneeded code from the `underscore` build of the `support` object. --- dist/lodash.compat.js | 2 +- dist/lodash.underscore.js | 12 -- dist/lodash.underscore.min.js | 66 ++++---- doc/README.md | 282 +++++++++++++++++----------------- lodash.js | 2 +- 5 files changed, 176 insertions(+), 188 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index cfe402b1e0..49840b50c7 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -6643,7 +6643,7 @@ }); // avoid array-like object bugs with `Array#shift` and `Array#splice` - // in Firefox < 10 and IE < 9 + // in IE < 9, Firefox < 10, Narwhal, and RingoJS if (!support.spliceObjects) { baseEach(['pop', 'shift', 'splice'], function(methodName) { var func = arrayRef[methodName], diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index a408f632b1..818c3c314c 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -27,9 +27,6 @@ /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; - /** Used to detect functions containing a `this` reference */ - var reThis = /\bthis\b/; - /** Used to match unescaped characters in compiled string literals */ var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; @@ -311,15 +308,6 @@ */ support.fastBind = nativeBind && !isV8; - /** - * Detect if functions can be decompiled by `Function#toString` - * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). - * - * @memberOf _.support - * @type boolean - */ - support.funcDecomp = !reNative.test(root.WinRTError) && reThis.test(function() { return this; }); - /** * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. * diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 5cea4cf322..eef86794d6 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -3,36 +3,36 @@ * Lo-Dash 2.1.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` */ -;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(tu(f,l))&&(t&&f.push(l),i.push(a))}return i}function c(n){return function(r,t,e){var u={};t=K(t,e,3),e=-1;var o=r?r.length:0; -if(typeof o=="number")for(;++ee&&(e=t,u=n)});else for(;++ou&&(u=t);return u}function q(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=i(r,e,4);var o=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++o]);++oarguments.length;return r=i(r,e,4),k(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function $(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return N(n,function(n){var t=Y(++r);e[r]=e[t],e[t]=n}),e}function I(n,r,t){var e;r=K(r,t,3),t=-1; -var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function P(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=K(r,t,3);++oe?$r(0,u+e):e||0}else if(e)return e=G(r,t),r[e]===t?e:-1;return n(r,t,e)}function V(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=K(r,t,3);++u>>1,t(n[e])/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Dr||(s=function(n){if(x(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),y(arguments)||(y=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Or.call(n,"callee")||!1 -});var Gr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Br.call(n)==fr||!1},Hr=function(n){var r,t=[];if(!n||!vr[typeof n])return t;for(r in n)Or.call(n,r)&&t.push(r);return t},Jr=Wr?function(n){return x(n)?Wr(n):[]}:Hr,Kr={"&":"&","<":"<",">":">",'"':""","'":"'"},Lr=b(Kr),Qr=RegExp("("+Jr(Lr).join("|")+")","g"),Xr=RegExp("["+Jr(Kr).join("")+"]","g"),Yr=function(n,r){var t;if(!n||!vr[typeof n])return n;for(t in n)if(r(n[t],t,n)===rr)break;return n},Zr=function(n,r){var t; -if(!n||!vr[typeof n])return n;for(t in n)if(Or.call(n,t)&&r(n[t],t,n)===rr)break;return n};j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==Br.call(n)});var nt=c(function(n,r,t){Or.call(n,t)?n[t]++:n[t]=1}),rt=c(function(n,r,t){(Or.call(n,t)?n[t]:n[t]=[]).push(r)}),tt=c(function(n,r,t){n[t]=r});u.after=function(n,r){if(!j(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=J,u.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n;i.push(f)}}return i},u.invert=b,u.invoke=function(n,r){var t=Cr.call(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return N(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},u.keys=Jr,u.map=D,u.max=F,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Or.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0; -if(r||typeof i!="number")r=K(r,t,3),N(n,function(n,t,o){t=r(n,t,o),tr(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!j(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Jr(n),e=t.length,u=Array(e);++rr?0:r);++nt?$r(0,e+t):Ir(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return yr._=xr,this},u.random=Y,u.reduce=M,u.reduceRight=W,u.result=function(n,r){if(n){var t=n[r];return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0; -return typeof r=="number"?r:Jr(n).length},u.some=I,u.sortedIndex=G,u.template=function(n,r,e){var o=u,i=o.templateSettings;n||(n=""),e=_({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(or,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';\n",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; -try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Qr,g)},u.uniqueId=function(n){var r=++nr+"";return n?n+r:r},u.all=R,u.any=I,u.detect=B,u.findWhere=function(n,r){return z(n,r,!0)},u.foldl=M,u.foldr=W,u.include=O,u.inject=M,u.first=P,u.last=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:Z; -return Cr.call(n,$r(0,u-e))},u.sample=function(n,r,t){var e=n?n.length:0;return typeof e!="number"&&(n=A(n)),null==r||t?n?n[Y(e-1)]:Z:(n=$(n),n.length=Ir($r(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.1.0",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var r=wr[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Vr.spliceObjects||0!==n.length||delete n[0],this -}}),N(["concat","join","slice"],function(n){var r=wr[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(yr._=u, define(function(){return u})):mr&&_r?dr?(_r.exports=u)._=u:mr._=u:yr._=u}).call(this); \ No newline at end of file +;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(tu(f,l))&&(t&&f.push(l),i.push(a))}return i}function c(n){return function(r,t,e){var u={};t=K(t,e,3),e=-1;var o=r?r.length:0; +if(typeof o=="number")for(;++ee&&(e=t,u=n)});else for(;++ou&&(u=t);return u}function D(n,r){var t=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++targuments.length;r=i(r,e,4);var o=-1,f=n.length;if(typeof f=="number")for(u&&(t=n[++o]);++oarguments.length;return r=i(r,e,4),k(n,function(n,e,o){t=u?(u=!1,n):r(t,n,e,o)}),t}function I(n){var r=-1,t=n?n.length:0,e=Array(typeof t=="number"?t:0);return R(n,function(n){var t=Y(++r);e[r]=e[t],e[t]=n}),e}function W(n,r,t){var e;r=K(r,t,3),t=-1; +var u=n?n.length:0;if(typeof u=="number")for(;++tt(u,i)&&o.push(i)}return o}function P(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=-1;for(r=K(r,t,3);++oe?$r(0,u+e):e||0}else if(e)return e=G(r,t),r[e]===t?e:-1;return n(r,t,e)}function V(n,r,t){if(typeof r!="number"&&null!=r){var e=0,u=-1,o=n?n.length:0;for(r=K(r,t,3);++u>>1,t(n[e])/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},kr||(s=function(n){if(x(n)){e.prototype=n;var r=new e;e.prototype=null}return r||{}}),y(arguments)||(y=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Ar.call(n,"callee")||!1});var Vr=Fr||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&Br.call(n)==ir||!1 +},Gr=function(n){var r,t=[];if(!n||!hr[typeof n])return t;for(r in n)Ar.call(n,r)&&t.push(r);return t},Hr=Mr?function(n){return x(n)?Mr(n):[]}:Gr,Jr={"&":"&","<":"<",">":">",'"':""","'":"'"},Kr=b(Jr),Lr=RegExp("("+Hr(Kr).join("|")+")","g"),Qr=RegExp("["+Hr(Jr).join("")+"]","g"),Xr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(r(n[t],t,n)===rr)break;return n},Yr=function(n,r){var t;if(!n||!hr[typeof n])return n;for(t in n)if(Ar.call(n,t)&&r(n[t],t,n)===rr)break; +return n};j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==Br.call(n)});var Zr=c(function(n,r,t){Ar.call(n,t)?n[t]++:n[t]=1}),nt=c(function(n,r,t){(Ar.call(n,t)?n[t]:n[t]=[]).push(r)}),rt=c(function(n,r,t){n[t]=r});u.after=function(n,r){if(!j(r))throw new TypeError;return function(){return 1>--n?r.apply(this,arguments):void 0}},u.bind=J,u.bindAll=function(n){for(var r=1u(i,f)){for(var a=t;--a;)if(0>u(r[a],f))continue n; +i.push(f)}}return i},u.invert=b,u.invoke=function(n,r){var t=zr.call(arguments,2),e=-1,u=typeof r=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return R(n,function(n){i[++e]=(u?r:n[r]).apply(n,t)}),i},u.keys=Hr,u.map=F,u.max=q,u.memoize=function(n,r){var t={};return function(){var e=r?r.apply(this,arguments):tr+arguments[0];return Ar.call(t,e)?t[e]:t[e]=n.apply(this,arguments)}},u.min=function(n,r,t){var e=1/0,u=e,o=-1,i=n?n.length:0;if(r||typeof i!="number")r=K(r,t,3),R(n,function(n,t,o){t=r(n,t,o),tr(t,u)&&(e[u]=n)}),e},u.once=function(n){var r,t;if(!j(n))throw new TypeError;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},u.pairs=function(n){for(var r=-1,t=Hr(n),e=t.length,u=Array(e);++rr?0:r);++nt?$r(0,e+t):Ir(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return gr._=jr,this},u.random=Y,u.reduce=M,u.reduceRight=$,u.result=function(n,r){if(n){var t=n[r];return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Hr(n).length +},u.some=W,u.sortedIndex=G,u.template=function(n,r,e){var o=u,i=o.templateSettings;n||(n=""),e=_({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ur,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';\n",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; +try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Lr,g)},u.uniqueId=function(n){var r=++nr+"";return n?n+r:r},u.all=S,u.any=W,u.detect=N,u.findWhere=function(n,r){return z(n,r,!0)},u.foldl=M,u.foldr=$,u.include=O,u.inject=M,u.first=P,u.last=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:Z; +return zr.call(n,$r(0,u-e))},u.sample=function(n,r,t){var e=n?n.length:0;return typeof e!="number"&&(n=A(n)),null==r||t?n?n[Y(e-1)]:Z:(n=I(n),n.length=Ir($r(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.1.0",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},R("pop push reverse shift sort splice unshift".split(" "),function(n){var r=br[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Ur.spliceObjects||0!==n.length||delete n[0],this +}}),R(["concat","join","slice"],function(n){var r=br[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gr._=u, define(function(){return u})):yr&&mr?_r?(mr.exports=u)._=u:yr._=u:gr._=u}).call(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 1e74bfa724..9e3fb44cd6 100644 --- a/doc/README.md +++ b/doc/README.md @@ -233,7 +233,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4176 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4186 "View in source") [Ⓣ][1] Creates an array with all falsey values removed. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are all falsey. @@ -257,7 +257,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array, [array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4205 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4215 "View in source") [Ⓣ][1] Creates an array excluding all values of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -282,7 +282,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4255 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4265 "View in source") [Ⓣ][1] This method is like `_.find` except that it returns the index of the first element that passes the callback check, instead of the element itself. @@ -310,7 +310,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.findLastIndex(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4288 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4298 "View in source") [Ⓣ][1] This method is like `_.findIndex` except that it iterates over elements of a `collection` from right to left. @@ -338,7 +338,7 @@ _.findLastIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4355 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4365 "View in source") [Ⓣ][1] Gets the first element or first `n` elements of an array. If a callback is provided elements at the beginning of the array are returned as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -398,7 +398,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array, [isShallow=false], [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4415 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4425 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truey, the array will only be flattened a single level. If a callback is provided each element of the array is passed through the callback before flattening. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -441,7 +441,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4452 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4462 "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 providing `true` for `fromIndex` will run a faster binary search. @@ -473,7 +473,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array, [callback=1], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4518 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4528 "View in source") [Ⓣ][1] Gets all but the last element or last `n` elements of an array. If a callback is provided elements at the end of the array are excluded from the result as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -530,7 +530,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4548 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4558 "View in source") [Ⓣ][1] Creates an array of unique values present in all provided arrays using strict equality for comparisons, i.e. `===`. @@ -554,7 +554,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4648 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4658 "View in source") [Ⓣ][1] Gets the last element or last `n` elements of an array. If a callback is provided elements at the end of the array are returned as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -611,7 +611,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value, [fromIndex=array.length-1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4687 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4697 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -640,7 +640,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.pull(array, [value])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4717 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4727 "View in source") [Ⓣ][1] Removes all provided values from the given array using strict equality for comparisons, i.e. `===`. @@ -667,7 +667,7 @@ console.log(array); ### `_.range([start=0], end, [step=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4768 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4778 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. If `start` is less than `stop` a zero-length range is created unless a negative `step` is specified. @@ -708,7 +708,7 @@ _.range(0); ### `_.remove(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4821 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4831 "View in source") [Ⓣ][1] Removes all elements from an array that the callback returns truey for and returns an array of removed elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -744,7 +744,7 @@ console.log(evens); ### `_.rest(array, [callback=1], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4895 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4905 "View in source") [Ⓣ][1] The opposite of `_.initial` this method gets all but the first element or first `n` elements of an array. If a callback function is provided elements at the beginning of the array are excluded from the result as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -804,7 +804,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4969 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which a value should be inserted into a given sorted array in order to maintain the sort order of the array. If a callback is provided it will be executed for `value` and each element of `array` to compute their sort ranking. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -853,7 +853,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4990 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5000 "View in source") [Ⓣ][1] Creates an array of unique values, in order, of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -877,7 +877,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array, [isSorted=false], [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5038 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5048 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of an array using strict equality for comparisons, i.e. `===`. If the array is sorted, providing `true` for `isSorted` will use a faster algorithm. If a callback is provided each element of `array` is passed through the callback before uniqueness is computed. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -924,7 +924,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.without(array, [value])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5066 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5076 "View in source") [Ⓣ][1] Creates an array excluding all provided values using strict equality for comparisons, i.e. `===`. @@ -949,7 +949,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5086 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5096 "View in source") [Ⓣ][1] Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. @@ -976,7 +976,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys, [values=[]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5116 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5126 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Provide either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` or two arrays, one of `keys` and one of corresponding `values`. @@ -1011,7 +1011,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L636 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L650 "View in source") [Ⓣ][1] Creates a `lodash` object which wraps the given value to enable method chaining. @@ -1064,7 +1064,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6336 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6344 "View in source") [Ⓣ][1] Creates a `lodash` object that wraps the given value. @@ -1097,7 +1097,7 @@ var youngest = _.chain(stooges) ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6364 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6372 "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. @@ -1127,7 +1127,7 @@ _([1, 2, 3, 4]) ### `_.prototype.chain()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6384 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6392 "View in source") [Ⓣ][1] Enables method chaining on the wrapper object. @@ -1151,7 +1151,7 @@ var sum = _([1, 2, 3]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6401 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6409 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1172,7 +1172,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6418 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6426 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1203,7 +1203,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection, [index])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3030 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3040 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1231,7 +1231,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3073 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] Checks if a given value is present in a collection using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1269,7 +1269,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3128 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3138 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of `collection` through the callback. The corresponding value of each key is the number of times the key was returned by the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1305,7 +1305,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3173 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3183 "View in source") [Ⓣ][1] Checks if the given callback returns truey value for **all** elements of a collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1351,7 +1351,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3234 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3244 "View in source") [Ⓣ][1] Iterates over elements of a collection, returning an array of all elements the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1397,7 +1397,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3301 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3311 "View in source") [Ⓣ][1] Iterates over elements of a collection, returning the first element that the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1446,7 @@ _.find(food, 'organic'); ### `_.findLast(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3346 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3356 "View in source") [Ⓣ][1] This method is like `_.find` except that it iterates over elements of a `collection` from right to left. @@ -1474,7 +1474,7 @@ _.findLast([1, 2, 3, 4], function(num) { ### `_.forEach(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3380 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3390 "View in source") [Ⓣ][1] Iterates over elements of a collection, executing the callback for each element. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1506,7 +1506,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); ### `_.forEachRight(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3413 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3423 "View in source") [Ⓣ][1] This method is like `_.forEach` except that it iterates over elements of a `collection` from right to left. @@ -1535,7 +1535,7 @@ _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); ### `_.groupBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3474 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3484 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of a collection through the callback. The corresponding value of each key is an array of the elements responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1572,7 +1572,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.indexBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3517 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3527 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of the collection through the given callback. The corresponding value of each key is the last element responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1613,7 +1613,7 @@ _.indexBy(stooges, function(key) { this.fromCharCode(key.code); }, String); ### `_.invoke(collection, methodName, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3543 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3553 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection` returning an array of the results of each invoked method. Additional arguments will be provided to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1642,7 +1642,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3595 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3605 "View in source") [Ⓣ][1] Creates an array of values by running each element in the collection through the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1687,7 +1687,7 @@ _.map(stooges, 'name'); ### `_.max(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3653 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3663 "View in source") [Ⓣ][1] Retrieves the maximum value of a collection. If the collection is empty or falsey `-Infinity` is returned. If a callback is provided it will be executed for each value in the collection to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1729,7 +1729,7 @@ _.max(stooges, 'age'); ### `_.min(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3723 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3733 "View in source") [Ⓣ][1] Retrieves the minimum value of a collection. If the collection is empty or falsey `Infinity` is returned. If a callback is provided it will be executed for each value in the collection to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1771,7 +1771,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3773 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3783 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1801,7 +1801,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3805 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3815 "View in source") [Ⓣ][1] Reduces a collection to a value which is the accumulated result of running each element in the collection through the callback, where each successive callback execution consumes the return value of the previous execution. If `accumulator` is not provided the first element of the collection will be used as the initial `accumulator` value. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1839,7 +1839,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3848 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3858 "View in source") [Ⓣ][1] This method is like `_.reduce` except that it iterates over elements of a `collection` from right to left. @@ -1870,7 +1870,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3897 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3907 "View in source") [Ⓣ][1] The opposite of `_.filter` this method returns the elements of a collection that the callback does **not** return truey for. @@ -1913,7 +1913,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.sample(collection, [n])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3923 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3933 "View in source") [Ⓣ][1] Retrieves a random element or `n` random elements from a collection. @@ -1941,7 +1941,7 @@ _.sample([1, 2, 3, 4], 2); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3952 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3962 "View in source") [Ⓣ][1] Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1965,7 +1965,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3985 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3995 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1995,7 +1995,7 @@ _.size('curly'); ### `_.some(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4032 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4042 "View in source") [Ⓣ][1] Checks if the callback returns a truey value for **any** element of a collection. The function returns as soon as it finds a passing value and does not iterate over the entire collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -2041,7 +2041,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4088 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4098 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in a collection through the callback. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -2078,7 +2078,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4124 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4134 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -2102,7 +2102,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4158 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] Performs a deep comparison of each element in a `collection` to the given `properties` object, returning an array of all elements that have equivalent property values. @@ -2142,7 +2142,7 @@ _.where(stooges, { 'quotes': ['Poifect!'] }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5158 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5168 "View in source") [Ⓣ][1] Creates a function that executes `func`, with the `this` binding and arguments of the created function, only after being called `n` times. @@ -2175,7 +2175,7 @@ _.forEach(saves, function(type) { ### `_.bind(func, [thisArg], [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5191 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5201 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those provided to the bound function. @@ -2206,7 +2206,7 @@ func(); ### `_.bindAll(object, [methodName])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5221 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5231 "View in source") [Ⓣ][1] Binds methods of an object to the object itself, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided all the function properties of `object` will be bound. @@ -2237,7 +2237,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5267 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5277 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those provided to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2278,7 +2278,7 @@ func(); ### `_.compose([func])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5303 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5313 "View in source") [Ⓣ][1] Creates a function that is the composition of the provided functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2316,7 +2316,7 @@ welcome('curly'); ### `_.createCallback([func=identity], [thisArg], [argCount])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5354 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5364 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name the created callback will return the property value for a given element. If `func` is an object the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2355,7 +2355,7 @@ _.filter(stooges, 'age__gt45'); ### `_.curry(func, [arity=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5419 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5429 "View in source") [Ⓣ][1] Creates a function which accepts one or more arguments of `func` that when invoked either executes `func` returning its result, if all `func` arguments have been provided, or returns a function that accepts one or more of the remaining `func` arguments, and so on. The arity of `func` can be specified if `func.length` is not sufficient. @@ -2390,7 +2390,7 @@ curried(1, 2, 3); ### `_.debounce(func, wait, [options], [options.maxWait])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5463 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5473 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2434,7 +2434,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5564 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5574 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be provided to `func` when it is invoked. @@ -2459,7 +2459,7 @@ _.defer(function() { console.log('deferred'); }); ### `_.delay(func, wait, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5598 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5608 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be provided to `func` when it is invoked. @@ -2486,7 +2486,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func, [resolver])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5640 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5650 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is provided it will be used to determine the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2526,7 +2526,7 @@ stooge('curly'); ### `_.once(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5673 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5683 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2552,7 +2552,7 @@ initialize(); ### `_.partial(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5711 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5721 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those provided to the new function. This method is similar to `_.bind` except it does **not** alter the `this` binding. @@ -2579,7 +2579,7 @@ hi('moe'); ### `_.partialRight(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5742 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5752 "View in source") [Ⓣ][1] This method is like `_.partial` except that `partial` arguments are appended to those provided to the new function. @@ -2616,7 +2616,7 @@ options.imports ### `_.throttle(func, wait, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5777 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5787 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2652,7 +2652,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5821 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5829 "View in source") [Ⓣ][1] Creates a function that provides `value` to the wrapper function as its first argument. Additional arguments provided to the function are appended to those provided to the wrapper function. The wrapper is executed with the `this` binding of the created function. @@ -2688,7 +2688,7 @@ hello(); ### `_.assign(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1956 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1966 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the assigned values. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2726,7 +2726,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value, [deep=false], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2009 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2019 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true` nested objects will also be cloned, otherwise they will be assigned by reference. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2737,7 +2737,7 @@ Creates a clone of `value`. If `deep` is `true` nested objects will also be clon 4. `[thisArg]` *(\*)*: The `this` binding of `callback`. #### Returns -*(\*)*: Returns the cloned `value`. +*(\*)*: Returns the cloned value. #### Example ```js @@ -2773,7 +2773,7 @@ clone.childNodes.length; ### `_.cloneDeep(value, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2061 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2071 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2785,7 +2785,7 @@ Note: This method is loosely based on the structured clone algorithm. Functions 3. `[thisArg]` *(\*)*: The `this` binding of `callback`. #### Returns -*(\*)*: Returns the deep cloned `value`. +*(\*)*: Returns the deep cloned value. #### Example ```js @@ -2819,7 +2819,7 @@ clone.node == view.node; ### `_.defaults(object, [source])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2085 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2095 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2845,7 +2845,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2107 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2117 "View in source") [Ⓣ][1] This method is like `_.findIndex` except that it returns the key of the first element that passes the callback check, instead of the element itself. @@ -2873,7 +2873,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.findLastKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2139 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2149 "View in source") [Ⓣ][1] This method is like `_.findKey` except that it iterates over elements of a `collection` in the opposite order. @@ -2901,7 +2901,7 @@ _.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2180 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2190 "View in source") [Ⓣ][1] Iterates over own and inherited enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2937,7 +2937,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forInRight(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2210 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2220 "View in source") [Ⓣ][1] This method is like `_.forIn` except that it iterates over elements of a `collection` in the opposite order. @@ -2973,7 +2973,7 @@ _.forInRight(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2248 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2258 "View in source") [Ⓣ][1] Iterates over own enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3001,7 +3001,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.forOwnRight(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2268 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2278 "View in source") [Ⓣ][1] This method is like `_.forOwn` except that it iterates over elements of a `collection` in the opposite order. @@ -3029,7 +3029,7 @@ _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2297 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2307 "View in source") [Ⓣ][1] Creates a sorted array of property names of all enumerable properties, own and inherited, of `object` that have function values. @@ -3056,7 +3056,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2322 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2332 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -3081,7 +3081,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2339 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2349 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given object. @@ -3105,7 +3105,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1781 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1791 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -3132,7 +3132,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1810 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1820 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -3159,7 +3159,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2365 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2375 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -3183,7 +3183,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2382 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2392 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -3207,7 +3207,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2399 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2409 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -3231,7 +3231,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2424 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2434 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -3261,7 +3261,7 @@ _.isEmpty(''); ### `_.isEqual(a, b, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2481 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If a callback is provided it will be executed to compare values. If the callback returns `undefined` comparisons will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -3306,7 +3306,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2513 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2523 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -3344,7 +3344,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2530 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2540 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -3368,7 +3368,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2593 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2603 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -3403,7 +3403,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2615 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2625 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3430,7 +3430,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2634 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2644 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3456,7 +3456,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2560 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2570 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3486,7 +3486,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2662 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2672 "View in source") [Ⓣ][1] Checks if `value` is an object created by the `Object` constructor. @@ -3521,7 +3521,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2687 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2697 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3545,7 +3545,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2704 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2714 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3569,7 +3569,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2731 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3593,7 +3593,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1844 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1854 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of an object. @@ -3617,7 +3617,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2776 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2786 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined` into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the merged values of the destination and source properties. If the callback returns `undefined` merging will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3673,7 +3673,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2832 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2842 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` omitting the properties the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3704,7 +3704,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2867 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2877 "View in source") [Ⓣ][1] Creates a two dimensional array of an object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3728,7 +3728,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2907 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2917 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` picking the properties the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3759,7 +3759,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2962 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2972 "View in source") [Ⓣ][1] An alternative to `_.reduce` this method transforms `object` to a new `accumulator` object which is the result of running each of its elements through a callback, with each callback execution potentially mutating the `accumulator` object. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3796,7 +3796,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3005 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3827,7 +3827,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5848 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5856 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3851,7 +3851,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5866 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5874 "View in source") [Ⓣ][1] This method returns the first argument provided to it. @@ -3876,7 +3876,7 @@ moe === _.identity(moe); ### `_.mixin(object, object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5893 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5901 "View in source") [Ⓣ][1] Adds function properties of a source object to the `lodash` function and chainable wrapper. @@ -3907,7 +3907,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5931 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5939 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3927,7 +3927,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value, [radix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5955 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5963 "View in source") [Ⓣ][1] Converts the given value into an integer of the specified radix. If `radix` is `undefined` or `0` a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3954,7 +3954,7 @@ _.parseInt('08'); ### `_.random([min=0], [max=1], [floating=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5987 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5995 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided a number between `0` and the given number will be returned. If `floating` is truey or either `min` or `max` are floats a floating-point number will be returned instead of an integer. @@ -3989,7 +3989,7 @@ _.random(1.2, 5.2); ### `_.result(object, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6044 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6052 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey then `undefined` is returned. @@ -4024,7 +4024,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=root])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L457 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L471 "View in source") [Ⓣ][1] Create a new `lodash` function using the given context object. @@ -4042,7 +4042,7 @@ Create a new `lodash` function using the given context object. ### `_.template(text, data, [options], [options.escape], [options.evaluate], [options.imports], [options.interpolate], [sourceURL], [variable])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6137 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6145 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -4136,7 +4136,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6260 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6268 "View in source") [Ⓣ][1] Executes the callback `n` times, returning an array of the results of each callback execution. The callback is bound to `thisArg` and invoked with one argument; *(index)*. @@ -4168,7 +4168,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6287 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6295 "View in source") [Ⓣ][1] The inverse of `_.escape` this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -4192,7 +4192,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6307 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6315 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is provided the ID will be appended to it. @@ -4226,7 +4226,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L864 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L878 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -4245,7 +4245,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6616 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6624 "View in source") [Ⓣ][1] *(string)*: The semantic version number. @@ -4257,7 +4257,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L665 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L679 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -4269,7 +4269,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L682 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L696 "View in source") [Ⓣ][1] *(boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -4281,7 +4281,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L690 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L704 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -4293,7 +4293,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L699 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L713 "View in source") [Ⓣ][1] *(boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -4305,7 +4305,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L712 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L726 "View in source") [Ⓣ][1] *(boolean)*: Detect if `prototype` properties are enumerable by default. @@ -4319,7 +4319,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L720 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L734 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -4331,7 +4331,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.funcDecomp` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L729 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L743 "View in source") [Ⓣ][1] *(boolean)*: Detect if functions can be decompiled by `Function#toString` *(all but PS3 and older Opera mobile browsers & avoided in Windows `8` apps)*. @@ -4343,7 +4343,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.funcNames` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L737 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L751 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Function#name` is supported *(all but IE)*. @@ -4355,7 +4355,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L746 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L760 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -4367,7 +4367,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L757 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L771 "View in source") [Ⓣ][1] *(boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -4381,7 +4381,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L765 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L779 "View in source") [Ⓣ][1] *(boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -4393,7 +4393,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L779 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L793 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -4407,7 +4407,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L790 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L804 "View in source") [Ⓣ][1] *(boolean)*: Detect lack of support for accessing string characters by index. @@ -4421,7 +4421,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L816 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L830 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -4433,7 +4433,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L824 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L838 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -4445,7 +4445,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L832 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L846 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -4457,7 +4457,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L840 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L854 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -4469,7 +4469,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L848 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L862 "View in source") [Ⓣ][1] *(string)*: Used to reference the data object in the template text. @@ -4481,7 +4481,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L856 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L870 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. diff --git a/lodash.js b/lodash.js index 3f175a1300..03a71932f7 100644 --- a/lodash.js +++ b/lodash.js @@ -6660,7 +6660,7 @@ }); // avoid array-like object bugs with `Array#shift` and `Array#splice` - // in Firefox < 10 and IE < 9 + // in IE < 9, Firefox < 10, Narwhal, and RingoJS if (!support.spliceObjects) { baseEach(['pop', 'shift', 'splice'], function(methodName) { var func = arrayRef[methodName], From da782398a26d4cf0f5e7f4ae655ab24296a3f1fd Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 28 Sep 2013 17:13:24 -0700 Subject: [PATCH 17/24] Allow test.'s to support `rhino -require` with modularized builds. --- test/test.js | 429 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 259 insertions(+), 170 deletions(-) diff --git a/test/test.js b/test/test.js index d427ed4ab8..f5b7498ee4 100644 --- a/test/test.js +++ b/test/test.js @@ -104,6 +104,9 @@ /** Detects if running in a PhantomJS web page */ var isPhantomPage = typeof callPhantom == 'function'; + /** Detect if running in Rhino */ + var isRhino = root.java && typeof global == 'function' && global().Array === root.Array; + /** Use a single "load" function */ var load = !amd && typeof require == 'function' ? require : root.load; @@ -830,125 +833,160 @@ (function() { test('subsequent "immediate" debounced calls return the last `func` result', function() { - var debounced = _.debounce(_.identity, 32, true), - result = [debounced('x'), debounced('y')]; + if (!(isRhino && isModularize)) { + var debounced = _.debounce(_.identity, 32, true), + result = [debounced('x'), debounced('y')]; - deepEqual(result, ['x', 'x']); + deepEqual(result, ['x', 'x']); + } + else { + skipTest(); + } }); asyncTest('subsequent debounced calls return the last `func` result', function() { - var debounced = _.debounce(_.identity, 32); - debounced('x'); + if (!(isRhino && isModularize)) { + var debounced = _.debounce(_.identity, 32); + debounced('x'); - setTimeout(function() { - equal(debounced('y'), 'x'); + setTimeout(function() { + equal(debounced('y'), 'x'); + QUnit.start(); + }, 64); + } + else { + skipTest(); QUnit.start(); - }, 64); + } }); asyncTest('should apply default options correctly', function() { - var count = 0; + if (!(isRhino && isModularize)) { + var count = 0; - var debounced = _.debounce(function(value) { - count++; - return value; - }, 32, {}); + var debounced = _.debounce(function(value) { + count++; + return value; + }, 32, {}); - strictEqual(debounced('x'), undefined); + strictEqual(debounced('x'), undefined); - setTimeout(function() { - strictEqual(count, 1); + setTimeout(function() { + strictEqual(count, 1); + QUnit.start(); + }, 64); + } + else { + skipTest(2); QUnit.start(); - }, 64); + } }); asyncTest('should work with `leading` option', function() { - var withLeadingAndTrailing, - counts = [0, 0, 0]; - - _.forEach([true, { 'leading': true }], function(options, index) { - var debounced = _.debounce(function(value) { - counts[index]++; - return value; - }, 32, options); - - if (index == 1) { - withLeadingAndTrailing = debounced; - } - equal(debounced('x'), 'x'); - }); + if (!(isRhino && isModularize)) { + var withLeadingAndTrailing, + counts = [0, 0, 0]; + + _.forEach([true, { 'leading': true }], function(options, index) { + var debounced = _.debounce(function(value) { + counts[index]++; + return value; + }, 32, options); + + if (index == 1) { + withLeadingAndTrailing = debounced; + } + equal(debounced('x'), 'x'); + }); - _.times(2, _.debounce(function() { counts[2]++; }, 32, { 'leading': true })); - strictEqual(counts[2], 1); + _.times(2, _.debounce(function() { counts[2]++; }, 32, { 'leading': true })); + strictEqual(counts[2], 1); - _.forEach([false, { 'leading': false }], function(options) { - var withoutLeading = _.debounce(_.identity, 32, options); - strictEqual(withoutLeading('x'), undefined); - }); + _.forEach([false, { 'leading': false }], function(options) { + var withoutLeading = _.debounce(_.identity, 32, options); + strictEqual(withoutLeading('x'), undefined); + }); - setTimeout(function() { - deepEqual(counts, [1, 1, 2]); + setTimeout(function() { + deepEqual(counts, [1, 1, 2]); - withLeadingAndTrailing('x'); - equal(counts[1], 2); + withLeadingAndTrailing('x'); + equal(counts[1], 2); + QUnit.start(); + }, 64); + } + else { + skipTest(5); QUnit.start(); - }, 64); + } }); asyncTest('should work with `trailing` option', function() { - var withCount = 0, - withoutCount = 0; + if (!(isRhino && isModularize)) { + var withCount = 0, + withoutCount = 0; - var withTrailing = _.debounce(function(value) { - withCount++; - return value; - }, 32, { 'trailing': true }); + var withTrailing = _.debounce(function(value) { + withCount++; + return value; + }, 32, { 'trailing': true }); - var withoutTrailing = _.debounce(function(value) { - withoutCount++; - return value; - }, 32, { 'trailing': false }); + var withoutTrailing = _.debounce(function(value) { + withoutCount++; + return value; + }, 32, { 'trailing': false }); - strictEqual(withTrailing('x'), undefined); - strictEqual(withoutTrailing('x'), undefined); + strictEqual(withTrailing('x'), undefined); + strictEqual(withoutTrailing('x'), undefined); - setTimeout(function() { - strictEqual(withCount, 1); - strictEqual(withoutCount, 0); + setTimeout(function() { + strictEqual(withCount, 1); + strictEqual(withoutCount, 0); + QUnit.start(); + }, 64); + } + else { + skipTest(4); QUnit.start(); - }, 64); + } }); asyncTest('should work with `maxWait` option', function() { - var limit = 100, - withCount = 0, - withoutCount = 0; - - var withMaxWait = _.debounce(function() { - withCount++; - }, 32, { 'maxWait': 64 }); - - var withoutMaxWait = _.debounce(function() { - withoutCount++; - }, 32); - - var start = new Date; - while ((new Date - start) < limit) { - withMaxWait(); - withoutMaxWait(); - } - strictEqual(withCount, 1); - strictEqual(withoutCount, 0); + if (!(isRhino && isModularize)) { + var limit = 100, + withCount = 0, + withoutCount = 0; + + var withMaxWait = _.debounce(function() { + withCount++; + }, 32, { 'maxWait': 64 }); + + var withoutMaxWait = _.debounce(function() { + withoutCount++; + }, 32); - var lastWithCount = withCount, - lastWithoutCount = withoutCount; + var start = new Date; + while ((new Date - start) < limit) { + withMaxWait(); + withoutMaxWait(); + } + strictEqual(withCount, 1); + strictEqual(withoutCount, 0); - setTimeout(function() { - ok(withCount > lastWithCount); - ok(withoutCount > lastWithoutCount && withoutCount < withCount); + var lastWithCount = withCount, + lastWithoutCount = withoutCount; + + setTimeout(function() { + ok(withCount > lastWithCount); + ok(withoutCount > lastWithoutCount && withoutCount < withCount); + QUnit.start(); + }, 64); + } + else { + skipTest(4); QUnit.start(); - }, 64); + } }); }()); @@ -974,10 +1012,15 @@ (function() { asyncTest('should accept additional arguments', function() { - _.defer(function() { - deepEqual(slice.call(arguments), [1, 2, 3]); + if (!(isRhino && isModularize)) { + _.defer(function() { + deepEqual(slice.call(arguments), [1, 2, 3]); + QUnit.start(); + }, 1, 2, 3); + } else { + skipTest(); QUnit.start(); - }, 1, 2, 3); + } }); }()); @@ -3809,10 +3852,15 @@ (function() { test('subsequent calls should return the result of the first call', function() { - var throttled = _.throttle(function(value) { return value; }, 32), - result = [throttled('x'), throttled('y')]; + if (!(isRhino && isModularize)) { + var throttled = _.throttle(function(value) { return value; }, 32), + result = [throttled('x'), throttled('y')]; - deepEqual(result, ['x', 'x']); + deepEqual(result, ['x', 'x']); + } + else { + skipTest(); + } }); test('should clear timeout when `func` is called', function() { @@ -3842,127 +3890,168 @@ }); asyncTest('supports recursive calls', function() { - var count = 0; - var throttled = _.throttle(function() { - count++; - if (count < 10) { - throttled(); - } - }, 32); + if (!(isRhino && isModularize)) { + var count = 0; + var throttled = _.throttle(function() { + count++; + if (count < 10) { + throttled(); + } + }, 32); - throttled(); - equal(count, 1); + throttled(); + equal(count, 1); - setTimeout(function() { - ok(count < 3) + setTimeout(function() { + ok(count < 3) + QUnit.start(); + }, 32); + } + else { + skipTest(2); QUnit.start(); - }, 32); + } }); asyncTest('should not trigger a trailing call when invoked once', function() { - var count = 0, - throttled = _.throttle(function() { count++; }, 32); - - throttled(); - equal(count, 1); + if (!(isRhino && isModularize)) { + var count = 0, + throttled = _.throttle(function() { count++; }, 32); - setTimeout(function() { + throttled(); equal(count, 1); + + setTimeout(function() { + equal(count, 1); + QUnit.start(); + }, 96); + } + else { + skipTest(2); QUnit.start(); - }, 96); + } }); _.times(2, function(index) { asyncTest('should trigger trailing call when invoked repeatedly' + (index ? ' and `leading` is `false`' : '') , function() { - var count = 0, - limit = 160, - options = index ? { 'leading': false } : {}, - throttled = _.throttle(function() { count++; }, 64, options), - start = new Date; + if (!(isRhino && isModularize)) { + var count = 0, + limit = 160, + options = index ? { 'leading': false } : {}, + throttled = _.throttle(function() { count++; }, 64, options), + start = new Date; + + while ((new Date - start) < limit) { + throttled(); + } + var lastCount = count; + ok(count > 1); - while ((new Date - start) < limit) { - throttled(); + setTimeout(function() { + ok(count > lastCount); + QUnit.start(); + }, 96); } - var lastCount = count; - ok(count > 1); - - setTimeout(function() { - ok(count > lastCount); + else { + skipTest(2); QUnit.start(); - }, 96); + } }); }); asyncTest('should apply default options correctly', function() { - var count = 0; + if (!(isRhino && isModularize)) { + var count = 0; - var throttled = _.throttle(function(value) { - count++; - return value; - }, 32, {}); + var throttled = _.throttle(function(value) { + count++; + return value; + }, 32, {}); - _.times(2, function() { - equal(throttled('x'), 'x'); - }); + _.times(2, function() { + equal(throttled('x'), 'x'); + }); - setTimeout(function() { - strictEqual(count, 2); + setTimeout(function() { + strictEqual(count, 2); + QUnit.start(); + }, 64); + } + else { + skipTest(3); QUnit.start(); - }, 64); + } }); test('should work with `leading` option', function() { - _.forEach([true, { 'leading': true }], function(options) { - var withLeading = _.throttle(_.identity, 32, options); - equal(withLeading('x'), 'x'); - }); + if (!(isRhino && isModularize)) { + _.forEach([true, { 'leading': true }], function(options) { + var withLeading = _.throttle(_.identity, 32, options); + equal(withLeading('x'), 'x'); + }); - _.forEach([false, { 'leading': false }], function(options) { - var withoutLeading = _.throttle(_.identity, 32, options); - strictEqual(withoutLeading('x'), undefined); - }); + _.forEach([false, { 'leading': false }], function(options) { + var withoutLeading = _.throttle(_.identity, 32, options); + strictEqual(withoutLeading('x'), undefined); + }); + } + else { + skipTest(4); + } }); asyncTest('should work with `trailing` option', function() { - var withCount = 0, - withoutCount = 0; - - var withTrailing = _.throttle(function(value) { - withCount++; - return value; - }, 32, { 'trailing': true }); - - var withoutTrailing = _.throttle(function(value) { - withoutCount++; - return value; - }, 32, { 'trailing': false }); - - _.times(2, function() { - equal(withTrailing('x'), 'x'); - equal(withoutTrailing('x'), 'x'); - }); + if (!(isRhino && isModularize)) { + var withCount = 0, + withoutCount = 0; + + var withTrailing = _.throttle(function(value) { + withCount++; + return value; + }, 32, { 'trailing': true }); - setTimeout(function() { - equal(withCount, 2); - strictEqual(withoutCount, 1); + var withoutTrailing = _.throttle(function(value) { + withoutCount++; + return value; + }, 32, { 'trailing': false }); + + _.times(2, function() { + equal(withTrailing('x'), 'x'); + equal(withoutTrailing('x'), 'x'); + }); + + setTimeout(function() { + equal(withCount, 2); + strictEqual(withoutCount, 1); + QUnit.start(); + }, 64); + } + else { + skipTest(6); QUnit.start(); - }, 64); + } }); asyncTest('should not update `lastCalled`, at the end of the timeout, when `trailing` is `false`', function() { - var count = 0; + if (!(isRhino && isModularize)) { + var count = 0; - var throttled = _.throttle(function() { - count++; - }, 64, { 'trailing': false }); + var throttled = _.throttle(function() { + count++; + }, 64, { 'trailing': false }); - _.times(2, throttled); - setTimeout(function() { _.times(2, throttled); }, 100); + _.times(2, throttled); + setTimeout(function() { _.times(2, throttled); }, 100); - setTimeout(function() { - equal(count, 2); + setTimeout(function() { + equal(count, 2); + QUnit.start(); + }, 128); + } + else { + skipTest(); QUnit.start(); - }, 128); + } }); }()); From bafe4fff9330fade4f3d0fe8df215100bd31cc70 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 28 Sep 2013 18:27:07 -0700 Subject: [PATCH 18/24] Update vendor/qunit-clib and validate assert counts in each unit test. --- test/test.js | 798 ++++++++++++++++---------------- vendor/qunit-clib/qunit-clib.js | 33 ++ 2 files changed, 436 insertions(+), 395 deletions(-) diff --git a/test/test.js b/test/test.js index f5b7498ee4..e0a5abecad 100644 --- a/test/test.js +++ b/test/test.js @@ -211,7 +211,7 @@ QUnit.module(basename); (function() { - test('supports loading ' + basename + ' as the "lodash" module', function() { + test('supports loading ' + basename + ' as the "lodash" module', 1, function() { if (amd) { equal((lodashModule || {}).moduleName, 'lodash'); } else { @@ -219,7 +219,7 @@ } }); - test('supports loading ' + basename + ' with the Require.js "shim" configuration option', function() { + test('supports loading ' + basename + ' with the Require.js "shim" configuration option', 1, function() { if (amd && /requirejs/.test(ui.loaderPath)) { equal((shimmedModule || {}).moduleName, 'shimmed'); } else { @@ -227,7 +227,7 @@ } }); - test('supports loading ' + basename + ' as the "underscore" module', function() { + test('supports loading ' + basename + ' as the "underscore" module', 1, function() { if (amd && !/dojo/.test(ui.loaderPath)) { equal((underscoreModule || {}).moduleName, 'underscore'); } else { @@ -235,7 +235,7 @@ } }); - asyncTest('supports loading ' + basename + ' in a web worker', function() { + asyncTest('supports loading ' + basename + ' in a web worker', 1, function() { if (Worker && !isModularize) { var limit = 1000, start = new Date; @@ -251,13 +251,14 @@ }; attempt(); - } else { + } + else { skipTest(); QUnit.start(); } }); - test('avoids overwritten native methods', function() { + test('avoids overwritten native methods', 3, function() { function message(methodName) { return '`_.' + methodName + '` should avoid overwritten native methods'; } @@ -291,11 +292,11 @@ QUnit.module('lodash constructor'); (function() { - test('creates a new instance when called without the `new` operator', function() { + test('creates a new instance when called without the `new` operator', 1, function() { ok(_() instanceof _); }); - test('should return provided `lodash` instances', function() { + test('should return provided `lodash` instances', 1,function() { var wrapped = _(false); equal(_(wrapped), wrapped); }); @@ -306,7 +307,7 @@ QUnit.module('lodash.assign'); (function() { - test('should not error on `null` or `undefined` sources (test in IE < 9)', function() { + test('should not error on `null` or `undefined` sources (test in IE < 9)', 1, function() { try { deepEqual(_.assign({}, null, undefined, { 'a': 1 }), { 'a': 1 }); } catch(e) { @@ -322,31 +323,31 @@ (function() { var args = arguments; - test('should return `undefined` for nonexistent keys', function() { + test('should return `undefined` for nonexistent keys', 1, function() { var actual = _.at(['a', 'b', 'c'], [0, 2, 4]); deepEqual(actual, ['a', 'c', undefined]); }); - test('should return an empty array when no keys are provided', function() { + test('should return an empty array when no keys are provided', 1, function() { deepEqual(_.at(['a', 'b', 'c']), []); }); - test('should accept multiple key arguments', function() { + test('should accept multiple key arguments', 1, function() { var actual = _.at(['a', 'b', 'c', 'd'], 0, 2, 3); deepEqual(actual, ['a', 'c', 'd']); }); - test('should work with an `arguments` object for `collection`', function() { + test('should work with an `arguments` object for `collection`', 1, function() { var actual = _.at(args, [0, 2]); deepEqual(actual, ['a', 'c']); }); - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var actual = _.at({ 'a': 1, 'b': 2, 'c': 3 }, ['a', 'c']); deepEqual(actual, [1, 3]); }); - test('should work when used as `callback` for `_.map`', function() { + test('should work when used as `callback` for `_.map`', 1, function() { var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]], actual = _.map(array, _.at); @@ -358,7 +359,7 @@ 'object': Object('abc') }, function(collection, key) { - test('should work with a string ' + key + ' for `collection`', function() { + test('should work with a string ' + key + ' for `collection`', 1, function() { deepEqual(_.at(collection, [0, 2]), ['a', 'c']); }); }); @@ -369,7 +370,7 @@ QUnit.module('lodash.bind'); (function() { - test('should append array arguments to partially applied arguments (test in IE < 9)', function() { + test('should append array arguments to partially applied arguments (test in IE < 9)', 1, function() { var args, bound = _.bind(function() { args = slice.call(arguments); }, {}, 'a'); @@ -377,14 +378,14 @@ deepEqual(args, ['a', ['b'], 'c']); }); - test('ensure `new bound` is an instance of `func`', function() { + test('ensure `new bound` is an instance of `func`', 1, function() { var func = function() {}, bound = _.bind(func, {}); ok(new bound instanceof func); }); - test('should throw a TypeError if `func` is not a function', function() { + test('should throw a TypeError if `func` is not a function', 1, function() { raises(function() { _.bind(); }, TypeError); }); }()); @@ -396,7 +397,7 @@ (function() { var args = arguments; - test('should bind all methods of `object`', function() { + test('should bind all methods of `object`', 1, function() { function Foo() { this._a = 1; this._b = 2; @@ -415,7 +416,7 @@ deepEqual(actual, [1, 2]); }); - test('should accept arrays of method names', function() { + test('should accept arrays of method names', 1, function() { var object = { '_a': 1, '_b': 2, @@ -436,13 +437,13 @@ deepEqual(actual, [1, 2, 3, undefined]); }); - test('should work with an array `object` argument', function() { + test('should work with an array `object` argument', 1, function() { var array = ['push', 'pop']; _.bindAll(array); equal(array.pop, Array.prototype.pop); }); - test('should work with `arguments` objects as secondary arguments', function() { + test('should work with `arguments` objects as secondary arguments', 1, function() { var object = { '_a': 1, 'a': function() { return this._a; } @@ -463,7 +464,7 @@ QUnit.module('lodash.bindKey'); (function() { - test('should work when the target function is overwritten', function() { + test('should work when the target function is overwritten', 2, function() { var object = { 'name': 'moe', 'greet': function(greeting) { @@ -487,17 +488,17 @@ QUnit.module('lodash.chain'); (function() { - test('should return a wrapped value', function() { + test('should return a wrapped value', 1, function() { var actual = _.chain({ 'a': 0 }); ok(actual instanceof _); }); - test('should return the existing wrapper when chaining', function() { + test('should return the existing wrapper when chaining', 1, function() { var wrapper = _({ 'a': 0 }); equal(wrapper.chain(), wrapper); }); - test('should enable chaining of methods that return unwrapped values by default', function() { + test('should enable chaining of methods that return unwrapped values by default', 6, function() { var array = ['abc']; ok(_.chain(array).first() instanceof _); @@ -545,7 +546,7 @@ objects['an array'].length = 5; - test('`_.clone` should shallow clone by default', function() { + test('`_.clone` should shallow clone by default', 2, function() { var expected = [{ 'a': 0 }, { 'b': 1 }], actual = _.clone(expected); @@ -553,14 +554,14 @@ ok(actual != expected && actual[0] === expected[0]); }); - test('`_.clone` should perform a shallow clone when used as `callback` for `_.map`', function() { + test('`_.clone` should perform a shallow clone when used as `callback` for `_.map`', 1, function() { var expected = [{ 'a': [0] }, { 'b': [1] }], actual = _.map(expected, _.clone); ok(actual[0] != expected[0] && actual[0].a === expected[0].a && actual[1].b === expected[1].b); }); - test('`_.cloneDeep` should deep clone objects with circular references', function() { + test('`_.cloneDeep` should deep clone objects with circular references', 1, function() { var object = { 'foo': { 'b': { 'foo': { 'c': { } } } }, 'bar': { } @@ -582,7 +583,7 @@ klass = new Klass; _.forOwn(objects, function(object, key) { - test('`_.' + methodName + '` should clone ' + key, function() { + test('`_.' + methodName + '` should clone ' + key, 2, function() { var clone = func(object); strictEqual(_.isEqual(object, clone), true); @@ -595,17 +596,17 @@ }); _.forOwn(nonCloneable, function(object, key) { - test('`_.' + methodName + '` should not clone ' + key, function() { + test('`_.' + methodName + '` should not clone ' + key, 1, function() { strictEqual(func(object), object); }); }); - test('`_.' + methodName + '` should clone problem JScript properties (test in IE < 9)', function() { + test('`_.' + methodName + '` should clone problem JScript properties (test in IE < 9)', 2, function() { deepEqual(func(shadowedObject), shadowedObject); notEqual(func(shadowedObject), shadowedObject); }); - test('`_.' + methodName + '` should pass the correct `callback` arguments', function() { + test('`_.' + methodName + '` should pass the correct `callback` arguments', 1, function() { var args; func(klass, function() { @@ -615,7 +616,7 @@ deepEqual(args, [klass]); }); - test('`_.' + methodName + '` should correct set the `this` binding', function() { + test('`_.' + methodName + '` should correct set the `this` binding', 1, function() { var actual = func('a', function(value) { return this[value]; }, { 'a': 'A' }); @@ -623,12 +624,12 @@ equal(actual, 'A'); }); - test('`_.' + methodName + '` should handle cloning if `callback` returns `undefined`', function() { + test('`_.' + methodName + '` should handle cloning if `callback` returns `undefined`', 1, function() { var actual = func({ 'a': { 'b': 'c' } }, function() {}); deepEqual(actual, { 'a': { 'b': 'c' } }); }); - test('`_.' + methodName + '` should deep clone `index` and `input` array properties', function() { + test('`_.' + methodName + '` should deep clone `index` and `input` array properties', 2, function() { var array = /x/.exec('vwxyz'), actual = func(array); @@ -636,7 +637,7 @@ equal(actual.input, 'vwxyz'); }); - test('`_.' + methodName + '` should deep clone `lastIndex` regexp property', function() { + test('`_.' + methodName + '` should deep clone `lastIndex` regexp property', 1, function() { var regexp = /x/g; regexp.test('vwxyz'); @@ -658,22 +659,22 @@ 'a string': '123123' }, function(collection, key) { - test('should work with ' + key + ' and a positive `fromIndex`', function() { + test('should work with ' + key + ' and a positive `fromIndex`', 1, function() { strictEqual(_.contains(collection, 1, 2), true); }); - test('should work with ' + key + ' and a `fromIndex` >= collection\'s length', function() { + test('should work with ' + key + ' and a `fromIndex` >= collection\'s length', 4, function() { strictEqual(_.contains(collection, 1, 6), false); strictEqual(_.contains(collection, undefined, 6), false); strictEqual(_.contains(collection, 1, 8), false); strictEqual(_.contains(collection, undefined, 8), false); }); - test('should work with ' + key + ' and a negative `fromIndex`', function() { + test('should work with ' + key + ' and a negative `fromIndex`', 1, function() { strictEqual(_.contains(collection, 2, -3), true); }); - test('should work with ' + key + ' and a negative `fromIndex` <= negative collection\'s length', function() { + test('should work with ' + key + ' and a negative `fromIndex` <= negative collection\'s length', 2, function() { strictEqual(_.contains(collection, 1, -6), true); strictEqual(_.contains(collection, 2, -8), true); }); @@ -684,7 +685,7 @@ 'object': Object('abc') }, function(collection, key) { - test('should work with a string ' + key + ' for `collection`', function() { + test('should work with a string ' + key + ' for `collection`', 2, function() { strictEqual(_.contains(collection, 'bc'), true); strictEqual(_.contains(collection, 'd'), false); }); @@ -696,12 +697,12 @@ QUnit.module('lodash.countBy'); (function() { - test('should use `_.identity` when no `callback` is provided', function() { + test('should use `_.identity` when no `callback` is provided', 1, function() { var actual = _.countBy([4, 6, 6]); deepEqual(actual, { '4': 1, '6': 2 }); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.countBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); @@ -709,7 +710,7 @@ deepEqual(actual, { '4': 1, '6': 2 }); }); - test('should only add values to own, not inherited, properties', function() { + test('should only add values to own, not inherited, properties', 2, function() { var actual = _.countBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; }); @@ -718,7 +719,7 @@ deepEqual(actual.hasOwnProperty, 2); }); - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var actual = _.countBy({ 'a': 4.2, 'b': 6.1, 'c': 6.4 }, function(num) { return Math.floor(num); }); @@ -726,7 +727,7 @@ deepEqual(actual, { '4': 1, '6': 2 }); }); - test('should work with a number for `callback`', function() { + test('should work with a number for `callback`', 2, function() { var array = [ [1, 'a'], [2, 'a'], @@ -743,7 +744,7 @@ QUnit.module('lodash.createCallback'); (function() { - test('should work with functions created by `_.partial` and `_.partialRight`', function() { + test('should work with functions created by `_.partial` and `_.partialRight`', 2, function() { function func() { var result = [this.x]; push.apply(result, arguments); @@ -759,7 +760,7 @@ deepEqual(callback(2), expected); }); - test('should work without an `argCount`', function() { + test('should work without an `argCount`', 1, function() { var args, expected = ['a', 'b', 'c', 'd', 'e']; @@ -777,7 +778,7 @@ QUnit.module('lodash.curry'); (function() { - test('should curry based on the number of arguments provided', function() { + test('should curry based on the number of arguments provided', 3, function() { function func(a, b, c) { return a + b + c; } @@ -789,7 +790,7 @@ equal(curried(1, 2, 3), 6); }); - test('should work with partial methods', function() { + test('should work with partial methods', 2, function() { function func(a, b, c) { return a + b + c; } @@ -803,7 +804,7 @@ equal(c(), 6); }); - test('should not alter the `this` binding', function() { + test('should not alter the `this` binding', 9, function() { function func(a, b, c) { var value = this || {}; return value[a] + value[b] + value[c]; @@ -832,7 +833,7 @@ QUnit.module('lodash.debounce'); (function() { - test('subsequent "immediate" debounced calls return the last `func` result', function() { + test('subsequent "immediate" debounced calls return the last `func` result', 1, function() { if (!(isRhino && isModularize)) { var debounced = _.debounce(_.identity, 32, true), result = [debounced('x'), debounced('y')]; @@ -844,7 +845,7 @@ } }); - asyncTest('subsequent debounced calls return the last `func` result', function() { + asyncTest('subsequent debounced calls return the last `func` result', 1, function() { if (!(isRhino && isModularize)) { var debounced = _.debounce(_.identity, 32); debounced('x'); @@ -860,7 +861,7 @@ } }); - asyncTest('should apply default options correctly', function() { + asyncTest('should apply default options correctly', 2, function() { if (!(isRhino && isModularize)) { var count = 0; @@ -882,7 +883,7 @@ } }); - asyncTest('should work with `leading` option', function() { + asyncTest('should work with `leading` option', 7, function() { if (!(isRhino && isModularize)) { var withLeadingAndTrailing, counts = [0, 0, 0]; @@ -917,12 +918,12 @@ }, 64); } else { - skipTest(5); + skipTest(7); QUnit.start(); } }); - asyncTest('should work with `trailing` option', function() { + asyncTest('should work with `trailing` option', 4, function() { if (!(isRhino && isModularize)) { var withCount = 0, withoutCount = 0; @@ -952,7 +953,7 @@ } }); - asyncTest('should work with `maxWait` option', function() { + asyncTest('should work with `maxWait` option', 4, function() { if (!(isRhino && isModularize)) { var limit = 100, withCount = 0, @@ -995,12 +996,12 @@ QUnit.module('lodash.defaults'); (function() { - test('should not overwrite `null` values', function() { + test('should not overwrite `null` values', 1, function() { var actual = _.defaults({ 'a': null }, { 'a': 1 }); strictEqual(actual.a, null); }); - test('should overwrite `undefined` values', function() { + test('should overwrite `undefined` values', 1, function() { var actual = _.defaults({ 'a': undefined }, { 'a': 1 }); strictEqual(actual.a, 1); }); @@ -1011,13 +1012,14 @@ QUnit.module('lodash.defer'); (function() { - asyncTest('should accept additional arguments', function() { + asyncTest('should accept additional arguments', 1, function() { if (!(isRhino && isModularize)) { _.defer(function() { deepEqual(slice.call(arguments), [1, 2, 3]); QUnit.start(); }, 1, 2, 3); - } else { + } + else { skipTest(); QUnit.start(); } @@ -1029,7 +1031,7 @@ QUnit.module('lodash.difference'); (function() { - test('should work with large arrays', function() { + test('should work with large arrays', 1, function() { var array1 = _.range(largeArraySize), array2 = array1.slice(), a = {}, @@ -1042,7 +1044,7 @@ deepEqual(_.difference(array1, array2), []); }); - test('should not accept individual secondary values', function() { + test('should not accept individual secondary values', 1, function() { var array = [1, null, 3]; deepEqual(_.difference(array, null, 3), array); }); @@ -1053,15 +1055,15 @@ QUnit.module('lodash.escape'); (function() { - test('should not escape the "/" character', function() { + test('should not escape the "/" character', 1, function() { equal(_.escape('/'), '/'); }); - test('should escape "\'" to "'"', function() { + test('should escape "\'" to "'"', 1, function() { equal(_.escape("'"), "'"); }); - test('should return an empty string when provided `null` or `undefined`', function() { + test('should return an empty string when provided `null` or `undefined`', 2, function() { equal(_.escape(null), ''); equal(_.escape(undefined), ''); }); @@ -1072,7 +1074,7 @@ QUnit.module('lodash.every'); (function() { - test('should return `false` as soon as the `callback` result is falsey', function() { + test('should return `false` as soon as the `callback` result is falsey', 1, function() { strictEqual(_.every([true, null, true], _.identity), false); }); }()); @@ -1084,13 +1086,13 @@ _.forEach(['assign', 'defaults', 'merge'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` should not assign inherited `source` properties', function() { + test('`_.' + methodName + '` should not assign inherited `source` properties', 1, function() { function Foo() {} Foo.prototype = { 'a': 1 }; deepEqual(func({}, new Foo), {}); }); - test('should work when used as `callback` for `_.reduce`', function() { + test('should work when used as `callback` for `_.reduce`', 1, function() { var array = [{ 'a': 1 }, { 'b': 2 }, { 'c': 3 }], actual = _.reduce(array, _.merge); @@ -1098,7 +1100,7 @@ }); if (methodName == 'merge') { - test('`_.' + methodName + '` should treat sparse arrays as dense', function() { + test('`_.' + methodName + '` should treat sparse arrays as dense', 2, function() { var array = Array(3); array[0] = 1; array[2] = 3; @@ -1121,7 +1123,7 @@ _.forEach(['assign', 'bindAll', 'defaults'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` should not throw strict mode errors', function() { + test('`_.' + methodName + '` should not throw strict mode errors', 1, function() { var object = { 'a': null, 'b': function(){} }, pass = true; @@ -1149,7 +1151,7 @@ QUnit.module('lodash.filter'); (function() { - test('should not modify the resulting value from within `callback`', function() { + test('should not modify the resulting value from within `callback`', 1, function() { var actual = _.filter([0], function(num, index, array) { return (array[index] = 1); }); @@ -1180,23 +1182,23 @@ var func = _[methodName]; - test('should return the correct value', function() { + test('should return the correct value', 1, function() { strictEqual(func(objects, function(object) { return object.a; }), expected[0]); }); - test('should work with a `thisArg`', function() { + test('should work with a `thisArg`', 1, function() { strictEqual(func(objects, function(object, index) { return this[index].a; }, objects), expected[0]); }); - test('should return `' + expected[1] + '` if value is not found', function() { + test('should return `' + expected[1] + '` if value is not found', 1, function() { strictEqual(func(objects, function(object) { return object.a == 3; }), expected[1]); }); - test('should work with an object for `callback`', function() { + test('should work with an object for `callback`', 1, function() { strictEqual(func(objects, { 'b': 2 }), expected[2]); }); - test('should work with a string for `callback`', function() { + test('should work with a string for `callback`', 1, function() { strictEqual(func(objects, 'b'), expected[3]); }); }); @@ -1215,38 +1217,38 @@ { 'a': 0, 'b': 0 } ]; - test('should return the first element', function() { + test('should return the first element', 1, function() { strictEqual(_.first(array), 1); }); - test('should return the first two elements', function() { + test('should return the first two elements', 1, function() { deepEqual(_.first(array, 2), [1, 2]); }); - test('should return an empty array when `n` < `1`', function() { + test('should return an empty array when `n` < `1`', 3, function() { _.each([0, -1, -2], function(n) { deepEqual(_.first(array, n), []); }); }); - test('should return all elements when `n` >= `array.length`', function() { + test('should return all elements when `n` >= `array.length`', 2, function() { _.each([3, 4], function(n) { deepEqual(_.first(array, n), array.slice()); }); }); - test('should return `undefined` when querying empty arrays', function() { + test('should return `undefined` when querying empty arrays', 1, function() { strictEqual(_.first([]), undefined); }); - test('should work when used as `callback` for `_.map`', function() { + test('should work when used as `callback` for `_.map`', 1, function() { var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]], actual = _.map(array, _.first); deepEqual(actual, [1, 4, 7]); }); - test('should work with a `callback`', function() { + test('should work with a `callback`', 1, function() { var actual = _.first(array, function(num) { return num < 3; }); @@ -1254,7 +1256,7 @@ deepEqual(actual, [1, 2]); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args; _.first(array, function() { @@ -1264,7 +1266,7 @@ deepEqual(args, [1, 0, array]); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.first(array, function(num, index) { return this[index] < 3; }, array); @@ -1272,7 +1274,7 @@ deepEqual(actual, [1, 2]); }); - test('should chain when passing `n`, `callback`, or `thisArg`', function() { + test('should chain when passing `n`, `callback`, or `thisArg`', 3, function() { var actual = _(array).first(2); ok(actual instanceof _); @@ -1290,16 +1292,16 @@ ok(actual instanceof _); }); - test('should not chain when arguments are not provided', function() { + test('should not chain when arguments are not provided', 1, function() { var actual = _(array).first(); strictEqual(actual, 1); }); - test('should work with an object for `callback`', function() { + test('should work with an object for `callback`', 1, function() { deepEqual(_.first(objects, { 'b': 2 }), objects.slice(0, 1)); }); - test('should work with a string for `callback`', function() { + test('should work with a string for `callback`', 1, function() { deepEqual(_.first(objects, 'b'), objects.slice(0, 2)); }); }()); @@ -1312,12 +1314,12 @@ var args = arguments, array = [{ 'a': [1, [2]] }, { 'a': [3] }]; - test('should flatten `arguments` objects', function() { + test('should flatten `arguments` objects', 1, function() { var actual = _.flatten([args, args]); deepEqual(actual, [1, 2, 3, 1, 2, 3]); }); - test('should work with a `callback`', function() { + test('should work with a `callback`', 1, function() { var actual = _.flatten(array, function(object) { return object.a; }); @@ -1325,7 +1327,7 @@ deepEqual(actual, [1, 2, 3]); }); - test('should work with `isShallow` and `callback`', function() { + test('should work with `isShallow` and `callback`', 1, function() { var actual = _.flatten(array, true, function(object) { return object.a; }); @@ -1333,7 +1335,7 @@ deepEqual(actual, [1, [2], 3]); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args; _.flatten(array, function() { @@ -1343,7 +1345,7 @@ deepEqual(args, [{ 'a': [1, [2]] }, 0, array]); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.flatten(array, function(object, index) { return this[index].a; }, array); @@ -1351,18 +1353,18 @@ deepEqual(actual, [1, 2, 3]); }); - test('should work with a string for `callback`', function() { + test('should work with a string for `callback`', 1, function() { deepEqual(_.flatten(array, 'a'), [1, 2, 3]); }); - test('should perform a deep flatten when used as `callback` for `_.map`', function() { + test('should perform a deep flatten when used as `callback` for `_.map`', 1, function() { var array = [[[['a']]], [[['b']]]], actual = _.map(array, _.flatten); deepEqual(actual, [['a'], ['b']]); }); - test('should treat sparse arrays as dense', function() { + test('should treat sparse arrays as dense', 4, function() { var array = [[1, 2, 3], Array(3)], expected = [1, 2, 3], actual1 = _.flatten(array), @@ -1377,7 +1379,7 @@ ok(4 in actual2); }); - test('should work with extremely large arrays', function() { + test('should work with extremely large arrays', 1, function() { var expected = Array(5e5), pass = true; @@ -1397,7 +1399,7 @@ } }); - test('should work with empty arrays', function() { + test('should work with empty arrays', 1, function() { var actual = _.flatten([[], [[]], [[], [[[]]]]]); deepEqual(actual, []); }); @@ -1410,17 +1412,17 @@ _.forEach(['forEach', 'forEachRight'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` should return the collection', function() { + test('`_.' + methodName + '` should return the collection', 1, function() { var collection = [1, 2, 3]; equal(func(collection, Boolean), collection); }); - test('`_.' + methodName + '` should return the existing wrapper when chaining', function() { + test('`_.' + methodName + '` should return the existing wrapper when chaining', 1, function() { var wrapper = _([1, 2, 3]); equal(wrapper[methodName](Boolean), wrapper); }); - test('`_.' + methodName + '` should support the `thisArg` argument', function() { + test('`_.' + methodName + '` should support the `thisArg` argument', 2, function() { var actual; function callback(num, index) { @@ -1439,7 +1441,7 @@ 'object': Object('abc') }, function(collection, key) { - test('`_.' + methodName + '` should work with a string ' + key + ' for `collection` (test in IE < 9)', function() { + test('`_.' + methodName + '` should work with a string ' + key + ' for `collection` (test in IE < 9)', 2, function() { var args, values = []; @@ -1466,7 +1468,7 @@ _.forEach(['forIn', 'forInRight'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` iterates over inherited properties', function() { + test('`_.' + methodName + '` iterates over inherited properties', 1, function() { function Foo() { this.a = 1; } Foo.prototype.b = 2; @@ -1475,7 +1477,7 @@ deepEqual(keys.sort(), ['a', 'b']); }); - test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug with inherited properties (test in IE < 9)', function() { + test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug with inherited properties (test in IE < 9)', 1, function() { function Foo() {} Foo.prototype = shadowedObject; @@ -1496,7 +1498,7 @@ _.forEach(['forOwn', 'forOwnRight'], function(methodName) { var func = _[methodName]; - test('iterates over the `length` property', function() { + test('iterates over the `length` property', 1, function() { var object = { '0': 'zero', '1': 'one', 'length': 2 }, props = []; @@ -1512,13 +1514,13 @@ _.forEach(['forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { + test('`_.' + methodName + '` fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() { var props = []; func(shadowedObject, function(value, prop) { props.push(prop); }); deepEqual(props.sort(), shadowedProps); }); - test('`_.' + methodName + '` does not iterate over non-enumerable properties (test in IE < 9)', function() { + test('`_.' + methodName + '` does not iterate over non-enumerable properties (test in IE < 9)', 10, function() { _.forOwn({ 'Array': Array.prototype, 'Boolean': Boolean.prototype, @@ -1548,7 +1550,7 @@ }); }); - test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { + test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() { function Foo() {} Foo.prototype.a = 1; @@ -1572,13 +1574,13 @@ _.forEach(['assign', 'defaults', 'merge'], function(methodName) { var func = _[methodName]; - test('should return the existing wrapper when chaining', function() { + test('should return the existing wrapper when chaining', 1, function() { var wrapper = _({ 'a': 1 }); equal(wrapper[methodName]({ 'b': 2 }), wrapper); }); - test('`_.' + methodName + '` should assign problem JScript properties (test in IE < 9)', function() { + test('`_.' + methodName + '` should assign problem JScript properties (test in IE < 9)', 1, function() { var object = { 'constructor': '0', 'hasOwnProperty': '1', @@ -1599,7 +1601,7 @@ deepEqual(func(object, source), shadowedObject); }); - test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { + test('`_.' + methodName + '` skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() { function Foo() {} Foo.prototype.c = 3; @@ -1613,7 +1615,7 @@ deepEqual(func({}, Foo), expected); }); - test('`_.' + methodName + '` should work with `_.reduce`', function() { + test('`_.' + methodName + '` should work with `_.reduce`', 1, function() { var actual = { 'a': 1}, array = [{ 'b': 2 }, { 'c': 3 }]; @@ -1625,7 +1627,7 @@ _.forEach(['assign', 'merge'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` should pass the correct `callback` arguments', function() { + test('`_.' + methodName + '` should pass the correct `callback` arguments', 2, function() { var args; func({ 'a': 1 }, { 'a': 2 }, function() { args || (args = slice.call(arguments)); @@ -1644,7 +1646,7 @@ deepEqual(args, [array, object], 'non-primitive property values'); }); - test('`_.' + methodName + '` should correct set the `this` binding', function() { + test('`_.' + methodName + '` should correct set the `this` binding', 1, function() { var actual = func({}, { 'a': 0 }, function(a, b) { return this[b]; }, [2]); @@ -1652,7 +1654,7 @@ deepEqual(actual, { 'a': 2 }); }); - test('`_.' + methodName + '` should not treat the second argument as a `callback`', function() { + test('`_.' + methodName + '` should not treat the second argument as a `callback`', 2, function() { function callback() {} callback.b = 2; @@ -1671,7 +1673,7 @@ _.forEach(['forEach', 'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` can exit early when iterating arrays', function() { + test('`_.' + methodName + '` can exit early when iterating arrays', 1, function() { var array = [1, 2, 3], values = []; @@ -1679,7 +1681,7 @@ deepEqual(values, [/Right/.test(methodName) ? 3 : 1]); }); - test('`_.' + methodName + '` can exit early when iterating objects', function() { + test('`_.' + methodName + '` can exit early when iterating objects', 1, function() { var object = { 'a': 1, 'b': 2, 'c': 3 }, values = []; @@ -1701,14 +1703,14 @@ return count % 2 ? stringObject : stringLiteral; }); - test('internal data objects should work with the `__proto__` key', function() { + test('internal data objects should work with the `__proto__` key', 4, function() { deepEqual(_.difference(array, array), []); deepEqual(_.intersection(array, array), expected); deepEqual(_.uniq(array), expected); deepEqual(_.without.apply(_, [array].concat(array)), []); }); - test('lodash.memoize should memoize values resolved to the `__proto__` key', function() { + test('lodash.memoize should memoize values resolved to the `__proto__` key', 1, function() { var count = 0, memoized = _.memoize(function() { return ++count; }); @@ -1723,12 +1725,12 @@ QUnit.module('lodash.groupBy'); (function() { - test('should use `_.identity` when no `callback` is provided', function() { + test('should use `_.identity` when no `callback` is provided', 1, function() { var actual = _.groupBy([4, 6, 6]); deepEqual(actual, { '4': [4], '6': [6, 6] }); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); @@ -1736,7 +1738,7 @@ deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] }); }); - test('should only add values to own, not inherited, properties', function() { + test('should only add values to own, not inherited, properties', 2, function() { var actual = _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; }); @@ -1745,7 +1747,7 @@ deepEqual(actual.hasOwnProperty, [6.1, 6.4]); }); - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var actual = _.groupBy({ 'a': 4.2, 'b': 6.1, 'c': 6.4 }, function(num) { return Math.floor(num); }); @@ -1753,7 +1755,7 @@ deepEqual(actual, { '4': [4.2], '6': [6.1, 6.4] }); }); - test('should work with a number for `callback`', function() { + test('should work with a number for `callback`', 2, function() { var array = [ [1, 'a'], [2, 'a'], @@ -1770,12 +1772,12 @@ QUnit.module('lodash.indexBy'); (function() { - test('should use `_.identity` when no `callback` is provided', function() { + test('should use `_.identity` when no `callback` is provided', 1, function() { var actual = _.indexBy([4, 6, 6]); deepEqual(actual, { '4': 4, '6': 6 }); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.indexBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); @@ -1783,7 +1785,7 @@ deepEqual(actual, { '4': 4.2, '6': 6.4 }); }); - test('should only add values to own, not inherited, properties', function() { + test('should only add values to own, not inherited, properties', 2, function() { var actual = _.indexBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num) > 4 ? 'hasOwnProperty' : 'constructor'; }); @@ -1792,7 +1794,7 @@ deepEqual(actual.hasOwnProperty, 6.4); }); - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var actual = _.indexBy({ 'a': 4.2, 'b': 6.1, 'c': 6.4 }, function(num) { return Math.floor(num); }); @@ -1800,7 +1802,7 @@ deepEqual(actual, { '4': 4.2, '6': 6.4 }); }); - test('should work with a number for `callback`', function() { + test('should work with a number for `callback`', 2, function() { var array = [ [1, 'a'], [2, 'a'], @@ -1817,7 +1819,7 @@ QUnit.module('lodash.has'); (function() { - test('should return `false` for primitives', function() { + test('should return `false` for primitives', 9, function() { _.forEach(falsey.concat(1, 'a'), function(value) { strictEqual(_.has(value, 'valueOf'), false); }); @@ -1831,31 +1833,31 @@ (function() { var array = [1, 2, 3, 1, 2, 3]; - test('should work with a positive `fromIndex`', function() { + test('should work with a positive `fromIndex`', 1, function() { equal(_.indexOf(array, 1, 2), 3); }); - test('should work with `fromIndex` >= `array.length`', function() { + test('should work with `fromIndex` >= `array.length`', 4, function() { equal(_.indexOf(array, 1, 6), -1); equal(_.indexOf(array, undefined, 6), -1); equal(_.indexOf(array, 1, 8), -1); equal(_.indexOf(array, undefined, 8), -1); }); - test('should work with a negative `fromIndex`', function() { + test('should work with a negative `fromIndex`', 1, function() { equal(_.indexOf(array, 2, -3), 4); }); - test('should work with a negative `fromIndex` <= `-array.length`', function() { + test('should work with a negative `fromIndex` <= `-array.length`', 2, function() { strictEqual(_.indexOf(array, 1, -6), 0); strictEqual(_.indexOf(array, 2, -8), 1); }); - test('should ignore non-number `fromIndex` values', function() { + test('should ignore non-number `fromIndex` values', 1, function() { strictEqual(_.indexOf([1, 2, 3], 1, '1'), 0); }); - test('should work with `isSorted`', function() { + test('should work with `isSorted`', 1, function() { strictEqual(_.indexOf([1, 2, 3], 1, true), 0); }); }()); @@ -1885,47 +1887,51 @@ var array = [1, new Foo, 3, new Foo], indexOf = _.indexOf; - test('`_.contains` should work with a custom `_.indexOf` method', function() { + test('`_.contains` should work with a custom `_.indexOf` method', 1, function() { if (!isModularize) { _.indexOf = custom; ok(_.contains(array, new Foo)); _.indexOf = indexOf; - } else { + } + else { skipTest(); } }); - test('`_.difference` should work with a custom `_.indexOf` method', function() { + test('`_.difference` should work with a custom `_.indexOf` method', 1, function() { if (!isModularize) { _.indexOf = custom; deepEqual(_.difference(array, [new Foo]), [1, 3]); _.indexOf = indexOf; - } else { + } + else { skipTest(); } }); - test('`_.intersection` should work with a custom `_.indexOf` method', function() { + test('`_.intersection` should work with a custom `_.indexOf` method', 1, function() { if (!isModularize) { _.indexOf = custom; deepEqual(_.intersection(array, [new Foo]), [array[1]]); _.indexOf = indexOf; - } else { + } + else { skipTest(); } }); - test('`_.omit` should work with a custom `_.indexOf` method', function() { + test('`_.omit` should work with a custom `_.indexOf` method', 1, function() { if (!isModularize) { _.indexOf = custom; deepEqual(_.omit(array, ['x']), { '0': 1, '2': 3 }); _.indexOf = indexOf; - } else { + } + else { skipTest(); } }); - test('`_.uniq` should work with a custom `_.indexOf` method', function() { + test('`_.uniq` should work with a custom `_.indexOf` method', 2, function() { if (!isModularize) { _.indexOf = custom; deepEqual(_.uniq(array), array.slice(0, 3)); @@ -1936,7 +1942,8 @@ deepEqual(_.uniq(largeArray), [largeArray[0]]); _.indexOf = indexOf; - } else { + } + else { skipTest(2); } }); @@ -1955,7 +1962,7 @@ { 'a': 2, 'b': 2 } ]; - test('should accept a falsey `array` argument', function() { + test('should accept a falsey `array` argument', 7, function() { _.forEach(falsey, function(index, value) { try { var actual = index ? _.initial(value) : _.initial(); @@ -1964,38 +1971,38 @@ }) }); - test('should exclude last element', function() { + test('should exclude last element', 1, function() { deepEqual(_.initial(array), [1, 2]); }); - test('should exclude the last two elements', function() { + test('should exclude the last two elements', 1, function() { deepEqual(_.initial(array, 2), [1]); }); - test('should return an empty when querying empty arrays', function() { + test('should return an empty when querying empty arrays', 1, function() { deepEqual(_.initial([]), []); }); - test('should return all elements when `n` < `1`', function() { + test('should return all elements when `n` < `1`', 3, function() { _.each([0, -1, -2], function(n) { deepEqual(_.initial(array, n), array.slice()); }); }); - test('should return an empty array when `n` >= `array.length`', function() { + test('should return an empty array when `n` >= `array.length`', 2, function() { _.each([3, 4], function(n) { deepEqual(_.initial(array, n), []); }); }); - test('should work when used as `callback` for `_.map`', function() { + test('should work when used as `callback` for `_.map`', 1, function() { var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]], actual = _.map(array, _.initial); deepEqual(actual, [[1, 2], [4, 5], [7, 8]]); }); - test('should work with a `callback`', function() { + test('should work with a `callback`', 1, function() { var actual = _.initial(array, function(num) { return num > 1; }); @@ -2003,7 +2010,7 @@ deepEqual(actual, [1]); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args; _.initial(array, function() { @@ -2013,7 +2020,7 @@ deepEqual(args, [3, 2, array]); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.initial(array, function(num, index) { return this[index] > 1; }, array); @@ -2021,11 +2028,11 @@ deepEqual(actual, [1]); }); - test('should work with an object for `callback`', function() { + test('should work with an object for `callback`', 1, function() { deepEqual(_.initial(objects, { 'b': 2 }), objects.slice(0, 2)); }); - test('should work with a string for `callback`', function() { + test('should work with a string for `callback`', 1, function() { deepEqual(_.initial(objects, 'b'), objects.slice(0, 1)); }); }()); @@ -2035,7 +2042,7 @@ QUnit.module('lodash.invoke'); (function() { - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var object = { 'a': 1, 'b': 2, 'c': 3 }; deepEqual(_.invoke(object, 'toFixed', 1), ['1.0', '2.0', '3.0']); }); @@ -2046,10 +2053,10 @@ QUnit.module('lodash.isElement'); (function() { - test('should use strict equality in its duck type check', function() { + test('should use strict equality in its duck type check', 6, function() { var element = body || { 'nodeType': 1 }; - strictEqual(_.isElement(element), true); + strictEqual(_.isElement(element), true); strictEqual(_.isElement({ 'nodeType': new Number(1) }), false); strictEqual(_.isElement({ 'nodeType': true }), false); strictEqual(_.isElement({ 'nodeType': [1] }), false); @@ -2065,11 +2072,11 @@ (function() { var args = arguments; - test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { + test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() { equal(_.isEmpty(shadowedObject), false); }); - test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { + test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() { function Foo() {} Foo.prototype.a = 1; strictEqual(_.isEmpty(Foo), true); @@ -2078,18 +2085,18 @@ strictEqual(_.isEmpty(Foo), true); }); - test('should work with an object that has a `length` property', function() { + test('should work with an object that has a `length` property', 1, function() { strictEqual(_.isEmpty({ 'length': 0 }), false); }); - test('should work with jQuery/MooTools DOM query collections', function() { + test('should work with jQuery/MooTools DOM query collections', 1, function() { function Foo(elements) { push.apply(this, elements); } Foo.prototype = { 'length': 0, 'splice': Array.prototype.splice }; strictEqual(_.isEmpty(new Foo([])), true); }); - test('should work with `arguments` objects (test in IE < 9)', function() { + test('should work with `arguments` objects (test in IE < 9)', 1, function() { if (!isPhantomPage) { strictEqual(_.isEmpty(args), false); } else { @@ -2103,7 +2110,7 @@ QUnit.module('lodash.isEqual'); (function() { - test('should work with `arguments` objects (test in IE < 9)', function() { + test('should work with `arguments` objects (test in IE < 9)', 2, function() { var args1 = (function() { return arguments; }(1, 2, 3)), args2 = (function() { return arguments; }(1, 2, 3)), args3 = (function() { return arguments; }(1, 2)); @@ -2116,11 +2123,11 @@ } }); - test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { + test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() { strictEqual(_.isEqual(shadowedObject, {}), false); }); - test('should return `true` for like-objects from different documents', function() { + test('should return `true` for like-objects from different documents', 1, function() { // ensure `_._object` is assigned (unassigned in Opera 10.00) if (_._object) { var object = { 'a': 1, 'b': 2, 'c': 3 }; @@ -2130,7 +2137,7 @@ } }); - test('should return `false` when comparing values with circular references to unlike values', function() { + test('should return `false` when comparing values with circular references to unlike values', 2, function() { var array1 = ['a', null, 'c'], array2 = ['a', [], 'c'], object1 = { 'a': 1, 'b': null, 'c': 3 }, @@ -2143,7 +2150,7 @@ strictEqual(_.isEqual(object1, object2), false); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args; _.isEqual('a', 'b', function() { @@ -2153,7 +2160,7 @@ deepEqual(args, ['a', 'b']); }); - test('should correct set the `this` binding', function() { + test('should correct set the `this` binding', 1, function() { var actual = _.isEqual('a', 'b', function(a, b) { return this[a] == this[b]; }, { 'a': 1, 'b': 1 }); @@ -2161,12 +2168,12 @@ strictEqual(actual, true); }); - test('should handle comparisons if `callback` returns `undefined`', function() { + test('should handle comparisons if `callback` returns `undefined`', 1, function() { var actual = _.isEqual('a', 'a', function() {}); strictEqual(actual, true); }); - test('should return a boolean value even if `callback` does not', function() { + test('should return a boolean value even if `callback` does not', 8, function() { var actual = _.isEqual('a', 'a', function() { return 'a'; }); strictEqual(actual, true); @@ -2176,7 +2183,7 @@ }); }); - test('should ensure `callback` is a function', function() { + test('should ensure `callback` is a function', 1, function() { var array = [1, 2, 3], eq = _.partial(_.isEqual, array), actual = _.every([array, [1, 0, 3]], eq); @@ -2190,7 +2197,7 @@ QUnit.module('lodash.isFinite'); (function() { - test('should return `false` for non-numeric values', function() { + test('should return `false` for non-numeric values', 6, function() { strictEqual(_.isFinite(null), false); strictEqual(_.isFinite([]), false); strictEqual(_.isFinite(true), false); @@ -2199,7 +2206,7 @@ strictEqual(_.isFinite('2px'), false); }); - test('should return `true` for numeric string values', function() { + test('should return `true` for numeric string values', 3, function() { strictEqual(_.isFinite('2'), true); strictEqual(_.isFinite('0'), true); strictEqual(_.isFinite('08'), true); @@ -2211,7 +2218,7 @@ QUnit.module('lodash.isObject'); (function() { - test('should avoid V8 bug #2291', function() { + test('should avoid V8 bug #2291', 1, function() { // trigger V8 bug // http://code.google.com/p/v8/issues/detail?id=2291 var obj = {}, @@ -2231,7 +2238,7 @@ QUnit.module('lodash.isNaN'); (function() { - test('returns `true` for `new Number(NaN)`', function() { + test('returns `true` for `new Number(NaN)`', 1, function() { strictEqual(_.isNaN(new Number(NaN)), true); }); }()); @@ -2241,7 +2248,7 @@ QUnit.module('lodash.isNumber'); (function() { - test('should avoid `[xpconnect wrapped native prototype]` in Firefox', function() { + test('should avoid `[xpconnect wrapped native prototype]` in Firefox', 1, function() { strictEqual(_.isNumber(+"2"), true); }); }()); @@ -2251,7 +2258,7 @@ QUnit.module('lodash.isPlainObject'); (function() { - test('should detect plain objects', function() { + test('should detect plain objects', 5, function() { function Foo(a) { this.a = 1; } @@ -2272,11 +2279,11 @@ } }); - test('should return `true` for empty objects', function() { + test('should return `true` for empty objects', 1, function() { strictEqual(_.isPlainObject({}), true); }); - test('should return `false` for Object objects without a [[Class]] of "Object"', function() { + test('should return `false` for Object objects without a [[Class]] of "Object"', 4, function() { strictEqual(_.isPlainObject(arguments), false); strictEqual(_.isPlainObject(Error), false); strictEqual(_.isPlainObject(Math), false); @@ -2309,7 +2316,7 @@ function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` should return a boolean', function() { + test('`_.' + methodName + '` should return a boolean', 15, function() { var expected = 'boolean'; equal(typeof func(arguments), expected); @@ -2331,7 +2338,7 @@ }); (function() { - test('should return `false` for subclassed values', function() { + test('should return `false` for subclassed values', 7, function() { _.forEach(['isArray', 'isBoolean', 'isDate', 'isFunction', 'isNumber', 'isRegExp', 'isString'], function(methodName) { function Foo() {} Foo.prototype = root[methodName.slice(2)].prototype; @@ -2353,7 +2360,7 @@ (function() { var args = arguments; - test('should work with `arguments` objects (test in IE < 9)', function() { + test('should work with `arguments` objects (test in IE < 9)', 1, function() { if (!isPhantomPage) { deepEqual(_.keys(args), ['0', '1', '2']); } else { @@ -2361,7 +2368,7 @@ } }); - test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { + test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 2, function() { function Foo() {} Foo.prototype.a = 1; @@ -2369,7 +2376,7 @@ deepEqual(_.keys(shadowedObject).sort(), shadowedProps); }); - test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { + test('skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', 2, function() { function Foo() {} Foo.prototype.c = 3; @@ -2397,38 +2404,38 @@ { 'a': 2, 'b': 2 } ]; - test('should return the last element', function() { + test('should return the last element', 1, function() { equal(_.last(array), 3); }); - test('should return the last two elements', function() { + test('should return the last two elements', 1, function() { deepEqual(_.last(array, 2), [2, 3]); }); - test('should return an empty array when `n` < `1`', function() { + test('should return an empty array when `n` < `1`', 3, function() { _.each([0, -1, -2], function(n) { deepEqual(_.last(array, n), []); }); }); - test('should return all elements when `n` >= `array.length`', function() { + test('should return all elements when `n` >= `array.length`', 2, function() { _.each([3, 4], function(n) { deepEqual(_.last(array, n), array.slice()); }); }); - test('should return `undefined` when querying empty arrays', function() { + test('should return `undefined` when querying empty arrays', 1, function() { strictEqual(_.last([]), undefined); }); - test('should work when used as `callback` for `_.map`', function() { + test('should work when used as `callback` for `_.map`', 1, function() { var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]], actual = _.map(array, _.last); deepEqual(actual, [3, 6, 9]); }); - test('should work with a `callback`', function() { + test('should work with a `callback`', 1, function() { var actual = _.last(array, function(num) { return num > 1; }); @@ -2436,7 +2443,7 @@ deepEqual(actual, [2, 3]); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args; _.last(array, function() { @@ -2446,7 +2453,7 @@ deepEqual(args, [3, 2, array]); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.last(array, function(num, index) { return this[index] > 1; }, array); @@ -2454,7 +2461,7 @@ deepEqual(actual, [2, 3]); }); - test('should chain when passing `n`, `callback`, or `thisArg`', function() { + test('should chain when passing `n`, `callback`, or `thisArg`', 3, function() { var actual = _(array).last(2); ok(actual instanceof _); @@ -2472,16 +2479,16 @@ ok(actual instanceof _); }); - test('should not chain when arguments are not provided', function() { + test('should not chain when arguments are not provided', 1, function() { var actual = _(array).last(); equal(actual, 3); }); - test('should work with an object for `callback`', function() { + test('should work with an object for `callback`', 1, function() { deepEqual(_.last(objects, { 'b': 2 }), objects.slice(-1)); }); - test('should work with a string for `callback`', function() { + test('should work with a string for `callback`', 1, function() { deepEqual(_.last(objects, 'b'), objects.slice(-2)); }); }()); @@ -2493,27 +2500,27 @@ (function() { var array = [1, 2, 3, 1, 2, 3]; - test('should work with a positive `fromIndex`', function() { + test('should work with a positive `fromIndex`', 1, function() { strictEqual(_.lastIndexOf(array, 1, 2), 0); }); - test('should work with `fromIndex` >= `array.length`', function() { + test('should work with `fromIndex` >= `array.length`', 4, function() { equal(_.lastIndexOf(array, undefined, 6), -1); equal(_.lastIndexOf(array, 1, 6), 3); equal(_.lastIndexOf(array, undefined, 8), -1); equal(_.lastIndexOf(array, 1, 8), 3); }); - test('should work with a negative `fromIndex`', function() { + test('should work with a negative `fromIndex`', 1, function() { strictEqual(_.lastIndexOf(array, 2, -3), 1); }); - test('should work with a negative `fromIndex` <= `-array.length`', function() { + test('should work with a negative `fromIndex` <= `-array.length`', 2, function() { strictEqual(_.lastIndexOf(array, 1, -6), 0); equal(_.lastIndexOf(array, 2, -8), -1); }); - test('should ignore non-number `fromIndex` values', function() { + test('should ignore non-number `fromIndex` values', 2, function() { equal(_.lastIndexOf([1, 2, 3], 3, '1'), 2); equal(_.lastIndexOf([1, 2, 3], 3, true), 2); }); @@ -2524,12 +2531,12 @@ QUnit.module('lodash.map'); (function() { - test('should return the correct result when iterating an object', function() { + test('should return the correct result when iterating an object', 1, function() { var actual = _.map({ 'a': 1, 'b': 2, 'c': 3 }); deepEqual(actual, [1, 2, 3]); }); - test('should handle object arguments with non-numeric length properties', function() { + test('should handle object arguments with non-numeric length properties', 1, function() { if (defineProperty) { var object = {}; defineProperty(object, 'length', { 'value': 'x' }); @@ -2547,7 +2554,7 @@ _.forEach(['max', 'min'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` should iterate an object', function() { + test('`_.' + methodName + '` should iterate an object', 1, function() { var actual = func({ 'a': 1, 'b': 2, 'c': 3 }); equal(actual, methodName == 'max' ? 3 : 1); }); @@ -2560,7 +2567,7 @@ _.forEach(['max', 'min'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` should iterate a string', function() { + test('`_.' + methodName + '` should iterate a string', 2, function() { _.forEach(['abc', Object('abc')], function(value) { var actual = func(value); equal(actual, methodName == 'max' ? 'c' : 'a'); @@ -2573,7 +2580,7 @@ QUnit.module('lodash.max and lodash.min chaining'); _.forEach(['max', 'min'], function(methodName) { - test('`_.' + methodName + '` should resolve the correct value when provided an array containing only one value', function() { + test('`_.' + methodName + '` should resolve the correct value when provided an array containing only one value', 1, function() { var actual = _([40])[methodName]().value(); strictEqual(actual, 40); }); @@ -2584,7 +2591,7 @@ QUnit.module('lodash.memoize'); (function() { - test('should expose a `cache` object on the `memoized` function', function() { + test('should expose a `cache` object on the `memoized` function', 2, function() { var memoized = _.memoize(_.identity, _.identity); memoized('x'); @@ -2602,7 +2609,7 @@ (function() { var args = arguments; - test('should merge `source` into the destination object', function() { + test('should merge `source` into the destination object', 1, function() { var names = { 'stooges': [ { 'name': 'moe' }, @@ -2634,7 +2641,7 @@ deepEqual(_.merge(names, ages, heights), expected); }); - test('should merge sources containing circular references', function() { + test('should merge sources containing circular references', 1, function() { var object = { 'foo': { 'a': 1 }, 'bar': { 'a': 2 } @@ -2652,7 +2659,7 @@ ok(actual.bar.b === actual.foo.b && actual.foo.b.foo.c === actual.foo.b.foo.c.foo.b.foo.c); }); - test('should not treat `arguments` objects as plain objects', function() { + test('should not treat `arguments` objects as plain objects', 1, function() { var object = { 'args': args }; @@ -2665,34 +2672,34 @@ equal(_.isArguments(actual.args), false); }); - test('should work with four arguments', function() { + test('should work with four arguments', 1, function() { var expected = { 'a': 4 }; deepEqual(_.merge({ 'a': 1 }, { 'a': 2 }, { 'a': 3 }, expected), expected); }); - test('should assign `null` values', function() { + test('should assign `null` values', 1, function() { var actual = _.merge({ 'a': 1 }, { 'a': null }); strictEqual(actual.a, null); }); - test('should not assign `undefined` values', function() { + test('should not assign `undefined` values', 1, function() { var actual = _.merge({ 'a': 1 }, { 'a': undefined }); strictEqual(actual.a, 1); }); - test('should handle merging if `callback` returns `undefined`', function() { + test('should handle merging if `callback` returns `undefined`', 1, function() { var actual = _.merge({ 'a': { 'b': [1, 1] } }, { 'a': { 'b': [0] } }, function() {}); deepEqual(actual, { 'a': { 'b': [0, 1] } }); }); - test('should defer to `callback` when it returns a value other than `undefined`', function() { + test('should defer to `callback` when it returns a value other than `undefined`', 1, function() { var actual = _.merge({ 'a': { 'b': [0, 1] } }, { 'a': { 'b': [2] } }, function(a, b) { return _.isArray(a) ? a.concat(b) : undefined; }); deepEqual(actual, { 'a': { 'b': [0, 1, 2] } }); }); - test('should pass the correct values to `callback`', function() { + test('should pass the correct values to `callback`', 1, function() { var argsList = [], array = [1, 2], object = { 'b': 2 }; @@ -2710,13 +2717,13 @@ QUnit.module('lodash.mixin'); (function() { - test('should accept an `object` argument', function() { + test('should accept an `object` argument', 1, function() { var lodash = {}; _.mixin(lodash, { 'a': function(a) { return a[0]; } }); strictEqual(lodash.a(['a']), 'a'); }); - test('should accept a function `object` argument', function() { + test('should accept a function `object` argument', 1, function() { function lodash(value) { if (!(this instanceof lodash)) { return new lodash(value); @@ -2740,34 +2747,34 @@ object = { 'a': 1, 'b': 2 }, expected = { 'b': 2 }; - test('should accept individual property names', function() { + test('should accept individual property names', 1, function() { deepEqual(_.omit(object, 'a'), expected); }); - test('should accept an array of property names', function() { + test('should accept an array of property names', 1, function() { deepEqual(_.omit(object, ['a', 'c']), expected); }); - test('should accept mixes of individual and arrays of property names', function() { + test('should accept mixes of individual and arrays of property names', 1, function() { deepEqual(_.omit(object, ['a'], 'c'), expected); }); - test('should iterate over inherited properties', function() { + test('should iterate over inherited properties', 1, function() { function Foo() {} Foo.prototype = object; deepEqual(_.omit(new Foo, 'a'), expected); }); - test('should work with `arguments` objects as secondary arguments', function() { + test('should work with `arguments` objects as secondary arguments', 1, function() { deepEqual(_.omit(object, args), expected); }); - test('should work with an array `object` argument', function() { + test('should work with an array `object` argument', 1, function() { deepEqual(_.omit([1, 2, 3], '0', '2'), { '1': 2 }); }); - test('should work with a `callback` argument', function() { + test('should work with a `callback` argument', 1, function() { var actual = _.omit(object, function(num) { return num === 1; }); @@ -2775,7 +2782,7 @@ deepEqual(actual, expected); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args, lastKey = _.keys(object).pop(); @@ -2790,7 +2797,7 @@ deepEqual(args, expected); }); - test('should correct set the `this` binding', function() { + test('should correct set the `this` binding', 1, function() { var actual = _.omit(object, function(num) { return num === this.a; }, { 'a': 1 }); @@ -2804,7 +2811,7 @@ QUnit.module('lodash.once'); (function() { - test('should ignore recursive calls', function() { + test('should ignore recursive calls', 1, function() { var count = 0; var func = _.once(function() { @@ -2816,7 +2823,7 @@ strictEqual(count, 1); }); - test('should not throw more than once', function() { + test('should not throw more than once', 2, function() { var pass = true; var func = _.once(function() { @@ -2839,19 +2846,19 @@ QUnit.module('lodash.parseInt'); (function() { - test('should parse strings with leading whitespace and zeros with a `radix` of 10 by default (test in Chrome, Firefox, and Opera)', function() { + test('should parse strings with leading whitespace and zeros with a `radix` of 10 by default (test in Chrome, Firefox, and Opera)', 2, function() { var whitespace = ' \x09\x0B\x0C\xA0\ufeff\x0A\x0D\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; equal(_.parseInt('08'), 8); equal(_.parseInt(whitespace + '08'), 8); }); - test('should use a radix of `10`, for non-hexadecimals, if `radix` is `undefined` or `0`', function() { + test('should use a radix of `10`, for non-hexadecimals, if `radix` is `undefined` or `0`', 3, function() { equal(_.parseInt('10', 0), 10); equal(_.parseInt('10'), 10); equal(_.parseInt('10', undefined), 10); }); - test('should use a radix of `16`, for hexadecimals, if `radix` is `undefined` or `0`', function() { + test('should use a radix of `16`, for hexadecimals, if `radix` is `undefined` or `0`', 3, function() { equal(_.parseInt('0x20', 0), 32); equal(_.parseInt('0x20'), 32); equal(_.parseInt('0x20', undefined), 32); @@ -2865,14 +2872,14 @@ _.forEach(['partial', 'partialRight'], function(methodName) { var func = _[methodName]; - test('`_.' + methodName + '` partially applies an argument, without additional arguments', function() { + test('`_.' + methodName + '` partially applies an argument, without additional arguments', 1, function() { var arg = 'a', fn = function(x) { return x; }; equal(func(fn, arg)(), arg); }); - test('`_.' + methodName + '` partially applies an argument, with additional arguments', function() { + test('`_.' + methodName + '` partially applies an argument, with additional arguments', 1, function() { var arg1 = 'a', arg2 = 'b', expected = [arg1, arg2], @@ -2884,19 +2891,19 @@ deepEqual(func(fn, arg1)(arg2), expected); }); - test('`_.' + methodName + '` works without partially applying arguments, without additional arguments', function() { + test('`_.' + methodName + '` works without partially applying arguments, without additional arguments', 1, function() { var fn = function() { return arguments.length; }; strictEqual(func(fn)(), 0); }); - test('`_.' + methodName + '` works without partially applying arguments, with additional arguments', function() { + test('`_.' + methodName + '` works without partially applying arguments, with additional arguments', 1, function() { var arg = 'a', fn = function(x) { return x; }; equal(func(fn)(arg), arg); }); - test('`_.' + methodName + '` should not alter the `this` binding', function() { + test('`_.' + methodName + '` should not alter the `this` binding', 3, function() { var object = { 'a': 1 }, fn = function() { return this.a; }; @@ -2913,7 +2920,7 @@ QUnit.module('lodash.partialRight'); (function() { - test('should work as a deep `_.defaults`', function() { + test('should work as a deep `_.defaults`', 1, function() { var object = { 'a': { 'b': 1 } }, source = { 'a': { 'b': 2, 'c': 3 } }, expected = { 'a': { 'b': 1, 'c': 3 } }; @@ -2928,7 +2935,7 @@ QUnit.module('methods using `createBound`'); (function() { - test('combinations of partial functions should work', function() { + test('combinations of partial functions should work', 1, function() { function func() { return slice.call(arguments); } @@ -2939,7 +2946,7 @@ deepEqual(c(2), [1, 2, 3]); }); - test('combinations of bound and partial functions should work', function() { + test('combinations of bound and partial functions should work', 3, function() { function func() { var result = [this.x]; push.apply(result, arguments); @@ -2967,7 +2974,7 @@ deepEqual(c(3), expected); }); - test('recursively bound functions should work', function() { + test('recursively bound functions should work', 1, function() { function func() { return this.x; } @@ -2988,22 +2995,22 @@ object = { 'a': 1, 'b': 2 }, expected = { 'b': 2 }; - test('should iterate over inherited properties', function() { + test('should iterate over inherited properties', 1, function() { function Foo() {} Foo.prototype = object; deepEqual(_.pick(new Foo, 'b'), expected); }); - test('should work with `arguments` objects as secondary arguments', function() { + test('should work with `arguments` objects as secondary arguments', 1, function() { deepEqual(_.pick(object, args), expected); }); - test('should work with an array `object` argument', function() { + test('should work with an array `object` argument', 1, function() { deepEqual(_.pick([1, 2, 3], '1'), { '1': 2 }); }); - test('should work with a `callback` argument', function() { + test('should work with a `callback` argument', 1, function() { var actual = _.pick(object, function(num) { return num === 2; }); @@ -3011,7 +3018,7 @@ deepEqual(actual, expected); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args, lastKey = _.keys(object).pop(); @@ -3026,7 +3033,7 @@ deepEqual(args, expected); }); - test('should correct set the `this` binding', function() { + test('should correct set the `this` binding', 1, function() { var actual = _.pick(object, function(num) { return num === this.b; }, { 'b': 2 }); @@ -3040,7 +3047,7 @@ QUnit.module('lodash.pluck'); (function() { - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var object = { 'a': [1], 'b': [1, 2], 'c': [1, 2, 3] }; deepEqual(_.pluck(object, 'length'), [1, 2, 3]); }); @@ -3051,7 +3058,7 @@ QUnit.module('lodash.pull'); (function() { - test('should modify and return the array', function() { + test('should modify and return the array', 2, function() { var array = [1, 2, 3], actual = _.pull(array, 1, 3); @@ -3059,7 +3066,7 @@ ok(actual === array); }); - test('should preserve holes in arrays', function() { + test('should preserve holes in arrays', 2, function() { var array = [1, 2, 3, 4]; delete array[1]; delete array[3]; @@ -3069,7 +3076,7 @@ equal(2 in array, false); }); - test('should treat holes as `undefined`', function() { + test('should treat holes as `undefined`', 1, function() { var array = [1, 2, 3]; delete array[1]; @@ -3083,12 +3090,12 @@ QUnit.module('lodash.random'); (function() { - test('should return `0` or `1` when arguments are not provided', function() { + test('should return `0` or `1` when arguments are not provided', 1, function() { var actual = _.random(); ok(actual === 0 || actual === 1); }); - test('supports not passing a `max` argument', function() { + test('supports not passing a `max` argument', 1, function() { var actual = _.random(5), limit = 60, start = new Date; @@ -3099,7 +3106,7 @@ notEqual(actual, 5); }); - test('supports large integer values', function() { + test('supports large integer values', 2, function() { var array = Array(1000), min = Math.pow(2, 31), max = Math.pow(2, 62); @@ -3113,11 +3120,11 @@ }), true); }); - test('should coerce arguments to numbers', function() { + test('should coerce arguments to numbers', 1, function() { strictEqual(_.random('1', '1'), 1); }); - test('should support floats', function() { + test('should support floats', 2, function() { var min = 1.5, max = 1.6, actual = _.random(min, max); @@ -3126,7 +3133,7 @@ ok(actual >= min && actual <= max); }); - test('supports passing a `floating` argument', function() { + test('supports passing a `floating` argument', 3, function() { var actual = _.random(true); ok(actual % 1 && actual >= 0 && actual <= 1); @@ -3145,7 +3152,7 @@ (function() { var func = _.range; - test('should treat falsey `start` arguments as `0`', function() { + test('should treat falsey `start` arguments as `0`', 13, function() { _.forEach(falsey, function(value, index) { if (index) { deepEqual(_.range(value), []); @@ -3156,12 +3163,12 @@ }); }); - test('should coerce arguments to numbers', function() { + test('should coerce arguments to numbers', 1, function() { var actual = [func('0',1), func('1'), func(0, 1, '1')]; deepEqual(actual, [[0], [0], [0]]); }); - test('should support a `step` of `0`', function() { + test('should support a `step` of `0`', 1, function() { deepEqual(_.range(1, 4, 0), [1, 1, 1]); }); }()); @@ -3171,7 +3178,7 @@ QUnit.module('lodash.reduce'); (function() { - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args, array = [1, 2, 3]; @@ -3187,7 +3194,7 @@ 'object': Object('abc') }, function(collection, key) { - test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() { + test('should work with a string ' + key + ' for `collection` (test in IE < 9)', 2, function() { var args; var actual = _.reduce(collection, function(accumulator, value) { @@ -3206,7 +3213,7 @@ QUnit.module('lodash.reduceRight'); (function() { - test('should pass the correct `callback` arguments when iterating an array', function() { + test('should pass the correct `callback` arguments when iterating an array', 1, function() { var args, array = [1, 2, 3]; @@ -3217,7 +3224,7 @@ deepEqual(args, [3, 2, 1, array]); }); - test('should pass the correct `callback` arguments when iterating an object', function() { + test('should pass the correct `callback` arguments when iterating an object', 1, function() { var args, object = { 'a': 1, 'b': 2 }, lastKey = _.keys(object).pop(); @@ -3238,7 +3245,7 @@ 'object': Object('abc') }, function(collection, key) { - test('should work with a string ' + key + ' for `collection` (test in IE < 9)', function() { + test('should work with a string ' + key + ' for `collection` (test in IE < 9)', 2, function() { var args; var actual = _.reduceRight(collection, function(accumulator, value) { @@ -3257,7 +3264,7 @@ QUnit.module('lodash.remove'); (function() { - test('should modify the array and return removed elements', function() { + test('should modify the array and return removed elements', 2, function() { var array = [1, 2, 3]; var actual = _.remove(array, function(num) { @@ -3268,7 +3275,7 @@ deepEqual(actual, [1, 2]); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args, array = [1, 2, 3]; @@ -3279,7 +3286,7 @@ deepEqual(args, [1, 0, array]); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var array = [1, 2, 3]; var actual = _.remove(array, function(num, index) { @@ -3289,7 +3296,7 @@ deepEqual(actual, [1, 2]); }); - test('should preserve holes in arrays', function() { + test('should preserve holes in arrays', 2, function() { var array = [1, 2, 3, 4]; delete array[1]; delete array[3]; @@ -3299,7 +3306,7 @@ equal(2 in array, false); }); - test('should treat holes as `undefined`', function() { + test('should treat holes as `undefined`', 1, function() { var array = [1, 2, 3]; delete array[1]; @@ -3313,7 +3320,7 @@ QUnit.module('lodash.result'); (function() { - test('should return `undefined` when provided a falsey `object` argument', function() { + test('should return `undefined` when provided a falsey `object` argument', 1, function() { strictEqual(_.result(), undefined); }); }()); @@ -3331,7 +3338,7 @@ { 'a': 0, 'b': 0 } ]; - test('should accept a falsey `array` argument', function() { + test('should accept a falsey `array` argument', 7, function() { _.forEach(falsey, function(index, value) { try { var actual = index ? _.rest(value) : _.rest(); @@ -3340,38 +3347,38 @@ }) }); - test('should exclude the first element', function() { + test('should exclude the first element', 1, function() { deepEqual(_.rest(array), [2, 3]); }); - test('should exclude the first two elements', function() { + test('should exclude the first two elements', 1, function() { deepEqual(_.rest(array, 2), [3]); }); - test('should return all elements when `n` < `1`', function() { + test('should return all elements when `n` < `1`', 3, function() { _.each([0, -1, -2], function(n) { deepEqual(_.rest(array, n), [1, 2, 3]); }); }); - test('should return an empty array when `n` >= `array.length`', function() { + test('should return an empty array when `n` >= `array.length`', 2, function() { _.each([3, 4], function(n) { deepEqual(_.rest(array, n), []); }); }); - test('should return an empty when querying empty arrays', function() { + test('should return an empty when querying empty arrays', 1, function() { deepEqual(_.rest([]), []); }); - test('should work when used as `callback` for `_.map`', function() { + test('should work when used as `callback` for `_.map`', 1, function() { var array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]], actual = _.map(array, _.rest); deepEqual(actual, [[2, 3], [5, 6], [8, 9]]); }); - test('should work with a `callback`', function() { + test('should work with a `callback`', 1, function() { var actual = _.rest(array, function(num) { return num < 3; }); @@ -3379,7 +3386,7 @@ deepEqual(actual, [3]); }); - test('should pass the correct `callback` arguments', function() { + test('should pass the correct `callback` arguments', 1, function() { var args; _.rest(array, function() { @@ -3389,7 +3396,7 @@ deepEqual(args, [1, 0, array]); }); - test('supports the `thisArg` argument', function() { + test('supports the `thisArg` argument', 1, function() { var actual = _.rest(array, function(num, index) { return this[index] < 3; }, array); @@ -3397,11 +3404,11 @@ deepEqual(actual, [3]); }); - test('should work with an object for `callback`', function() { + test('should work with an object for `callback`', 1, function() { deepEqual(_.rest(objects, { 'b': 2 }), objects.slice(-2)); }); - test('should work with a string for `callback`', function() { + test('should work with a string for `callback`', 1, function() { deepEqual(_.rest(objects, 'b'), objects.slice(-1)); }); }()); @@ -3411,7 +3418,7 @@ QUnit.module('lodash.runInContext'); (function() { - test('should not require a fully populated `context` object', function() { + test('should not require a fully populated `context` object', 1, function() { if (!isModularize) { var lodash = _.runInContext({ 'setTimeout': function(callback) { @@ -3422,7 +3429,8 @@ var pass = false; lodash.delay(function() { pass = true; }, 32); ok(pass); - } else { + } + else { skipTest(); } }); @@ -3435,33 +3443,33 @@ (function() { var array = [1, 2, 3]; - test('should return a random element', function() { + test('should return a random element', 1, function() { var actual = _.sample(array); ok(_.contains(array, actual)); }); - test('should return two random elements', function() { + test('should return two random elements', 1, function() { var actual = _.sample(array, 2); ok(actual[0] !== actual[1] && _.contains(array, actual[0]) && _.contains(array, actual[1])); }); - test('should return an empty array when `n` < `1`', function() { + test('should return an empty array when `n` < `1`', 3, function() { _.each([0, -1, -2], function(n) { deepEqual(_.sample(array, n), []); }); }); - test('should return all elements when `n` >= `array.length`', function() { + test('should return all elements when `n` >= `array.length`', 2, function() { _.each([3, 4], function(n) { deepEqual(_.sample(array, n).sort(), array.slice()); }); }); - test('should return `undefined` when sampling an empty array', function() { + test('should return `undefined` when sampling an empty array', 1, function() { strictEqual(_.sample([]), undefined); }); - test('should sample an object', function() { + test('should sample an object', 2, function() { var object = { 'a': 1, 'b': 2, 'c': 3 }, actual = _.sample(object); @@ -3471,7 +3479,7 @@ ok(actual[0] !== actual[1] && _.contains(array, actual[0]) && _.contains(array, actual[1])); }); - test('should work when used as `callback` for `_.map`', function() { + test('should work when used as `callback` for `_.map`', 1, function() { var a = [1, 2, 3], b = [4, 5, 6], c = [7, 8, 9], @@ -3480,12 +3488,12 @@ ok(_.contains(a, actual[0]) && _.contains(b, actual[1]) && _.contains(c, actual[2])); }); - test('should chain when passing `n`', function() { + test('should chain when passing `n`', 1, function() { var actual = _(array).sample(2); ok(actual instanceof _); }); - test('should not chain when arguments are not provided', function() { + test('should not chain when arguments are not provided', 1, function() { var actual = _(array).sample(); ok(_.contains(array, actual)); }); @@ -3495,7 +3503,7 @@ 'object': Object('abc') }, function(collection, key) { - test('should work with a string ' + key + ' for `collection`', function() { + test('should work with a string ' + key + ' for `collection`', 2, function() { var actual = _.sample(collection); ok(_.contains(collection, actual)); @@ -3510,7 +3518,7 @@ QUnit.module('lodash.shuffle'); (function() { - test('should shuffle an object', function() { + test('should shuffle an object', 1, function() { var actual = _.shuffle({ 'a': 1, 'b': 2, 'c': 3 }); deepEqual(actual.sort(), [1, 2, 3]); }); @@ -3520,7 +3528,7 @@ 'object': Object('abc') }, function(collection, key) { - test('should work with a string ' + key + ' for `collection`', function() { + test('should work with a string ' + key + ' for `collection`', 1, function() { var actual = _.shuffle(collection); deepEqual(actual.sort(), ['a','b', 'c']); }); @@ -3534,7 +3542,7 @@ (function() { var args = arguments; - test('should accept a falsey `object` argument', function() { + test('should accept a falsey `object` argument', 7, function() { _.forEach(falsey, function(index, value) { try { var actual = index ? _.size(value) : _.size(); @@ -3543,14 +3551,14 @@ }) }); - test('should work with jQuery/MooTools DOM query collections', function() { + test('should work with jQuery/MooTools DOM query collections', 1, function() { function Foo(elements) { push.apply(this, elements); } Foo.prototype = { 'length': 0, 'splice': Array.prototype.splice }; equal(_.size(new Foo([1, 2, 3])), 3); }); - test('should work with `arguments` objects (test in IE < 9)', function() { + test('should work with `arguments` objects (test in IE < 9)', 1, function() { if (!isPhantomPage) { equal(_.size(args), 3); } else { @@ -3558,7 +3566,7 @@ } }); - test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', function() { + test('fixes the JScript [[DontEnum]] bug (test in IE < 9)', 1, function() { equal(_.size(shadowedObject), 7); }); @@ -3567,7 +3575,7 @@ 'object': Object('abc') }, function(collection, key) { - test('should work with a string ' + key + ' for `collection`', function() { + test('should work with a string ' + key + ' for `collection`', 1, function() { deepEqual(_.size(collection), 3); }); }); @@ -3578,7 +3586,7 @@ QUnit.module('lodash.some'); (function() { - test('should return `true` as soon as the `callback` result is truey', function() { + test('should return `true` as soon as the `callback` result is truey', 1, function() { strictEqual(_.some([null, true, null], _.identity), true); }); }()); @@ -3588,7 +3596,7 @@ QUnit.module('lodash.sortBy'); (function() { - test('should sort in ascending order', function() { + test('should sort in ascending order', 1, function() { var actual = _.pluck(_.sortBy([ { 'num': 991 }, { 'num': 212 }, @@ -3602,7 +3610,7 @@ deepEqual(actual, [0, 11, 16, 74, 212, 991, 1515]); }); - test('should perform a stable sort (test in IE > 8, Opera, and V8)', function() { + test('should perform a stable sort (test in IE > 8, Opera, and V8)', 1, function() { function Pair(x, y) { this.x = x; this.y = y; @@ -3627,12 +3635,12 @@ deepEqual(actual, collection); }); - test('should use `_.identity` when no `callback` is provided', function() { + test('should use `_.identity` when no `callback` is provided', 1, function() { var actual = _.sortBy([3, 2, 1]); deepEqual(actual, [1, 2, 3]); }); - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); @@ -3640,7 +3648,7 @@ deepEqual(actual, [3, 1, 2]); }); - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var actual = _.sortBy({ 'a': 1, 'b': 2, 'c': 3 }, function(num) { return Math.sin(num); }); @@ -3654,7 +3662,7 @@ QUnit.module('lodash.sortedIndex'); (function() { - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.sortedIndex([1, 2, 3], 4, function(num) { return this.sin(num); }, Math); @@ -3662,7 +3670,7 @@ strictEqual(actual, 0); }); - test('supports arrays with lengths larger than `Math.pow(2, 31) - 1`', function() { + test('supports arrays with lengths larger than `Math.pow(2, 31) - 1`', 1, function() { var length = Math.pow(2, 32) - 1, index = length - 1, array = Array(length), @@ -3679,11 +3687,11 @@ QUnit.module('lodash.support'); (function() { - test('should contain properties with boolean values', function() { + test('should contain properties with boolean values', 1, function() { ok(_.every(_.values(_.support), _.isBoolean)); }); - test('should not contain minified properties (test production builds)', function() { + test('should not contain minified properties (test production builds)', 1, function() { var props = [ 'argsClass', 'argsObject', @@ -3709,20 +3717,20 @@ QUnit.module('lodash.template'); (function() { - test('supports recursive calls', function() { + test('supports recursive calls', 1, function() { var compiled = _.template('<%= a %><% a = _.template(c, obj) %><%= a %>'), data = { 'a': 'A', 'b': 'B', 'c': '<%= b %>' }; equal(compiled(data), 'AB'); }); - test('should not augment the `options` object', function() { + test('should not augment the `options` object', 1, function() { var options = {}; _.template('', null, options); deepEqual(options, {}); }); - test('should provide the template source when a SyntaxError occurs', function() { + test('should provide the template source when a SyntaxError occurs', 1, function() { try { _.template('<% if x %>'); } catch(e) { @@ -3731,7 +3739,7 @@ ok(/__p/.test(source)); }); - test('should work with complex "interpolate" delimiters', function() { + test('should work with complex "interpolate" delimiters', 22, function() { _.forEach({ '<%= a + b %>': '3', '<%= b - a %>': '1', @@ -3764,14 +3772,14 @@ }); }); - test('should allow referencing variables declared in "evaluate" delimiters from other delimiters', function() { + test('should allow referencing variables declared in "evaluate" delimiters from other delimiters', 1, function() { var compiled = _.template('<% var b = a; %><%= b.value %>'), data = { 'a': { 'value': 1 } }; equal(compiled(data), '1'); }); - test('should work when passing `options.variable`', function() { + test('should work when passing `options.variable`', 1, function() { var compiled = _.template( '<% _.forEach( data.a, function( value ) { %>' + '<%= value.valueOf() %>' + @@ -3787,7 +3795,7 @@ } }); - test('should not error with IE conditional comments enabled (test with development build)', function() { + test('should not error with IE conditional comments enabled (test with development build)', 1, function() { var compiled = _.template(''), pass = true; @@ -3800,21 +3808,21 @@ ok(pass); }); - test('should tokenize delimiters', function() { + test('should tokenize delimiters', 1, function() { var compiled = _.template(''), data = { 'type': 1 }; equal(compiled(data), ''); }); - test('should work with "interpolate" delimiters containing ternary operators', function() { + test('should work with "interpolate" delimiters containing ternary operators', 1, function() { var compiled = _.template('<%= value ? value : "b" %>'), data = { 'value': 'a' }; equal(compiled(data), 'a'); }); - test('should work with "interpolate" delimiters containing global values', function() { + test('should work with "interpolate" delimiters containing global values', 1, function() { var compiled = _.template('<%= typeof Math.abs %>'); try { @@ -3824,7 +3832,7 @@ equal(actual, 'function'); }); - test('should parse delimiters with newlines', function() { + test('should parse delimiters with newlines', 1, function() { var expected = '<<\nprint("

" + (value ? "yes" : "no") + "

")\n>>', compiled = _.template(expected, null, { 'evaluate': /<<(.+?)>>/g }), data = { 'value': true }; @@ -3832,13 +3840,13 @@ equal(compiled(data), expected); }); - test('should parse ES6 template delimiters', function() { + test('should parse ES6 template delimiters', 2, function() { var data = { 'value': 2 }; equal(_.template('1${value}3', data), '123'); equal(_.template('${"{" + value + "\\}"}', data), '{2}'); }); - test('supports the "imports" option', function() { + test('supports the "imports" option', 1, function() { var options = { 'imports': { 'a': 1 } }, compiled = _.template('<%= a %>', null, options); @@ -3851,7 +3859,7 @@ QUnit.module('lodash.throttle'); (function() { - test('subsequent calls should return the result of the first call', function() { + test('subsequent calls should return the result of the first call', 1, function() { if (!(isRhino && isModularize)) { var throttled = _.throttle(function(value) { return value; }, 32), result = [throttled('x'), throttled('y')]; @@ -3863,7 +3871,7 @@ } }); - test('should clear timeout when `func` is called', function() { + test('should clear timeout when `func` is called', 1, function() { if (!isModularize) { var callCount = 0, dateCount = 0; @@ -3889,7 +3897,7 @@ } }); - asyncTest('supports recursive calls', function() { + asyncTest('supports recursive calls', 2, function() { if (!(isRhino && isModularize)) { var count = 0; var throttled = _.throttle(function() { @@ -3913,7 +3921,7 @@ } }); - asyncTest('should not trigger a trailing call when invoked once', function() { + asyncTest('should not trigger a trailing call when invoked once', 2, function() { if (!(isRhino && isModularize)) { var count = 0, throttled = _.throttle(function() { count++; }, 32); @@ -3933,7 +3941,7 @@ }); _.times(2, function(index) { - asyncTest('should trigger trailing call when invoked repeatedly' + (index ? ' and `leading` is `false`' : '') , function() { + asyncTest('should trigger trailing call when invoked repeatedly' + (index ? ' and `leading` is `false`' : ''), 2, function() { if (!(isRhino && isModularize)) { var count = 0, limit = 160, @@ -3959,7 +3967,7 @@ }); }); - asyncTest('should apply default options correctly', function() { + asyncTest('should apply default options correctly', 3, function() { if (!(isRhino && isModularize)) { var count = 0; @@ -3983,7 +3991,7 @@ } }); - test('should work with `leading` option', function() { + test('should work with `leading` option', 4, function() { if (!(isRhino && isModularize)) { _.forEach([true, { 'leading': true }], function(options) { var withLeading = _.throttle(_.identity, 32, options); @@ -4000,7 +4008,7 @@ } }); - asyncTest('should work with `trailing` option', function() { + asyncTest('should work with `trailing` option', 6, function() { if (!(isRhino && isModularize)) { var withCount = 0, withoutCount = 0; @@ -4032,7 +4040,7 @@ } }); - asyncTest('should not update `lastCalled`, at the end of the timeout, when `trailing` is `false`', function() { + asyncTest('should not update `lastCalled`, at the end of the timeout, when `trailing` is `false`', 1, function() { if (!(isRhino && isModularize)) { var count = 0; @@ -4062,7 +4070,7 @@ (function() { var args = arguments; - test('should return a dense array', function() { + test('should return a dense array', 3, function() { var array = Array(3); array[1] = 2; @@ -4073,18 +4081,18 @@ deepEqual(actual, array); }); - test('should treat array-like objects like arrays', function() { + test('should treat array-like objects like arrays', 2, function() { var object = { '0': 'a', '1': 'b', '2': 'c', 'length': 3 }; deepEqual(_.toArray(object), ['a', 'b', 'c']); deepEqual(_.toArray(args), [1, 2, 3]); }); - test('should work with a string for `collection` (test in Opera < 10.52)', function() { + test('should work with a string for `collection` (test in Opera < 10.52)', 2, function() { deepEqual(_.toArray('abc'), ['a', 'b', 'c']); deepEqual(_.toArray(Object('abc')), ['a', 'b', 'c']); }); - test('should work with a node list for `collection` (test in IE < 9)', function() { + test('should work with a node list for `collection` (test in IE < 9)', 1, function() { if (document) { try { var nodeList = document.getElementsByTagName('body'), @@ -4102,15 +4110,15 @@ QUnit.module('lodash.times'); (function() { - test('should return an array of the results of each `callback` execution', function() { + test('should return an array of the results of each `callback` execution', 1, function() { deepEqual(_.times(3, function(n) { return n * 2; }), [0, 2, 4]); }); - test('should coerce `n` to a number', function() { + test('should coerce `n` to a number', 1, function() { deepEqual(_.times(null), []); }); - test('should not error on negative `n` values', function() { + test('should not error on negative `n` values', 1, function() { var pass = true; try { _.times(-1); @@ -4126,7 +4134,7 @@ QUnit.module('lodash.transform'); (function() { - test('should produce an that is an instance of the given object\'s constructor', function() { + test('should produce an that is an instance of the given object\'s constructor', 2, function() { function Foo() { this.a = 1; this.b = 2; @@ -4141,7 +4149,7 @@ deepEqual(_.clone(actual), { 'a': 1, 'b': 4, 'c': 9 }); }); - test('should treat sparse arrays as dense', function() { + test('should treat sparse arrays as dense', 1, function() { var actual = _.transform(Array(1), function(result, value, index) { result[index] = String(value); }); @@ -4154,7 +4162,7 @@ 'object': { 'a': 1, 'b': 2, 'c': 3 } }, function(object, key) { - test('should pass the correct `callback` arguments when transforming an ' + key, function() { + test('should pass the correct `callback` arguments when transforming an ' + key, 2, function() { var args; _.transform(object, function() { @@ -4171,7 +4179,7 @@ } }); - test('should support the `thisArg` argument when transforming an ' + key, function() { + test('should support the `thisArg` argument when transforming an ' + key, 2, function() { var actual = _.transform(object, function(result, value, key) { result[key] = this[key]; }, null, object); @@ -4190,19 +4198,19 @@ var escaped = '&<>"'\/', unescaped = '&<>"\'\/'; - test('should unescape entities in the correct order', function() { + test('should unescape entities in the correct order', 1, function() { equal(_.unescape('&lt;'), '<'); }); - test('should unescape the proper entities', function() { + test('should unescape the proper entities', 1, function() { equal(_.unescape(escaped), unescaped); }); - test('should unescape the same characters escaped by `_.escape`', function() { + test('should unescape the same characters escaped by `_.escape`', 1, function() { equal(_.unescape(_.escape(unescaped)), unescaped); }); - test('should return an empty string when provided `null` or `undefined`', function() { + test('should return an empty string when provided `null` or `undefined`', 2, function() { equal(_.unescape(null), ''); equal(_.unescape(undefined), ''); }); @@ -4213,14 +4221,14 @@ QUnit.module('lodash.union'); (function() { - test('should produce correct results when provided a falsey `array` argument', function() { + test('should produce correct results when provided a falsey `array` argument', 1, function() { var expected = [1, 2, 3], actual = _.union(null, expected); deepEqual(actual, expected); }); - test('should not accept individual secondary values', function() { + test('should not accept individual secondary values', 1, function() { deepEqual(_.union([1], 1, 2, 3), [1]); }); }()); @@ -4230,7 +4238,7 @@ QUnit.module('lodash.uniq'); (function() { - test('should support the `thisArg` argument', function() { + test('should support the `thisArg` argument', 1, function() { var actual = _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); @@ -4238,14 +4246,14 @@ deepEqual(actual, [1, 2, 3]); }); - test('should perform an unsorted uniq operation when used as `callback` for `_.map`', function() { + test('should perform an unsorted uniq operation when used as `callback` for `_.map`', 1, function() { var array = [[2, 1, 2], [1, 2, 1]], actual = _.map(array, _.uniq); deepEqual(actual, [[2, 1], [1, 2]]); }); - test('should work with large arrays of boolean, `null`, and `undefined` values', function() { + test('should work with large arrays of boolean, `null`, and `undefined` values', 1, function() { var array = [], expected = [true, false, null, undefined], count = Math.ceil(largeArraySize / expected.length); @@ -4256,7 +4264,7 @@ deepEqual(_.uniq(array), expected); }); - test('should distinguish between numbers and numeric strings', function() { + test('should distinguish between numbers and numeric strings', 1, function() { var array = [], expected = ['2', 2, Object('2'), Object(2)], count = Math.ceil(largeArraySize / expected.length); @@ -4274,7 +4282,7 @@ 'a string': '0' }, function(callback, key) { - test('should work with ' + key + ' for `callback`', function() { + test('should work with ' + key + ' for `callback`', 1, function() { var actual = _.uniq([['a'], ['b'], ['a']], callback); deepEqual(actual, [['a'], ['b']]); }); @@ -4286,11 +4294,11 @@ QUnit.module('lodash.uniqueId'); (function() { - test('should return a string value when not passing a prefix argument', function() { + test('should return a string value when not passing a prefix argument', 1, function() { equal(typeof _.uniqueId(), 'string'); }); - test('should coerce the prefix argument to a string', function() { + test('should coerce the prefix argument to a string', 1, function() { var actual = [_.uniqueId(3), _.uniqueId(2), _.uniqueId(1)]; ok(/3\d+,2\d+,1\d+/.test(actual)); }); @@ -4309,7 +4317,7 @@ { 'a': 3 } ]; - test('should filter by properties', function() { + test('should filter by properties', 6, function() { deepEqual(_.where(array, { 'a': 1 }), [{ 'a': 1 }, { 'a': 1 }, { 'a': 1, 'b': 2 }]); deepEqual(_.where(array, { 'a': 2 }), [{ 'a': 2, 'b': 2 }]); deepEqual(_.where(array, { 'a': 3 }), [{ 'a': 3 }]); @@ -4318,7 +4326,7 @@ deepEqual(_.where(array, { 'a': 1, 'b': 2 }), [{ 'a': 1, 'b': 2 }]); }); - test('should not filter by inherited properties', function() { + test('should not filter by inherited properties', 1, function() { function Foo() {} Foo.prototype = { 'a': 2 }; @@ -4327,12 +4335,12 @@ deepEqual(_.where(array, properties), [{ 'a': 1, 'b': 2 }, { 'a': 2, 'b': 2 }]); }); - test('should filter by problem JScript properties (test in IE < 9)', function() { + test('should filter by problem JScript properties (test in IE < 9)', 1, function() { var collection = [shadowedObject]; deepEqual(_.where(collection, shadowedObject), [shadowedObject]); }); - test('should work with an object for `collection`', function() { + test('should work with an object for `collection`', 1, function() { var collection = { 'x': { 'a': 1 }, 'y': { 'a': 3 }, @@ -4342,18 +4350,18 @@ deepEqual(_.where(collection, { 'a': 1 }), [{ 'a': 1 }, { 'a': 1, 'b': 2 }]); }); - test('should return an empty array when provided an empty `properties` object', function() { + test('should return an empty array when provided an empty `properties` object', 1, function() { deepEqual(_.where(array, {}), []); }); - test('should deep compare `properties` values', function() { + test('should deep compare `properties` values', 1, function() { var collection = [{ 'a': { 'b': { 'c': 1, 'd': 2 }, 'e': 3 }, 'f': 4 }], expected = _.cloneDeep(collection); deepEqual(_.where(collection, { 'a': { 'b': { 'c': 1 } } }), expected); }); - test('should search of arrays for values', function() { + test('should search of arrays for values', 2, function() { var collection = [{ 'a': [1, 2] }], expected = _.cloneDeep(collection); @@ -4387,14 +4395,14 @@ }; _.forOwn(object, function(pair, key) { - test('should work with ' + key, function() { + test('should work with ' + key, 2, function() { var actual = _.zip.apply(_, pair[0]); deepEqual(actual, pair[1]); deepEqual(_.zip.apply(_, actual), actual.length ? pair[0] : []); }); }); - test('should work with tuples of different lengths', function() { + test('should work with tuples of different lengths', 4, function() { var pair = [ [['moe', 30], ['larry', 40, false]], [['moe', 'larry'], [30, 40], [undefined, false]] @@ -4409,7 +4417,7 @@ deepEqual(actual, [['moe', 30, undefined], ['larry', 40, false]]); }); - test('should correctly consume it\'s output', function() { + test('should correctly consume it\'s output', 1, function() { var expected = [['moe', 'larry'], [30, 40]]; deepEqual(_.zip(_.zip(_.zip(_.zip(expected)))), expected); }); @@ -4420,7 +4428,7 @@ QUnit.module('lodash.zipObject'); (function() { - test('should skip falsey elements in a given two dimensional array', function() { + test('should skip falsey elements in a given two dimensional array', 1, function() { var actual = _.zipObject([['a', 1], ['b', 2]].concat(falsey)); deepEqual(actual, { 'a': 1, 'b': 2 }); }); @@ -4431,7 +4439,7 @@ QUnit.module('lodash(...).shift'); (function() { - test('should remove the value at index `0` when length is `0` (test in IE 8 compatibility mode)', function() { + test('should remove the value at index `0` when length is `0` (test in IE 8 compatibility mode)', 2, function() { var wrapped = _({ '0': 1, 'length': 1 }); wrapped.shift(); @@ -4445,7 +4453,7 @@ QUnit.module('lodash(...).splice'); (function() { - test('should remove the value at index `0` when length is `0` (test in IE < 9, and in compatibility mode for IE9)', function() { + test('should remove the value at index `0` when length is `0` (test in IE < 9, and in compatibility mode for IE9)', 2, function() { var wrapped = _({ '0': 1, 'length': 1 }); wrapped.splice(0, 1); @@ -4459,7 +4467,7 @@ QUnit.module('lodash(...).toString'); (function() { - test('should return the `toString` result of the wrapped value', function() { + test('should return the `toString` result of the wrapped value', 1, function() { var wrapped = _([1, 2, 3]); equal(String(wrapped), '1,2,3'); }); @@ -4470,7 +4478,7 @@ QUnit.module('lodash(...).valueOf'); (function() { - test('should return the `valueOf` result of the wrapped value', function() { + test('should return the `valueOf` result of the wrapped value', 1, function() { var wrapped = _(123); equal(Number(wrapped), 123); }); @@ -4490,7 +4498,7 @@ ]; _.forEach(funcs, function(methodName) { - test('`_.' + methodName + '` should return a wrapped value', function() { + test('`_.' + methodName + '` should return a wrapped value', 1, function() { ok(wrapped[methodName]() instanceof _); }); }); @@ -4538,7 +4546,7 @@ ]; _.forEach(funcs, function(methodName) { - test('`_(...).' + methodName + '` should return an unwrapped value', function() { + test('`_(...).' + methodName + '` should return an unwrapped value', 1, function() { var result = methodName == 'reduceRight' ? wrapped[methodName](_.identity) : wrapped[methodName](); @@ -4563,15 +4571,15 @@ ]; _.forEach(funcs, function(methodName) { - test('`_(...).' + methodName + '` called without an `n` argument should return an unwrapped value', function() { + test('`_(...).' + methodName + '` called without an `n` argument should return an unwrapped value', 1, function() { equal(typeof wrapped[methodName](), 'number'); }); - test('`_(...).' + methodName + '` called with an `n` argument should return a wrapped value', function() { + test('`_(...).' + methodName + '` called with an `n` argument should return a wrapped value', 1, function() { ok(wrapped[methodName](1) instanceof _); }); - test('`_.' + methodName + '` should return `undefined` when querying falsey arguments without an `n` argument', function() { + test('`_.' + methodName + '` should return `undefined` when querying falsey arguments without an `n` argument', 1, function() { var actual = [], expected = _.map(falsey, function() { return undefined; }), func = _[methodName]; @@ -4585,7 +4593,7 @@ deepEqual(actual, expected); }); - test('`_.' + methodName + '` should return an empty array when querying falsey arguments with an `n` argument', function() { + test('`_.' + methodName + '` should return an empty array when querying falsey arguments with an `n` argument', 1, function() { var actual = [], expected = _.map(falsey, function() { return []; }), func = _[methodName]; @@ -4609,7 +4617,7 @@ var args = arguments, array = [1, 2, 3, 4, 5, 6]; - test('should work with `arguments` objects', function() { + test('should work with `arguments` objects', 23, function() { function message(methodName) { return '`_.' + methodName + '` should work with `arguments` objects'; } @@ -4646,7 +4654,7 @@ ok(args.length == 1 && _.isEqual(args[0], [3]), message('remove')); }); - test('should accept falsey primary arguments', function() { + test('should accept falsey primary arguments', 3, function() { function message(methodName) { return '`_.' + methodName + '` should accept falsey primary arguments'; } @@ -4656,7 +4664,7 @@ deepEqual(_.union(null, array), array, message('union')); }); - test('should accept falsey secondary arguments', function() { + test('should accept falsey secondary arguments', 3, function() { function message(methodName) { return '`_.' + methodName + '` should accept falsey secondary arguments'; } @@ -4724,7 +4732,7 @@ var acceptFalsey = _.difference(allMethods, rejectFalsey); - test('should accept falsey arguments', function() { + test('should accept falsey arguments', 147, function() { var isExported = '_' in root, oldDash = root._; @@ -4762,7 +4770,7 @@ } }); - test('should reject falsey arguments', function() { + test('should reject falsey arguments', 14, function() { _.forEach(rejectFalsey, function(methodName) { var actual = [], expected = _.map(falsey, function() { return true; }), @@ -4782,7 +4790,7 @@ }); }); - test('should handle `null` `thisArg` arguments', function() { + test('should handle `null` `thisArg` arguments', 30, function() { var thisArg, callback = function() { thisArg = this; }, expected = (function() { return this; }).call(null); diff --git a/vendor/qunit-clib/qunit-clib.js b/vendor/qunit-clib/qunit-clib.js index 5842ce7ccc..acf368f7b4 100644 --- a/vendor/qunit-clib/qunit-clib.js +++ b/vendor/qunit-clib/qunit-clib.js @@ -118,9 +118,38 @@ /** Used as a horizontal rule in console output */ var hr = '----------------------------------------'; + /** Used by `logInline` to clear previously logged messages */ + var prevLine = ''; + /** Shorten `context.QUnit.QUnit` to `context.QUnit` */ var QUnit = context.QUnit = context.QUnit.QUnit || context.QUnit; + /** + * Logs an inline message to standard output. + * + * @private + * @param {string} text The text to log. + */ + var logInline = (function() { + // exit early if not Node.js + if (!(typeof process == 'object' && process && process.on && process.stdout)) { + return function() {}; + } + // cleanup any inline logs when exited via `ctrl+c` + process.on('SIGINT', function() { + logInline(''); + process.exit(); + }); + return function(text) { + var blankLine = Array(prevLine.length + 1).join(' '); + if (text.length > hr.length) { + text = text.slice(0, hr.length - 3) + '...'; + } + prevLine = text; + process.stdout.write(text + blankLine.slice(text.length) + '\r'); + } + }()); + /** * A logging callback triggered when all testing is completed. * @@ -137,6 +166,7 @@ } ran = true; + logInline(''); console.log(hr); console.log(' PASS: ' + details.passed + ' FAIL: ' + details.failed + ' TOTAL: ' + details.total); console.log(' Finished in ' + details.runtime + ' milliseconds.'); @@ -230,6 +260,7 @@ testName = details.name; if (details.failed > 0) { + logInline(''); if (!modulePrinted) { modulePrinted = true; console.log(hr); @@ -240,6 +271,8 @@ assertions.forEach(function(value) { console.log(' ' + value); }); + } else { + logInline('Testing ' + moduleName + '...'); } assertions.length = 0; }); From 6da87e4a790004c3bc448dcf340ce3b3b6b68036 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 28 Sep 2013 20:29:54 -0700 Subject: [PATCH 19/24] Bump to v2.2.0. --- README.md | 17 +++++++++-------- bower.json | 2 +- component.json | 2 +- dist/lodash.compat.js | 4 ++-- dist/lodash.compat.min.js | 4 ++-- dist/lodash.js | 4 ++-- dist/lodash.min.js | 4 ++-- dist/lodash.underscore.js | 4 ++-- dist/lodash.underscore.min.js | 4 ++-- doc/README.md | 2 +- doc/parse.php | 2 +- lodash.js | 4 ++-- package.json | 2 +- 13 files changed, 28 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 9b7ce40ed4..3c282e777f 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,23 @@ -# Lo-Dash v2.1.0 +# Lo-Dash v2.2.0 A utility library delivering consistency, [customization](http://lodash.com/custom-builds), [performance](http://lodash.com/benchmarks), & [extras](http://lodash.com/#features). ## Download * Modern builds perfect for newer browsers/environments:
-[Development](https://raw.github.com/lodash/lodash/2.1.0/dist/lodash.js) & -[Production](https://raw.github.com/lodash/lodash/2.1.0/dist/lodash.min.js) +[Development](https://raw.github.com/lodash/lodash/2.2.0/dist/lodash.js) & +[Production](https://raw.github.com/lodash/lodash/2.2.0/dist/lodash.min.js) * Compatibility builds for older environment support too:
-[Development](https://raw.github.com/lodash/lodash/2.1.0/dist/lodash.compat.js) & -[Production](https://raw.github.com/lodash/lodash/2.1.0/dist/lodash.compat.min.js) +[Development](https://raw.github.com/lodash/lodash/2.2.0/dist/lodash.compat.js) & +[Production](https://raw.github.com/lodash/lodash/2.2.0/dist/lodash.compat.min.js) * Underscore builds to use as a drop-in replacement:
-[Development](https://raw.github.com/lodash/lodash/2.1.0/dist/lodash.underscore.js) & -[Production](https://raw.github.com/lodash/lodash/2.1.0/dist/lodash.underscore.min.js) +[Development](https://raw.github.com/lodash/lodash/2.2.0/dist/lodash.underscore.js) & +[Production](https://raw.github.com/lodash/lodash/2.2.0/dist/lodash.underscore.min.js) CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash).
For smaller file sizes, create [custom builds](http://lodash.com/custom-builds) with only the features needed.
-Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-node](https://npmjs.org/package/lodash-node), and [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method. +Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-node](https://npmjs.org/package/lodash-node), & [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method. ## Dive in @@ -31,6 +31,7 @@ The full changelog for this release is available on our [wiki](https://github.co * [_(…)](http://lodash.com/docs#_) supports intuitive chaining * [_.at](http://lodash.com/docs#at) for cherry-picking collection values * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods + * [_.clone](http://lodash.com/docs#clone) supports cloning `Date` & `RegExp` objects * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays & objects * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` * [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins diff --git a/bower.json b/bower.json index 1fb9348bcb..4b4db66e9f 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "2.1.0", + "version": "2.2.0", "main": "dist/lodash.compat.js", "ignore": [ ".*", diff --git a/component.json b/component.json index 506d978bf3..df4ea20e72 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "name": "lodash", "repo": "lodash/lodash", - "version": "2.1.0", + "version": "2.2.0", "description": "A utility library delivering consistency, customization, performance, & extras.", "license": "MIT", "keywords": ["amd", "browser", "client", "customize", "functional", "performance", "server", "speed", "util"], diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 49840b50c7..49136ed90d 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 2.1.0 (Custom Build) + * Lo-Dash 2.2.0 (Custom Build) * Build: `lodash -o ./dist/lodash.compat.js` * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.5.2 @@ -6604,7 +6604,7 @@ * @memberOf _ * @type string */ - lodash.VERSION = '2.1.0'; + lodash.VERSION = '2.2.0'; // add "Chaining" functions to the wrapper lodash.prototype.chain = wrapperChain; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index a0418f02eb..090098cf12 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 2.1.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE + * Lo-Dash 2.2.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e/g,B=RegExp("^["+x+"]*0+(?=.$)"),D=/($^)/,P=/\bthis\b/,R=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),L="[object Arguments]",T="[object Array]",z="[object Boolean]",q="[object Date]",K="[object Error]",W="[object Function]",G="[object Number]",J="[object Object]",M="[object RegExp]",H="[object String]",U={}; U[W]=!1,U[L]=U[T]=U[z]=U[q]=U[G]=U[J]=U[M]=U[H]=!0;var V={leading:!1,maxWait:0,trailing:!1},Q={configurable:!1,enumerable:!1,value:null,writable:!1},X={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:!1},Y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=Y[typeof window]&&window||this,tt=Y[typeof exports]&&exports&&!exports.nodeType&&exports,et=Y[typeof module]&&module&&!module.nodeType&&module,rt=et&&et.exports===tt&&tt,ut=Y[typeof global]&&global; !ut||ut.global!==ut&&ut.window!==ut||(nt=ut);var ot=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(nt._=ot, define(function(){return ot})):tt&&et?rt?(et.exports=ot)._=ot:tt._=ot:nt._=ot}).call(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 80e7883cd1..cdd275d73c 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 2.1.0 (Custom Build) + * Lo-Dash 2.2.0 (Custom Build) * Build: `lodash modern -o ./dist/lodash.js` * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.5.2 @@ -6254,7 +6254,7 @@ * @memberOf _ * @type string */ - lodash.VERSION = '2.1.0'; + lodash.VERSION = '2.2.0'; // add "Chaining" functions to the wrapper lodash.prototype.chain = wrapperChain; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index e308f9f2aa..7ebe2c9bc6 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 2.1.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE + * Lo-Dash 2.2.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e/g,E=RegExp("^["+w+"]*0+(?=.$)"),S=/($^)/,R=/\bthis\b/,A=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",$="[object Array]",F="[object Boolean]",T="[object Date]",W="[object Function]",q="[object Number]",z="[object Object]",P="[object RegExp]",K="[object String]",L={}; L[W]=!1,L[B]=L[$]=L[F]=L[T]=L[q]=L[z]=L[P]=L[K]=!0;var M={leading:!1,maxWait:0,trailing:!1},U={configurable:!1,enumerable:!1,value:null,writable:!1},V={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},H=V[typeof window]&&window||this,J=V[typeof exports]&&exports&&!exports.nodeType&&exports,Q=V[typeof module]&&module&&!module.nodeType&&module,X=Q&&Q.exports===J&&J,Y=V[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(H=Y); var Z=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(H._=Z, define(function(){return Z})):J&&Q?X?(Q.exports=Z)._=Z:J._=Z:H._=Z}).call(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 818c3c314c..cb6a2bf91a 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 2.1.0 (Custom Build) + * Lo-Dash 2.2.0 (Custom Build) * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.5.2 @@ -4696,7 +4696,7 @@ * @memberOf _ * @type string */ - lodash.VERSION = '2.1.0'; + lodash.VERSION = '2.2.0'; // add "Chaining" functions to the wrapper lodash.prototype.chain = wrapperChain; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index eef86794d6..25284789ac 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 2.1.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE + * Lo-Dash 2.2.0 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` */ ;(function(){function n(n,r,t){t=(t||0)-1;for(var e=n?n.length:0;++te||typeof t=="undefined")return 1;if(tt?$r(0,e+t):Ir(t,e-1))+1);e--;)if(n[e]===r)return e;return-1},u.mixin=X,u.noConflict=function(){return gr._=jr,this},u.random=Y,u.reduce=M,u.reduceRight=$,u.result=function(n,r){if(n){var t=n[r];return j(t)?n[r]():t}},u.size=function(n){var r=n?n.length:0;return typeof r=="number"?r:Hr(n).length },u.some=W,u.sortedIndex=G,u.template=function(n,r,e){var o=u,i=o.templateSettings;n||(n=""),e=_({},e,i);var f=0,a="__p+='",i=e.variable;n.replace(RegExp((e.escape||er).source+"|"+(e.interpolate||er).source+"|"+(e.evaluate||er).source+"|$","g"),function(r,e,u,o,i){return a+=n.slice(f,i).replace(ur,t),e&&(a+="'+_.escape("+e+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),f=i+r.length,r}),a+="';\n",i||(i="obj",a="with("+i+"||{}){"+a+"}"),a="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"; try{var l=Function("_","return "+a)(o)}catch(c){throw c.source=a,c}return r?l(r):(l.source=a,l)},u.unescape=function(n){return null==n?"":(n+"").replace(Lr,g)},u.uniqueId=function(n){var r=++nr+"";return n?n+r:r},u.all=S,u.any=W,u.detect=N,u.findWhere=function(n,r){return z(n,r,!0)},u.foldl=M,u.foldr=$,u.include=O,u.inject=M,u.first=P,u.last=function(n,r,t){var e=0,u=n?n.length:0;if(typeof r!="number"&&null!=r){var o=u;for(r=K(r,t,3);o--&&r(n[o],o,n);)e++}else if(e=r,null==e||t)return n?n[u-1]:Z; -return zr.call(n,$r(0,u-e))},u.sample=function(n,r,t){var e=n?n.length:0;return typeof e!="number"&&(n=A(n)),null==r||t?n?n[Y(e-1)]:Z:(n=I(n),n.length=Ir($r(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.1.0",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},R("pop push reverse shift sort splice unshift".split(" "),function(n){var r=br[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Ur.spliceObjects||0!==n.length||delete n[0],this +return zr.call(n,$r(0,u-e))},u.sample=function(n,r,t){var e=n?n.length:0;return typeof e!="number"&&(n=A(n)),null==r||t?n?n[Y(e-1)]:Z:(n=I(n),n.length=Ir($r(0,r),n.length),n)},u.take=P,u.head=P,X(u),u.VERSION="2.2.0",u.prototype.chain=function(){return this.__chain__=!0,this},u.prototype.value=function(){return this.__wrapped__},R("pop push reverse shift sort splice unshift".split(" "),function(n){var r=br[n];u.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),Ur.spliceObjects||0!==n.length||delete n[0],this }}),R(["concat","join","slice"],function(n){var r=br[n];u.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(gr._=u, define(function(){return u})):yr&&mr?_r?(mr.exports=u)._=u:yr._=u:gr._=u}).call(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 9e3fb44cd6..1a52f5891a 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v2.1.0 +# Lo-Dash v2.2.0 diff --git a/doc/parse.php b/doc/parse.php index 3b7b44eaee..66f4554236 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -21,7 +21,7 @@ // generate Markdown $markdown = docdown(array( 'path' => '../' . $file, - 'title' => 'Lo-Dash v2.1.0', + 'title' => 'Lo-Dash v2.2.0', 'toc' => 'categories', 'url' => 'https://github.com/lodash/lodash/blob/master/lodash.js' )); diff --git a/lodash.js b/lodash.js index 03a71932f7..af31f64a57 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 2.1.0 + * Lo-Dash 2.2.0 * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.5.2 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors @@ -6621,7 +6621,7 @@ * @memberOf _ * @type string */ - lodash.VERSION = '2.1.0'; + lodash.VERSION = '2.2.0'; // add "Chaining" functions to the wrapper lodash.prototype.chain = wrapperChain; diff --git a/package.json b/package.json index 80163b7dc3..991fbc3d94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "2.1.0", + "version": "2.2.0", "description": "A utility library delivering consistency, customization, performance, & extras.", "homepage": "http://lodash.com/", "license": "MIT", From 7883e6544ef9be338667a1129639e69f43f794ab Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 28 Sep 2013 22:14:05 -0700 Subject: [PATCH 20/24] Remove `modularize` entry in test-ui.js, update `isModularize` detection, and avoid a false fail in old Opera. --- test/test-ui.js | 11 ++++------- test/test.js | 5 +++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/test/test-ui.js b/test/test-ui.js index 81d90b3386..06ff770222 100644 --- a/test/test-ui.js +++ b/test/test-ui.js @@ -49,7 +49,6 @@ case 'lodash-modern': result = 'dist/lodash.min.js'; break; case 'lodash-legacy': result = 'dist/lodash.legacy.min.js'; break; case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break; - case 'lodash-modularize': result = 'modularize/main.js'; break; case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break; case 'lodash-custom-dev': result = 'lodash.custom.js'; break; case 'lodash-custom': result = 'lodash.custom.min.js'; break; @@ -74,7 +73,7 @@ }()); // used to indicate testing a modularized build - ui.isModularize = /\b(?:lodash-(?:amd|node)|modularize)\b/.test([location.pathname, location.search, ui.buildPath]); + ui.isModularize = /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize)\b/.test([location.pathname, location.search, ui.buildPath]); // initialize controls addListener(window, 'load', function() { @@ -108,10 +107,9 @@ case 'lodash-modern': return 3; case 'lodash-legacy': return 4; case 'lodash-mobile': return 5; - case 'lodash-modularize': return 6; - case 'lodash-underscore': return 7; - case 'lodash-custom-dev': return 8; - case 'lodash-custom': return 9; + case 'lodash-underscore': return 6; + case 'lodash-custom-dev': return 7; + case 'lodash-custom': return 8; case 'lodash-compat-dev': case null: return 0; } @@ -148,7 +146,6 @@ '' + '' + '' + - '' + '' + '' + '' + diff --git a/test/test.js b/test/test.js index e0a5abecad..bee2490999 100644 --- a/test/test.js +++ b/test/test.js @@ -47,7 +47,7 @@ }); /** Used to indicate testing a modularized build */ - var isModularize = ui.isModularize || /\b(?:commonjs|index\.js|lodash-(?:amd|node)|modularize)\b/.test([ui.buildPath, ui.urlParams.build, basename]); + var isModularize = ui.isModularize || /\b(?:commonjs|(index|main)\.js|lodash-(?:amd|node)|modularize)\b/.test([ui.buildPath, ui.urlParams.build, basename]); /*--------------------------------------------------------------------------*/ @@ -638,7 +638,8 @@ }); test('`_.' + methodName + '` should deep clone `lastIndex` regexp property', 1, function() { - var regexp = /x/g; + // avoid regexp literal here for older Opera + var regexp = RegExp('x', 'g'); regexp.test('vwxyz'); var actual = func(regexp); From 0471dfa2f8752e1c6225d68a69ec311117e6cf3f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 29 Sep 2013 09:53:05 -0700 Subject: [PATCH 21/24] Update vendor/qunit-clib to avoid `logInline` when running on Windows. --- vendor/qunit-clib/qunit-clib.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor/qunit-clib/qunit-clib.js b/vendor/qunit-clib/qunit-clib.js index acf368f7b4..f43ff6c042 100644 --- a/vendor/qunit-clib/qunit-clib.js +++ b/vendor/qunit-clib/qunit-clib.js @@ -132,7 +132,8 @@ */ var logInline = (function() { // exit early if not Node.js - if (!(typeof process == 'object' && process && process.on && process.stdout)) { + if (!(typeof process == 'object' && process && + process.on && process.stdout && process.platform != 'win32')) { return function() {}; } // cleanup any inline logs when exited via `ctrl+c` @@ -172,7 +173,7 @@ console.log(' Finished in ' + details.runtime + ' milliseconds.'); console.log(hr); - // exit out of Narhwal, Rhino, or Ringo + // exit out of Narhwal, Rhino, or RingoJS try { quit(); } catch(e) { } From 0558495760a9efcc5b77a523b09a441ae7e88194 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 29 Sep 2013 12:30:34 -0700 Subject: [PATCH 22/24] Update `_.clone` unit test for older Safari. --- test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index bee2490999..026fbd4d32 100644 --- a/test/test.js +++ b/test/test.js @@ -638,9 +638,9 @@ }); test('`_.' + methodName + '` should deep clone `lastIndex` regexp property', 1, function() { - // avoid regexp literal here for older Opera + // avoid a regexp literal for older Opera and use `exec` for older Safari var regexp = RegExp('x', 'g'); - regexp.test('vwxyz'); + regexp.exec('vwxyz'); var actual = func(regexp); equal(actual.lastIndex, 3); From 5e29e3f1cb287a181ad027ca2196e0c6bce8b5dd Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 29 Sep 2013 14:46:52 -0700 Subject: [PATCH 23/24] Tweak wording on `_.clone` feature note in readme & tweak unit test handling missing `_.runInContext`. --- README.md | 2 +- test/test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3c282e777f..ca83c37d53 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The full changelog for this release is available on our [wiki](https://github.co * [_(…)](http://lodash.com/docs#_) supports intuitive chaining * [_.at](http://lodash.com/docs#at) for cherry-picking collection values * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods - * [_.clone](http://lodash.com/docs#clone) supports cloning `Date` & `RegExp` objects + * [_.clone](http://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays & objects * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` * [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins diff --git a/test/test.js b/test/test.js index 026fbd4d32..d38f8acca8 100644 --- a/test/test.js +++ b/test/test.js @@ -4766,7 +4766,7 @@ }); // add a skipped test for `_.runInContext` which is abscent from modularized builds - if (isModularize) { + if (!_.runInContext) { skipTest(); } }); From 23b00ebaac81e17ed5814ade020df897d5331a57 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Sun, 29 Sep 2013 14:46:52 -0700 Subject: [PATCH 24/24] Update v2.2.0 docs --- doc/README.md | 280 +++++++++++++++++++++++++------------------------- doc/parse.php | 4 +- 2 files changed, 142 insertions(+), 142 deletions(-) diff --git a/doc/README.md b/doc/README.md index 1a52f5891a..5fd47e2be1 100644 --- a/doc/README.md +++ b/doc/README.md @@ -233,7 +233,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4186 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4186 "View in source") [Ⓣ][1] Creates an array with all falsey values removed. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are all falsey. @@ -257,7 +257,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array, [array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4215 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4215 "View in source") [Ⓣ][1] Creates an array excluding all values of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -282,7 +282,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4265 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4265 "View in source") [Ⓣ][1] This method is like `_.find` except that it returns the index of the first element that passes the callback check, instead of the element itself. @@ -310,7 +310,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.findLastIndex(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4298 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4298 "View in source") [Ⓣ][1] This method is like `_.findIndex` except that it iterates over elements of a `collection` from right to left. @@ -338,7 +338,7 @@ _.findLastIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4365 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4365 "View in source") [Ⓣ][1] Gets the first element or first `n` elements of an array. If a callback is provided elements at the beginning of the array are returned as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -398,7 +398,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array, [isShallow=false], [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4425 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4425 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truey, the array will only be flattened a single level. If a callback is provided each element of the array is passed through the callback before flattening. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -441,7 +441,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4462 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4462 "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 providing `true` for `fromIndex` will run a faster binary search. @@ -473,7 +473,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array, [callback=1], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4528 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4528 "View in source") [Ⓣ][1] Gets all but the last element or last `n` elements of an array. If a callback is provided elements at the end of the array are excluded from the result as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -530,7 +530,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4558 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4558 "View in source") [Ⓣ][1] Creates an array of unique values present in all provided arrays using strict equality for comparisons, i.e. `===`. @@ -554,7 +554,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4658 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4658 "View in source") [Ⓣ][1] Gets the last element or last `n` elements of an array. If a callback is provided elements at the end of the array are returned as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -611,7 +611,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value, [fromIndex=array.length-1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4697 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -640,7 +640,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.pull(array, [value])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4727 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4727 "View in source") [Ⓣ][1] Removes all provided values from the given array using strict equality for comparisons, i.e. `===`. @@ -667,7 +667,7 @@ console.log(array); ### `_.range([start=0], end, [step=1])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4778 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4778 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. If `start` is less than `stop` a zero-length range is created unless a negative `step` is specified. @@ -708,7 +708,7 @@ _.range(0); ### `_.remove(array, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4831 "View in source") [Ⓣ][1] Removes all elements from an array that the callback returns truey for and returns an array of removed elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -744,7 +744,7 @@ console.log(evens); ### `_.rest(array, [callback=1], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4905 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4905 "View in source") [Ⓣ][1] The opposite of `_.initial` this method gets all but the first element or first `n` elements of an array. If a callback function is provided elements at the beginning of the array are excluded from the result as long as the callback returns truey. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -804,7 +804,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4969 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4969 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which a value should be inserted into a given sorted array in order to maintain the sort order of the array. If a callback is provided it will be executed for `value` and each element of `array` to compute their sort ranking. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -853,7 +853,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5000 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5000 "View in source") [Ⓣ][1] Creates an array of unique values, in order, of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -877,7 +877,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array, [isSorted=false], [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5048 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5048 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of an array using strict equality for comparisons, i.e. `===`. If the array is sorted, providing `true` for `isSorted` will use a faster algorithm. If a callback is provided each element of `array` is passed through the callback before uniqueness is computed. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -924,7 +924,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.without(array, [value])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5076 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5076 "View in source") [Ⓣ][1] Creates an array excluding all provided values using strict equality for comparisons, i.e. `===`. @@ -949,7 +949,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5096 "View in source") [Ⓣ][1] Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. @@ -976,7 +976,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys, [values=[]])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5126 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5126 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Provide either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` or two arrays, one of `keys` and one of corresponding `values`. @@ -1011,7 +1011,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L650 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L650 "View in source") [Ⓣ][1] Creates a `lodash` object which wraps the given value to enable method chaining. @@ -1064,7 +1064,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6344 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6344 "View in source") [Ⓣ][1] Creates a `lodash` object that wraps the given value. @@ -1097,7 +1097,7 @@ var youngest = _.chain(stooges) ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6372 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6372 "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. @@ -1127,7 +1127,7 @@ _([1, 2, 3, 4]) ### `_.prototype.chain()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6392 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6392 "View in source") [Ⓣ][1] Enables method chaining on the wrapper object. @@ -1151,7 +1151,7 @@ var sum = _([1, 2, 3]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6409 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6409 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1172,7 +1172,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6426 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6426 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1203,7 +1203,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection, [index])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3040 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3040 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1231,7 +1231,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target, [fromIndex=0])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3083 "View in source") [Ⓣ][1] Checks if a given value is present in a collection using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1269,7 +1269,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3138 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3138 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of `collection` through the callback. The corresponding value of each key is the number of times the key was returned by the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1305,7 +1305,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3183 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3183 "View in source") [Ⓣ][1] Checks if the given callback returns truey value for **all** elements of a collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1351,7 +1351,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3244 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3244 "View in source") [Ⓣ][1] Iterates over elements of a collection, returning an array of all elements the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1397,7 +1397,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3311 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3311 "View in source") [Ⓣ][1] Iterates over elements of a collection, returning the first element that the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1446,7 @@ _.find(food, 'organic'); ### `_.findLast(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3356 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3356 "View in source") [Ⓣ][1] This method is like `_.find` except that it iterates over elements of a `collection` from right to left. @@ -1474,7 +1474,7 @@ _.findLast([1, 2, 3, 4], function(num) { ### `_.forEach(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3390 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3390 "View in source") [Ⓣ][1] Iterates over elements of a collection, executing the callback for each element. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1506,7 +1506,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); ### `_.forEachRight(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3423 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3423 "View in source") [Ⓣ][1] This method is like `_.forEach` except that it iterates over elements of a `collection` from right to left. @@ -1535,7 +1535,7 @@ _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); ### `_.groupBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3484 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3484 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of a collection through the callback. The corresponding value of each key is an array of the elements responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1572,7 +1572,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.indexBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3527 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3527 "View in source") [Ⓣ][1] Creates an object composed of keys generated from the results of running each element of the collection through the given callback. The corresponding value of each key is the last element responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1613,7 +1613,7 @@ _.indexBy(stooges, function(key) { this.fromCharCode(key.code); }, String); ### `_.invoke(collection, methodName, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3553 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3553 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection` returning an array of the results of each invoked method. Additional arguments will be provided to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1642,7 +1642,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3605 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3605 "View in source") [Ⓣ][1] Creates an array of values by running each element in the collection through the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1687,7 +1687,7 @@ _.map(stooges, 'name'); ### `_.max(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3663 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3663 "View in source") [Ⓣ][1] Retrieves the maximum value of a collection. If the collection is empty or falsey `-Infinity` is returned. If a callback is provided it will be executed for each value in the collection to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1729,7 +1729,7 @@ _.max(stooges, 'age'); ### `_.min(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3733 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3733 "View in source") [Ⓣ][1] Retrieves the minimum value of a collection. If the collection is empty or falsey `Infinity` is returned. If a callback is provided it will be executed for each value in the collection to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1771,7 +1771,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3783 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3783 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1801,7 +1801,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3815 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3815 "View in source") [Ⓣ][1] Reduces a collection to a value which is the accumulated result of running each element in the collection through the callback, where each successive callback execution consumes the return value of the previous execution. If `accumulator` is not provided the first element of the collection will be used as the initial `accumulator` value. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1839,7 +1839,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3858 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3858 "View in source") [Ⓣ][1] This method is like `_.reduce` except that it iterates over elements of a `collection` from right to left. @@ -1870,7 +1870,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3907 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3907 "View in source") [Ⓣ][1] The opposite of `_.filter` this method returns the elements of a collection that the callback does **not** return truey for. @@ -1913,7 +1913,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.sample(collection, [n])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3933 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3933 "View in source") [Ⓣ][1] Retrieves a random element or `n` random elements from a collection. @@ -1941,7 +1941,7 @@ _.sample([1, 2, 3, 4], 2); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3962 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3962 "View in source") [Ⓣ][1] Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1965,7 +1965,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3995 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1995,7 +1995,7 @@ _.size('curly'); ### `_.some(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4042 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4042 "View in source") [Ⓣ][1] Checks if the callback returns a truey value for **any** element of a collection. The function returns as soon as it finds a passing value and does not iterate over the entire collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -2041,7 +2041,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4098 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4098 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in a collection through the callback. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -2078,7 +2078,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4134 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4134 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -2102,7 +2102,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L4168 "View in source") [Ⓣ][1] Performs a deep comparison of each element in a `collection` to the given `properties` object, returning an array of all elements that have equivalent property values. @@ -2142,7 +2142,7 @@ _.where(stooges, { 'quotes': ['Poifect!'] }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5168 "View in source") [Ⓣ][1] Creates a function that executes `func`, with the `this` binding and arguments of the created function, only after being called `n` times. @@ -2175,7 +2175,7 @@ _.forEach(saves, function(type) { ### `_.bind(func, [thisArg], [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5201 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5201 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those provided to the bound function. @@ -2206,7 +2206,7 @@ func(); ### `_.bindAll(object, [methodName])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5231 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5231 "View in source") [Ⓣ][1] Binds methods of an object to the object itself, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided all the function properties of `object` will be bound. @@ -2237,7 +2237,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5277 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5277 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those provided to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2278,7 +2278,7 @@ func(); ### `_.compose([func])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5313 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5313 "View in source") [Ⓣ][1] Creates a function that is the composition of the provided functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2316,7 +2316,7 @@ welcome('curly'); ### `_.createCallback([func=identity], [thisArg], [argCount])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5364 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5364 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name the created callback will return the property value for a given element. If `func` is an object the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2355,7 +2355,7 @@ _.filter(stooges, 'age__gt45'); ### `_.curry(func, [arity=func.length])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5429 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5429 "View in source") [Ⓣ][1] Creates a function which accepts one or more arguments of `func` that when invoked either executes `func` returning its result, if all `func` arguments have been provided, or returns a function that accepts one or more of the remaining `func` arguments, and so on. The arity of `func` can be specified if `func.length` is not sufficient. @@ -2390,7 +2390,7 @@ curried(1, 2, 3); ### `_.debounce(func, wait, [options], [options.maxWait])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5473 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5473 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2434,7 +2434,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5574 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5574 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be provided to `func` when it is invoked. @@ -2459,7 +2459,7 @@ _.defer(function() { console.log('deferred'); }); ### `_.delay(func, wait, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5608 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5608 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be provided to `func` when it is invoked. @@ -2486,7 +2486,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func, [resolver])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5650 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5650 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is provided it will be used to determine the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2526,7 +2526,7 @@ stooge('curly'); ### `_.once(func)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5683 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5683 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2552,7 +2552,7 @@ initialize(); ### `_.partial(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5721 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those provided to the new function. This method is similar to `_.bind` except it does **not** alter the `this` binding. @@ -2579,7 +2579,7 @@ hi('moe'); ### `_.partialRight(func, [arg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5752 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5752 "View in source") [Ⓣ][1] This method is like `_.partial` except that `partial` arguments are appended to those provided to the new function. @@ -2616,7 +2616,7 @@ options.imports ### `_.throttle(func, wait, [options])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5787 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5787 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2652,7 +2652,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5829 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5829 "View in source") [Ⓣ][1] Creates a function that provides `value` to the wrapper function as its first argument. Additional arguments provided to the function are appended to those provided to the wrapper function. The wrapper is executed with the `this` binding of the created function. @@ -2688,7 +2688,7 @@ hello(); ### `_.assign(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1966 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L1966 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the assigned values. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2726,7 +2726,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value, [deep=false], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2019 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2019 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true` nested objects will also be cloned, otherwise they will be assigned by reference. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2773,7 +2773,7 @@ clone.childNodes.length; ### `_.cloneDeep(value, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2071 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2071 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2819,7 +2819,7 @@ clone.node == view.node; ### `_.defaults(object, [source])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2095 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2095 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2845,7 +2845,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2117 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2117 "View in source") [Ⓣ][1] This method is like `_.findIndex` except that it returns the key of the first element that passes the callback check, instead of the element itself. @@ -2873,7 +2873,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.findLastKey(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2149 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2149 "View in source") [Ⓣ][1] This method is like `_.findKey` except that it iterates over elements of a `collection` in the opposite order. @@ -2901,7 +2901,7 @@ _.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2190 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2190 "View in source") [Ⓣ][1] Iterates over own and inherited enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2937,7 +2937,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forInRight(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2220 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2220 "View in source") [Ⓣ][1] This method is like `_.forIn` except that it iterates over elements of a `collection` in the opposite order. @@ -2973,7 +2973,7 @@ _.forInRight(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2258 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2258 "View in source") [Ⓣ][1] Iterates over own enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3001,7 +3001,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.forOwnRight(object, [callback=identity], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2278 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2278 "View in source") [Ⓣ][1] This method is like `_.forOwn` except that it iterates over elements of a `collection` in the opposite order. @@ -3029,7 +3029,7 @@ _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2307 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2307 "View in source") [Ⓣ][1] Creates a sorted array of property names of all enumerable properties, own and inherited, of `object` that have function values. @@ -3056,7 +3056,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2332 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2332 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -3081,7 +3081,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2349 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2349 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given object. @@ -3105,7 +3105,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1791 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L1791 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -3132,7 +3132,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1820 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L1820 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -3159,7 +3159,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2375 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2375 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -3183,7 +3183,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2392 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2392 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -3207,7 +3207,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2409 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2409 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -3231,7 +3231,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2434 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2434 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -3261,7 +3261,7 @@ _.isEmpty(''); ### `_.isEqual(a, b, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2491 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If a callback is provided it will be executed to compare values. If the callback returns `undefined` comparisons will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -3306,7 +3306,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2523 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2523 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -3344,7 +3344,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2540 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2540 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -3368,7 +3368,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2603 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -3403,7 +3403,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2625 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2625 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3430,7 +3430,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2644 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2644 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3456,7 +3456,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2570 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2570 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3486,7 +3486,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2672 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2672 "View in source") [Ⓣ][1] Checks if `value` is an object created by the `Object` constructor. @@ -3521,7 +3521,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2697 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3545,7 +3545,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2714 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2714 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3569,7 +3569,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2731 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2731 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3593,7 +3593,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L1854 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L1854 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of an object. @@ -3617,7 +3617,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object, [source], [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2786 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2786 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined` into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the merged values of the destination and source properties. If the callback returns `undefined` merging will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3673,7 +3673,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2842 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2842 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` omitting the properties the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3704,7 +3704,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2877 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2877 "View in source") [Ⓣ][1] Creates a two dimensional array of an object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3728,7 +3728,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, [callback], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2917 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2917 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` picking the properties the callback returns truey for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3759,7 +3759,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection, [callback=identity], [accumulator], [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2972 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L2972 "View in source") [Ⓣ][1] An alternative to `_.reduce` this method transforms `object` to a new `accumulator` object which is the result of running each of its elements through a callback, with each callback execution potentially mutating the `accumulator` object. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3796,7 +3796,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L3005 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L3005 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3827,7 +3827,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5856 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5856 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3851,7 +3851,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5874 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5874 "View in source") [Ⓣ][1] This method returns the first argument provided to it. @@ -3876,7 +3876,7 @@ moe === _.identity(moe); ### `_.mixin(object, object)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5901 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5901 "View in source") [Ⓣ][1] Adds function properties of a source object to the `lodash` function and chainable wrapper. @@ -3907,7 +3907,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5939 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5939 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3927,7 +3927,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value, [radix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5963 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5963 "View in source") [Ⓣ][1] Converts the given value into an integer of the specified radix. If `radix` is `undefined` or `0` a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3954,7 +3954,7 @@ _.parseInt('08'); ### `_.random([min=0], [max=1], [floating=false])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L5995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L5995 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided a number between `0` and the given number will be returned. If `floating` is truey or either `min` or `max` are floats a floating-point number will be returned instead of an integer. @@ -3989,7 +3989,7 @@ _.random(1.2, 5.2); ### `_.result(object, property)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6052 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6052 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey then `undefined` is returned. @@ -4024,7 +4024,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=root])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L471 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L471 "View in source") [Ⓣ][1] Create a new `lodash` function using the given context object. @@ -4042,7 +4042,7 @@ Create a new `lodash` function using the given context object. ### `_.template(text, data, [options], [options.escape], [options.evaluate], [options.imports], [options.interpolate], [sourceURL], [variable])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6145 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6145 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -4136,7 +4136,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback, [thisArg])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6268 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6268 "View in source") [Ⓣ][1] Executes the callback `n` times, returning an array of the results of each callback execution. The callback is bound to `thisArg` and invoked with one argument; *(index)*. @@ -4168,7 +4168,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6295 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6295 "View in source") [Ⓣ][1] The inverse of `_.escape` this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -4192,7 +4192,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6315 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6315 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is provided the ID will be appended to it. @@ -4226,7 +4226,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L878 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L878 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -4245,7 +4245,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L6624 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L6624 "View in source") [Ⓣ][1] *(string)*: The semantic version number. @@ -4257,7 +4257,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L679 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L679 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -4269,7 +4269,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L696 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L696 "View in source") [Ⓣ][1] *(boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -4281,7 +4281,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L704 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L704 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -4293,7 +4293,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L713 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L713 "View in source") [Ⓣ][1] *(boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -4305,7 +4305,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L726 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L726 "View in source") [Ⓣ][1] *(boolean)*: Detect if `prototype` properties are enumerable by default. @@ -4319,7 +4319,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L734 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L734 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -4331,7 +4331,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.funcDecomp` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L743 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L743 "View in source") [Ⓣ][1] *(boolean)*: Detect if functions can be decompiled by `Function#toString` *(all but PS3 and older Opera mobile browsers & avoided in Windows `8` apps)*. @@ -4343,7 +4343,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.funcNames` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L751 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L751 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Function#name` is supported *(all but IE)*. @@ -4355,7 +4355,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L760 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L760 "View in source") [Ⓣ][1] *(boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -4367,7 +4367,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L771 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L771 "View in source") [Ⓣ][1] *(boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -4381,7 +4381,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L779 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L779 "View in source") [Ⓣ][1] *(boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -4393,7 +4393,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L793 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L793 "View in source") [Ⓣ][1] *(boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -4407,7 +4407,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L804 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L804 "View in source") [Ⓣ][1] *(boolean)*: Detect lack of support for accessing string characters by index. @@ -4421,7 +4421,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L830 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L830 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -4433,7 +4433,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L838 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L838 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -4445,7 +4445,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L846 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L846 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -4457,7 +4457,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L854 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L854 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -4469,7 +4469,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L862 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L862 "View in source") [Ⓣ][1] *(string)*: Used to reference the data object in the template text. @@ -4481,7 +4481,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L870 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/2.2.0/lodash.js#L870 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. @@ -4496,4 +4496,4 @@ IE < `8` can't access characters by index and IE `8` can only access characters - [1]: #Arrays "Jump back to the TOC." \ No newline at end of file + [1]: #Arrays "Jump back to the TOC." diff --git a/doc/parse.php b/doc/parse.php index 66f4554236..8c94245f3f 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -23,7 +23,7 @@ 'path' => '../' . $file, 'title' => 'Lo-Dash v2.2.0', 'toc' => 'categories', - 'url' => 'https://github.com/lodash/lodash/blob/master/lodash.js' + 'url' => 'https://github.com/lodash/lodash/blob/2.2.0/lodash.js' )); // save to a .md file @@ -33,4 +33,4 @@ header('Content-Type: text/plain;charset=utf-8'); echo $markdown . PHP_EOL; -?> \ No newline at end of file +?>