Added support for _.merge to accept callback and thisArg arguments. [closes #154]

Former-commit-id: 5d641ae4ba1d120d776a895f8bc9b8c1a7def0b6
This commit is contained in:
John-David Dalton
2013-01-16 01:11:39 -08:00
parent 677503dbf1
commit b60d0cdb17
4 changed files with 152 additions and 99 deletions

View File

@@ -134,7 +134,7 @@
* [`_.isString`](#_isstringvalue)
* [`_.isUndefined`](#_isundefinedvalue)
* [`_.keys`](#_keysobject)
* [`_.merge`](#_mergeobject--source1-source2-)
* [`_.merge`](#_mergeobject--source1-source2--callback-thisarg)
* [`_.methods`](#_functionsobject)
* [`_.omit`](#_omitobject-callback-prop1-prop2--thisarg)
* [`_.pairs`](#_pairsobject)
@@ -196,7 +196,7 @@
<!-- div -->
### <a id="_compactarray"></a>`_.compact(array)`
<a href="#_compactarray">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2790 "View in source") [&#x24C9;][1]
<a href="#_compactarray">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2815 "View in source") [&#x24C9;][1]
Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
@@ -220,7 +220,7 @@ _.compact([0, 1, false, 2, '', 3]);
<!-- div -->
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
<a href="#_differencearray--array1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2820 "View in source") [&#x24C9;][1]
<a href="#_differencearray--array1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2845 "View in source") [&#x24C9;][1]
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
@@ -245,7 +245,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
<!-- div -->
### <a id="_firstarray--callbackn-thisarg"></a>`_.first(array [, callback|n, thisArg])`
<a href="#_firstarray--callbackn-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2864 "View in source") [&#x24C9;][1]
<a href="#_firstarray--callbackn-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2889 "View in source") [&#x24C9;][1]
Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, the first elements the `callback` returns truthy for are returned. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -282,7 +282,7 @@ _.first([1, 2, 3], function(num) {
<!-- div -->
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
<a href="#_flattenarray-shallow">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2903 "View in source") [&#x24C9;][1]
<a href="#_flattenarray-shallow">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2928 "View in source") [&#x24C9;][1]
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
@@ -310,7 +310,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
<!-- div -->
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
<a href="#_indexofarray-value--fromindex0">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2945 "View in source") [&#x24C9;][1]
<a href="#_indexofarray-value--fromindex0">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2970 "View in source") [&#x24C9;][1]
Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search.
@@ -342,7 +342,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
<!-- div -->
### <a id="_initialarray--callbackn1-thisarg"></a>`_.initial(array [, callback|n=1, thisArg])`
<a href="#_initialarray--callbackn1-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2991 "View in source") [&#x24C9;][1]
<a href="#_initialarray--callbackn1-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3016 "View in source") [&#x24C9;][1]
Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, the last elements the `callback` returns truthy for are excluded from the result. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -376,7 +376,7 @@ _.initial([1, 2, 3], function(num) {
<!-- div -->
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
<a href="#_intersectionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3025 "View in source") [&#x24C9;][1]
<a href="#_intersectionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3050 "View in source") [&#x24C9;][1]
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -400,7 +400,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
<!-- div -->
### <a id="_lastarray--callbackn-thisarg"></a>`_.last(array [, callback|n, thisArg])`
<a href="#_lastarray--callbackn-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3087 "View in source") [&#x24C9;][1]
<a href="#_lastarray--callbackn-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3112 "View in source") [&#x24C9;][1]
Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, the last elements the `callback` returns truthy for are returned. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -434,7 +434,7 @@ _.last([1, 2, 3], function(num) {
<!-- div -->
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3128 "View in source") [&#x24C9;][1]
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3153 "View in source") [&#x24C9;][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.
@@ -463,7 +463,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
<!-- div -->
### <a id="_objectkeys--values"></a>`_.object(keys [, values=[]])`
<a href="#_objectkeys--values">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3158 "View in source") [&#x24C9;][1]
<a href="#_objectkeys--values">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3183 "View in source") [&#x24C9;][1]
Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`.
@@ -488,7 +488,7 @@ _.object(['moe', 'larry', 'curly'], [30, 40, 50]);
<!-- div -->
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
<a href="#_rangestart0-end--step1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3203 "View in source") [&#x24C9;][1]
<a href="#_rangestart0-end--step1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3228 "View in source") [&#x24C9;][1]
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
@@ -526,7 +526,7 @@ _.range(0);
<!-- div -->
### <a id="_restarray--callbackn1-thisarg"></a>`_.rest(array [, callback|n=1, thisArg])`
<a href="#_restarray--callbackn1-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3253 "View in source") [&#x24C9;][1]
<a href="#_restarray--callbackn1-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3278 "View in source") [&#x24C9;][1]
The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, the first elements the `callback` returns truthy for are excluded from the result. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -563,7 +563,7 @@ _.rest([1, 2, 3], function(num) {
<!-- div -->
### <a id="_sortedindexarray-value--callbackidentityproperty-thisarg"></a>`_.sortedIndex(array, value [, callback=identity|property, thisArg])`
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3309 "View in source") [&#x24C9;][1]
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3334 "View in source") [&#x24C9;][1]
Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. The `callback` argument may also be the name of a property to order by.
@@ -607,7 +607,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
<!-- div -->
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
<a href="#_unionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3341 "View in source") [&#x24C9;][1]
<a href="#_unionarray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3366 "View in source") [&#x24C9;][1]
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
@@ -631,7 +631,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
<!-- div -->
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3375 "View in source") [&#x24C9;][1]
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3400 "View in source") [&#x24C9;][1]
Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*.
@@ -670,7 +670,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math);
<!-- div -->
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
<a href="#_withoutarray--value1-value2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3434 "View in source") [&#x24C9;][1]
<a href="#_withoutarray--value1-value2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3459 "View in source") [&#x24C9;][1]
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
@@ -695,7 +695,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
<!-- div -->
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
<a href="#_ziparray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3465 "View in source") [&#x24C9;][1]
<a href="#_ziparray1-array2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3490 "View in source") [&#x24C9;][1]
Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion.
@@ -752,7 +752,7 @@ The wrapper functions `first` and `last` return wrapped values when `n` is passe
<!-- div -->
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
<a href="#_tapvalue-interceptor">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4337 "View in source") [&#x24C9;][1]
<a href="#_tapvalue-interceptor">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4362 "View in source") [&#x24C9;][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.
@@ -782,7 +782,7 @@ _([1, 2, 3, 4])
<!-- div -->
### <a id="_prototypetostring"></a>`_.prototype.toString()`
<a href="#_prototypetostring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4354 "View in source") [&#x24C9;][1]
<a href="#_prototypetostring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4379 "View in source") [&#x24C9;][1]
Produces the `toString` result of the wrapped value.
@@ -803,7 +803,7 @@ _([1, 2, 3]).toString();
<!-- div -->
### <a id="_prototypevalueof"></a>`_.prototype.valueOf()`
<a href="#_prototypevalueof">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4371 "View in source") [&#x24C9;][1]
<a href="#_prototypevalueof">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4396 "View in source") [&#x24C9;][1]
Extracts the wrapped value.
@@ -834,7 +834,7 @@ _([1, 2, 3]).valueOf();
<!-- div -->
### <a id="_atcollection--index1-index2-"></a>`_.at(collection [, index1, index2, ...])`
<a href="#_atcollection--index1-index2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1989 "View in source") [&#x24C9;][1]
<a href="#_atcollection--index1-index2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2014 "View in source") [&#x24C9;][1]
Creates an array of elements from the specified index(es), or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes.
@@ -862,7 +862,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2);
<!-- div -->
### <a id="_containscollection-target--fromindex0"></a>`_.contains(collection, target [, fromIndex=0])`
<a href="#_containscollection-target--fromindex0">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2031 "View in source") [&#x24C9;][1]
<a href="#_containscollection-target--fromindex0">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2056 "View in source") [&#x24C9;][1]
Checks if a given `target` element 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.
@@ -900,7 +900,7 @@ _.contains('curly', 'ur');
<!-- div -->
### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2078 "View in source") [&#x24C9;][1]
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2103 "View in source") [&#x24C9;][1]
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
@@ -932,7 +932,7 @@ _.countBy(['one', 'two', 'three'], 'length');
<!-- div -->
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
<a href="#_everycollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2108 "View in source") [&#x24C9;][1]
<a href="#_everycollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2133 "View in source") [&#x24C9;][1]
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -961,7 +961,7 @@ _.every([true, 1, null, 'yes'], Boolean);
<!-- div -->
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2147 "View in source") [&#x24C9;][1]
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2172 "View in source") [&#x24C9;][1]
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -990,7 +990,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; })
<!-- div -->
### <a id="_findcollection--callbackidentity-thisarg"></a>`_.find(collection [, callback=identity, thisArg])`
<a href="#_findcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2191 "View in source") [&#x24C9;][1]
<a href="#_findcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2216 "View in source") [&#x24C9;][1]
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -1019,7 +1019,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
<!-- div -->
### <a id="_foreachcollection--callbackidentity-thisarg"></a>`_.forEach(collection [, callback=identity, thisArg])`
<a href="#_foreachcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2226 "View in source") [&#x24C9;][1]
<a href="#_foreachcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2251 "View in source") [&#x24C9;][1]
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
@@ -1051,7 +1051,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
<!-- div -->
### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2268 "View in source") [&#x24C9;][1]
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2293 "View in source") [&#x24C9;][1]
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to group by *(e.g. 'length')*.
@@ -1083,7 +1083,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
<!-- div -->
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2301 "View in source") [&#x24C9;][1]
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2326 "View in source") [&#x24C9;][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 passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`.
@@ -1112,7 +1112,7 @@ _.invoke([123, 456], String.prototype.split, '');
<!-- div -->
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2335 "View in source") [&#x24C9;][1]
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2360 "View in source") [&#x24C9;][1]
Creates an array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -1144,7 +1144,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
<!-- div -->
### <a id="_maxcollection--callback-thisarg"></a>`_.max(collection [, callback, thisArg])`
<a href="#_maxcollection--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2377 "View in source") [&#x24C9;][1]
<a href="#_maxcollection--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2402 "View in source") [&#x24C9;][1]
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
@@ -1176,7 +1176,7 @@ _.max(stooges, function(stooge) { return stooge.age; });
<!-- div -->
### <a id="_mincollection--callback-thisarg"></a>`_.min(collection [, callback, thisArg])`
<a href="#_mincollection--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2425 "View in source") [&#x24C9;][1]
<a href="#_mincollection--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2450 "View in source") [&#x24C9;][1]
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
@@ -1202,7 +1202,7 @@ _.min([10, 5, 100, 2, 1000]);
<!-- div -->
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
<a href="#_pluckcollection-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2476 "View in source") [&#x24C9;][1]
<a href="#_pluckcollection-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2501 "View in source") [&#x24C9;][1]
Retrieves the value of a specified property from all elements in the `collection`.
@@ -1233,7 +1233,7 @@ _.pluck(stooges, 'name');
<!-- div -->
### <a id="_reducecollection--callbackidentity-accumulator-thisarg"></a>`_.reduce(collection [, callback=identity, accumulator, thisArg])`
<a href="#_reducecollection--callbackidentity-accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2500 "View in source") [&#x24C9;][1]
<a href="#_reducecollection--callbackidentity-accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2525 "View in source") [&#x24C9;][1]
Reduces a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with four arguments; for arrays they are *(accumulator, value, index|key, collection)*.
@@ -1263,7 +1263,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
<!-- div -->
### <a id="_reducerightcollection--callbackidentity-accumulator-thisarg"></a>`_.reduceRight(collection [, callback=identity, accumulator, thisArg])`
<a href="#_reducerightcollection--callbackidentity-accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2542 "View in source") [&#x24C9;][1]
<a href="#_reducerightcollection--callbackidentity-accumulator-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2567 "View in source") [&#x24C9;][1]
The right-associative version of `_.reduce`.
@@ -1294,7 +1294,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
<!-- div -->
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2580 "View in source") [&#x24C9;][1]
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2605 "View in source") [&#x24C9;][1]
The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for.
@@ -1320,7 +1320,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
<!-- div -->
### <a id="_shufflecollection"></a>`_.shuffle(collection)`
<a href="#_shufflecollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2601 "View in source") [&#x24C9;][1]
<a href="#_shufflecollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2626 "View in source") [&#x24C9;][1]
Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
@@ -1344,7 +1344,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
<!-- div -->
### <a id="_sizecollection"></a>`_.size(collection)`
<a href="#_sizecollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2634 "View in source") [&#x24C9;][1]
<a href="#_sizecollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2659 "View in source") [&#x24C9;][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.
@@ -1374,7 +1374,7 @@ _.size('curly');
<!-- div -->
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
<a href="#_somecollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2659 "View in source") [&#x24C9;][1]
<a href="#_somecollection--callbackidentity-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2684 "View in source") [&#x24C9;][1]
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
@@ -1403,7 +1403,7 @@ _.some([null, 0, 'yes', false], Boolean);
<!-- div -->
### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2705 "View in source") [&#x24C9;][1]
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2730 "View in source") [&#x24C9;][1]
Creates an array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
@@ -1435,7 +1435,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length');
<!-- div -->
### <a id="_toarraycollection"></a>`_.toArray(collection)`
<a href="#_toarraycollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2740 "View in source") [&#x24C9;][1]
<a href="#_toarraycollection">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2765 "View in source") [&#x24C9;][1]
Converts the `collection` to an array.
@@ -1459,7 +1459,7 @@ Converts the `collection` to an array.
<!-- div -->
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
<a href="#_wherecollection-properties">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2770 "View in source") [&#x24C9;][1]
<a href="#_wherecollection-properties">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2795 "View in source") [&#x24C9;][1]
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
@@ -1497,7 +1497,7 @@ _.where(stooges, { 'age': 40 });
<!-- div -->
### <a id="_aftern-func"></a>`_.after(n, func)`
<a href="#_aftern-func">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3498 "View in source") [&#x24C9;][1]
<a href="#_aftern-func">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3523 "View in source") [&#x24C9;][1]
Creates a function that is restricted to executing `func` only after it is called `n` times. The `func` is executed with the `this` binding of the created function.
@@ -1525,7 +1525,7 @@ _.forEach(notes, function(note) {
<!-- div -->
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3531 "View in source") [&#x24C9;][1]
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3556 "View in source") [&#x24C9;][1]
Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function.
@@ -1556,7 +1556,7 @@ func();
<!-- div -->
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
<a href="#_bindallobject--methodname1-methodname2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3562 "View in source") [&#x24C9;][1]
<a href="#_bindallobject--methodname1-methodname2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3587 "View in source") [&#x24C9;][1]
Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound.
@@ -1587,7 +1587,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
<!-- div -->
### <a id="_bindkeyobject-key--arg1-arg2-"></a>`_.bindKey(object, key [, arg1, arg2, ...])`
<a href="#_bindkeyobject-key--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3608 "View in source") [&#x24C9;][1]
<a href="#_bindkeyobject-key--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3633 "View in source") [&#x24C9;][1]
Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern.
@@ -1628,7 +1628,7 @@ func();
<!-- div -->
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
<a href="#_composefunc1-func2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3631 "View in source") [&#x24C9;][1]
<a href="#_composefunc1-func2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3656 "View in source") [&#x24C9;][1]
Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function.
@@ -1655,7 +1655,7 @@ welcome('moe');
<!-- div -->
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
<a href="#_debouncefunc-wait-immediate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3664 "View in source") [&#x24C9;][1]
<a href="#_debouncefunc-wait-immediate">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3689 "View in source") [&#x24C9;][1]
Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call.
@@ -1681,7 +1681,7 @@ jQuery(window).on('resize', lazyLayout);
<!-- div -->
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
<a href="#_deferfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3728 "View in source") [&#x24C9;][1]
<a href="#_deferfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3753 "View in source") [&#x24C9;][1]
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
@@ -1706,7 +1706,7 @@ _.defer(function() { alert('deferred'); });
<!-- div -->
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3708 "View in source") [&#x24C9;][1]
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3733 "View in source") [&#x24C9;][1]
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
@@ -1733,7 +1733,7 @@ _.delay(log, 1000, 'logged later');
<!-- div -->
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
<a href="#_memoizefunc--resolver">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3752 "View in source") [&#x24C9;][1]
<a href="#_memoizefunc--resolver">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3777 "View in source") [&#x24C9;][1]
Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function.
@@ -1759,7 +1759,7 @@ var fibonacci = _.memoize(function(n) {
<!-- div -->
### <a id="_oncefunc"></a>`_.once(func)`
<a href="#_oncefunc">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3779 "View in source") [&#x24C9;][1]
<a href="#_oncefunc">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3804 "View in source") [&#x24C9;][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.
@@ -1785,7 +1785,7 @@ initialize();
<!-- div -->
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
<a href="#_partialfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3814 "View in source") [&#x24C9;][1]
<a href="#_partialfunc--arg1-arg2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3839 "View in source") [&#x24C9;][1]
Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `bind`, except it does **not** alter the `this` binding.
@@ -1812,7 +1812,7 @@ hi('moe');
<!-- div -->
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
<a href="#_throttlefunc-wait">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3836 "View in source") [&#x24C9;][1]
<a href="#_throttlefunc-wait">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3861 "View in source") [&#x24C9;][1]
Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
@@ -1837,7 +1837,7 @@ jQuery(window).on('scroll', throttled);
<!-- div -->
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
<a href="#_wrapvalue-wrapper">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3889 "View in source") [&#x24C9;][1]
<a href="#_wrapvalue-wrapper">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3914 "View in source") [&#x24C9;][1]
Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function.
@@ -2631,14 +2631,16 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
<!-- div -->
### <a id="_mergeobject--source1-source2-"></a>`_.merge(object [, source1, source2, ...])`
<a href="#_mergeobject--source1-source2-">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1773 "View in source") [&#x24C9;][1]
### <a id="_mergeobject--source1-source2--callback-thisarg"></a>`_.merge(object [, source1, source2, ..., callback, thisArg])`
<a href="#_mergeobject--source1-source2--callback-thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1778 "View in source") [&#x24C9;][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 propery assignments of previous sources.
Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source object properties. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*.
#### Arguments
1. `object` *(Object)*: The destination object.
2. `[source1, source2, ...]` *(Object)*: The source objects.
3. `[callback]` *(Function)*: The function called for each property to merge.
4. `[thisArg]` *(Mixed)*: The `this` binding of `callback`.
#### Returns
*(Object)*: Returns the destination object.
@@ -2671,7 +2673,7 @@ _.merge(names, ages);
<!-- div -->
### <a id="_omitobject-callback-prop1-prop2--thisarg"></a>`_.omit(object, callback|[prop1, prop2, ..., thisArg])`
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1845 "View in source") [&#x24C9;][1]
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1870 "View in source") [&#x24C9;][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 `callback` is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
@@ -2702,7 +2704,7 @@ _.omit({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(va
<!-- div -->
### <a id="_pairsobject"></a>`_.pairs(object)`
<a href="#_pairsobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1879 "View in source") [&#x24C9;][1]
<a href="#_pairsobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1904 "View in source") [&#x24C9;][1]
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
@@ -2726,7 +2728,7 @@ _.pairs({ 'moe': 30, 'larry': 40, 'curly': 50 });
<!-- div -->
### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1917 "View in source") [&#x24C9;][1]
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1942 "View in source") [&#x24C9;][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 `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
@@ -2757,7 +2759,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) {
<!-- div -->
### <a id="_valuesobject"></a>`_.values(object)`
<a href="#_valuesobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1954 "View in source") [&#x24C9;][1]
<a href="#_valuesobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1979 "View in source") [&#x24C9;][1]
Creates an array composed of the own enumerable property values of `object`.
@@ -2788,7 +2790,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
<!-- div -->
### <a id="_escapestring"></a>`_.escape(string)`
<a href="#_escapestring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3913 "View in source") [&#x24C9;][1]
<a href="#_escapestring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3938 "View in source") [&#x24C9;][1]
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
@@ -2812,7 +2814,7 @@ _.escape('Moe, Larry & Curly');
<!-- div -->
### <a id="_identityvalue"></a>`_.identity(value)`
<a href="#_identityvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3931 "View in source") [&#x24C9;][1]
<a href="#_identityvalue">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3956 "View in source") [&#x24C9;][1]
This function returns the first argument passed to it.
@@ -2837,7 +2839,7 @@ moe === _.identity(moe);
<!-- div -->
### <a id="_mixinobject"></a>`_.mixin(object)`
<a href="#_mixinobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3957 "View in source") [&#x24C9;][1]
<a href="#_mixinobject">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3982 "View in source") [&#x24C9;][1]
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
@@ -2867,7 +2869,7 @@ _('curly').capitalize();
<!-- div -->
### <a id="_noconflict"></a>`_.noConflict()`
<a href="#_noconflict">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3981 "View in source") [&#x24C9;][1]
<a href="#_noconflict">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4006 "View in source") [&#x24C9;][1]
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
@@ -2887,7 +2889,7 @@ var lodash = _.noConflict();
<!-- div -->
### <a id="_randommin0-max1"></a>`_.random([min=0, max=1])`
<a href="#_randommin0-max1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4004 "View in source") [&#x24C9;][1]
<a href="#_randommin0-max1">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4029 "View in source") [&#x24C9;][1]
Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned.
@@ -2915,7 +2917,7 @@ _.random(5);
<!-- div -->
### <a id="_resultobject-property"></a>`_.result(object, property)`
<a href="#_resultobject-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4042 "View in source") [&#x24C9;][1]
<a href="#_resultobject-property">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4067 "View in source") [&#x24C9;][1]
Resolves the value of `property` on `object`. If `property` is a function, it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
@@ -2950,7 +2952,7 @@ _.result(object, 'stuff');
<!-- div -->
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
<a href="#_templatetext-data-options">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4127 "View in source") [&#x24C9;][1]
<a href="#_templatetext-data-options">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4152 "View in source") [&#x24C9;][1]
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code.
@@ -3028,7 +3030,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
<!-- div -->
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
<a href="#_timesn-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4263 "View in source") [&#x24C9;][1]
<a href="#_timesn-callback--thisarg">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4288 "View in source") [&#x24C9;][1]
Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*.
@@ -3060,7 +3062,7 @@ _.times(3, function(n) { this.cast(n); }, mage);
<!-- div -->
### <a id="_unescapestring"></a>`_.unescape(string)`
<a href="#_unescapestring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4289 "View in source") [&#x24C9;][1]
<a href="#_unescapestring">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4314 "View in source") [&#x24C9;][1]
The opposite of `_.escape`, this method converts the HTML entities `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#x27;` in `string` to their corresponding characters.
@@ -3084,7 +3086,7 @@ _.unescape('Moe, Larry &amp; Curly');
<!-- div -->
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
<a href="#_uniqueidprefix">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4309 "View in source") [&#x24C9;][1]
<a href="#_uniqueidprefix">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4334 "View in source") [&#x24C9;][1]
Generates a unique ID. If `prefix` is passed, the ID will be appended to it.
@@ -3137,7 +3139,7 @@ A reference to the `lodash` function.
<!-- div -->
### <a id="_version"></a>`_.VERSION`
<a href="#_version">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4536 "View in source") [&#x24C9;][1]
<a href="#_version">#</a> [&#x24C8;](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4561 "View in source") [&#x24C9;][1]
*(String)*: The semantic version number.

View File

@@ -1737,14 +1737,19 @@
/**
* Recursively merges own enumerable properties of the source object(s), that
* don't resolve to `undefined`, into the `destination` object. Subsequent
* sources will overwrite propery assignments of previous sources.
* don't resolve to `undefined`, into the `destination` object. Subsequent sources
* will overwrite propery assignments of previous sources. If a `callback` function
* is passed, it will be executed to produce the merged values of the destination
* and source object properties. The `callback` is bound to `thisArg` and invoked
* with two arguments; (objectValue, sourceValue).
*
* @static
* @memberOf _
* @category Objects
* @param {Object} object The destination object.
* @param {Object} [source1, source2, ...] The source objects.
* @param {Function} [callback] The function called for each property to merge.
* @param {Mixed} [thisArg] The `this` binding of `callback`.
* @param- {Object} [indicator] Internally used to indicate that the `stack`
* argument is an array of traversed objects instead of another source object.
* @param- {Array} [stackA=[]] Internally used to track traversed source objects.
@@ -1773,45 +1778,65 @@
function merge(object, source, indicator) {
var args = arguments,
index = 0,
length = 2,
stackA = args[3],
stackB = args[4];
length = 2;
if (indicator !== indicatorObject) {
if (!object) {
return object;
}
if (indicator === indicatorObject) {
var callback = args[3],
stackA = args[4],
stackB = args[5];
}
else {
stackA = [];
stackB = [];
// work with `_.reduce` by only using its callback `accumulator` and `value` arguments
if (typeof indicator != 'number') {
length = args.length;
callback = typeof (callback = args[length - 2]) == 'function'
? createCallback(callback, args[--length])
: (typeof (callback = args[length - 1]) == 'function' && callback);
}
}
while (++index < length) {
var isArr = isArray(args[index]);
(isArr ? forEach : forOwn)(args[index], function(source, key) {
var found, isObj, value;
var found,
isObj,
value = object[key];
if (source && ((isObj = isPlainObject(source)) || isArray(source))) {
// avoid merging previously merged cyclic sources
var stackLength = stackA.length;
while (stackLength--) {
if ((found = stackA[stackLength] == source)) {
object[key] = stackB[stackLength];
value = stackB[stackLength];
break;
}
}
if (!found) {
value = isObj
? (isPlainObject(value) ? value : {})
: (isArray(value) ? value : []);
if (callback) {
value = callback(value, source);
}
// add `source` and associated `value` to the stack of traversed objects
stackA.push(source);
stackB.push(value = (value = object[key], isObj)
? (isPlainObject(value) ? value : {})
: (isArray(value) ? value : [])
);
stackB.push(value);
// recursively merge objects and arrays (susceptible to call stack limits)
object[key] = merge(value, source, indicatorObject, stackA, stackB);
value = value && merge(value, source, indicatorObject, callback, stackA, stackB);
}
} else if (isArr || typeof source != 'undefined') {
object[key] = source;
}
else if (callback) {
value = callback(value, source);
}
else if (isArr || typeof source != 'undefined') {
value = source;
}
object[key] = value;
});
}
return object;

16
lodash.min.js vendored
View File

@@ -10,14 +10,14 @@ return(t.b||t.h)&&(r+="}"),r+=t.c+";return t",Function("e,h,j,k,p,n,s","return f
var r=n.constructor;return!j(r)&&(!Zt||!p(n))||r instanceof r?tt?(lr(n,function(n,r,e){return t=!St.call(e,r),X}),t===X):(lr(n,function(n,r){t=r}),t===X||St.call(n,t)):t}function m(n){var t=[];return pr(n,function(n,r){t.push(r)}),t}function _(n,t,r,e,u){if(n==W)return n;if(r&&(t=X),r=x(n)){var o=$t.call(n);if(!tr[o]||Zt&&p(n))return n;var i=yr(n)}if(!r||!t)return r?i?v(n):cr({},n):n;switch(r=rr[o],o){case zt:case Ct:return new r(+n);case Kt:case Vt:return new r(n);case Ut:return r(n.source,vt.exec(n))
}for(e||(e=[]),u||(u=[]),o=e.length;o--;)if(e[o]==n)return u[o];var a=i?r(n.length):{};return e.push(n),u.push(a),(i?R:pr)(n,function(n,r){a[r]=_(n,t,W,e,u)}),i&&(St.call(n,"index")&&(a.index=n.index),St.call(n,"input")&&(a.input=n.input)),a}function d(n){var t=[];return lr(n,function(n,r){j(n)&&t.push(r)}),t.sort()}function b(n){for(var t=-1,r=sr(n),e=r.length,u={};++t<e;){var o=r[t];u[n[o]]=o}return u}function w(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(n==W||t==W)return n===t;var u=$t.call(n),o=$t.call(t);
if(u==Mt&&(u=Lt),o==Mt&&(o=Lt),u!=o)return X;switch(u){case zt:case Ct:return+n==+t;case Kt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case Ut:case Vt:return n==t+""}if(o=u==Pt,!o){if(n.__wrapped__||t.__wrapped__)return w(n.__wrapped__||n,t.__wrapped__||t);if(u!=Lt||Zt&&(p(n)||p(t)))return X;var u=!Wt&&h(n)?Object:n.constructor,i=!Wt&&h(t)?Object:t.constructor;if(u!=i&&(!j(u)||!(u instanceof u&&j(i)&&i instanceof i)))return X}for(r||(r=[]),e||(e=[]),u=r.length;u--;)if(r[u]==n)return e[u]==t;var a=Q,f=0;
if(r.push(n),e.push(t),o){if(f=n.length,a=f==t.length)for(;f--&&(a=w(n[f],t[f],r,e)););return a}return lr(n,function(n,u,o){return St.call(o,u)?(f++,a=St.call(t,u)&&w(n,t[u],r,e)):void 0}),a&&lr(t,function(n,t,r){return St.call(r,t)?a=-1<--f:void 0}),a}function j(n){return typeof n=="function"}function x(n){return n?er[typeof n]:X}function O(n){return typeof n=="number"||$t.call(n)==Kt}function A(n){return typeof n=="string"||$t.call(n)==Vt}function S(n,t,r){var e=arguments,u=0,o=2,i=e[3],a=e[4];for(r!==ot&&(i=[],a=[],typeof r!="number"&&(o=e.length));++u<o;){var f=yr(e[u]);
(f?R:pr)(e[u],function(t,r){var e,u,o;if(t&&((u=mr(t))||yr(t))){for(var c=i.length;c--;)if(e=i[c]==t){n[r]=a[c];break}e||(i.push(t),a.push((o=n[r],o=u?mr(o)?o:{}:yr(o)?o:[])),n[r]=S(o,t,ot,i,a))}else(f||typeof t!="undefined")&&(n[r]=t)})}return n}function E(n){for(var t=-1,r=sr(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];return u}function k(n,t,r){var e=-1,u=n?n.length:0,o=X,r=(0>r?It(0,u+r):r)||0;return typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):C(n,t,r)):fr(n,function(n){return++e<r?void 0:!(o=n===t)
}),o}function $(n,t,r){var e=Q,t=a(t,r);if(yr(n))for(var r=-1,u=n.length;++r<u&&(e=!!t(n[r],r,n)););else fr(n,function(n,r,u){return e=!!t(n,r,u)});return e}function q(n,t,r){var e=[],t=a(t,r);if(yr(n))for(var r=-1,u=n.length;++r<u;){var o=n[r];t(o,r,n)&&e.push(o)}else fr(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e}function N(n,t,r){var e,t=a(t,r);return R(n,function(n,r,u){return t(n,r,u)?(e=n,X):void 0}),e}function R(n,t,r){if(t&&typeof r=="undefined"&&yr(n))for(var r=-1,e=n.length;++r<e&&t(n[r],r,n)!==X;);else fr(n,t,r);
return n}function F(n,t,r){var e=-1,u=n?n.length:0,o=Array(typeof u=="number"?u:0),t=a(t,r);if(yr(n))for(;++e<u;)o[e]=t(n[e],e,n);else fr(n,function(n,r,u){o[++e]=t(n,r,u)});return o}function D(n,t,r){var e=-1/0,o=e;if(!t&&yr(n))for(var r=-1,i=n.length;++r<i;){var f=n[r];f>o&&(o=f)}else t=!t&&A(n)?u:a(t,r),fr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function I(n,t){return F(n,t+"")}function T(n,t,r,e){var u=3>arguments.length,t=a(t,e,ot);if(yr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++o<i;)r=t(r,n[o],o,n)
}else fr(n,function(n,e,o){r=u?(u=X,n):t(r,n,e,o)});return r}function B(n,t,r,e){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var f=sr(n),o=f.length;else Yt&&A(n)&&(u=n.split(""));return t=a(t,e,ot),R(n,function(n,e,a){e=f?f[--o]:--o,r=i?(i=X,u[e]):t(r,u[e],e,a)}),r}function M(n,t,r){var e,t=a(t,r);if(yr(n))for(var r=-1,u=n.length;++r<u&&!(e=t(n[r],r,n)););else fr(n,function(n,r,u){return!(e=t(n,r,u))});return!!e}function P(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function")for(var o=-1,t=a(t,r);++o<u&&t(n[o],o,n);)e++;
else if(e=t,e==W||r)return n[0];return v(n,0,Tt(It(0,e),u))}}function z(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];yr(o)?Et.apply(u,t?o:z(o)):u.push(o)}return u}function C(n,t,r){var e=-1,u=n?n.length:0;if(typeof r=="number")e=(0>r?It(0,u+r):r||0)-1;else if(r)return e=L(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){if(typeof t=="function")for(var e=0,u=-1,o=n?n.length:0,t=a(t,r);++u<o&&t(n[u],u,n);)e++;else e=t==W||r?1:It(0,t);return v(n,e)}function L(n,t,r,e){for(var u=0,o=n?n.length:u,r=r?a(r,e):G,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;
return u}function U(n,t,r,e){var u=-1,o=n?n.length:0,i=[],f=i;typeof t=="function"&&(e=r,r=t,t=X);var c=!t&&75<=o;if(c)var l={};for(r&&(f=[],r=a(r,e));++u<o;){var e=n[u],p=r?r(e,u,n):e;if(c)var s=p+"",s=St.call(l,s)?!(f=l[s]):f=l[s]=[];(t?!u||f[f.length-1]!==p:s||0>C(f,p))&&((r||c)&&f.push(p),i.push(e))}return i}function V(n,t){return Ht||qt&&2<arguments.length?qt.call.apply(qt,arguments):i(n,t,v(arguments,2))}function G(n){return n}function H(n){R(d(n),function(t){var e=r[t]=n[t];r.prototype[t]=function(){var n=[this.__wrapped__];
return Et.apply(n,arguments),new r(e.apply(r,n))}})}function J(){return this.__wrapped__}var Q=!0,W=null,X=!1,Y=typeof exports=="object"&&exports,Z=typeof global=="object"&&global;Z.global===Z&&(n=Z);var nt,tt,rt=[],et=new function(){},ut=0,ot=et,it=30,at=n._,ft=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,ct=/&(?:amp|lt|gt|quot|#x27);/g,lt=/\b__p\+='';/g,pt=/\b(__p\+=)''\+/g,st=/(__e\(.*?\)|\b__t\))\+'';/g,vt=/\w*$/,gt=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,ht=RegExp("^"+(et.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,mt=/<%=([\s\S]+?)%>/g,_t=/($^)/,dt=/[&<>"']/g,bt=/['\n\r\t\u2028\u2029\\]/g,wt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),jt=Math.ceil,xt=rt.concat,Ot=Math.floor,At=ht.test(At=Object.getPrototypeOf)&&At,St=et.hasOwnProperty,Et=rt.push,kt=et.propertyIsEnumerable,$t=et.toString,qt=ht.test(qt=v.bind)&&qt,Nt=ht.test(Nt=Array.isArray)&&Nt,Rt=n.isFinite,Ft=n.isNaN,Dt=ht.test(Dt=Object.keys)&&Dt,It=Math.max,Tt=Math.min,Bt=Math.random,Mt="[object Arguments]",Pt="[object Array]",zt="[object Boolean]",Ct="[object Date]",Kt="[object Number]",Lt="[object Object]",Ut="[object RegExp]",Vt="[object String]",Gt=!!n.attachEvent,Ht=qt&&/\n|true/.test(qt+Gt),Jt=(Jt={0:1,length:1},rt.splice.call(Jt,0,1),Jt[0]),Qt=Q;
if(r.push(n),e.push(t),o){if(f=n.length,a=f==t.length)for(;f--&&(a=w(n[f],t[f],r,e)););return a}return lr(n,function(n,u,o){return St.call(o,u)?(f++,a=St.call(t,u)&&w(n,t[u],r,e)):void 0}),a&&lr(t,function(n,t,r){return St.call(r,t)?a=-1<--f:void 0}),a}function j(n){return typeof n=="function"}function x(n){return n?er[typeof n]:X}function O(n){return typeof n=="number"||$t.call(n)==Kt}function A(n){return typeof n=="string"||$t.call(n)==Vt}function S(n,t,r){var e=arguments,u=0,o=2;if(!n)return n;if(r===ot)var i=e[3],f=e[4],c=e[5];
else f=[],c=[],typeof r!="number"&&(o=e.length,i=typeof(i=e[o-2])=="function"?a(i,e[--o]):typeof(i=e[o-1])=="function"&&i);for(;++u<o;){var l=yr(e[u]);(l?R:pr)(e[u],function(t,r){var e,u,o=n[r];if(t&&((u=mr(t))||yr(t))){for(var a=f.length;a--;)if(e=f[a]==t){o=c[a];break}e||(o=u?mr(o)?o:{}:yr(o)?o:[],i&&(o=i(o,t)),f.push(t),c.push(o),o=o&&S(o,t,ot,i,f,c))}else i?o=i(o,t):(l||typeof t!="undefined")&&(o=t);n[r]=o})}return n}function E(n){for(var t=-1,r=sr(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];
return u}function k(n,t,r){var e=-1,u=n?n.length:0,o=X,r=(0>r?It(0,u+r):r)||0;return typeof u=="number"?o=-1<(A(n)?n.indexOf(t,r):C(n,t,r)):fr(n,function(n){return++e<r?void 0:!(o=n===t)}),o}function $(n,t,r){var e=Q,t=a(t,r);if(yr(n))for(var r=-1,u=n.length;++r<u&&(e=!!t(n[r],r,n)););else fr(n,function(n,r,u){return e=!!t(n,r,u)});return e}function q(n,t,r){var e=[],t=a(t,r);if(yr(n))for(var r=-1,u=n.length;++r<u;){var o=n[r];t(o,r,n)&&e.push(o)}else fr(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e
}function N(n,t,r){var e,t=a(t,r);return R(n,function(n,r,u){return t(n,r,u)?(e=n,X):void 0}),e}function R(n,t,r){if(t&&typeof r=="undefined"&&yr(n))for(var r=-1,e=n.length;++r<e&&t(n[r],r,n)!==X;);else fr(n,t,r);return n}function F(n,t,r){var e=-1,u=n?n.length:0,o=Array(typeof u=="number"?u:0),t=a(t,r);if(yr(n))for(;++e<u;)o[e]=t(n[e],e,n);else fr(n,function(n,r,u){o[++e]=t(n,r,u)});return o}function D(n,t,r){var e=-1/0,o=e;if(!t&&yr(n))for(var r=-1,i=n.length;++r<i;){var f=n[r];f>o&&(o=f)}else t=!t&&A(n)?u:a(t,r),fr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)
});return o}function I(n,t){return F(n,t+"")}function T(n,t,r,e){var u=3>arguments.length,t=a(t,e,ot);if(yr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++o<i;)r=t(r,n[o],o,n)}else fr(n,function(n,e,o){r=u?(u=X,n):t(r,n,e,o)});return r}function B(n,t,r,e){var u=n,o=n?n.length:0,i=3>arguments.length;if(typeof o!="number")var f=sr(n),o=f.length;else Yt&&A(n)&&(u=n.split(""));return t=a(t,e,ot),R(n,function(n,e,a){e=f?f[--o]:--o,r=i?(i=X,u[e]):t(r,u[e],e,a)}),r}function M(n,t,r){var e,t=a(t,r);if(yr(n))for(var r=-1,u=n.length;++r<u&&!(e=t(n[r],r,n)););else fr(n,function(n,r,u){return!(e=t(n,r,u))
});return!!e}function P(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function")for(var o=-1,t=a(t,r);++o<u&&t(n[o],o,n);)e++;else if(e=t,e==W||r)return n[0];return v(n,0,Tt(It(0,e),u))}}function z(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];yr(o)?Et.apply(u,t?o:z(o)):u.push(o)}return u}function C(n,t,r){var e=-1,u=n?n.length:0;if(typeof r=="number")e=(0>r?It(0,u+r):r||0)-1;else if(r)return e=L(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){if(typeof t=="function")for(var e=0,u=-1,o=n?n.length:0,t=a(t,r);++u<o&&t(n[u],u,n);)e++;
else e=t==W||r?1:It(0,t);return v(n,e)}function L(n,t,r,e){for(var u=0,o=n?n.length:u,r=r?a(r,e):G,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;return u}function U(n,t,r,e){var u=-1,o=n?n.length:0,i=[],f=i;typeof t=="function"&&(e=r,r=t,t=X);var c=!t&&75<=o;if(c)var l={};for(r&&(f=[],r=a(r,e));++u<o;){var e=n[u],p=r?r(e,u,n):e;if(c)var s=p+"",s=St.call(l,s)?!(f=l[s]):f=l[s]=[];(t?!u||f[f.length-1]!==p:s||0>C(f,p))&&((r||c)&&f.push(p),i.push(e))}return i}function V(n,t){return Ht||qt&&2<arguments.length?qt.call.apply(qt,arguments):i(n,t,v(arguments,2))
}function G(n){return n}function H(n){R(d(n),function(t){var e=r[t]=n[t];r.prototype[t]=function(){var n=[this.__wrapped__];return Et.apply(n,arguments),new r(e.apply(r,n))}})}function J(){return this.__wrapped__}var Q=!0,W=null,X=!1,Y=typeof exports=="object"&&exports,Z=typeof global=="object"&&global;Z.global===Z&&(n=Z);var nt,tt,rt=[],et=new function(){},ut=0,ot=et,it=30,at=n._,ft=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,ct=/&(?:amp|lt|gt|quot|#x27);/g,lt=/\b__p\+='';/g,pt=/\b(__p\+=)''\+/g,st=/(__e\(.*?\)|\b__t\))\+'';/g,vt=/\w*$/,gt=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,ht=RegExp("^"+(et.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,mt=/<%=([\s\S]+?)%>/g,_t=/($^)/,dt=/[&<>"']/g,bt=/['\n\r\t\u2028\u2029\\]/g,wt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),jt=Math.ceil,xt=rt.concat,Ot=Math.floor,At=ht.test(At=Object.getPrototypeOf)&&At,St=et.hasOwnProperty,Et=rt.push,kt=et.propertyIsEnumerable,$t=et.toString,qt=ht.test(qt=v.bind)&&qt,Nt=ht.test(Nt=Array.isArray)&&Nt,Rt=n.isFinite,Ft=n.isNaN,Dt=ht.test(Dt=Object.keys)&&Dt,It=Math.max,Tt=Math.min,Bt=Math.random,Mt="[object Arguments]",Pt="[object Array]",zt="[object Boolean]",Ct="[object Date]",Kt="[object Number]",Lt="[object Object]",Ut="[object RegExp]",Vt="[object String]",Gt=!!n.attachEvent,Ht=qt&&/\n|true/.test(qt+Gt),Jt=(Jt={0:1,length:1},rt.splice.call(Jt,0,1),Jt[0]),Qt=Q;
(function(){function n(){this.x=1}var t=[];n.prototype={valueOf:1,y:1};for(var r in new n)t.push(r);for(r in arguments)Qt=!r;nt=!/valueOf/.test(t),tt="x"!=t[0]})(1);var Wt=arguments.constructor==Object,Xt=!h(arguments),Yt="xx"!="x"[0]+Object("x")[0];try{var Zt=$t.call(document)==Lt&&X}catch(nr){}var tr={"[object Function]":X};tr[Mt]=tr[Pt]=tr[zt]=tr[Ct]=tr[Kt]=tr[Lt]=tr[Ut]=tr[Vt]=Q;var rr={};rr[Pt]=Array,rr[zt]=Boolean,rr[Ct]=Date,rr[Lt]=Object,rr[Kt]=Number,rr[Ut]=RegExp,rr[Vt]=String;var er={"boolean":X,"function":Q,object:Q,number:X,string:X,undefined:X},ur={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};
r.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:mt,variable:"",imports:{_:r}};var or={a:"o,v,g",k:"var a=0,b=typeof g=='number'?2:arguments.length;while(++a<b){if((l=arguments[a])){",g:"t[i]=l[i]",c:"}}"},ir={b:Q,a:"d,c,w",k:"c=c&&typeof w=='undefined'?c:e(c,w)",g:"if(c(l[i],i,d)===false)return t"},ar={b:X},fr=f(ir),cr=f(or);Xt&&(h=function(n){return n?St.call(n,"callee"):X});var lr=f(ir,ar,{l:X}),pr=f(ir,ar),sr=Dt?function(n){return typeof n=="function"&&kt.call(n,"prototype")?m(n):x(n)?Dt(n):[]
}:m,vr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},gr=b(vr),hr=f(or,{g:"if(t[i]==null)"+or.g}),yr=Nt||function(n){return Wt&&n instanceof Array||$t.call(n)==Pt};j(/x/)&&(j=function(n){return n instanceof Function||"[object Function]"==$t.call(n)});var mr=At?function(n){if(!n||typeof n!="object")return X;var t=n.valueOf,r=typeof t=="function"&&(r=At(t))&&At(r);return r?n==r||At(n)==r&&!h(n):y(n)}:y;r.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0

View File

@@ -1402,6 +1402,32 @@
ok(1 in actual);
deepEqual(actual, expected);
});
test('should pass the correct `callback` arguments', function() {
var args;
_.merge({ 'a': 1 }, { 'a': 2 }, function() {
args || (args = slice.call(arguments));
});
deepEqual(args, [1, 2]);
});
test('should correct set the `this` binding', function() {
var actual = _.merge({}, { 'a': 0 }, function(a, b) {
return this[b];
}, [2]);
deepEqual(actual, { 'a': 2 });
});
test('should work as a deep `_.defaults`', function() {
var object = { 'a': { 'b': 1 } },
source = { 'a': { 'b': 2, 'c': 3 } },
expected = { 'a': { 'b': 1, 'c': 3 } };
deepEqual(_.merge(object, source, _.defaults), expected);
});
}(1, 2, 3));
/*--------------------------------------------------------------------------*/