diff --git a/README.md b/README.md
index 0a439a9694..9ceba6f9e9 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Lo-Dash v0.2.0
+# Lo-Dash v0.2.1
-A drop-in replacement for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://jsperf.com/lodash-underscore#filterby=family), bug fixes, and additional features.
+A drop-in replacement for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://jsperf.com/lodash-underscore#filterby=family), [bug fixes](https://github.com/bestiejs/lodash#closed-underscorejs-issues), and [additional features](https://github.com/bestiejs/lodash#features).
Lo-Dash’s performance is gained by avoiding slower native methods, instead opting for simplified non-ES5 compliant methods optimized for common usage, and by leveraging function compilation to reduce the number of overall function calls.
@@ -23,9 +23,9 @@ For more information check out these screencasts over Lo-Dash:
* [_.bind](http://lodash.com/docs#_bindfunc--arg1-arg2-) supports *"lazy"* binding
* [_.debounce](http://lodash.com/docs#_debouncefunc-wait-immediate)’ed functions match [_.throttle](http://lodash.com/docs#_throttlefunc-wait)’ed functions’ return value behavior
* [_.forEach](http://lodash.com/docs#_foreachcollection-callback--thisarg) is chainable
- * [_.groupBy](http://lodash.com/docs#_groupbycollection-callback--thisarg) accepts a third `thisArg` argument
+ * [_.groupBy](http://lodash.com/docs#_groupbycollection-callback--thisarg) accepts a third, `thisArg`, argument
* [_.partial](http://lodash.com/docs#_partialfunc--arg1-arg2-) for more functional fun
- * [_.size](http://lodash.com/docs#_sizecollection) returns the `length` of string values
+ * [_.size](http://lodash.com/docs#_sizecollection) supports returning the `length` of string values
## Support
@@ -116,14 +116,16 @@ git submodule update --init
## Closed Underscore.js issues
- * Fix Firefox, IE, Opera, and Safari object iteration bugs [#376](https://github.com/documentcloud/underscore/issues/376)
- * Handle arrays with `undefined` values correctly in IE < 9 [#601](https://github.com/documentcloud/underscore/issues/601)
- * Methods should work on pages with incorrectly shimmed native methods [#7](https://github.com/documentcloud/underscore/issues/7)
- * Register as AMD module, but still export to global [#431](https://github.com/documentcloud/underscore/pull/431)
- * `_.forEach` should be chainable [#142](https://github.com/documentcloud/underscore/issues/142)
- * `_isNaN(new Number(NaN))` should return `true`
- * `_.reduceRight` should pass correct callback arguments when iterating objects
- * `_.size` should return the `length` of string values
+ * Ensure `_.groupBy` adds values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L229-236)]
+ * Ensure `_.throttle` works when called in tight loops [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L436-446)]
+ * Fix Firefox, IE, Opera, and Safari object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L152-172), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L206-213), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L255-257), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L265-267), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L285-292), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L386-388)]
+ * Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)]
+ * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L77-83)]
+ * Register as AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L61-75)]
+ * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/5bcd444084c92b1753feeaf66c20323e57a2dac3/test/test.js#L74-77)]
+ * `_isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/5bcd444084c92b1753feeaf66c20323e57a2dac3/test/test.js#L95-99)]
+ * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/5bcd444084c92b1753feeaf66c20323e57a2dac3/test/test.js#L106-116)]
+ * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/5bcd444084c92b1753feeaf66c20323e57a2dac3/test/test.js#L121-127)]
## Optimized methods (50+)
@@ -146,7 +148,7 @@ git submodule update --init
* `_.functions`, `_.methods`
* `_.groupBy`
* `_.indexOf`
- * `_.intersection`, `_.intersect`
+ * `_.intersection`
* `_.invoke`
* `_.isEmpty`
* `_.isEqual`
@@ -182,6 +184,14 @@ git submodule update --init
## Changelog
+### v0.2.1
+
+* Adjusted the Lo-Dash export order for r.js
+* Ensured `_.groupBy` values are added to own, not inherited, properties
+* Made `_.bind` follow ES5 spec to support a popular Backbone.js pattern
+* Removed the alias `intersect`
+* Simplified `_.bind`, `_.flatten`, `_.groupBy`, `_.max`, and `_.min`
+
### v0.2.0
* Added custom build options
@@ -189,11 +199,12 @@ git submodule update --init
* Added *"lazy bind"* support to `_.bind`
* Added native method overwrite detection to avoid bad native shims
* Added support for more AMD build optimizers and aliasing as the *"underscore"* module
- * Added `thisArg` to `_.groupBy`
+ * Added `thisArg` argument to `_.groupBy`
* Added whitespace to compiled strings
- * Added `_.partial`
+ * Added `_.partial` method
* Commented the `iterationFactory` options object
* Ensured `_.max` and `_.min` support extremely large arrays
+ * Ensured `_.throttle` works in tight loops
* Fixed IE < 9 `[DontEnum]` bug and Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1’s prototype property iteration bug
* Inlined `_.isFunction` calls.
* Made `_.debounce`’ed functions match `_.throttle`’ed functions’ return value behavior
diff --git a/build.js b/build.js
index 9b88cec177..a2f37d863d 100755
--- a/build.js
+++ b/build.js
@@ -31,7 +31,6 @@
'head': 'first',
'include': 'contains',
'inject': 'reduce',
- 'intersect': 'intersection',
'methods': 'functions',
'select': 'filter',
'tail': 'rest',
@@ -48,7 +47,6 @@
'first': ['head', 'take'],
'forEach': ['each'],
'functions': ['methods'],
- 'intersection': ['intersect'],
'map': ['collect'],
'reduce': ['foldl', 'inject'],
'reduceRight': ['foldr'],
@@ -416,11 +414,6 @@
// remove `templateSettings` assignment
source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, '');
}
- if (isRemoved(source, 'max', 'min')) {
- source = removeVar(source, 'argsLimit');
- // remove `argsLimit` try-catch
- source = source.replace(/\n *try\s*\{[\s\S]+?argsLimit *=[\s\S]+?catch[^}]+}\n/, '');
- }
if (isRemoved(source, 'isArray', 'isEmpty', 'isEqual', 'size')) {
source = removeVar(source, 'arrayClass');
}
diff --git a/build/pre-compile.js b/build/pre-compile.js
index fad4c8a3b6..24781f09be 100644
--- a/build/pre-compile.js
+++ b/build/pre-compile.js
@@ -8,33 +8,24 @@
/** Used to minify variables embedded in compiled strings */
var compiledVars = [
'accumulator',
- 'args',
- 'array',
'arrayClass',
'bind',
'callback',
'className',
'collection',
- 'concat',
'ctor',
'false',
'funcClass',
'hasOwnProperty',
'identity',
'index',
- 'indexOf',
- 'isArray',
- 'isEmpty',
- 'isFunc',
'length',
'object',
'objectTypes',
'noaccum',
- 'prop',
'property',
'result',
'skipProto',
- 'slice',
'source',
'sourceIndex',
'stringClass',
@@ -119,7 +110,6 @@
'initial',
'inject',
'interpolate',
- 'intersect',
'intersection',
'invoke',
'isArguments',
@@ -177,7 +167,6 @@
'throttle',
'times',
'toArray',
- 'toArray',
'union',
'uniq',
'unique',
diff --git a/doc/README.md b/doc/README.md
index b1f21d887d..513b834b59 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,4 +1,4 @@
-# Lo-Dash v0.2.0
+# Lo-Dash v0.2.1
@@ -30,7 +30,7 @@
* [`_.flatten`](#_flattenarray-shallow)
* [`_.forEach`](#_foreachcollection-callback--thisarg)
* [`_.functions`](#_functionsobject)
-* [`_.groupBy`](#_groupbycollection-callback--thisarg)
+* [`_.groupBy`](#_groupbyarray-callback--thisarg)
* [`_.has`](#_hasobject-property)
* [`_.identity`](#_identityvalue)
* [`_.indexOf`](#_indexofarray-value--issortedfalse)
@@ -73,9 +73,9 @@
* [`_.rest`](#_restarray--n-guard)
* [`_.result`](#_resultobject-property)
* [`_.shuffle`](#_shufflearray)
-* [`_.size`](#_sizecollection)
+* [`_.size`](#_sizevalue)
* [`_.some`](#_somecollection-callback--thisarg)
-* [`_.sortBy`](#_sortbycollection-callback--thisarg)
+* [`_.sortBy`](#_sortbyarray-callback--thisarg)
* [`_.sortedIndex`](#_sortedindexarray-value--callback)
* [`_.tap`](#_tapvalue-interceptor)
* [`_.template`](#_templatetext-data-options)
@@ -124,13 +124,10 @@
## `_`
-
-
-
### `_(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L289 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L115 "View in source") [Ⓣ][1]
The `lodash` function.
@@ -145,13 +142,10 @@ The `lodash` function.
-
-
-
### `_.VERSION`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3066 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3089 "View in source") [Ⓣ][1]
*(String)*: The semantic version number.
@@ -160,13 +154,10 @@ The `lodash` function.
-
-
-
### `_.after(n, func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1680 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1618 "View in source") [Ⓣ][1]
Creates a new function that is restricted to executing only after it is called `n` times.
@@ -191,13 +182,10 @@ _.forEach(notes, function(note) {
-
-
-
### `_.bind(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1731 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1669 "View in source") [Ⓣ][1]
Creates a new function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`.
@@ -241,13 +229,10 @@ func();
-
-
-
### `_.bindAll(object [, methodName1, methodName2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1794 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1740 "View in source") [Ⓣ][1]
Binds methods on the `object` to the object, overwriting the non-bound method. If no method names are provided, all the function properties of the `object` will be bound.
@@ -276,13 +261,10 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
-
-
-
### `_.chain(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3018 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3041 "View in source") [Ⓣ][1]
Wraps the value in a `lodash` chainable object.
@@ -313,13 +295,10 @@ var youngest = _.chain(stooges)
-
-
-
### `_.clone(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2120 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2066 "View in source") [Ⓣ][1]
Create a shallow clone of the `value`. Any nested objects or arrays will be assigned by reference and not cloned.
@@ -340,13 +319,10 @@ _.clone({ 'name': 'moe' });
-
-
-
### `_.compact(array)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1022 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L879 "View in source") [Ⓣ][1]
Produces a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
@@ -367,13 +343,10 @@ _.compact([0, 1, false, 2, '', 3]);
-
-
-
### `_.compose([func1, func2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1826 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1772 "View in source") [Ⓣ][1]
Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing thefunctions `f()`, `g()`, and `h()` produces `f(g(h()))`.
@@ -397,13 +370,10 @@ welcome('moe');
-
-
-
### `_.contains(collection, target)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L551 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L520 "View in source") [Ⓣ][1]
Checks if a given `target` value is present in a `collection` using strict equality for comparisons, i.e. `===`.
@@ -425,13 +395,10 @@ _.contains([1, 2, 3], 3);
-
-
-
### `_.debounce(func, wait, immediate)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1859 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1805 "View in source") [Ⓣ][1]
Creates a new function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call.
@@ -454,13 +421,10 @@ jQuery(window).on('resize', lazyLayout);
-
-
-
### `_.defaults(object [, defaults1, defaults2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2143 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2089 "View in source") [Ⓣ][1]
Assigns missing properties in `object` with default values from the defaults objects. As soon as a property is set, additional defaults of the same property will be ignored.
@@ -483,13 +447,10 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'lots' });
-
-
-
### `_.defer(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1924 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1870 "View in source") [Ⓣ][1]
Defers executing the `func` function until the current call stack has cleared. Additional arguments are passed to `func` when it is invoked.
@@ -511,13 +472,10 @@ _.defer(function() { alert('deferred'); });
-
-
-
### `_.delay(func, wait [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1904 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1850 "View in source") [Ⓣ][1]
Executes the `func` function after `wait` milliseconds. Additional arguments are passed to `func` when it is invoked.
@@ -541,13 +499,10 @@ _.delay(log, 1000, 'logged later');
-
-
-
### `_.difference(array [, array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1051 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L908 "View in source") [Ⓣ][1]
Produces a new array of `array` values not present in the other arrays using strict equality for comparisons, i.e. `===`.
@@ -569,13 +524,10 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
-
-
-
### `_.escape(string)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2714 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2737 "View in source") [Ⓣ][1]
Escapes a string for insertion into HTML, replacing `&`, `<`, `"`, `'`, and `/` characters.
@@ -596,13 +548,10 @@ _.escape('Curly, Larry & Moe');
-
-
-
### `_.every(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L575 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L544 "View in source") [Ⓣ][1]
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -625,13 +574,10 @@ _.every([true, 1, null, 'yes'], Boolean);
-
-
-
### `_.extend(object [, source1, source2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2162 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2108 "View in source") [Ⓣ][1]
Copies enumerable properties from the source objects to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
@@ -653,13 +599,10 @@ _.extend({ 'name': 'moe' }, { 'age': 40 });
-
-
-
### `_.filter(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L596 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L565 "View in source") [Ⓣ][1]
Examines each value in a `collection`, returning an array of all values the `callback` returns truthy for. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -682,13 +625,10 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; })
-
-
-
### `_.find(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L618 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L587 "View in source") [Ⓣ][1]
Examines each value in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable value, and does not iterate over the entire `collection`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -711,13 +651,10 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
-
-
-
### `_.first(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1084 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L941 "View in source") [Ⓣ][1]
Gets the first value of the `array`. Pass `n` to return the first `n` values of the `array`.
@@ -740,13 +677,10 @@ _.first([5, 4, 3, 2, 1]);
-
-
-
### `_.flatten(array, shallow)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1106 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L963 "View in source") [Ⓣ][1]
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
@@ -771,13 +705,10 @@ _.flatten([1, [2], [3, [[4]]]], true);
-
-
-
### `_.forEach(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L644 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L613 "View in source") [Ⓣ][1]
Iterates over a `collection`, executing the `callback` for each value in the `collection`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -803,13 +734,10 @@ _([1, 2, 3]).forEach(function(num) { alert(num); }).join(',');
-
-
-
### `_.functions(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2179 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2125 "View in source") [Ⓣ][1]
Produces a sorted array of the properties, own and inherited, of `object` that have function values.
@@ -832,16 +760,13 @@ _.functions(_);
+### `_.groupBy(array, callback [, thisArg])`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1005 "View in source") [Ⓣ][1]
-
-
-### `_.groupBy(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L673 "View in source") [Ⓣ][1]
-
-Splits a `collection` into sets, grouped by the result of running each value through `callback`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. The `callback` argument may also be the name of a property to group by.
+Splits a `collection` into sets, grouped by the result of running each value through `callback`. The `callback` is invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to group by.
#### Arguments
-1. `collection` *(Array|Object)*: The collection to iterate over.
+1. `array` *(Array)*: The array to iterate over.
2. `callback` *(Function|String)*: The function called per iteration or property name to group by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
@@ -865,13 +790,10 @@ _.groupBy(['one', 'two', 'three'], 'length');
-
-
-
### `_.has(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2202 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2148 "View in source") [Ⓣ][1]
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
@@ -893,15 +815,12 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
-
-
-
### `_.identity(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2741 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2764 "View in source") [Ⓣ][1]
-This function simply returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
+This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
#### Arguments
1. `value` *(Mixed)*: Any value.
@@ -921,13 +840,10 @@ moe === _.identity(moe);
-
-
-
### `_.indexOf(array, value [, isSorted=false])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1143 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1090 "View in source") [Ⓣ][1]
Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster binary search.
@@ -950,13 +866,10 @@ _.indexOf([1, 2, 3], 2);
-
-
-
### `_.initial(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1177 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1124 "View in source") [Ⓣ][1]
Gets all but the last value of the `array`. Pass `n` to exclude the last `n` values from the result.
@@ -979,13 +892,10 @@ _.initial([5, 4, 3, 2, 1]);
-
-
-
### `_.intersection([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1196 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1142 "View in source") [Ⓣ][1]
Computes the intersection of all the passed-in arrays.
@@ -1006,13 +916,10 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
-
-
-
### `_.invoke(array, methodName [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1229 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1175 "View in source") [Ⓣ][1]
Calls the method named by `methodName` for each value of the `collection`. Additional arguments will be passed to each invoked method.
@@ -1035,13 +942,10 @@ _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
-
-
-
### `_.isArguments(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2222 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2168 "View in source") [Ⓣ][1]
Checks if a `value` is an `arguments` object.
@@ -1065,13 +969,10 @@ _.isArguments([1, 2, 3]);
-
-
-
### `_.isArray(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L327 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2194 "View in source") [Ⓣ][1]
Checks if a `value` is an array.
@@ -1095,13 +996,10 @@ _.isArray([1, 2, 3]);
-
-
-
### `_.isBoolean(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2245 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2211 "View in source") [Ⓣ][1]
Checks if a `value` is a boolean *(`true` or `false`)* value.
@@ -1122,13 +1020,10 @@ _.isBoolean(null);
-
-
-
### `_.isDate(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2262 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2228 "View in source") [Ⓣ][1]
Checks if a `value` is a date.
@@ -1149,13 +1044,10 @@ _.isDate(new Date);
-
-
-
### `_.isElement(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2279 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2245 "View in source") [Ⓣ][1]
Checks if a `value` is a DOM element.
@@ -1176,18 +1068,15 @@ _.isElement(document.body);
-
-
-
### `_.isEmpty(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L348 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2266 "View in source") [Ⓣ][1]
Checks if a `value` is empty. Arrays or strings with a length of `0` and objects with no enumerable own properties are considered "empty".
#### Arguments
-1. `value` *(Mixed)*: The value to check.
+1. `value` *(Array|Object|String)*: The value to inspect.
#### Returns
*(Boolean)*: Returns `true` if the `value` is empty, else `false`.
@@ -1206,13 +1095,10 @@ _.isEmpty({});
-
-
-
### `_.isEqual(a, b [, stack])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2306 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2300 "View in source") [Ⓣ][1]
Performs a deep comparison between two values to determine if they are equivalent to each other.
@@ -1241,13 +1127,10 @@ _.isEqual(moe, clone);
-
-
-
### `_.isFinite(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2458 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2452 "View in source") [Ⓣ][1]
Checks if a `value` is a finite number.
@@ -1274,13 +1157,10 @@ _.isFinite(Infinity);
-
-
-
### `_.isFunction(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2475 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2469 "View in source") [Ⓣ][1]
Checks if a `value` is a function.
@@ -1301,13 +1181,10 @@ _.isFunction(''.concat);
-
-
-
### `_.isNaN(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2526 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2520 "View in source") [Ⓣ][1]
Checks if a `value` is `NaN`. Note: this is not the same as native `isNaN`, which will return true for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
@@ -1337,13 +1214,10 @@ _.isNaN(undefined);
-
-
-
### `_.isNull(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2548 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2542 "View in source") [Ⓣ][1]
Checks if a `value` is `null`.
@@ -1367,13 +1241,10 @@ _.isNull(undefined);
-
-
-
### `_.isNumber(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2565 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2559 "View in source") [Ⓣ][1]
Checks if a `value` is a number.
@@ -1394,13 +1265,10 @@ _.isNumber(8.4 * 5;
-
-
-
### `_.isObject(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2496 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2490 "View in source") [Ⓣ][1]
Checks if a `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)*`, and `new String('')`)
@@ -1424,13 +1292,10 @@ _.isObject(1);
-
-
-
### `_.isRegExp(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2582 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2576 "View in source") [Ⓣ][1]
Checks if a `value` is a regular expression.
@@ -1451,13 +1316,10 @@ _.isRegExp(/moe/);
-
-
-
### `_.isString(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2599 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2593 "View in source") [Ⓣ][1]
Checks if a `value` is a string.
@@ -1478,13 +1340,10 @@ _.isString('moe');
-
-
-
### `_.isUndefined(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2616 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2610 "View in source") [Ⓣ][1]
Checks if a `value` is `undefined`.
@@ -1505,13 +1364,10 @@ _.isUndefined(void 0);
-
-
-
### `_.keys(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2633 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2627 "View in source") [Ⓣ][1]
Produces an array of the `object`'s enumerable own property names.
@@ -1532,13 +1388,10 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
-
-
-
### `_.last(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1259 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1205 "View in source") [Ⓣ][1]
Gets the last value of the `array`. Pass `n` to return the lasy `n` values of the `array`.
@@ -1561,13 +1414,10 @@ _.last([5, 4, 3, 2, 1]);
-
-
-
### `_.lastIndexOf(array, value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1279 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1225 "View in source") [Ⓣ][1]
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`.
@@ -1589,13 +1439,10 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
-
-
-
### `_.map(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L707 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L639 "View in source") [Ⓣ][1]
Produces a new array of values by mapping each value in the `collection` through a transformation `callback`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -1621,13 +1468,10 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
-
-
-
### `_.max(array [, callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1316 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1262 "View in source") [Ⓣ][1]
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is invoked with `3` arguments; *(value, index, array)*.
@@ -1656,13 +1500,10 @@ _.max(stooges, function(stooge) { return stooge.age; });
-
-
-
### `_.memoize(func [, resolver])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1947 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1893 "View in source") [Ⓣ][1]
Creates a new function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key.
@@ -1685,13 +1526,10 @@ var fibonacci = _.memoize(function(n) {
-
-
-
### `_.min(array [, callback, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1366 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1308 "View in source") [Ⓣ][1]
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is invoked with `3` arguments; *(value, index, array)*.
@@ -1714,13 +1552,10 @@ _.min([10, 5, 100, 2, 1000]);
-
-
-
### `_.mixin(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2767 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2790 "View in source") [Ⓣ][1]
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
@@ -1747,13 +1582,10 @@ _('larry').capitalize();
-
-
-
### `_.noConflict()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2798 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2821 "View in source") [Ⓣ][1]
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
@@ -1770,13 +1602,10 @@ var lodash = _.noConflict();
-
-
-
### `_.once(func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1973 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1919 "View in source") [Ⓣ][1]
Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call.
@@ -1799,13 +1628,10 @@ initialize();
-
-
-
### `_.partial(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2006 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1952 "View in source") [Ⓣ][1]
Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the partially applied function. This method is similar `bind`, except it does **not** alter the `this` binding.
@@ -1829,13 +1655,10 @@ hi('moe');
-
-
-
### `_.pick(object [, prop1, prop2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2655 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2649 "View in source") [Ⓣ][1]
Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names.
@@ -1857,13 +1680,10 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
-
-
-
### `_.pluck(collection, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L729 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L661 "View in source") [Ⓣ][1]
Retrieves the value of a specified property from all values in a `collection`.
@@ -1891,13 +1711,10 @@ _.pluck(stooges, 'name');
-
-
-
### `_.range([start=0], end [, step=1])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1424 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1365 "View in source") [Ⓣ][1]
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
@@ -1932,13 +1749,10 @@ _.range(0);
-
-
-
### `_.reduce(collection, callback [, accumulator, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L759 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L691 "View in source") [Ⓣ][1]
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*.
@@ -1962,13 +1776,10 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
-
-
-
### `_.reduceRight(collection, callback [, accumulator, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L799 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L731 "View in source") [Ⓣ][1]
The right-associative version of `_.reduce`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*.
@@ -1993,13 +1804,10 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
-
-
-
### `_.reject(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L852 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L784 "View in source") [Ⓣ][1]
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -2022,13 +1830,10 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
-
-
-
### `_.rest(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1460 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1401 "View in source") [Ⓣ][1]
The opposite of `_.initial`, this method gets all but the first value of the `array`. Pass `n` to exclude the first `n` values from the result.
@@ -2051,13 +1856,10 @@ _.rest([5, 4, 3, 2, 1]);
-
-
-
### `_.result(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2828 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2851 "View in source") [Ⓣ][1]
Resolves the value of `property` on `object`. If the property is a function it will be invoked and its result returned, else the property value is returned.
@@ -2089,13 +1891,10 @@ _.result(object, 'stuff');
-
-
-
### `_.shuffle(array)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1478 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1419 "View in source") [Ⓣ][1]
Produces a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
@@ -2118,19 +1917,16 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
+### `_.size(value)`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2688 "View in source") [Ⓣ][1]
-
-
-### `_.size(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L875 "View in source") [Ⓣ][1]
-
-Gets the number of values in the `collection` or the `length` of a string value.
+Gets the size of a `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object.
#### Arguments
-1. `collection` *(Array|Object)*: The collection inspect.
+1. `value` *(Array|Object|String)*: The value to inspect.
#### Returns
-*(Number)*: Returns the number of values in the collection.
+*(Number)*: Returns `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object.
#### Example
~~~ js
@@ -2149,13 +1945,10 @@ _.size('curly');
-
-
-
### `_.some(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L951 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L808 "View in source") [Ⓣ][1]
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -2180,16 +1973,13 @@ _.some([null, 0, 'yes', false]);
-
-
-
-### `_.sortBy(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L905 "View in source") [Ⓣ][1]
+### `_.sortBy(array, callback [, thisArg])`
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1047 "View in source") [Ⓣ][1]
Produces a new sorted array, ranked in ascending order by the results of running each value of a `collection` through `callback`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
#### Arguments
-1. `collection` *(Array|Object)*: The collection to iterate over.
+1. `array` *(Array)*: The array to iterate over.
2. `callback` *(Function|String)*: The function called per iteration or property name to sort by.
3. `[thisArg]` *(Mixed)*: The `this` binding for the callback.
@@ -2210,13 +2000,10 @@ _.sortBy([1, 2, 3, 4, 5, 6], function(num) { return this.sin(num); }, Math);
-
-
-
### `_.sortedIndex(array, value [, callback])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1512 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1453 "View in source") [Ⓣ][1]
Uses a binary search to determine the smallest index at which the `value` should be inserted into the `collection` in order to maintain the sort order of the `collection`. If `callback` is passed, it will be executed for each value in the `collection` to compute their sort ranking. The `callback` is invoked with `1` argument; *(value)*.
@@ -2239,13 +2026,10 @@ _.sortedIndex([10, 20, 30, 40, 50], 35);
-
-
-
### `_.tap(value, interceptor)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2693 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2716 "View in source") [Ⓣ][1]
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The primary purpose of this method is to "tap into" a method chain, in order to performoperations on intermediate results within the chain.
@@ -2272,13 +2056,10 @@ _.chain([1,2,3,200])
-
-
-
### `_.template(text, data, options)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2888 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2911 "View in source") [Ⓣ][1]
A JavaScript micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code.
@@ -2335,13 +2116,10 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' });
-
-
-
### `_.throttle(func, wait)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2042 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1988 "View in source") [Ⓣ][1]
Creates a new function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once, `func` will also be called on the trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
@@ -2363,13 +2141,10 @@ jQuery(window).on('scroll', throttled);
-
-
-
### `_.times(n, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2965 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2988 "View in source") [Ⓣ][1]
Executes the `callback` function `n` times. The `callback` is invoked with `1` argument; *(index)*.
@@ -2388,13 +2163,10 @@ _.times(3, function() { genie.grantWish(); });
-
-
-
### `_.toArray(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L970 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L827 "View in source") [Ⓣ][1]
Converts the `collection`, into an array. Useful for converting the `arguments` object.
@@ -2415,13 +2187,10 @@ Converts the `collection`, into an array. Useful for converting the `arguments`
-
-
-
### `_.union([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1545 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1486 "View in source") [Ⓣ][1]
Computes the union of the passed-in arrays.
@@ -2442,13 +2211,10 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
-
-
-
### `_.uniq(array [, isSorted=false, callback])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1580 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1521 "View in source") [Ⓣ][1]
Produces a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each value of `array` is passed through a transformation `callback` before uniqueness is computed. The `callback` is invoked with `3` arguments; *(value, index, array)*.
@@ -2471,13 +2237,10 @@ _.uniq([1, 2, 1, 3, 1, 4]);
-
-
-
### `_.uniqueId([prefix])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2988 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3011 "View in source") [Ⓣ][1]
Generates a unique id. If `prefix` is passed, the id will be appended to it.
@@ -2498,13 +2261,10 @@ _.uniqueId('contact_');
-
-
-
### `_.values(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L998 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L855 "View in source") [Ⓣ][1]
Produces an array of enumerable own property values of the `collection`.
@@ -2525,13 +2285,10 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
-
-
-
### `_.without(array [, value1, value2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1618 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1]
Produces a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
@@ -2553,13 +2310,10 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
-
-
-
### `_.wrap(func, wrapper [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2094 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2040 "View in source") [Ⓣ][1]
Create a new function that passes the `func` function to the `wrapper` function as its first argument. Additional arguments are appended to those passed to the `wrapper` function.
@@ -2586,13 +2340,10 @@ hello();
-
-
-
### `_.zip([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1648 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1586 "View in source") [Ⓣ][1]
Merges together the values of each of the arrays with the value at the corresponding position. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion.
@@ -2620,13 +2371,10 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
## `_.prototype`
-
-
-
### `_.prototype.chain()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3036 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3059 "View in source") [Ⓣ][1]
Extracts the value from a wrapped chainable object.
@@ -2644,13 +2392,10 @@ _([1, 2, 3]).value();
-
-
-
### `_.prototype.value()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3053 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3076 "View in source") [Ⓣ][1]
Extracts the value from a wrapped chainable object.
@@ -2675,13 +2420,10 @@ _([1, 2, 3]).value();
## `_.templateSettings`
-
-
-
### `_.templateSettings`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3076 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L143 "View in source") [Ⓣ][1]
*(Object)*: By default, Lo-Dash uses ERB-style template delimiters, change the following template settings to use alternative delimiters.
@@ -2690,13 +2432,10 @@ _([1, 2, 3]).value();
-
-
-
### `_.templateSettings.escape`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3085 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L152 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to be HTML-escaped.
@@ -2705,13 +2444,10 @@ _([1, 2, 3]).value();
-
-
-
### `_.templateSettings.evaluate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3094 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L161 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect code to be evaluated.
@@ -2720,13 +2456,10 @@ _([1, 2, 3]).value();
-
-
-
### `_.templateSettings.interpolate`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3103 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L170 "View in source") [Ⓣ][1]
*(RegExp)*: Used to detect `data` property values to inject.
@@ -2735,13 +2468,10 @@ _([1, 2, 3]).value();
-
-
-
### `_.templateSettings.variable`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3112 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L179 "View in source") [Ⓣ][1]
*(String)*: Used to reference the data object in the template text.
diff --git a/doc/parse.php b/doc/parse.php
index aa87779dc0..48e5a55dde 100644
--- a/doc/parse.php
+++ b/doc/parse.php
@@ -21,7 +21,7 @@
// generate Markdown
$markdown = docdown(array(
'path' => '../' . $file,
- 'title' => 'Lo-Dash v0.2.0',
+ 'title' => 'Lo-Dash v0.2.1',
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
));
diff --git a/lodash.js b/lodash.js
index ca8747d4ce..cc73224bd0 100644
--- a/lodash.js
+++ b/lodash.js
@@ -1,5 +1,5 @@
/*!
- * Lo-Dash v0.2.0
+ * Lo-Dash v0.2.1
* Copyright 2012 John-David Dalton
* Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
*
@@ -12,30 +12,6 @@
var freeExports = typeof exports == 'object' && exports &&
(typeof global == 'object' && global && global == global.global && (window = global), exports);
- /**
- * Used to detect the JavaScript engine's argument length limit.
- *
- * The initial value of `argsLimit` is low enough not to cause uncatchable
- * errors in Java and avoid locking up older browsers like Safari 3.
- *
- * Some engines have a limit on the number of arguments functions can accept
- * before clipping the argument length or throwing an error.
- * https://bugs.webkit.org/show_bug.cgi?id=80797
- *
- * For example Firefox's limits have been observed to be at least:
- * Firefox 2 - 35,535
- * Firefox 3.6 - 16,777,215
- * Firefox 4-7 - 523,264
- * Firefox >= 8 - Throws error
- */
- var argsLimit = 5e4;
-
- try {
- (function() {
- argsLimit = arguments.length;
- }).apply(null, Array(argsLimit));
- } catch(e) { }
-
/** Used to escape characters in templates */
var escapes = {
'\\': '\\',
@@ -70,15 +46,6 @@
/** Used to restore the original `_` reference in `noConflict` */
var oldDash = window._;
- /** Used to match the "escape" template delimiters */
- var reEscapeDelimiter = /<%-([\s\S]+?)%>/g;
-
- /** Used to match the "evaluate" template delimiters */
- var reEvaluateDelimiter = /<%([\s\S]+?)%>/g;
-
- /** Used to match the "interpolate" template delimiters */
- var reInterpolateDelimiter = /<%=([\s\S]+?)%>/g;
-
/** Used to detect if a method is native */
var reNative = RegExp('^' + ({}.valueOf + '')
.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&')
@@ -137,6 +104,83 @@
/*--------------------------------------------------------------------------*/
+ /**
+ * The `lodash` function.
+ *
+ * @name _
+ * @constructor
+ * @param {Mixed} value The value to wrap in a `LoDash` instance.
+ * @returns {Object} Returns a `LoDash` instance.
+ */
+ function lodash(value) {
+ // allow invoking `lodash` without the `new` operator
+ return new LoDash(value);
+ }
+
+ /**
+ * Creates a `LoDash` instance that wraps a value to allow chaining.
+ *
+ * @private
+ * @constructor
+ * @param {Mixed} value The value to wrap.
+ */
+ function LoDash(value) {
+ // exit early if already wrapped
+ if (value && value._wrapped) {
+ return value;
+ }
+ this._wrapped = value;
+ }
+
+ /**
+ * By default, Lo-Dash uses ERB-style template delimiters, change the
+ * following template settings to use alternative delimiters.
+ *
+ * @static
+ * @memberOf _
+ * @type Object
+ */
+ lodash.templateSettings = {
+
+ /**
+ * Used to detect `data` property values to be HTML-escaped.
+ *
+ * @static
+ * @memberOf _.templateSettings
+ * @type RegExp
+ */
+ 'escape': /<%-([\s\S]+?)%>/g,
+
+ /**
+ * Used to detect code to be evaluated.
+ *
+ * @static
+ * @memberOf _.templateSettings
+ * @type RegExp
+ */
+ 'evaluate': /<%([\s\S]+?)%>/g,
+
+ /**
+ * Used to detect `data` property values to inject.
+ *
+ * @static
+ * @memberOf _.templateSettings
+ * @type RegExp
+ */
+ 'interpolate': /<%=([\s\S]+?)%>/g,
+
+ /**
+ * Used to reference the data object in the template text.
+ *
+ * @static
+ * @memberOf _.templateSettings
+ * @type String
+ */
+ 'variable': 'object'
+ };
+
+ /*--------------------------------------------------------------------------*/
+
/**
* The template used to create iterator functions.
*
@@ -213,11 +257,7 @@
'<%= bottom %>;\n' +
// finally, return the `result`
'return result'
-
- , null, {
- 'evaluate': reEvaluateDelimiter,
- 'interpolate': reInterpolateDelimiter
- });
+ );
/**
* Reusable iterator options shared by
@@ -278,86 +318,6 @@
/*--------------------------------------------------------------------------*/
- /**
- * The `lodash` function.
- *
- * @name _
- * @constructor
- * @param {Mixed} value The value to wrap in a `LoDash` instance.
- * @returns {Object} Returns a `LoDash` instance.
- */
- function lodash(value) {
- // allow invoking `lodash` without the `new` operator
- return new LoDash(value);
- }
-
- /**
- * Creates a `LoDash` instance that wraps a value to allow chaining.
- *
- * @private
- * @constructor
- * @param {Mixed} value The value to wrap.
- */
- function LoDash(value) {
- // exit early if already wrapped
- if (value && value._wrapped) {
- return value;
- }
- this._wrapped = value;
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Checks if a `value` is an array.
- *
- * @static
- * @memberOf _
- * @category Objects
- * @param {Mixed} value The value to check.
- * @returns {Boolean} Returns `true` if the `value` is an array, else `false`.
- * @example
- *
- * (function() { return _.isArray(arguments); })();
- * // => false
- *
- * _.isArray([1, 2, 3]);
- * // => true
- */
- var isArray = nativeIsArray || function(value) {
- return toString.call(value) == arrayClass;
- };
-
- /**
- * Checks if a `value` is empty. Arrays or strings with a length of `0` and
- * objects with no enumerable own properties are considered "empty".
- *
- * @static
- * @memberOf _
- * @category Objects
- * @param {Mixed} value The value to check.
- * @returns {Boolean} Returns `true` if the `value` is empty, else `false`.
- * @example
- *
- * _.isEmpty([1, 2, 3]);
- * // => false
- *
- * _.isEmpty({});
- * // => true
- */
- var isEmpty = createIterator({
- 'args': 'value',
- 'init': 'true',
- 'top':
- 'var className = toString.call(value);\n' +
- 'if (className == arrayClass || className == stringClass) return !value.length',
- 'inLoop': {
- 'object': 'return false'
- }
- });
-
- /*--------------------------------------------------------------------------*/
-
/**
* Creates compiled iteration functions. The iteration function will be created
* to iterate over only objects if the first argument of `options.args` is
@@ -407,8 +367,8 @@
'exit': '',
'init': '',
'top': '',
- 'arrayBranch': { 'loopExp': '++index < length' },
- 'objectBranch': {}
+ 'arrayBranch': { 'beforeLoop': '', 'loopExp': '++index < length' },
+ 'objectBranch': { 'beforeLoop': '' }
};
while (++index < length) {
@@ -443,7 +403,7 @@
data.useHas = data.useHas !== false;
if (!data.exit) {
- data.exit = 'if (' + firstArg + ' == null) return result';
+ data.exit = 'if (!' + firstArg + ') return result';
}
if (firstArg == 'object' || !arrayBranch.inLoop) {
data.arrayBranch = null;
@@ -453,14 +413,14 @@
}
// create the function factory
var factory = Function(
- 'arrayClass, bind, concat, funcClass, hasOwnProperty, identity, indexOf, ' +
- 'isArray, isEmpty, objectTypes, slice, stringClass, toString, undefined',
+ 'arrayClass, bind, funcClass, hasOwnProperty, identity, objectTypes, ' +
+ 'stringClass, toString, undefined',
'"use strict"; return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
);
// return the compiled function
return factory(
- arrayClass, bind, concat, funcClass, hasOwnProperty, identity, indexOf,
- isArray, isEmpty, objectTypes, slice, stringClass, toString
+ arrayClass, bind, funcClass, hasOwnProperty, identity, objectTypes,
+ stringClass, toString
);
}
@@ -488,6 +448,15 @@
return '\\' + escapes[match];
}
+ /**
+ * A no-operation function.
+ *
+ * @private
+ */
+ function noop() {
+ // no operation performed
+ }
+
/**
* Used by `template()` to replace "escape" template delimiters with tokens.
*
@@ -645,43 +614,6 @@
'top': 'if (thisArg) callback = bind(callback, thisArg)'
});
- /**
- * Splits a `collection` into sets, grouped by the result of running each value
- * through `callback`. The `callback` is invoked with 3 arguments; for arrays
- * they are (value, index, array) and for objects they are (value, key, object).
- * The `callback` argument may also be the name of a property to group by.
- *
- * @static
- * @memberOf _
- * @category Collections
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function|String} callback The function called per iteration or
- * property name to group by.
- * @param {Mixed} [thisArg] The `this` binding for the callback.
- * @returns {Object} Returns an object of grouped values.
- * @example
- *
- * _.groupBy([1.3, 2.1, 2.4], function(num) { return Math.floor(num); });
- * // => { '1': [1.3], '2': [2.1, 2.4] }
- *
- * _.groupBy([1.3, 2.1, 2.4], function(num) { return this.floor(num); }, Math);
- * // => { '1': [1.3], '2': [2.1, 2.4] }
- *
- * _.groupBy(['one', 'two', 'three'], 'length');
- * // => { '3': ['one', 'two'], '5': ['three'] }
- */
- var groupBy = createIterator(baseIteratorOptions, {
- 'init': '{}',
- 'top':
- 'var prop, isFunc = toString.call(callback) == funcClass;\n' +
- 'if (isFunc && thisArg) callback = bind(callback, thisArg)',
- 'inLoop':
- 'prop = isFunc\n' +
- ' ? callback(collection[index], index, collection)\n' +
- ' : collection[index][callback];\n' +
- '(result[prop] || (result[prop] = [])).push(collection[index])'
- });
-
/**
* Produces a new array of values by mapping each value in the `collection`
* through a transformation `callback`. The `callback` is bound to the `thisArg`
@@ -853,81 +785,6 @@
'inLoop': '!' + filterIteratorOptions.inLoop
});
- /**
- * Gets the number of values in the `collection` or the `length` of a string value.
- *
- * @static
- * @memberOf _
- * @category Collections
- * @param {Array|Object} collection The collection inspect.
- * @returns {Number} Returns the number of values in the collection.
- * @example
- *
- * _.size([1, 2]);
- * // => 2
- *
- * _.size({ 'one': 1, 'two': 2, 'three': 3 });
- * // => 3
- *
- * _.size('curly');
- * // => 5
- */
- function size(collection) {
- var className = toString.call(collection);
- return className == arrayClass || className == stringClass
- ? collection.length
- : keys(collection).length;
- }
-
- /**
- * Produces a new sorted array, ranked in ascending order by the results of
- * running each value of a `collection` through `callback`. The `callback` is
- * invoked with 3 arguments; for arrays they are (value, index, array) and for
- * objects they are (value, key, object). The `callback` argument may also be
- * the name of a property to sort by (e.g. 'length').
- *
- * @static
- * @memberOf _
- * @category Collections
- * @param {Array|Object} collection The collection to iterate over.
- * @param {Function|String} callback The function called per iteration or
- * property name to sort by.
- * @param {Mixed} [thisArg] The `this` binding for the callback.
- * @returns {Array} Returns a new array of sorted values.
- * @example
- *
- * _.sortBy([1, 2, 3, 4, 5, 6], function(num) { return Math.sin(num); });
- * // => [5, 4, 6, 3, 1, 2]
- *
- * _.sortBy([1, 2, 3, 4, 5, 6], function(num) { return this.sin(num); }, Math);
- * // => [5, 4, 6, 3, 1, 2]
- */
- function sortBy(collection, callback, thisArg) {
- if (toString.call(callback) != funcClass) {
- var prop = callback;
- callback = function(collection) { return collection[prop]; };
- } else if (thisArg) {
- callback = bind(callback, thisArg);
- }
- return pluck(map(collection, function(value, index) {
- return {
- 'criteria': callback(value, index, collection),
- 'value': value
- };
- }).sort(function(left, right) {
- var a = left.criteria,
- b = right.criteria;
-
- if (a === undefined) {
- return 1;
- }
- if (b === undefined) {
- return -1;
- }
- return a < b ? -1 : a > b ? 1 : 0;
- }), 'value');
- }
-
/**
* Checks if the `callback` returns a truthy value for **any** element of a
* `collection`. The function returns as soon as it finds passing value, and
@@ -1104,9 +961,6 @@
* // => [1, 2, 3, [[4]]];
*/
function flatten(array, shallow) {
- if (shallow) {
- return concat.apply(ArrayProto, array);
- }
var value,
index = -1,
length = array.length,
@@ -1115,7 +969,7 @@
while (++index < length) {
value = array[index];
if (isArray(value)) {
- push.apply(result, flatten(value));
+ push.apply(result, shallow ? value : flatten(value));
} else {
result.push(value);
}
@@ -1123,6 +977,99 @@
return result;
}
+ /**
+ * Splits a `collection` into sets, grouped by the result of running each value
+ * through `callback`. The `callback` is invoked with 3 arguments;
+ * (value, index, array). The `callback` argument may also be the name of a
+ * property to group by.
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {Array} array The array to iterate over.
+ * @param {Function|String} callback The function called per iteration or
+ * property name to group by.
+ * @param {Mixed} [thisArg] The `this` binding for the callback.
+ * @returns {Object} Returns an object of grouped values.
+ * @example
+ *
+ * _.groupBy([1.3, 2.1, 2.4], function(num) { return Math.floor(num); });
+ * // => { '1': [1.3], '2': [2.1, 2.4] }
+ *
+ * _.groupBy([1.3, 2.1, 2.4], function(num) { return this.floor(num); }, Math);
+ * // => { '1': [1.3], '2': [2.1, 2.4] }
+ *
+ * _.groupBy(['one', 'two', 'three'], 'length');
+ * // => { '3': ['one', 'two'], '5': ['three'] }
+ */
+ function groupBy(array, callback, thisArg) {
+ var prop,
+ value,
+ index = -1,
+ isFunc = toString.call(callback) == funcClass,
+ length = array.length,
+ result = {};
+
+ if (isFunc && thisArg) {
+ callback = bind(callback, thisArg);
+ }
+ while (++index < length) {
+ value = array[index];
+ prop = isFunc ? callback(value, index, array) : value[callback];
+ (hasOwnProperty.call(result, prop) ? result[prop] : result[prop] = []).push(value);
+ }
+ return result
+ }
+
+ /**
+ * Produces a new sorted array, ranked in ascending order by the results of
+ * running each value of a `collection` through `callback`. The `callback` is
+ * invoked with 3 arguments; for arrays they are (value, index, array) and for
+ * objects they are (value, key, object). The `callback` argument may also be
+ * the name of a property to sort by (e.g. 'length').
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {Array} array The array to iterate over.
+ * @param {Function|String} callback The function called per iteration or
+ * property name to sort by.
+ * @param {Mixed} [thisArg] The `this` binding for the callback.
+ * @returns {Array} Returns a new array of sorted values.
+ * @example
+ *
+ * _.sortBy([1, 2, 3, 4, 5, 6], function(num) { return Math.sin(num); });
+ * // => [5, 4, 6, 3, 1, 2]
+ *
+ * _.sortBy([1, 2, 3, 4, 5, 6], function(num) { return this.sin(num); }, Math);
+ * // => [5, 4, 6, 3, 1, 2]
+ */
+ function sortBy(array, callback, thisArg) {
+ if (toString.call(callback) != funcClass) {
+ var prop = callback;
+ callback = function(array) { return array[prop]; };
+ } else if (thisArg) {
+ callback = bind(callback, thisArg);
+ }
+ return pluck(map(array, function(value, index) {
+ return {
+ 'criteria': callback(value, index, array),
+ 'value': value
+ };
+ }).sort(function(left, right) {
+ var a = left.criteria,
+ b = right.criteria;
+
+ if (a === undefined) {
+ return 1;
+ }
+ if (b === undefined) {
+ return -1;
+ }
+ return a < b ? -1 : a > b ? 1 : 0;
+ }), 'value');
+ }
+
/**
* Gets the index at which the first occurrence of `value` is found using
* strict equality for comparisons, i.e. `===`. If the `array` is already
@@ -1183,7 +1130,6 @@
*
* @static
* @memberOf _
- * @alias intersect
* @category Arrays
* @param {Array} [array1, array2, ...] Arrays to process.
* @returns {Array} Returns a new array of unique values, in order, that are
@@ -1321,22 +1267,18 @@
result = computed;
if (!callback) {
- // fast path for arrays of numbers
- if (array[0] === +array[0] && length <= argsLimit) {
- // some JavaScript engines have a limit on the number of arguments functions
- // can accept before clipping the argument length or throwing an error
- try {
- return Math.max.apply(Math, array);
- } catch(e) { }
- }
- if (!array.length) {
- return result;
+ while (++index < length) {
+ if (array[index] > result) {
+ result = array[index];
+ }
}
- } else if (thisArg) {
+ return result;
+ }
+ if (thisArg) {
callback = bind(callback, thisArg);
}
while (++index < length) {
- current = callback ? callback(array[index], index, array) : array[index];
+ current = callback(array[index], index, array);
if (current > computed) {
computed = current;
result = array[index];
@@ -1371,19 +1313,18 @@
result = computed;
if (!callback) {
- if (array[0] === +array[0] && length <= argsLimit) {
- try {
- return Math.min.apply(Math, array);
- } catch(e) { }
- }
- if (!array.length) {
- return result;
+ while (++index < length) {
+ if (array[index] < result) {
+ result = array[index];
+ }
}
- } else if (thisArg) {
+ return result;
+ }
+ if (thisArg) {
callback = bind(callback, thisArg);
}
while (++index < length) {
- current = callback ? callback(array[index], index, array) : array[index];
+ current = callback(array[index], index, array);
if (current < computed) {
computed = current;
result = array[index];
@@ -1584,9 +1525,6 @@
result = [],
seen = [];
- if (length < 3) {
- isSorted = true;
- }
while (++index < length) {
computed = callback ? callback(array[index]) : array[index];
if (isSorted
@@ -1739,33 +1677,41 @@
}
// use if `Function#bind` is faster
else if (nativeBind) {
- func = nativeBind.call.apply(nativeBind, arguments);
- return function() {
- return arguments.length ? func.apply(undefined, arguments) : func();
- };
+ return nativeBind.call.apply(nativeBind, arguments);
}
- var partialArgs = slice.call(arguments, 2),
- partialArgsLength = partialArgs.length;
+ var partialArgs = slice.call(arguments, 2);
- return function() {
- var result,
- args = arguments;
+ function bound() {
+ // `Function#bind` spec
+ // http://es5.github.com/#x15.3.4.5
+ var args = arguments,
+ thisBinding = thisArg;
if (!isFunc) {
func = thisArg[methodName];
}
- if (partialArgsLength) {
- if (args.length) {
- partialArgs.length = partialArgsLength;
- push.apply(partialArgs, args);
- }
- args = partialArgs;
+ if (partialArgs.length) {
+ args = args.length
+ ? concat.apply(partialArgs, args)
+ : partialArgs;
}
- result = args.length ? func.apply(thisArg, args) : func.call(thisArg);
- partialArgs.length = partialArgsLength;
- return result;
- };
+ if (this instanceof bound) {
+ // get `func` instance if `bound` is invoked in a `new` expression
+ noop.prototype = func.prototype;
+ thisBinding = new noop;
+
+ // mimic the constructor's `return` behavior
+ // http://es5.github.com/#x13.2.2
+ var result = func.apply(thisBinding, args);
+ return objectTypes[typeof result] && result !== null
+ ? result
+ : thisBinding
+ }
+ return func.apply(thisBinding, args);
+ }
+
+ return bound;
}
/**
@@ -2229,6 +2175,26 @@
};
}
+ /**
+ * Checks if a `value` is an array.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {Mixed} value The value to check.
+ * @returns {Boolean} Returns `true` if the `value` is an array, else `false`.
+ * @example
+ *
+ * (function() { return _.isArray(arguments); })();
+ * // => false
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ */
+ var isArray = nativeIsArray || function(value) {
+ return toString.call(value) == arrayClass;
+ };
+
/**
* Checks if a `value` is a boolean (`true` or `false`) value.
*
@@ -2280,6 +2246,34 @@
return !!(value && value.nodeType == 1);
}
+ /**
+ * Checks if a `value` is empty. Arrays or strings with a length of `0` and
+ * objects with no enumerable own properties are considered "empty".
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {Array|Object|String} value The value to inspect.
+ * @returns {Boolean} Returns `true` if the `value` is empty, else `false`.
+ * @example
+ *
+ * _.isEmpty([1, 2, 3]);
+ * // => false
+ *
+ * _.isEmpty({});
+ * // => true
+ */
+ var isEmpty = createIterator({
+ 'args': 'value',
+ 'init': 'true',
+ 'top':
+ 'var className = toString.call(value);\n' +
+ 'if (className == arrayClass || className == stringClass) return !value.length',
+ 'inLoop': {
+ 'object': 'return false'
+ }
+ });
+
/**
* Performs a deep comparison between two values to determine if they are
* equivalent to each other.
@@ -2669,6 +2663,35 @@
return result;
}
+ /**
+ * Gets the size of a `value` by returning `value.length` if `value` is a
+ * string or array, or the number of own enumerable properties if `value` is
+ * an object.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {Array|Object|String} value The value to inspect.
+ * @returns {Number} Returns `value.length` if `value` is a string or array,
+ * or the number of own enumerable properties if `value` is an object.
+ * @example
+ *
+ * _.size([1, 2]);
+ * // => 2
+ *
+ * _.size({ 'one': 1, 'two': 2, 'three': 3 });
+ * // => 3
+ *
+ * _.size('curly');
+ * // => 5
+ */
+ function size(value) {
+ var className = toString.call(value);
+ return className == arrayClass || className == stringClass
+ ? value.length
+ : keys(value).length;
+ }
+
/**
* Invokes `interceptor` with the `value` as the first argument, and then returns
* `value`. The primary purpose of this method is to "tap into" a method chain,
@@ -2724,7 +2747,7 @@
}
/**
- * This function simply returns the first argument passed to it.
+ * This function returns the first argument passed to it.
* Note: It is used throughout Lo-Dash as a default callback.
*
* @static
@@ -2889,7 +2912,7 @@
options || (options = {});
var result,
- defaults = lodash.templateSettings || {},
+ defaults = lodash.templateSettings,
escapeDelimiter = options.escape,
evaluateDelimiter = options.evaluate,
interpolateDelimiter = options.interpolate,
@@ -2926,7 +2949,7 @@
// if `options.variable` is not specified, add `data` to the top of the scope chain
if (!variable) {
- variable = defaults.variable || 'object';
+ variable = defaults.variable;
text = 'with (' + variable + ' || {}) {\n' + text + '\n}\n';
}
@@ -3063,54 +3086,7 @@
* @memberOf _
* @type String
*/
- lodash.VERSION = '0.2.0';
-
- /**
- * By default, Lo-Dash uses ERB-style template delimiters, change the
- * following template settings to use alternative delimiters.
- *
- * @static
- * @memberOf _
- * @type Object
- */
- lodash.templateSettings = {
-
- /**
- * Used to detect `data` property values to be HTML-escaped.
- *
- * @static
- * @memberOf _.templateSettings
- * @type RegExp
- */
- 'escape': reEscapeDelimiter,
-
- /**
- * Used to detect code to be evaluated.
- *
- * @static
- * @memberOf _.templateSettings
- * @type RegExp
- */
- 'evaluate': reEvaluateDelimiter,
-
- /**
- * Used to detect `data` property values to inject.
- *
- * @static
- * @memberOf _.templateSettings
- * @type RegExp
- */
- 'interpolate': reInterpolateDelimiter,
-
- /**
- * Used to reference the data object in the template text.
- *
- * @static
- * @memberOf _.templateSettings
- * @type String
- */
- 'variable': 'object'
- };
+ lodash.VERSION = '0.2.1';
// assign static methods
lodash.after = after;
@@ -3206,7 +3182,6 @@
lodash.head = first;
lodash.include = contains;
lodash.inject = reduce;
- lodash.intersect = intersection;
lodash.methods = functions;
lodash.select = filter;
lodash.tail = rest;
@@ -3275,7 +3250,22 @@
/*--------------------------------------------------------------------------*/
// expose Lo-Dash
- if (freeExports) {
+ // some AMD build optimizers, like r.js, check for specific condition patterns like the following:
+ if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+ // Expose Lo-Dash to the global object even when an AMD loader is present in
+ // case Lo-Dash was injected by a third-party script and not intended to be
+ // loaded as a module. The global assignment can be reverted in the Lo-Dash
+ // module via its `noConflict()` method.
+ window._ = lodash;
+
+ // define as an anonymous module so, through path mapping, it can be
+ // referenced as the "underscore" module
+ define(function() {
+ return lodash;
+ });
+ }
+ // check for `exports` after `define` in case a build optimizer adds an `exports` object
+ else if (freeExports) {
// in Node.js or RingoJS v0.8.0+
if (typeof module == 'object' && module && module.exports == freeExports) {
(module.exports = lodash)._ = lodash;
@@ -3285,21 +3275,8 @@
freeExports._ = lodash;
}
}
- // in a browser or Rhino
else {
- // Expose Lo-Dash to the global object even when an AMD loader is present in
- // case Lo-Dash was injected by a third-party script and not intended to be
- // loaded as a module. The global assignment can be reverted in the Lo-Dash
- // module via its `noConflict()` method.
+ // in a browser or Rhino
window._ = lodash;
-
- // some AMD build optimizers, like r.js, check for specific condition patterns like the following:
- if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
- // define as an anonymous module so, through path mapping, it can be
- // referenced as the "underscore" module
- define(function() {
- return lodash;
- });
- }
}
}(this));
diff --git a/lodash.min.js b/lodash.min.js
index d7fcf19f10..22754424b9 100644
--- a/lodash.min.js
+++ b/lodash.min.js
@@ -1,30 +1,30 @@
/*!
- Lo-Dash 0.2.0 lodash.com/license
+ Lo-Dash 0.2.1 lodash.com/license
Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE
*/
-;(function(u,m){"use strict";function R(a){return"[object Arguments]"==h.call(a)}function c(a){return new p(a)}function p(a){if(a&&a._wrapped)return a;this._wrapped=a}function j(){for(var a,b,d,k=-1,c=arguments.length,f={e:"",f:"",k:"",q:"",c:{m:"++oarguments.length;c&&(b=v(b,c));if(e===+e){for(e&&f&&(d=a[--e]);e--;)d=b(d,a[e],e,a);return d}var g=U(a);for((e=g.length)&&f&&(d=a[g[--e]]);e--;)f=g[e],d=b(d,a[f],f,a);return d}function V(a,b,d){return b==m||d?a[0]:l.call(a,0,b)}function fa(a,b){if(b)return D.apply(z,a);for(var d,c=-1,e=a.length,f=[];++cw(f,b)&&W(e,function(a){return-1c&&(c=d,g=a[e]);return g}function ja(a,b,d){return l.call(a,b==m||d?1:b)}function ga
-(a,b,d){var c,e=0,f=a.length;for(d&&(b=d(b));e>1,(d?d(a[c]):a[c])f&&(b=n);++ew(i,c))i.push(c),g.push(a[e]);return g}function v(a,b){var d,c=h.call(a)==s;if(c){if(B)return a=B.call.apply(B,arguments),function(){return arguments.length?a.apply(m,arguments):a()}}else d=b,b=a;var e=l.call(arguments,2),f=e.length;return function(){var g;return g=arguments,c||(a=b[d
-]),f&&(g.length&&(e.length=f,E.apply(e,g)),g=e),g=g.length?a.apply(b,g):a.call(b),e.length=f,g}}function M(a,b,d){d||(d=[]);if(a===b)return 0!==a||1/a==1/b;if(a==m||b==m)return a===b;a.s&&(a=a._wrapped),b.s&&(b=b._wrapped);if(a.isEqual&&h.call(a.isEqual)==s)return a.isEqual(b);if(b.isEqual&&h.call(b.isEqual)==s)return b.isEqual(a);var c=h.call(a);if(c!=h.call(b))return r;switch(c){case K:return a==""+b;case N:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case la:case ma:return+a==+b;case na:return a.source==
-b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return r;for(var e=d.length;e--;)if(d[e]==a)return n;var e=-1,f=n,g=0;d.push(a);if(c==I){if(g=a.length,f=g==b.length)for(;g--&&(f=M(a[g],b[g],d)););}else{if("constructor"in a!="constructor"in b||a.constructor!=b.constructor)return r;for(var i in a)if(t.call(a,i)&&(g++,!(f=t.call(b,i)&&M(a[i],b[i],d))))break;if(f){for(i in b)if(t.call(b,i)&&!(g--))break;f=!g}if(f&&H)for(;7>++
-e&&(i=ba[e],!t.call(a,i)||!!(f=t.call(b,i)&&M(a[i],b[i],d))););}return d.pop(),f}function ca(a){return a}function oa(a){F(O(a),function(b){var d=c[b]=a[b];p.prototype[b]=function(){var a=[this._wrapped];return arguments.length&&E.apply(a,arguments),a=1==a.length?d.call(c,a[0]):d.apply(c,a),this.s&&(a=new p(a),a.s=n),a}})}var n=!0,o=null,r=!1,X="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(u=global),exports),L=5e4;try{(function(){L=arguments.length}).
-apply(o,Array(L))}catch(Ha){}var wa={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},H=!{valueOf:0}.propertyIsEnumerable("valueOf"),Aa=0,S={"boolean":r,"function":n,object:n,number:r,string:r,"undefined":r},Ba=u._,A=RegExp("^"+({}.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),Ca=/__token__(\d+)/g,Da=/['\n\r\t\u2028\u2029\\]/g,ba="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf"
-.split(" "),T="__token__",x=[],I="[object Array]",la="[object Boolean]",ma="[object Date]",s="[object Function]",N="[object Number]",na="[object RegExp]",K="[object String]",z=Array.prototype,y=Object.prototype,D=z.concat,t=y.hasOwnProperty,E=z.push,l=z.slice,h=y.toString,B=A.test(B=l.bind)&&/\n|Opera/.test(B+h.call(u.opera))&&B,C=A.test(C=Array.isArray)&&C,Ea=u.isFinite,Y=A.test(Y=Object.keys)&&Y,Fa=u.clearTimeout,P=u.setTimeout,ta=Function("u","var __p;with(u){__p='var o,z';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var t='+g+'.length;o=-1;';if(o){__p+='if(t===+t){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var A=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(A&&o==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var j='+l+'.constructor;';for(var k=0;k<7;k++){__p+='o=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(j&&j.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return z'}return __p"
-),q={a:"h,f,G",k:"h",q:"if(!f){f=n}else if(G){f=e(f,G)}",j:"f(h[o],o,h)"},Z={k:"I",j:"if(!f(h[o],o,h))return!z"},A={a:"u",k:"u",q:"for(var C,D=1,t=arguments.length;D/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"object"},c.after=
-function(a,b){return 1>a?b():function(){if(1>--a)return b.apply(this,arguments)}},c.bind=v,c.bindAll=function(a){var b=arguments,d=1;1==b.length&&(d=0,b=O(a));for(var c=b.length;dw(e,a[b])&&c.push(a[b]);return c},c.escape=function(a){return(a+"").replace(/&/g,"&").replace(/arguments.length&&(b=a||0,a=0);for(var c=-1,e=Math.max(Math.ceil((b-a)/d),0),f=Array(e);++cc?1:0}),"b")},c.sortedIndex=ga,c.tap=function(a,b)
-{return b(a),a},c.template=function(a,b,d){d||(d={});var k;k=c.templateSettings||{};var e=d.escape,f=d.evaluate,g=d.interpolate,d=d.variable;return e==o&&(e=k.escape),f==o&&(f=k.evaluate),g==o&&(g=k.interpolate),e&&(a=a.replace(e,xa)),g&&(a=a.replace(g,ya)),f&&(a=a.replace(f,za)),a="__p='"+a.replace(Da,va).replace(Ca,ua)+"';\n",x.length=0,d||(d=k.variable||"object",a="with("+d+"||{}){"+a+"}"),a="function("+d+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}"
-,k=Function("_","return "+a)(c),b?k(b):(k.source=a,k)},c.throttle=function(a,b){function d(){i=new Date,g=m,a.apply(f,c)}var c,e,f,g,i=0;return function(){var h=new Date,j=b-(h-i);return c=arguments,f=this,0>=j?(i=h,e=a.apply(f,c)):g||(g=P(d,j)),e}},c.times=function(a,b,d){d&&(b=v(b,d));for(d=0;dw(b,d[a])&&b.push(d[a]);return b},c.uniq=ka,c.uniqueId=function(a){var b=Aa++;return a?a+b:b},c.values=ra,c.without=function(a){for(var b=l.call(arguments,1),d=-1,c=a.length,e=[];++dw(b,a[d])&&e.push(a[d]);return e},c.wrap=function(a,b){return function(){var c=[a];return arguments.length&&E.apply(c,arguments),b.apply(this,c)}},c.zip=function(){for(var a=-1,b=ia(Q(arguments,"length")),c=Array(b);++aarguments.length;j&&(c=v(c,j));if(b===+b){for(b&&e&&(d=a[--b]);b--;)d=c(d,a[b],b,a);return d}var g=T(a);for((b=g.length)&&e&&(d=a[g[--b]]);b--;)e=g[b],d=c(d,a[e],e,a);return d}function U(a,c,d){return c==n||d?a[0]:l.call(a,0,c)}function ga(a,c){for(var d,b=-1,f=a.length,e=[];++bg&&(g=a[f]);return g}for(d&&(c=v(c,d));++fb&&(b=d,g=a[f]);return g}function ja(a,c,d){return l.call(a,c==n||d?1:c)}function ha(a,c,d){var b,f=0,e=a.length;for(d&&(c=d(c));f>1,(d?d(a[b]):a[b])x(h,b))h.push(b),
+g.push(a[f]);return g}function v(a,c){function d(){var g=arguments,h=c;return f||(a=c[b]),e.length&&(g=g.length?L.apply(e,g):e),this instanceof d?(ea.prototype=a.prototype,h=new ea,g=a.apply(h,g),I[typeof g]&&g!==o?g:h):a.apply(h,g)}var b,f=i.call(a)==r;if(f){if(y)return y.call.apply(y,arguments)}else b=c,c=a;var e=l.call(arguments,2);return d}function M(a,c,d){d||(d=[]);if(a===c)return 0!==a||1/a==1/c;if(a==n||c==n)return a===c;a.s&&(a=a._wrapped),c.s&&(c=c._wrapped);if(a.isEqual&&i.call(a.isEqual
+)==r)return a.isEqual(c);if(c.isEqual&&i.call(c.isEqual)==r)return c.isEqual(a);var b=i.call(a);if(b!=i.call(c))return q;switch(b){case J:return a==""+c;case N:return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case la:case ma:return+a==+c;case na:return a.source==c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return q;for(var f=d.length;f--;)if(d[f]==a)return m;var f=-1,e=m,g=0;d.push(a);if(b==H){if(g=a.length,e=g==c.length)for(;g--&&
+(e=M(a[g],c[g],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return q;for(var h in a)if(s.call(a,h)&&(g++,!(e=s.call(c,h)&&M(a[h],c[h],d))))break;if(e){for(h in c)if(s.call(c,h)&&!(g--))break;e=!g}if(e&&G)for(;7>++f&&(h=ca[f],!s.call(a,h)||!!(e=s.call(c,h)&&M(a[h],c[h],d))););}return d.pop(),e}function da(a){return a}function oa(a){B(O(a),function(c){var d=b[c]=a[c];p.prototype[c]=function(){var a=[this._wrapped];return arguments.length&&K.apply(a,arguments),a=1==
+a.length?d.call(b,a[0]):d.apply(b,a),this.s&&(a=new p(a),a.s=m),a}})}var m=!0,o=null,q=!1,W="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(u=global),exports),va={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},G=!{valueOf:0}.propertyIsEnumerable("valueOf"),za=0,I={"boolean":q,"function":m,object:m,number:q,string:q,"undefined":q},Aa=u._,z=RegExp("^"+({}.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g
+,".+?")+"$"),Ba=/__token__(\d+)/g,Ca=/['\n\r\t\u2028\u2029\\]/g,ca="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),S="__token__",w=[],H="[object Array]",la="[object Boolean]",ma="[object Date]",r="[object Function]",N="[object Number]",na="[object RegExp]",J="[object String]",A=Array.prototype,C=Object.prototype,L=A.concat,s=C.hasOwnProperty,K=A.push,l=A.slice,i=C.toString,y=z.test(y=l.bind)&&/\n|Opera/.test(y+i.call(u.opera))&&y,D=z.test
+(D=Array.isArray)&&D,Da=u.isFinite,X=z.test(X=Object.keys)&&X,Ea=u.clearTimeout,P=u.setTimeout;b.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"object"};var sa=Function("n","var __p;with(n){__p='var l,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;l=-1;';if(o){__p+='if(m===+m){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&l==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var g='+l+'.constructor;';for(var k=0;k<7;k++){__p+='l=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(g&&g.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p"
+),t={a:"f,d,x",k:"f",q:"if(!d){d=k}else if(x){d=c(d,x)}",j:"d(f[l],l,f)"},Y={k:"z",j:"if(!d(f[l],l,f))return!r"},Z={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ua?c():function(){if(1>--a)return c.apply(this,arguments)}},b.bind=v,b.bindAll=function(a){var c=arguments,d=1;1==c.length&&(d=0,c=O(a));for(var b=c.length;dx(f,a[c])&&b.push(a[c]);return b},b.escape=function(a){return(a+"").replace(/&/g,"&").replace(/x(e,c)&&$(f,function(a){return-1arguments.length&&(c=a||0,a=0);for(var b=-1,f=Math.max(Math.ceil((c-a)/d),0),e=Array(f);++bd?1:0}),"b")},b.sortedIndex=ha,b.tap=function(a,c){return c(a),a}
+,b.template=function(a,c,d){d||(d={});var j;j=b.templateSettings;var f=d.escape,e=d.evaluate,g=d.interpolate,d=d.variable;return f==o&&(f=j.escape),e==o&&(e=j.evaluate),g==o&&(g=j.interpolate),f&&(a=a.replace(f,wa)),g&&(a=a.replace(g,xa)),e&&(a=a.replace(e,ya)),a="__p='"+a.replace(Ca,ua).replace(Ba,ta)+"';\n",w.length=0,d||(d=j.variable,a="with("+d+"||{}){"+a+"}"),a="function("+d+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}",j=Function("_","return "+
+a)(b),c?j(c):(j.source=a,j)},b.throttle=function(a,c){function b(){h=new Date,g=n,a.apply(e,j)}var j,f,e,g,h=0;return function(){var i=new Date,k=c-(i-h);return j=arguments,e=this,0>=k?(h=i,f=a.apply(e,j)):g||(g=P(b,k)),f}},b.times=function(a,c,b){b&&(c=v(c,b));for(b=0;bx(b,d[a])&&
+b.push(d[a]);return b},b.uniq=ka,b.uniqueId=function(a){var b=za++;return a?a+b:b},b.values=qa,b.without=function(a){for(var b=l.call(arguments,1),d=-1,i=a.length,f=[];++dx(b,a[d])&&f.push(a[d]);return f},b.wrap=function(a,b){return function(){var d=[a];return arguments.length&&K.apply(d,arguments),b.apply(this,d)}},b.zip=function(){for(var a=-1,b=ia(Q(arguments,"length")),d=Array(b);++a
-
+
-
+