mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Allow _.first, _.last, _.initial, and _.rest to accept callback and thisArg arguments. [closes #155]
Former-commit-id: b921ae0ccc188c5544480f397216ce3b2479989e
This commit is contained in:
224
doc/README.md
224
doc/README.md
@@ -8,21 +8,21 @@
|
|||||||
## <a id="Arrays"></a>`Arrays`
|
## <a id="Arrays"></a>`Arrays`
|
||||||
* [`_.compact`](#_compactarray)
|
* [`_.compact`](#_compactarray)
|
||||||
* [`_.difference`](#_differencearray--array1-array2-)
|
* [`_.difference`](#_differencearray--array1-array2-)
|
||||||
* [`_.drop`](#_restarray--n1)
|
* [`_.drop`](#_restarray--callbackn1-thisarg)
|
||||||
* [`_.first`](#_firstarray--n)
|
* [`_.first`](#_firstarray--callbackn-thisarg)
|
||||||
* [`_.flatten`](#_flattenarray-shallow)
|
* [`_.flatten`](#_flattenarray-shallow)
|
||||||
* [`_.head`](#_firstarray--n)
|
* [`_.head`](#_firstarray--callbackn-thisarg)
|
||||||
* [`_.indexOf`](#_indexofarray-value--fromindex0)
|
* [`_.indexOf`](#_indexofarray-value--fromindex0)
|
||||||
* [`_.initial`](#_initialarray--n1)
|
* [`_.initial`](#_initialarray--callbackn1-thisarg)
|
||||||
* [`_.intersection`](#_intersectionarray1-array2-)
|
* [`_.intersection`](#_intersectionarray1-array2-)
|
||||||
* [`_.last`](#_lastarray--n)
|
* [`_.last`](#_lastarray--callbackn-thisarg)
|
||||||
* [`_.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1)
|
* [`_.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1)
|
||||||
* [`_.object`](#_objectkeys--values)
|
* [`_.object`](#_objectkeys--values)
|
||||||
* [`_.range`](#_rangestart0-end--step1)
|
* [`_.range`](#_rangestart0-end--step1)
|
||||||
* [`_.rest`](#_restarray--n1)
|
* [`_.rest`](#_restarray--callbackn1-thisarg)
|
||||||
* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentityproperty-thisarg)
|
* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentityproperty-thisarg)
|
||||||
* [`_.tail`](#_restarray--n1)
|
* [`_.tail`](#_restarray--callbackn1-thisarg)
|
||||||
* [`_.take`](#_firstarray--n)
|
* [`_.take`](#_firstarray--callbackn-thisarg)
|
||||||
* [`_.union`](#_unionarray1-array2-)
|
* [`_.union`](#_unionarray1-array2-)
|
||||||
* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
|
* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
|
||||||
* [`_.unique`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
|
* [`_.unique`](#_uniqarray--issortedfalse-callbackidentity-thisarg)
|
||||||
@@ -244,25 +244,34 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
|||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_firstarray--n"></a>`_.first(array [, n])`
|
### <a id="_firstarray--callbackn-thisarg"></a>`_.first(array [, callback|n, thisArg])`
|
||||||
<a href="#_firstarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2849 "View in source") [Ⓣ][1]
|
<a href="#_firstarray--callbackn-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2858 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the first element of the `array`. Pass `n` to return the first `n` elements of the `array`.
|
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)*.
|
||||||
|
|
||||||
#### Aliases
|
#### Aliases
|
||||||
*head, take*
|
*head, take*
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to query.
|
1. `array` *(Array)*: The array to query.
|
||||||
2. `[n]` *(Number)*: The number of elements to return.
|
2. `[callback|n]` *(Function|Number)*: The function called per element or the number of elements to return.
|
||||||
|
3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Mixed)*: Returns the first element, or an array of the first `n` elements, of `array`.
|
*(Mixed)*: Returns the first element(s) of `array`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
_.first([5, 4, 3, 2, 1]);
|
_.first([1, 2, 3]);
|
||||||
// => 5
|
// => 1
|
||||||
|
|
||||||
|
_.first([1, 2, 3], 2);
|
||||||
|
// => [1, 2]
|
||||||
|
|
||||||
|
_.first([1, 2, 3], function(num) {
|
||||||
|
return num < 3;
|
||||||
|
});
|
||||||
|
// => [1, 2]
|
||||||
```
|
```
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
@@ -273,7 +282,7 @@ _.first([5, 4, 3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
|
### <a id="_flattenarray-shallow"></a>`_.flatten(array, shallow)`
|
||||||
<a href="#_flattenarray-shallow">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2876 "View in source") [Ⓣ][1]
|
<a href="#_flattenarray-shallow">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2897 "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.
|
Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level.
|
||||||
|
|
||||||
@@ -301,7 +310,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
|
### <a id="_indexofarray-value--fromindex0"></a>`_.indexOf(array, value [, fromIndex=0])`
|
||||||
<a href="#_indexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2918 "View in source") [Ⓣ][1]
|
<a href="#_indexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2939 "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 `fromIndex` will run a faster binary search.
|
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.
|
||||||
|
|
||||||
@@ -332,22 +341,31 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
|||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_initialarray--n1"></a>`_.initial(array [, n=1])`
|
### <a id="_initialarray--callbackn1-thisarg"></a>`_.initial(array [, callback|n=1, thisArg])`
|
||||||
<a href="#_initialarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2953 "View in source") [Ⓣ][1]
|
<a href="#_initialarray--callbackn1-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2985 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets all but the last element of `array`. Pass `n` to exclude the last `n` elements from the result.
|
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)*.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to query.
|
1. `array` *(Array)*: The array to query.
|
||||||
2. `[n=1]` *(Number)*: The number of elements to exclude.
|
2. `[callback|n=1]` *(Function|Number)*: The function called per element or the number of elements to exclude.
|
||||||
|
3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Array)*: Returns all but the last element, or `n` elements, of `array`.
|
*(Array)*: Returns a slice of `array`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
_.initial([3, 2, 1]);
|
_.initial([1, 2, 3]);
|
||||||
// => [3, 2]
|
// => [1, 2]
|
||||||
|
|
||||||
|
_.initial([1, 2, 3], 2);
|
||||||
|
// => [1]
|
||||||
|
|
||||||
|
_.initial([1, 2, 3], function(num) {
|
||||||
|
return num > 1;
|
||||||
|
});
|
||||||
|
// => [1]
|
||||||
```
|
```
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
@@ -358,7 +376,7 @@ _.initial([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
|
### <a id="_intersectionarray1-array2-"></a>`_.intersection([array1, array2, ...])`
|
||||||
<a href="#_intersectionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2977 "View in source") [Ⓣ][1]
|
<a href="#_intersectionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3019 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -381,22 +399,31 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
|||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_lastarray--n"></a>`_.last(array [, n])`
|
### <a id="_lastarray--callbackn-thisarg"></a>`_.last(array [, callback|n, thisArg])`
|
||||||
<a href="#_lastarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3030 "View in source") [Ⓣ][1]
|
<a href="#_lastarray--callbackn-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3081 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the last element of the `array`. Pass `n` to return the last `n` elements of the `array`.
|
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)*.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to query.
|
1. `array` *(Array)*: The array to query.
|
||||||
2. `[n]` *(Number)*: The number of elements to return.
|
2. `[callback|n]` *(Function|Number)*: The function called per element or the number of elements to return.
|
||||||
|
3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Mixed)*: Returns the last element, or an array of the last `n` elements, of `array`.
|
*(Mixed)*: Returns the last element(s) of `array`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
_.last([3, 2, 1]);
|
_.last([1, 2, 3]);
|
||||||
// => 1
|
// => 3
|
||||||
|
|
||||||
|
_.last([1, 2, 3], 2);
|
||||||
|
// => [2, 3]
|
||||||
|
|
||||||
|
_.last([1, 2, 3], function(num) {
|
||||||
|
return num > 1;
|
||||||
|
});
|
||||||
|
// => [2, 3]
|
||||||
```
|
```
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
@@ -407,7 +434,7 @@ _.last([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
|
### <a id="_lastindexofarray-value--fromindexarraylength-1"></a>`_.lastIndexOf(array, value [, fromIndex=array.length-1])`
|
||||||
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3057 "View in source") [Ⓣ][1]
|
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3122 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection.
|
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.
|
||||||
|
|
||||||
@@ -436,7 +463,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_objectkeys--values"></a>`_.object(keys [, values=[]])`
|
### <a id="_objectkeys--values"></a>`_.object(keys [, values=[]])`
|
||||||
<a href="#_objectkeys--values">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3087 "View in source") [Ⓣ][1]
|
<a href="#_objectkeys--values">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3152 "View in source") [Ⓣ][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`.
|
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`.
|
||||||
|
|
||||||
@@ -461,7 +488,7 @@ _.object(['moe', 'larry', 'curly'], [30, 40, 50]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
|
### <a id="_rangestart0-end--step1"></a>`_.range([start=0], end [, step=1])`
|
||||||
<a href="#_rangestart0-end--step1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3132 "View in source") [Ⓣ][1]
|
<a href="#_rangestart0-end--step1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3197 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -498,25 +525,34 @@ _.range(0);
|
|||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_restarray--n1"></a>`_.rest(array [, n=1])`
|
### <a id="_restarray--callbackn1-thisarg"></a>`_.rest(array [, callback|n=1, thisArg])`
|
||||||
<a href="#_restarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3171 "View in source") [Ⓣ][1]
|
<a href="#_restarray--callbackn1-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3247 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result.
|
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)*.
|
||||||
|
|
||||||
#### Aliases
|
#### Aliases
|
||||||
*drop, tail*
|
*drop, tail*
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `array` *(Array)*: The array to query.
|
1. `array` *(Array)*: The array to query.
|
||||||
2. `[n=1]` *(Number)*: The number of elements to exclude.
|
2. `[callback|n=1]` *(Function|Number)*: The function called per element or the number of elements to exclude.
|
||||||
|
3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Array)*: Returns all but the first element, or `n` elements, of `array`.
|
*(Array)*: Returns a slice of `array`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
_.rest([3, 2, 1]);
|
_.rest([1, 2, 3]);
|
||||||
// => [2, 1]
|
// => [2, 3]
|
||||||
|
|
||||||
|
_.rest([1, 2, 3], 2);
|
||||||
|
// => [3]
|
||||||
|
|
||||||
|
_.rest([1, 2, 3], function(num) {
|
||||||
|
return num < 3;
|
||||||
|
});
|
||||||
|
// => [3]
|
||||||
```
|
```
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
@@ -527,7 +563,7 @@ _.rest([3, 2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sortedindexarray-value--callbackidentityproperty-thisarg"></a>`_.sortedIndex(array, value [, callback=identity|property, thisArg])`
|
### <a id="_sortedindexarray-value--callbackidentityproperty-thisarg"></a>`_.sortedIndex(array, value [, callback=identity|property, thisArg])`
|
||||||
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3215 "View in source") [Ⓣ][1]
|
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3303 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. The `callback` argument may also be the name of a property to order by.
|
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.
|
||||||
|
|
||||||
@@ -571,7 +607,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
|
### <a id="_unionarray1-array2-"></a>`_.union([array1, array2, ...])`
|
||||||
<a href="#_unionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3247 "View in source") [Ⓣ][1]
|
<a href="#_unionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3335 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -595,7 +631,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
|
### <a id="_uniqarray--issortedfalse-callbackidentity-thisarg"></a>`_.uniq(array [, isSorted=false, callback=identity, thisArg])`
|
||||||
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3281 "View in source") [Ⓣ][1]
|
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3369 "View in source") [Ⓣ][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)*.
|
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)*.
|
||||||
|
|
||||||
@@ -634,7 +670,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
|
### <a id="_withoutarray--value1-value2-"></a>`_.without(array [, value1, value2, ...])`
|
||||||
<a href="#_withoutarray--value1-value2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3340 "View in source") [Ⓣ][1]
|
<a href="#_withoutarray--value1-value2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3428 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
|
Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -659,7 +695,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
|
### <a id="_ziparray1-array2-"></a>`_.zip([array1, array2, ...])`
|
||||||
<a href="#_ziparray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3371 "View in source") [Ⓣ][1]
|
<a href="#_ziparray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3459 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -716,7 +752,7 @@ The wrapper functions `first` and `last` return wrapped values when `n` is passe
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
|
### <a id="_tapvalue-interceptor"></a>`_.tap(value, interceptor)`
|
||||||
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4242 "View in source") [Ⓣ][1]
|
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4330 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain.
|
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.
|
||||||
|
|
||||||
@@ -746,7 +782,7 @@ _([1, 2, 3, 4])
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_prototypetostring"></a>`_.prototype.toString()`
|
### <a id="_prototypetostring"></a>`_.prototype.toString()`
|
||||||
<a href="#_prototypetostring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4259 "View in source") [Ⓣ][1]
|
<a href="#_prototypetostring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4347 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Produces the `toString` result of the wrapped value.
|
Produces the `toString` result of the wrapped value.
|
||||||
|
|
||||||
@@ -767,7 +803,7 @@ _([1, 2, 3]).toString();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_prototypevalueof"></a>`_.prototype.valueOf()`
|
### <a id="_prototypevalueof"></a>`_.prototype.valueOf()`
|
||||||
<a href="#_prototypevalueof">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4276 "View in source") [Ⓣ][1]
|
<a href="#_prototypevalueof">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4364 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Extracts the wrapped value.
|
Extracts the wrapped value.
|
||||||
|
|
||||||
@@ -1049,7 +1085,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
|
|||||||
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
|
### <a id="_invokecollection-methodname--arg1-arg2-"></a>`_.invoke(collection, methodName [, arg1, arg2, ...])`
|
||||||
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2295 "View in source") [Ⓣ][1]
|
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2295 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`.
|
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`.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
1. `collection` *(Array|Object|String)*: The collection to iterate over.
|
||||||
@@ -1461,7 +1497,7 @@ _.where(stooges, { 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_aftern-func"></a>`_.after(n, func)`
|
### <a id="_aftern-func"></a>`_.after(n, func)`
|
||||||
<a href="#_aftern-func">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3404 "View in source") [Ⓣ][1]
|
<a href="#_aftern-func">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3492 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -1489,7 +1525,7 @@ _.forEach(notes, function(note) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
|
### <a id="_bindfunc--thisarg-arg1-arg2-"></a>`_.bind(func [, thisArg, arg1, arg2, ...])`
|
||||||
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3437 "View in source") [Ⓣ][1]
|
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3525 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function.
|
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.
|
||||||
|
|
||||||
@@ -1520,7 +1556,7 @@ func();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
|
### <a id="_bindallobject--methodname1-methodname2-"></a>`_.bindAll(object [, methodName1, methodName2, ...])`
|
||||||
<a href="#_bindallobject--methodname1-methodname2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3467 "View in source") [Ⓣ][1]
|
<a href="#_bindallobject--methodname1-methodname2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3555 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
|
Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound.
|
||||||
|
|
||||||
@@ -1551,7 +1587,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_bindkeyobject-key--arg1-arg2-"></a>`_.bindKey(object, key [, arg1, arg2, ...])`
|
### <a id="_bindkeyobject-key--arg1-arg2-"></a>`_.bindKey(object, key [, arg1, arg2, ...])`
|
||||||
<a href="#_bindkeyobject-key--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3513 "View in source") [Ⓣ][1]
|
<a href="#_bindkeyobject-key--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3601 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -1592,7 +1628,7 @@ func();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
|
### <a id="_composefunc1-func2-"></a>`_.compose([func1, func2, ...])`
|
||||||
<a href="#_composefunc1-func2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3536 "View in source") [Ⓣ][1]
|
<a href="#_composefunc1-func2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3624 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function.
|
Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function.
|
||||||
|
|
||||||
@@ -1619,7 +1655,7 @@ welcome('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
|
### <a id="_debouncefunc-wait-immediate"></a>`_.debounce(func, wait, immediate)`
|
||||||
<a href="#_debouncefunc-wait-immediate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3569 "View in source") [Ⓣ][1]
|
<a href="#_debouncefunc-wait-immediate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3657 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. 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.
|
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.
|
||||||
|
|
||||||
@@ -1645,7 +1681,7 @@ jQuery(window).on('resize', lazyLayout);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
|
### <a id="_deferfunc--arg1-arg2-"></a>`_.defer(func [, arg1, arg2, ...])`
|
||||||
<a href="#_deferfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3633 "View in source") [Ⓣ][1]
|
<a href="#_deferfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3721 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
|
Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked.
|
||||||
|
|
||||||
@@ -1670,7 +1706,7 @@ _.defer(function() { alert('deferred'); });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
|
### <a id="_delayfunc-wait--arg1-arg2-"></a>`_.delay(func, wait [, arg1, arg2, ...])`
|
||||||
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3613 "View in source") [Ⓣ][1]
|
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3701 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
|
Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked.
|
||||||
|
|
||||||
@@ -1697,7 +1733,7 @@ _.delay(log, 1000, 'logged later');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
|
### <a id="_memoizefunc--resolver"></a>`_.memoize(func [, resolver])`
|
||||||
<a href="#_memoizefunc--resolver">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3657 "View in source") [Ⓣ][1]
|
<a href="#_memoizefunc--resolver">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3745 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -1723,7 +1759,7 @@ var fibonacci = _.memoize(function(n) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_oncefunc"></a>`_.once(func)`
|
### <a id="_oncefunc"></a>`_.once(func)`
|
||||||
<a href="#_oncefunc">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3684 "View in source") [Ⓣ][1]
|
<a href="#_oncefunc">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3772 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function.
|
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.
|
||||||
|
|
||||||
@@ -1749,7 +1785,7 @@ initialize();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
|
### <a id="_partialfunc--arg1-arg2-"></a>`_.partial(func [, arg1, arg2, ...])`
|
||||||
<a href="#_partialfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3719 "View in source") [Ⓣ][1]
|
<a href="#_partialfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3807 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -1776,7 +1812,7 @@ hi('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
|
### <a id="_throttlefunc-wait"></a>`_.throttle(func, wait)`
|
||||||
<a href="#_throttlefunc-wait">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3741 "View in source") [Ⓣ][1]
|
<a href="#_throttlefunc-wait">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3829 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -1801,7 +1837,7 @@ jQuery(window).on('scroll', throttled);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
|
### <a id="_wrapvalue-wrapper"></a>`_.wrap(value, wrapper)`
|
||||||
<a href="#_wrapvalue-wrapper">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3794 "View in source") [Ⓣ][1]
|
<a href="#_wrapvalue-wrapper">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3882 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -2108,7 +2144,7 @@ Checks if `value` is an `arguments` object.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is an `arguments` object, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is an `arguments` object, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2135,7 +2171,7 @@ Checks if `value` is an array.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is an array, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is an array, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2156,13 +2192,13 @@ _.isArray([1, 2, 3]);
|
|||||||
### <a id="_isbooleanvalue"></a>`_.isBoolean(value)`
|
### <a id="_isbooleanvalue"></a>`_.isBoolean(value)`
|
||||||
<a href="#_isbooleanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1275 "View in source") [Ⓣ][1]
|
<a href="#_isbooleanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1275 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a boolean *(`true` or `false`)* value.
|
Checks if `value` is a boolean value.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a boolean value, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is a boolean value, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2186,7 +2222,7 @@ Checks if `value` is a date.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a date, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is a date, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2210,7 +2246,7 @@ Checks if `value` is a DOM element.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a DOM element, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is a DOM element, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2234,7 +2270,7 @@ Checks if `value` is empty. Arrays, strings, or `arguments` objects with a lengt
|
|||||||
1. `value` *(Array|Object|String)*: The value to inspect.
|
1. `value` *(Array|Object|String)*: The value to inspect.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is empty, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is empty, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2265,7 +2301,7 @@ Performs a deep comparison between two values to determine if they are equivalen
|
|||||||
2. `b` *(Mixed)*: The other value to compare.
|
2. `b` *(Mixed)*: The other value to compare.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the values are equvalent, else `false`.
|
*(Boolean)*: Returns `true`, if the values are equvalent, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2297,7 +2333,7 @@ Note: This is not the same as native `isFinite`, which will return true for bool
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a finite number, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is finite, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2333,7 +2369,7 @@ Checks if `value` is a function.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a function, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is a function, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2359,7 +2395,7 @@ Note: This is not the same as native `isNaN`, which will return `true` for `unde
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is `NaN`, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is `NaN`, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2392,7 +2428,7 @@ Checks if `value` is `null`.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is `null`, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is `null`, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2419,7 +2455,7 @@ Checks if `value` is a number.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a number, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is a number, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2443,7 +2479,7 @@ Checks if `value` is the language type of Object. *(e.g. arrays, functions, obje
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is an object, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is an object, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2473,7 +2509,7 @@ Checks if a given `value` is an object created by the `Object` constructor.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if `value` is a plain object, else `false`.
|
*(Boolean)*: Returns `true`, if `value` is a plain object, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2508,7 +2544,7 @@ Checks if `value` is a regular expression.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a regular expression, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is a regular expression, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2532,7 +2568,7 @@ Checks if `value` is a string.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is a string, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is a string, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2556,7 +2592,7 @@ Checks if `value` is `undefined`.
|
|||||||
1. `value` *(Mixed)*: The value to check.
|
1. `value` *(Mixed)*: The value to check.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Boolean)*: Returns `true` if the `value` is `undefined`, else `false`.
|
*(Boolean)*: Returns `true`, if the `value` is `undefined`, else `false`.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -2748,7 +2784,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_escapestring"></a>`_.escape(string)`
|
### <a id="_escapestring"></a>`_.escape(string)`
|
||||||
<a href="#_escapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3818 "View in source") [Ⓣ][1]
|
<a href="#_escapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3906 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
|
Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities.
|
||||||
|
|
||||||
@@ -2772,7 +2808,7 @@ _.escape('Moe, Larry & Curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_identityvalue"></a>`_.identity(value)`
|
### <a id="_identityvalue"></a>`_.identity(value)`
|
||||||
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3836 "View in source") [Ⓣ][1]
|
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3924 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
This function returns the first argument passed to it.
|
This function returns the first argument passed to it.
|
||||||
|
|
||||||
@@ -2797,7 +2833,7 @@ moe === _.identity(moe);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mixinobject"></a>`_.mixin(object)`
|
### <a id="_mixinobject"></a>`_.mixin(object)`
|
||||||
<a href="#_mixinobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3862 "View in source") [Ⓣ][1]
|
<a href="#_mixinobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3950 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
|
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
|
||||||
|
|
||||||
@@ -2827,7 +2863,7 @@ _('curly').capitalize();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_noconflict"></a>`_.noConflict()`
|
### <a id="_noconflict"></a>`_.noConflict()`
|
||||||
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3886 "View in source") [Ⓣ][1]
|
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3974 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
|
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
|
||||||
|
|
||||||
@@ -2847,7 +2883,7 @@ var lodash = _.noConflict();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_randommin0-max1"></a>`_.random([min=0, max=1])`
|
### <a id="_randommin0-max1"></a>`_.random([min=0, max=1])`
|
||||||
<a href="#_randommin0-max1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3909 "View in source") [Ⓣ][1]
|
<a href="#_randommin0-max1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3997 "View in source") [Ⓣ][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.
|
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.
|
||||||
|
|
||||||
@@ -2875,9 +2911,9 @@ _.random(5);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_resultobject-property"></a>`_.result(object, property)`
|
### <a id="_resultobject-property"></a>`_.result(object, property)`
|
||||||
<a href="#_resultobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3947 "View in source") [Ⓣ][1]
|
<a href="#_resultobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4035 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
|
Resolves the value of `property` on `object`. If `property` is a function, it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `object` *(Object)*: The object to inspect.
|
1. `object` *(Object)*: The object to inspect.
|
||||||
@@ -2910,7 +2946,7 @@ _.result(object, 'stuff');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
|
### <a id="_templatetext-data-options"></a>`_.template(text, data, options)`
|
||||||
<a href="#_templatetext-data-options">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4032 "View in source") [Ⓣ][1]
|
<a href="#_templatetext-data-options">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4120 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code.
|
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code.
|
||||||
|
|
||||||
@@ -2988,7 +3024,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
|
### <a id="_timesn-callback--thisarg"></a>`_.times(n, callback [, thisArg])`
|
||||||
<a href="#_timesn-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1]
|
<a href="#_timesn-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4256 "View in source") [Ⓣ][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)*.
|
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)*.
|
||||||
|
|
||||||
@@ -3020,7 +3056,7 @@ _.times(3, function(n) { this.cast(n); }, mage);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_unescapestring"></a>`_.unescape(string)`
|
### <a id="_unescapestring"></a>`_.unescape(string)`
|
||||||
<a href="#_unescapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4194 "View in source") [Ⓣ][1]
|
<a href="#_unescapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4282 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
|
The opposite of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters.
|
||||||
|
|
||||||
@@ -3044,7 +3080,7 @@ _.unescape('Moe, Larry & Curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
|
### <a id="_uniqueidprefix"></a>`_.uniqueId([prefix])`
|
||||||
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4214 "View in source") [Ⓣ][1]
|
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4302 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Generates a unique ID. If `prefix` is passed, the ID will be appended to it.
|
Generates a unique ID. If `prefix` is passed, the ID will be appended to it.
|
||||||
|
|
||||||
@@ -3097,7 +3133,7 @@ A reference to the `lodash` function.
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_version"></a>`_.VERSION`
|
### <a id="_version"></a>`_.VERSION`
|
||||||
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4441 "View in source") [Ⓣ][1]
|
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4529 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(String)*: The semantic version number.
|
*(String)*: The semantic version number.
|
||||||
|
|
||||||
|
|||||||
226
lodash.js
226
lodash.js
@@ -494,7 +494,7 @@
|
|||||||
* @param {Mixed} value The value to search for.
|
* @param {Mixed} value The value to search for.
|
||||||
* @param {Number} [fromIndex=0] The index to search from.
|
* @param {Number} [fromIndex=0] The index to search from.
|
||||||
* @param {Number} [largeSize=30] The length at which an array is considered large.
|
* @param {Number} [largeSize=30] The length at which an array is considered large.
|
||||||
* @returns {Boolean} Returns `true` if `value` is found, else `false`.
|
* @returns {Boolean} Returns `true`, if `value` is found, else `false`.
|
||||||
*/
|
*/
|
||||||
function cachedContains(array, fromIndex, largeSize) {
|
function cachedContains(array, fromIndex, largeSize) {
|
||||||
fromIndex || (fromIndex = 0);
|
fromIndex || (fromIndex = 0);
|
||||||
@@ -845,7 +845,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* (function() { return _.isArguments(arguments); })(1, 2, 3);
|
* (function() { return _.isArguments(arguments); })(1, 2, 3);
|
||||||
@@ -946,7 +946,7 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if `value` is a plain object, else `false`.
|
* @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
|
||||||
*/
|
*/
|
||||||
function shimIsPlainObject(value) {
|
function shimIsPlainObject(value) {
|
||||||
// avoid non-objects and false positives for `arguments` objects
|
// avoid non-objects and false positives for `arguments` objects
|
||||||
@@ -1244,7 +1244,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is an array, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* (function() { return _.isArray(arguments); })();
|
* (function() { return _.isArray(arguments); })();
|
||||||
@@ -1260,13 +1260,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is a boolean (`true` or `false`) value.
|
* Checks if `value` is a boolean value.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a boolean value, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isBoolean(null);
|
* _.isBoolean(null);
|
||||||
@@ -1283,7 +1283,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a date, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a date, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isDate(new Date);
|
* _.isDate(new Date);
|
||||||
@@ -1300,7 +1300,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a DOM element, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isElement(document.body);
|
* _.isElement(document.body);
|
||||||
@@ -1319,7 +1319,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Array|Object|String} value The value to inspect.
|
* @param {Array|Object|String} value The value to inspect.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is empty, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is empty, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isEmpty([1, 2, 3]);
|
* _.isEmpty([1, 2, 3]);
|
||||||
@@ -1361,7 +1361,7 @@
|
|||||||
* @param {Mixed} b The other value to compare.
|
* @param {Mixed} b The other value to compare.
|
||||||
* @param- {Object} [stackA=[]] Internally used track traversed `a` objects.
|
* @param- {Object} [stackA=[]] Internally used track traversed `a` objects.
|
||||||
* @param- {Object} [stackB=[]] Internally used track traversed `b` objects.
|
* @param- {Object} [stackB=[]] Internally used track traversed `b` objects.
|
||||||
* @returns {Boolean} Returns `true` if the values are equvalent, else `false`.
|
* @returns {Boolean} Returns `true`, if the values are equvalent, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var moe = { 'name': 'moe', 'luckyNumbers': [13, 27, 34] };
|
* var moe = { 'name': 'moe', 'luckyNumbers': [13, 27, 34] };
|
||||||
@@ -1506,7 +1506,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a finite number, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is finite, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isFinite(-101);
|
* _.isFinite(-101);
|
||||||
@@ -1535,7 +1535,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a function, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a function, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isFunction(_);
|
* _.isFunction(_);
|
||||||
@@ -1559,7 +1559,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is an object, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is an object, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isObject({});
|
* _.isObject({});
|
||||||
@@ -1589,7 +1589,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is `NaN`, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isNaN(NaN);
|
* _.isNaN(NaN);
|
||||||
@@ -1617,7 +1617,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is `null`, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isNull(null);
|
* _.isNull(null);
|
||||||
@@ -1637,7 +1637,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a number, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a number, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isNumber(8.4 * 5);
|
* _.isNumber(8.4 * 5);
|
||||||
@@ -1654,7 +1654,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if `value` is a plain object, else `false`.
|
* @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* function Stooge(name, age) {
|
* function Stooge(name, age) {
|
||||||
@@ -1690,7 +1690,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a regular expression, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isRegExp(/moe/);
|
* _.isRegExp(/moe/);
|
||||||
@@ -1707,7 +1707,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a string, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a string, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isString('moe');
|
* _.isString('moe');
|
||||||
@@ -1724,7 +1724,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is `undefined`, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isUndefined(void 0);
|
* _.isUndefined(void 0);
|
||||||
@@ -2273,7 +2273,7 @@
|
|||||||
/**
|
/**
|
||||||
* Invokes the method named by `methodName` on each element in the `collection`,
|
* Invokes the method named by `methodName` on each element in the `collection`,
|
||||||
* returning an array of the results of each invoked method. Additional arguments
|
* 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
|
* 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`.
|
* be invoked for, and `this` bound to, each element in the `collection`.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -2828,30 +2828,51 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the first element of the `array`. Pass `n` to return the first `n`
|
* Gets the first element of the `array`. If a number `n` is passed, the first
|
||||||
* elements of the `array`.
|
* `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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @alias head, take
|
* @alias head, take
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n] The number of elements to return.
|
* @param {Function|Number} [callback|n] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to return.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Mixed} Returns the first element, or an array of the first `n`
|
* @returns {Mixed} Returns the first element(s) of `array`.
|
||||||
* elements, of `array`.
|
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.first([5, 4, 3, 2, 1]);
|
* _.first([1, 2, 3]);
|
||||||
* // => 5
|
* // => 1
|
||||||
|
*
|
||||||
|
* _.first([1, 2, 3], 2);
|
||||||
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* _.first([1, 2, 3], function(num) {
|
||||||
|
* return num < 3;
|
||||||
|
* });
|
||||||
|
* // => [1, 2]
|
||||||
*/
|
*/
|
||||||
function first(array, n, guard) {
|
function first(array, callback, thisArg) {
|
||||||
if (array) {
|
if (array) {
|
||||||
var length = array.length;
|
var n = 0,
|
||||||
return (n == null || guard)
|
length = array.length;
|
||||||
? array[0]
|
|
||||||
: slice(array, 0, nativeMin(nativeMax(0, n), length));
|
if (typeof callback == 'function') {
|
||||||
|
var index = -1;
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (++index < length && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = callback;
|
||||||
|
if (n == null || thisArg) {
|
||||||
|
return array[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return slice(array, 0, nativeMin(nativeMax(0, n), length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2934,28 +2955,49 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all but the last element of `array`. Pass `n` to exclude the last `n`
|
* Gets all but the last element of `array`. If a number `n` is passed, the
|
||||||
* elements from the result.
|
* 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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n=1] The number of elements to exclude.
|
* @param {Function|Number} [callback|n=1] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to exclude.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Array} Returns all but the last element, or `n` elements, of `array`.
|
* @returns {Array} Returns a slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.initial([3, 2, 1]);
|
* _.initial([1, 2, 3]);
|
||||||
* // => [3, 2]
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* _.initial([1, 2, 3], 2);
|
||||||
|
* // => [1]
|
||||||
|
*
|
||||||
|
* _.initial([1, 2, 3], function(num) {
|
||||||
|
* return num > 1;
|
||||||
|
* });
|
||||||
|
* // => [1]
|
||||||
*/
|
*/
|
||||||
function initial(array, n, guard) {
|
function initial(array, callback, thisArg) {
|
||||||
if (!array) {
|
if (!array) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
var length = array.length;
|
var n = 0,
|
||||||
n = n == null || guard ? 1 : n || 0;
|
length = array.length;
|
||||||
|
|
||||||
|
if (typeof callback == 'function') {
|
||||||
|
var index = length;
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (index-- && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = (callback == null || thisArg) ? 1 : callback || n;
|
||||||
|
}
|
||||||
return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
|
return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3010,27 +3052,50 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the last element of the `array`. Pass `n` to return the last `n`
|
* Gets the last element of the `array`. If a number `n` is passed, the last
|
||||||
* elements of the `array`.
|
* `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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n] The number of elements to return.
|
* @param {Function|Number} [callback|n] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to return.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Mixed} Returns the last element, or an array of the last `n`
|
* @returns {Mixed} Returns the last element(s) of `array`.
|
||||||
* elements, of `array`.
|
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.last([3, 2, 1]);
|
* _.last([1, 2, 3]);
|
||||||
* // => 1
|
* // => 3
|
||||||
|
*
|
||||||
|
* _.last([1, 2, 3], 2);
|
||||||
|
* // => [2, 3]
|
||||||
|
*
|
||||||
|
* _.last([1, 2, 3], function(num) {
|
||||||
|
* return num > 1;
|
||||||
|
* });
|
||||||
|
* // => [2, 3]
|
||||||
*/
|
*/
|
||||||
function last(array, n, guard) {
|
function last(array, callback, thisArg) {
|
||||||
if (array) {
|
if (array) {
|
||||||
var length = array.length;
|
var n = 0,
|
||||||
return (n == null || guard) ? array[length - 1] : slice(array, nativeMax(0, length - n));
|
length = array.length;
|
||||||
|
|
||||||
|
if (typeof callback == 'function') {
|
||||||
|
var index = length;
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (index-- && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = callback;
|
||||||
|
if (n == null || thisArg) {
|
||||||
|
return array[length - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return slice(array, nativeMax(0, length - n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3151,25 +3216,48 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The opposite of `_.initial`, this method gets all but the first value of
|
* The opposite of `_.initial`, this method gets all but the first value of `array`.
|
||||||
* `array`. Pass `n` to exclude the first `n` values from the result.
|
* 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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @alias drop, tail
|
* @alias drop, tail
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n=1] The number of elements to exclude.
|
* @param {Function|Number} [callback|n=1] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to exclude.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Array} Returns all but the first element, or `n` elements, of `array`.
|
* @returns {Array} Returns a slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.rest([3, 2, 1]);
|
* _.rest([1, 2, 3]);
|
||||||
* // => [2, 1]
|
* // => [2, 3]
|
||||||
|
*
|
||||||
|
* _.rest([1, 2, 3], 2);
|
||||||
|
* // => [3]
|
||||||
|
*
|
||||||
|
* _.rest([1, 2, 3], function(num) {
|
||||||
|
* return num < 3;
|
||||||
|
* });
|
||||||
|
* // => [3]
|
||||||
*/
|
*/
|
||||||
function rest(array, n, guard) {
|
function rest(array, callback, thisArg) {
|
||||||
return slice(array, (n == null || guard) ? 1 : nativeMax(0, n));
|
if (typeof callback == 'function') {
|
||||||
|
var n = 0,
|
||||||
|
index = -1,
|
||||||
|
length = array ? array.length : 0;
|
||||||
|
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (++index < length && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
|
||||||
|
}
|
||||||
|
return slice(array, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3919,7 +4007,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves the value of `property` on `object`. If `property` is a function
|
* 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
|
* it will be invoked and its result returned, else the property value is
|
||||||
* returned. If `object` is falsey, then `null` is returned.
|
* returned. If `object` is falsey, then `null` is returned.
|
||||||
*
|
*
|
||||||
|
|||||||
35
lodash.min.js
vendored
35
lodash.min.js
vendored
@@ -14,26 +14,27 @@ 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
|
|||||||
if(t&&((u=yr(t))||mr(t))){for(var f=i.length;f--;)if(e=i[f]==t){n[r]=a[f];break}e||(i.push(t),a.push((o=n[r],o=u?yr(o)?o:[]:mr(o)?o:{})),n[r]=S(o,t,ot,i,a))}else 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(t&&((u=yr(t))||mr(t))){for(var f=i.length;f--;)if(e=i[f]==t){n[r]=a[f];break}e||(i.push(t),a.push((o=n[r],o=u?yr(o)?o:[]:mr(o)?o:{})),n[r]=S(o,t,ot,i,a))}else 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
|
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)
|
}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=n.length;return t==W||r?n[0]:v(n,0,Tt(It(0,t),e))
|
}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++;
|
||||||
}}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){return v(n,t==W||r?1:It(0,t))}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);
|
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;
|
||||||
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__
|
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__];
|
||||||
}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;
|
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"};
|
(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):[]
|
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={"&":"&","<":"<",">":">",'"':""","'":"'"},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
|
}:m,vr={"&":"&","<":"<",">":">",'"':""","'":"'"},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
|
||||||
}},r.assign=cr,r.at=function(n){var t=-1,r=xt.apply(rt,v(arguments,1)),e=r.length,u=Array(e);for(Yt&&A(n)&&(n=n.split(""));++t<e;)u[t]=n[r[t]];return u},r.bind=V,r.bindAll=function(n){for(var t=arguments,r=1<t.length?0:(t=d(n),-1),e=t.length;++r<e;){var u=t[r];n[u]=V(n[u],n)}return n},r.bindKey=function(n,t){return i(n,t,v(arguments,2))},r.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},r.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];
|
}},r.assign=cr,r.at=function(n){var t=-1,r=xt.apply(rt,v(arguments,1)),e=r.length,u=Array(e);for(Yt&&A(n)&&(n=n.split(""));++t<e;)u[t]=n[r[t]];return u},r.bind=V,r.bindAll=function(n){for(var t=arguments,r=1<t.length?0:(t=d(n),-1),e=t.length;++r<e;){var u=t[r];n[u]=V(n[u],n)}return n},r.bindKey=function(n,t){return i(n,t,v(arguments,2))},r.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},r.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];
|
||||||
return t[0]}},r.countBy=function(n,t,r){var e={},t=a(t,r);return R(n,function(n,r,u){r=t(n,r,u)+"",St.call(e,r)?e[r]++:e[r]=1}),e},r.debounce=function(n,t,r){function e(){a=W,r||(o=n.apply(i,u))}var u,o,i,a;return function(){var f=r&&!a;return u=arguments,i=this,clearTimeout(a),a=setTimeout(e,t),f&&(o=n.apply(i,u)),o}},r.defaults=hr,r.defer=function(n){var r=v(arguments,1);return setTimeout(function(){n.apply(t,r)},1)},r.delay=function(n,r){var e=v(arguments,2);return setTimeout(function(){n.apply(t,e)
|
return t[0]}},r.countBy=function(n,t,r){var e={},t=a(t,r);return R(n,function(n,r,u){r=t(n,r,u)+"",St.call(e,r)?e[r]++:e[r]=1}),e},r.debounce=function(n,t,r){function e(){a=W,r||(o=n.apply(i,u))}var u,o,i,a;return function(){var f=r&&!a;return u=arguments,i=this,clearTimeout(a),a=setTimeout(e,t),f&&(o=n.apply(i,u)),o}},r.defaults=hr,r.defer=function(n){var r=v(arguments,1);return setTimeout(function(){n.apply(t,r)},1)},r.delay=function(n,r){var e=v(arguments,2);return setTimeout(function(){n.apply(t,e)
|
||||||
},r)},r.difference=function(n){for(var t=-1,r=n?n.length:0,u=xt.apply(rt,arguments),u=e(u,r),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.filter=q,r.flatten=z,r.forEach=R,r.forIn=lr,r.forOwn=pr,r.functions=d,r.groupBy=function(n,t,r){var e={},t=a(t,r);return R(n,function(n,r,u){r=t(n,r,u)+"",(St.call(e,r)?e[r]:e[r]=[]).push(n)}),e},r.initial=function(n,t,r){if(!n)return[];var e=n.length;return v(n,0,Tt(It(0,e-(t==W||r?1:t||0)),e))},r.intersection=function(n){var t=arguments,r=t.length,u={0:{}},o=-1,i=n?n.length:0,a=100<=i,f=[],c=f;
|
},r)},r.difference=function(n){for(var t=-1,r=n?n.length:0,u=xt.apply(rt,arguments),u=e(u,r),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.filter=q,r.flatten=z,r.forEach=R,r.forIn=lr,r.forOwn=pr,r.functions=d,r.groupBy=function(n,t,r){var e={},t=a(t,r);return R(n,function(n,r,u){r=t(n,r,u)+"",(St.call(e,r)?e[r]:e[r]=[]).push(n)}),e},r.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t=="function")for(var o=u,t=a(t,r);o--&&t(n[o],o,n);)e++;else e=t==W||r?1:t||e;return v(n,0,Tt(It(0,u-e),u))
|
||||||
n:for(;++o<i;){var l=n[o];if(a)var p=l+"",p=St.call(u[0],p)?!(c=u[0][p]):c=u[0][p]=[];if(p||0>C(c,l)){a&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;f.push(l)}}return f},r.invert=b,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return R(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=sr,r.map=F,r.max=D,r.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";
|
},r.intersection=function(n){var t=arguments,r=t.length,u={0:{}},o=-1,i=n?n.length:0,a=100<=i,f=[],c=f;n:for(;++o<i;){var l=n[o];if(a)var p=l+"",p=St.call(u[0],p)?!(c=u[0][p]):c=u[0][p]=[];if(p||0>C(c,l)){a&&c.push(l);for(var s=r;--s;)if(!(u[s]||(u[s]=e(t[s],0,100)))(l))continue n;f.push(l)}}return f},r.invert=b,r.invoke=function(n,t){var r=v(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return R(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},r.keys=sr,r.map=F,r.max=D,r.memoize=function(n,t){var r={};
|
||||||
return St.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=S,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&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},r.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var o=n[r];t?u[o]=t[r]:u[o[0]]=o[1]}return u},r.omit=function(n,t,r){var e=typeof t=="function",u={};if(e)t=a(t,r);else var o=xt.apply(rt,arguments);return lr(n,function(n,r,i){(e?!t(n,r,i):0>C(o,r,1))&&(u[r]=n)
|
return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return St.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},r.merge=S,r.min=function(n,t,r){var e=1/0,o=e;if(!t&&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},r.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var o=n[r];t?u[o]=t[r]:u[o[0]]=o[1]}return u},r.omit=function(n,t,r){var e=typeof t=="function",u={};if(e)t=a(t,r);else var o=xt.apply(rt,arguments);
|
||||||
}),u},r.once=function(n){var t,r;return function(){return t?r:(t=Q,r=n.apply(this,arguments),n=W,r)}},r.pairs=function(n){for(var t=-1,r=sr(n),e=r.length,u=Array(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},r.partial=function(n){return i(n,v(arguments,1))},r.pick=function(n,t,r){var e={};if(typeof t!="function")for(var u=0,o=xt.apply(rt,arguments),i=o.length;++u<i;){var f=o[u];f in n&&(e[f]=n[f])}else t=a(t,r),lr(n,function(n,r,u){t(n,r,u)&&(e[r]=n)});return e},r.pluck=I,r.range=function(n,t,r){n=+n||0,r=+r||1,t==W&&(t=n,n=0);
|
return lr(n,function(n,r,i){(e?!t(n,r,i):0>C(o,r,1))&&(u[r]=n)}),u},r.once=function(n){var t,r;return function(){return t?r:(t=Q,r=n.apply(this,arguments),n=W,r)}},r.pairs=function(n){for(var t=-1,r=sr(n),e=r.length,u=Array(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},r.partial=function(n){return i(n,v(arguments,1))},r.pick=function(n,t,r){var e={};if(typeof t!="function")for(var u=0,o=xt.apply(rt,arguments),i=o.length;++u<i;){var f=o[u];f in n&&(e[f]=n[f])}else t=a(t,r),lr(n,function(n,r,u){t(n,r,u)&&(e[r]=n)
|
||||||
for(var e=-1,t=It(0,jt((t-n)/r)),u=Array(t);++e<t;)u[e]=n,n+=r;return u},r.reject=function(n,t,r){return t=a(t,r),q(n,function(n,r,e){return!t(n,r,e)})},r.rest=K,r.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return R(n,function(n){var r=Ot(Bt()*(++t+1));e[t]=e[r],e[r]=n}),e},r.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,i=Array(typeof u=="number"?u:0),t=a(t,r);for(R(n,function(n,r,u){i[++e]={a:t(n,r,u),b:e,c:n}}),u=i.length,i.sort(o);u--;)i[u]=i[u].c;return i},r.tap=function(n,t){return t(n),n
|
});return e},r.pluck=I,r.range=function(n,t,r){n=+n||0,r=+r||1,t==W&&(t=n,n=0);for(var e=-1,t=It(0,jt((t-n)/r)),u=Array(t);++e<t;)u[e]=n,n+=r;return u},r.reject=function(n,t,r){return t=a(t,r),q(n,function(n,r,e){return!t(n,r,e)})},r.rest=K,r.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return R(n,function(n){var r=Ot(Bt()*(++t+1));e[t]=e[r],e[r]=n}),e},r.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,i=Array(typeof u=="number"?u:0),t=a(t,r);for(R(n,function(n,r,u){i[++e]={a:t(n,r,u),b:e,c:n}
|
||||||
},r.throttle=function(n,t){function r(){a=new Date,i=W,u=n.apply(o,e)}var e,u,o,i,a=0;return function(){var f=new Date,c=t-(f-a);return e=arguments,o=this,0<c?i||(i=setTimeout(r,c)):(clearTimeout(i),i=W,a=f,u=n.apply(o,e)),u}},r.times=function(n,t,r){for(var n=+n||0,e=-1,u=Array(n);++e<n;)u[e]=t.call(r,e);return u},r.toArray=function(n){return n&&typeof n.length=="number"?Yt&&A(n)?n.split(""):v(n):E(n)},r.union=function(){return U(xt.apply(rt,arguments))},r.uniq=U,r.values=E,r.where=function(n,t){return q(n,t)
|
}),u=i.length,i.sort(o);u--;)i[u]=i[u].c;return i},r.tap=function(n,t){return t(n),n},r.throttle=function(n,t){function r(){a=new Date,i=W,u=n.apply(o,e)}var e,u,o,i,a=0;return function(){var f=new Date,c=t-(f-a);return e=arguments,o=this,0<c?i||(i=setTimeout(r,c)):(clearTimeout(i),i=W,a=f,u=n.apply(o,e)),u}},r.times=function(n,t,r){for(var n=+n||0,e=-1,u=Array(n);++e<n;)u[e]=t.call(r,e);return u},r.toArray=function(n){return n&&typeof n.length=="number"?Yt&&A(n)?n.split(""):v(n):E(n)},r.union=function(){return U(xt.apply(rt,arguments))
|
||||||
},r.without=function(n){for(var t=-1,r=n?n.length:0,u=e(arguments,1,20),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.wrap=function(n,t){return function(){var r=[n];return Et.apply(r,arguments),t.apply(this,r)}},r.zip=function(n){for(var t=-1,r=n?D(I(arguments,"length")):0,e=Array(r);++t<r;)e[t]=I(arguments,t);return e},r.collect=F,r.drop=K,r.each=R,r.extend=cr,r.methods=d,r.select=q,r.tail=K,r.unique=U,H(r),r.clone=_,r.cloneDeep=function(n){return _(n,Q)},r.contains=k,r.escape=function(n){return n==W?"":(n+"").replace(dt,l)
|
},r.uniq=U,r.values=E,r.where=function(n,t){return q(n,t)},r.without=function(n){for(var t=-1,r=n?n.length:0,u=e(arguments,1,20),o=[];++t<r;){var i=n[t];u(i)||o.push(i)}return o},r.wrap=function(n,t){return function(){var r=[n];return Et.apply(r,arguments),t.apply(this,r)}},r.zip=function(n){for(var t=-1,r=n?D(I(arguments,"length")):0,e=Array(r);++t<r;)e[t]=I(arguments,t);return e},r.collect=F,r.drop=K,r.each=R,r.extend=cr,r.methods=d,r.select=q,r.tail=K,r.unique=U,H(r),r.clone=_,r.cloneDeep=function(n){return _(n,Q)
|
||||||
},r.every=$,r.find=N,r.has=function(n,t){return n?St.call(n,t):X},r.identity=G,r.indexOf=C,r.isArguments=h,r.isArray=yr,r.isBoolean=function(n){return n===Q||n===X||$t.call(n)==zt},r.isDate=function(n){return n instanceof Date||$t.call(n)==Ct},r.isElement=function(n){return n?1===n.nodeType:X},r.isEmpty=function(n){var t=Q;if(!n)return t;var r=$t.call(n),e=n.length;return r==Pt||r==Vt||r==Mt||Xt&&h(n)||r==Lt&&typeof e=="number"&&j(n.splice)?!e:(pr(n,function(){return t=X}),t)},r.isEqual=w,r.isFinite=function(n){return Rt(n)&&!Ft(parseFloat(n))
|
},r.contains=k,r.escape=function(n){return n==W?"":(n+"").replace(dt,l)},r.every=$,r.find=N,r.has=function(n,t){return n?St.call(n,t):X},r.identity=G,r.indexOf=C,r.isArguments=h,r.isArray=yr,r.isBoolean=function(n){return n===Q||n===X||$t.call(n)==zt},r.isDate=function(n){return n instanceof Date||$t.call(n)==Ct},r.isElement=function(n){return n?1===n.nodeType:X},r.isEmpty=function(n){var t=Q;if(!n)return t;var r=$t.call(n),e=n.length;return r==Pt||r==Vt||r==Mt||Xt&&h(n)||r==Lt&&typeof e=="number"&&j(n.splice)?!e:(pr(n,function(){return t=X
|
||||||
},r.isFunction=j,r.isNaN=function(n){return O(n)&&n!=+n},r.isNull=function(n){return n===W},r.isNumber=O,r.isObject=x,r.isPlainObject=mr,r.isRegExp=function(n){return n instanceof RegExp||$t.call(n)==Ut},r.isString=A,r.isUndefined=function(n){return typeof n=="undefined"},r.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?It(0,e+r):Tt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=H,r.noConflict=function(){return n._=at,this},r.random=function(n,t){return n==W&&t==W&&(t=1),n=+n||0,t==W&&(t=n,n=0),n+Ot(Bt()*((+t||0)-n+1))
|
}),t)},r.isEqual=w,r.isFinite=function(n){return Rt(n)&&!Ft(parseFloat(n))},r.isFunction=j,r.isNaN=function(n){return O(n)&&n!=+n},r.isNull=function(n){return n===W},r.isNumber=O,r.isObject=x,r.isPlainObject=mr,r.isRegExp=function(n){return n instanceof RegExp||$t.call(n)==Ut},r.isString=A,r.isUndefined=function(n){return typeof n=="undefined"},r.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?It(0,e+r):Tt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},r.mixin=H,r.noConflict=function(){return n._=at,this
|
||||||
},r.reduce=T,r.reduceRight=B,r.result=function(n,t){var r=n?n[t]:W;return j(r)?n[t]():r},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:sr(n).length},r.some=M,r.sortedIndex=L,r.template=function(n,e,u){var o=r.templateSettings;n||(n="");var u=hr({},u,o),i=hr({},u.imports,o.imports),o=sr(i),i=E(i),a=0,f=u.interpolate||_t,l=!(1==o.length&&"_"==o[0]&&i[0]===r),p="__p+='";if(n.replace(RegExp((u.escape||_t).source+"|"+f.source+"|"+(f===mt?yt:_t).source+"|"+(u.evaluate||_t).source+"|$","g"),function(t,r,e,u,o,i){return e||(e=u),p+=n.slice(a,i).replace(bt,c),r&&(p+="'+__e("+r+")+'"),o&&(p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),l||(l=o||ft.test(r||e)),a=i+t.length,t
|
},r.random=function(n,t){return n==W&&t==W&&(t=1),n=+n||0,t==W&&(t=n,n=0),n+Ot(Bt()*((+t||0)-n+1))},r.reduce=T,r.reduceRight=B,r.result=function(n,t){var r=n?n[t]:W;return j(r)?n[t]():r},r.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:sr(n).length},r.some=M,r.sortedIndex=L,r.template=function(n,e,u){var o=r.templateSettings;n||(n="");var u=hr({},u,o),i=hr({},u.imports,o.imports),o=sr(i),i=E(i),a=0,f=u.interpolate||_t,l=!(1==o.length&&"_"==o[0]&&i[0]===r),p="__p+='";if(n.replace(RegExp((u.escape||_t).source+"|"+f.source+"|"+(f===mt?yt:_t).source+"|"+(u.evaluate||_t).source+"|$","g"),function(t,r,e,u,o,i){return e||(e=u),p+=n.slice(a,i).replace(bt,c),r&&(p+="'+__e("+r+")+'"),o&&(p+="';"+o+";__p+='"),e&&(p+="'+((__t=("+e+"))==null?'':__t)+'"),l||(l=o||ft.test(r||e)),a=i+t.length,t
|
||||||
}),p+="';\n",f=u=u.variable,!f)if(u="obj",l)p="with("+u+"){"+p+"}";else var s=RegExp("(\\(\\s*)"+u+"\\."+u+"\\b","g"),p=p.replace(gt,"$&"+u+".").replace(s,"$1__d");p=(l?p.replace(lt,""):p).replace(pt,"$1").replace(st,"$1;"),p="function("+u+"){"+(f?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(l?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(f?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}";try{var v=Function(o,"return "+p).apply(t,i)}catch(g){throw g.source=p,g}return e?v(e):(v.source=p,v)
|
}),p+="';\n",f=u=u.variable,!f)if(u="obj",l)p="with("+u+"){"+p+"}";else var s=RegExp("(\\(\\s*)"+u+"\\."+u+"\\b","g"),p=p.replace(gt,"$&"+u+".").replace(s,"$1__d");p=(l?p.replace(lt,""):p).replace(pt,"$1").replace(st,"$1;"),p="function("+u+"){"+(f?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(l?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(f?"":",__d="+u+"."+u+"||"+u)+";")+p+"return __p}";try{var v=Function(o,"return "+p).apply(t,i)}catch(g){throw g.source=p,g}return e?v(e):(v.source=p,v)
|
||||||
},r.unescape=function(n){return n==W?"":(n+"").replace(ct,g)},r.uniqueId=function(n){var t=++ut;return(n==W?"":n+"")+t},r.all=$,r.any=M,r.detect=N,r.foldl=T,r.foldr=B,r.include=k,r.inject=T,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return Et.apply(t,arguments),n.apply(r,t)})}),r.first=P,r.last=function(n,t,r){if(n){var e=n.length;return t==W||r?n[e-1]:v(n,It(0,e-t))}},r.take=P,r.head=P,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);
|
},r.unescape=function(n){return n==W?"":(n+"").replace(ct,g)},r.uniqueId=function(n){var t=++ut;return(n==W?"":n+"")+t},r.all=$,r.any=M,r.detect=N,r.foldl=T,r.foldr=B,r.include=k,r.inject=T,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(){var t=[this.__wrapped__];return Et.apply(t,arguments),n.apply(r,t)})}),r.first=P,r.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function")for(var o=u,t=a(t,r);o--&&t(n[o],o,n);)e++;else if(e=t,e==W||r)return n[u-1];return v(n,It(0,u-e))
|
||||||
return t==W||e?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=J,r.prototype.valueOf=J,fr(["join","pop","shift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),fr(["push","reverse","sort","unshift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),fr(["concat","slice","splice"],function(n){var t=rt[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))
|
}},r.take=P,r.head=P,pr(r,function(n,t){r.prototype[t]||(r.prototype[t]=function(t,e){var u=n(this.__wrapped__,t,e);return t==W||e?u:new r(u)})}),r.VERSION="1.0.0-rc.3",r.prototype.toString=function(){return this.__wrapped__+""},r.prototype.value=J,r.prototype.valueOf=J,fr(["join","pop","shift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),fr(["push","reverse","sort","unshift"],function(n){var t=rt[n];r.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this
|
||||||
}}),Jt&&fr(["pop","shift","splice"],function(n){var t=rt[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r})):Y?typeof module=="object"&&module&&module.exports==Y?(module.exports=r)._=r:Y._=r:n._=r})(this);
|
}}),fr(["concat","slice","splice"],function(n){var t=rt[n];r.prototype[n]=function(){return new r(t.apply(this.__wrapped__,arguments))}}),Jt&&fr(["pop","shift","splice"],function(n){var t=rt[n],e="splice"==n;r.prototype[n]=function(){var n=this.__wrapped__,u=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new r(u):u}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=r,define(function(){return r})):Y?typeof module=="object"&&module&&module.exports==Y?(module.exports=r)._=r:Y._=r:n._=r
|
||||||
|
})(this);
|
||||||
@@ -635,7 +635,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* (function() { return _.isArguments(arguments); })(1, 2, 3);
|
* (function() { return _.isArguments(arguments); })(1, 2, 3);
|
||||||
@@ -752,7 +752,7 @@
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if `value` is a plain object, else `false`.
|
* @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
|
||||||
*/
|
*/
|
||||||
function shimIsPlainObject(value) {
|
function shimIsPlainObject(value) {
|
||||||
// avoid non-objects and false positives for `arguments` objects
|
// avoid non-objects and false positives for `arguments` objects
|
||||||
@@ -960,7 +960,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is an array, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* (function() { return _.isArray(arguments); })();
|
* (function() { return _.isArray(arguments); })();
|
||||||
@@ -976,13 +976,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is a boolean (`true` or `false`) value.
|
* Checks if `value` is a boolean value.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a boolean value, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isBoolean(null);
|
* _.isBoolean(null);
|
||||||
@@ -999,7 +999,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a date, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a date, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isDate(new Date);
|
* _.isDate(new Date);
|
||||||
@@ -1016,7 +1016,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a DOM element, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isElement(document.body);
|
* _.isElement(document.body);
|
||||||
@@ -1035,7 +1035,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Array|Object|String} value The value to inspect.
|
* @param {Array|Object|String} value The value to inspect.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is empty, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is empty, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isEmpty([1, 2, 3]);
|
* _.isEmpty([1, 2, 3]);
|
||||||
@@ -1073,7 +1073,7 @@
|
|||||||
* @param {Mixed} b The other value to compare.
|
* @param {Mixed} b The other value to compare.
|
||||||
* @param- {Object} [stackA=[]] Internally used track traversed `a` objects.
|
* @param- {Object} [stackA=[]] Internally used track traversed `a` objects.
|
||||||
* @param- {Object} [stackB=[]] Internally used track traversed `b` objects.
|
* @param- {Object} [stackB=[]] Internally used track traversed `b` objects.
|
||||||
* @returns {Boolean} Returns `true` if the values are equvalent, else `false`.
|
* @returns {Boolean} Returns `true`, if the values are equvalent, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var moe = { 'name': 'moe', 'luckyNumbers': [13, 27, 34] };
|
* var moe = { 'name': 'moe', 'luckyNumbers': [13, 27, 34] };
|
||||||
@@ -1212,7 +1212,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a finite number, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is finite, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isFinite(-101);
|
* _.isFinite(-101);
|
||||||
@@ -1241,7 +1241,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a function, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a function, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isFunction(_);
|
* _.isFunction(_);
|
||||||
@@ -1265,7 +1265,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is an object, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is an object, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isObject({});
|
* _.isObject({});
|
||||||
@@ -1295,7 +1295,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is `NaN`, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isNaN(NaN);
|
* _.isNaN(NaN);
|
||||||
@@ -1323,7 +1323,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is `null`, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isNull(null);
|
* _.isNull(null);
|
||||||
@@ -1343,7 +1343,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a number, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a number, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isNumber(8.4 * 5);
|
* _.isNumber(8.4 * 5);
|
||||||
@@ -1360,7 +1360,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a regular expression, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isRegExp(/moe/);
|
* _.isRegExp(/moe/);
|
||||||
@@ -1377,7 +1377,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is a string, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is a string, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isString('moe');
|
* _.isString('moe');
|
||||||
@@ -1394,7 +1394,7 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Objects
|
* @category Objects
|
||||||
* @param {Mixed} value The value to check.
|
* @param {Mixed} value The value to check.
|
||||||
* @returns {Boolean} Returns `true` if the `value` is `undefined`, else `false`.
|
* @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.isUndefined(void 0);
|
* _.isUndefined(void 0);
|
||||||
@@ -1804,7 +1804,7 @@
|
|||||||
/**
|
/**
|
||||||
* Invokes the method named by `methodName` on each element in the `collection`,
|
* Invokes the method named by `methodName` on each element in the `collection`,
|
||||||
* returning an array of the results of each invoked method. Additional arguments
|
* 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
|
* 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`.
|
* be invoked for, and `this` bound to, each element in the `collection`.
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
@@ -2350,30 +2350,51 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the first element of the `array`. Pass `n` to return the first `n`
|
* Gets the first element of the `array`. If a number `n` is passed, the first
|
||||||
* elements of the `array`.
|
* `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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @alias head, take
|
* @alias head, take
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n] The number of elements to return.
|
* @param {Function|Number} [callback|n] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to return.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Mixed} Returns the first element, or an array of the first `n`
|
* @returns {Mixed} Returns the first element(s) of `array`.
|
||||||
* elements, of `array`.
|
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.first([5, 4, 3, 2, 1]);
|
* _.first([1, 2, 3]);
|
||||||
* // => 5
|
* // => 1
|
||||||
|
*
|
||||||
|
* _.first([1, 2, 3], 2);
|
||||||
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* _.first([1, 2, 3], function(num) {
|
||||||
|
* return num < 3;
|
||||||
|
* });
|
||||||
|
* // => [1, 2]
|
||||||
*/
|
*/
|
||||||
function first(array, n, guard) {
|
function first(array, callback, thisArg) {
|
||||||
if (array) {
|
if (array) {
|
||||||
var length = array.length;
|
var n = 0,
|
||||||
return (n == null || guard)
|
length = array.length;
|
||||||
? array[0]
|
|
||||||
: slice(array, 0, nativeMin(nativeMax(0, n), length));
|
if (typeof callback == 'function') {
|
||||||
|
var index = -1;
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (++index < length && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = callback;
|
||||||
|
if (n == null || thisArg) {
|
||||||
|
return array[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return slice(array, 0, nativeMin(nativeMax(0, n), length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2456,28 +2477,49 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all but the last element of `array`. Pass `n` to exclude the last `n`
|
* Gets all but the last element of `array`. If a number `n` is passed, the
|
||||||
* elements from the result.
|
* 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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n=1] The number of elements to exclude.
|
* @param {Function|Number} [callback|n=1] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to exclude.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Array} Returns all but the last element, or `n` elements, of `array`.
|
* @returns {Array} Returns a slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.initial([3, 2, 1]);
|
* _.initial([1, 2, 3]);
|
||||||
* // => [3, 2]
|
* // => [1, 2]
|
||||||
|
*
|
||||||
|
* _.initial([1, 2, 3], 2);
|
||||||
|
* // => [1]
|
||||||
|
*
|
||||||
|
* _.initial([1, 2, 3], function(num) {
|
||||||
|
* return num > 1;
|
||||||
|
* });
|
||||||
|
* // => [1]
|
||||||
*/
|
*/
|
||||||
function initial(array, n, guard) {
|
function initial(array, callback, thisArg) {
|
||||||
if (!array) {
|
if (!array) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
var length = array.length;
|
var n = 0,
|
||||||
n = n == null || guard ? 1 : n || 0;
|
length = array.length;
|
||||||
|
|
||||||
|
if (typeof callback == 'function') {
|
||||||
|
var index = length;
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (index-- && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = (callback == null || thisArg) ? 1 : callback || n;
|
||||||
|
}
|
||||||
return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
|
return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2520,27 +2562,50 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the last element of the `array`. Pass `n` to return the last `n`
|
* Gets the last element of the `array`. If a number `n` is passed, the last
|
||||||
* elements of the `array`.
|
* `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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n] The number of elements to return.
|
* @param {Function|Number} [callback|n] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to return.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Mixed} Returns the last element, or an array of the last `n`
|
* @returns {Mixed} Returns the last element(s) of `array`.
|
||||||
* elements, of `array`.
|
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.last([3, 2, 1]);
|
* _.last([1, 2, 3]);
|
||||||
* // => 1
|
* // => 3
|
||||||
|
*
|
||||||
|
* _.last([1, 2, 3], 2);
|
||||||
|
* // => [2, 3]
|
||||||
|
*
|
||||||
|
* _.last([1, 2, 3], function(num) {
|
||||||
|
* return num > 1;
|
||||||
|
* });
|
||||||
|
* // => [2, 3]
|
||||||
*/
|
*/
|
||||||
function last(array, n, guard) {
|
function last(array, callback, thisArg) {
|
||||||
if (array) {
|
if (array) {
|
||||||
var length = array.length;
|
var n = 0,
|
||||||
return (n == null || guard) ? array[length - 1] : slice(array, nativeMax(0, length - n));
|
length = array.length;
|
||||||
|
|
||||||
|
if (typeof callback == 'function') {
|
||||||
|
var index = length;
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (index-- && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = callback;
|
||||||
|
if (n == null || thisArg) {
|
||||||
|
return array[length - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return slice(array, nativeMax(0, length - n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2661,25 +2726,48 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The opposite of `_.initial`, this method gets all but the first value of
|
* The opposite of `_.initial`, this method gets all but the first value of `array`.
|
||||||
* `array`. Pass `n` to exclude the first `n` values from the result.
|
* 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).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @alias drop, tail
|
* @alias drop, tail
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to query.
|
||||||
* @param {Number} [n=1] The number of elements to exclude.
|
* @param {Function|Number} [callback|n=1] The function called per element or
|
||||||
* @param- {Object} [guard] Internally used to allow this method to work with
|
* the number of elements to exclude.
|
||||||
* others like `_.map` without using their callback `index` argument for `n`.
|
* @param {Mixed} [thisArg] The `this` binding of `callback`.
|
||||||
* @returns {Array} Returns all but the first element, or `n` elements, of `array`.
|
* @returns {Array} Returns a slice of `array`.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.rest([3, 2, 1]);
|
* _.rest([1, 2, 3]);
|
||||||
* // => [2, 1]
|
* // => [2, 3]
|
||||||
|
*
|
||||||
|
* _.rest([1, 2, 3], 2);
|
||||||
|
* // => [3]
|
||||||
|
*
|
||||||
|
* _.rest([1, 2, 3], function(num) {
|
||||||
|
* return num < 3;
|
||||||
|
* });
|
||||||
|
* // => [3]
|
||||||
*/
|
*/
|
||||||
function rest(array, n, guard) {
|
function rest(array, callback, thisArg) {
|
||||||
return slice(array, (n == null || guard) ? 1 : nativeMax(0, n));
|
if (typeof callback == 'function') {
|
||||||
|
var n = 0,
|
||||||
|
index = -1,
|
||||||
|
length = array ? array.length : 0;
|
||||||
|
|
||||||
|
callback = createCallback(callback, thisArg);
|
||||||
|
while (++index < length && callback(array[index], index, array)) {
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
|
||||||
|
}
|
||||||
|
return slice(array, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3362,7 +3450,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves the value of `property` on `object`. If `property` is a function
|
* 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
|
* it will be invoked and its result returned, else the property value is
|
||||||
* returned. If `object` is falsey, then `null` is returned.
|
* returned. If `object` is falsey, then `null` is returned.
|
||||||
*
|
*
|
||||||
|
|||||||
31
lodash.underscore.min.js
vendored
31
lodash.underscore.min.js
vendored
@@ -12,21 +12,22 @@ case wt:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case xt:case Et:return n==t+""}if
|
|||||||
}),f&&e(t,function(n,t,r){return ft.call(r,t)?!(f=-1<--c)&&Y:void 0}),f}function b(n){return typeof n=="function"}function j(n){return n?kt[typeof n]:K}function w(n){return typeof n=="number"||lt.call(n)==wt}function A(n){return typeof n=="string"||lt.call(n)==Et}function x(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];return u}function E(n,t){var r=K;return typeof(n?n.length:0)=="number"?r=-1<I(n,t):u(n,function(n){return(r=n===t)&&Y}),r}function O(n,t,r){var e=H,t=f(t,r);if(Bt(n))for(var r=-1,o=n.length;++r<o&&(e=!!t(n[r],r,n)););else u(n,function(n,r,u){return!(e=!!t(n,r,u))&&Y
|
}),f&&e(t,function(n,t,r){return ft.call(r,t)?!(f=-1<--c)&&Y:void 0}),f}function b(n){return typeof n=="function"}function j(n){return n?kt[typeof n]:K}function w(n){return typeof n=="number"||lt.call(n)==wt}function A(n){return typeof n=="string"||lt.call(n)==Et}function x(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++t<e;)u[t]=n[r[t]];return u}function E(n,t){var r=K;return typeof(n?n.length:0)=="number"?r=-1<I(n,t):u(n,function(n){return(r=n===t)&&Y}),r}function O(n,t,r){var e=H,t=f(t,r);if(Bt(n))for(var r=-1,o=n.length;++r<o&&(e=!!t(n[r],r,n)););else u(n,function(n,r,u){return!(e=!!t(n,r,u))&&Y
|
||||||
});return e}function S(n,t,r){var e=[],t=f(t,r);if(Bt(n))for(var r=-1,o=n.length;++r<o;){var i=n[r];t(i,r,n)&&e.push(i)}else u(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e}function N(n,t,r){var e,t=f(t,r);return k(n,function(n,r,u){return t(n,r,u)?(e=n,Y):void 0}),e}function k(n,t,r){if(t&&typeof r=="undefined"&&Bt(n))for(var r=-1,e=n.length;++r<e&&t(n[r],r,n)!==Y;);else u(n,t,r)}function F(n,t,r){var e=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0),t=f(t,r);if(Bt(n))for(;++e<o;)i[e]=t(n[e],e,n);
|
});return e}function S(n,t,r){var e=[],t=f(t,r);if(Bt(n))for(var r=-1,o=n.length;++r<o;){var i=n[r];t(i,r,n)&&e.push(i)}else u(n,function(n,r,u){t(n,r,u)&&e.push(n)});return e}function N(n,t,r){var e,t=f(t,r);return k(n,function(n,r,u){return t(n,r,u)?(e=n,Y):void 0}),e}function k(n,t,r){if(t&&typeof r=="undefined"&&Bt(n))for(var r=-1,e=n.length;++r<e&&t(n[r],r,n)!==Y;);else u(n,t,r)}function F(n,t,r){var e=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0),t=f(t,r);if(Bt(n))for(;++e<o;)i[e]=t(n[e],e,n);
|
||||||
else u(n,function(n,r,u){i[++e]=t(n,r,u)});return i}function R(n,t,r){var e=-1/0,o=e;if(!t&&Bt(n))for(var r=-1,i=n.length;++r<i;){var a=n[r];a>o&&(o=a)}else t=f(t,r),u(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function T(n,t){return F(n,t+"")}function q(n,t,r,e){var o=3>arguments.length,t=f(t,e,Y);if(Bt(n)){var i=-1,a=n.length;for(o&&(r=n[++i]);++i<a;)r=t(r,n[i],i,n)}else u(n,function(n,e,u){r=o?(o=K,n):t(r,n,e,u)});return r}function B(n,t,r,e){var u=n?n.length:0,o=3>arguments.length;
|
else u(n,function(n,r,u){i[++e]=t(n,r,u)});return i}function R(n,t,r){var e=-1/0,o=e;if(!t&&Bt(n))for(var r=-1,i=n.length;++r<i;){var a=n[r];a>o&&(o=a)}else t=f(t,r),u(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n)});return o}function T(n,t){return F(n,t+"")}function q(n,t,r,e){var o=3>arguments.length,t=f(t,e,Y);if(Bt(n)){var i=-1,a=n.length;for(o&&(r=n[++i]);++i<a;)r=t(r,n[i],i,n)}else u(n,function(n,e,u){r=o?(o=K,n):t(r,n,e,u)});return r}function B(n,t,r,e){var u=n?n.length:0,o=3>arguments.length;
|
||||||
if(typeof u!="number")var i=Rt(n),u=i.length;return t=f(t,e,Y),k(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=K,n[a]):t(r,n[a],a,f)}),r}function D(n,t,r){var e,t=f(t,r);if(Bt(n))for(var r=-1,o=n.length;++r<o&&!(e=t(n[r],r,n)););else u(n,function(n,r,u){return(e=t(n,r,u))&&Y});return!!e}function M(n,t,r){if(n){var e=n.length;return t==J||r?n[0]:p(n,0,_t(yt(0,t),e))}}function $(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];Bt(o)?ct.apply(u,t?o:$(o)):u.push(o)}return u}function I(n,t,r){var e=-1,u=n?n.length:0;
|
if(typeof u!="number")var i=Rt(n),u=i.length;return t=f(t,e,Y),k(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=K,n[a]):t(r,n[a],a,f)}),r}function D(n,t,r){var e,t=f(t,r);if(Bt(n))for(var r=-1,o=n.length;++r<o&&!(e=t(n[r],r,n)););else u(n,function(n,r,u){return(e=t(n,r,u))&&Y});return!!e}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t=="function")for(var o=-1,t=f(t,r);++o<u&&t(n[o],o,n);)e++;else if(e=t,e==J||r)return n[0];return p(n,0,_t(yt(0,e),u))}}function $(n,t){for(var r=-1,e=n?n.length:0,u=[];++r<e;){var o=n[r];
|
||||||
if(typeof r=="number")e=(0>r?yt(0,u+r):r||0)-1;else if(r)return e=C(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function z(n,t,r){return p(n,t==J||r?1:yt(0,t))}function C(n,t,r,e){for(var u=0,o=n?n.length:u,r=r?f(r,e):V,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;return u}function P(n,t,r,e){var u=-1,o=n?n.length:0,i=[],a=i;for(typeof t=="function"&&(e=r,r=t,t=K),r&&(a=[],r=f(r,e));++u<o;){var e=n[u],c=r?r(e,u,n):e;(t?!u||a[a.length-1]!==c:0>I(a,c))&&(r&&a.push(c),i.push(e))}return i
|
Bt(o)?ct.apply(u,t?o:$(o)):u.push(o)}return u}function I(n,t,r){var e=-1,u=n?n.length:0;if(typeof r=="number")e=(0>r?yt(0,u+r):r||0)-1;else if(r)return e=C(n,t),n[e]===t?e:-1;for(;++e<u;)if(n[e]===t)return e;return-1}function z(n,t,r){if(typeof t=="function")for(var e=0,u=-1,o=n?n.length:0,t=f(t,r);++u<o&&t(n[u],u,n);)e++;else e=t==J||r?1:yt(0,t);return p(n,e)}function C(n,t,r,e){for(var u=0,o=n?n.length:u,r=r?f(r,e):V,t=r(t);u<o;)e=u+o>>>1,r(n[e])<t?u=e+1:o=e;return u}function P(n,t,r,e){var u=-1,o=n?n.length:0,i=[],a=i;
|
||||||
}function U(n,t){return Ot||st&&2<arguments.length?st.call.apply(st,arguments):a(n,t,p(arguments,2))}function V(n){return n}function G(n){k(_(n),function(t){var r=o[t]=n[t];o.prototype[t]=function(){var n=[this.__wrapped__];return ct.apply(n,arguments),n=r.apply(o,n),this.__chain__&&(n=new o(n),n.__chain__=H),n}})}var H=!0,J=null,K=!1,L=typeof exports=="object"&&exports,Q=typeof global=="object"&&global;Q.global===Q&&(n=Q);var W=[],Q=new function(){},X=0,Y=Q,Z=n._,nt=/&(?:amp|lt|gt|quot|#x27);/g,tt=RegExp("^"+(Q.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),rt=/($^)/,et=/[&<>"']/g,ut=/['\n\r\t\u2028\u2029\\]/g,ot=Math.ceil,it=W.concat,at=Math.floor,ft=Q.hasOwnProperty,ct=W.push,lt=Q.toString,st=tt.test(st=p.bind)&&st,pt=tt.test(pt=Array.isArray)&&pt,vt=n.isFinite,gt=n.isNaN,ht=tt.test(ht=Object.keys)&&ht,yt=Math.max,_t=Math.min,mt=Math.random,dt="[object Array]",bt="[object Boolean]",jt="[object Date]",wt="[object Number]",At="[object Object]",xt="[object RegExp]",Et="[object String]",Q=!!n.attachEvent,Ot=st&&/\n|true/.test(st+Q),St=(St={0:1,length:1},W.splice.call(St,0,1),St[0]),Nt=arguments.constructor==Object,kt={"boolean":K,"function":H,object:H,number:K,string:K,undefined:K},Ft={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};
|
for(typeof t=="function"&&(e=r,r=t,t=K),r&&(a=[],r=f(r,e));++u<o;){var e=n[u],c=r?r(e,u,n):e;(t?!u||a[a.length-1]!==c:0>I(a,c))&&(r&&a.push(c),i.push(e))}return i}function U(n,t){return Ot||st&&2<arguments.length?st.call.apply(st,arguments):a(n,t,p(arguments,2))}function V(n){return n}function G(n){k(_(n),function(t){var r=o[t]=n[t];o.prototype[t]=function(){var n=[this.__wrapped__];return ct.apply(n,arguments),n=r.apply(o,n),this.__chain__&&(n=new o(n),n.__chain__=H),n}})}var H=!0,J=null,K=!1,L=typeof exports=="object"&&exports,Q=typeof global=="object"&&global;
|
||||||
|
Q.global===Q&&(n=Q);var W=[],Q=new function(){},X=0,Y=Q,Z=n._,nt=/&(?:amp|lt|gt|quot|#x27);/g,tt=RegExp("^"+(Q.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),rt=/($^)/,et=/[&<>"']/g,ut=/['\n\r\t\u2028\u2029\\]/g,ot=Math.ceil,it=W.concat,at=Math.floor,ft=Q.hasOwnProperty,ct=W.push,lt=Q.toString,st=tt.test(st=p.bind)&&st,pt=tt.test(pt=Array.isArray)&&pt,vt=n.isFinite,gt=n.isNaN,ht=tt.test(ht=Object.keys)&&ht,yt=Math.max,_t=Math.min,mt=Math.random,dt="[object Array]",bt="[object Boolean]",jt="[object Date]",wt="[object Number]",At="[object Object]",xt="[object RegExp]",Et="[object String]",Q=!!n.attachEvent,Ot=st&&/\n|true/.test(st+Q),St=(St={0:1,length:1},W.splice.call(St,0,1),St[0]),Nt=arguments.constructor==Object,kt={"boolean":K,"function":H,object:H,number:K,string:K,undefined:K},Ft={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};
|
||||||
o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},o.isArguments=function(n){return"[object Arguments]"==lt.call(n)},o.isArguments(arguments)||(o.isArguments=function(n){return n?ft.call(n,"callee"):K});var Rt=ht?function(n){return j(n)?ht(n):[]}:h,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},qt=m(Tt),Bt=pt||function(n){return Nt&&n instanceof Array||lt.call(n)==dt};b(/x/)&&(b=function(n){return n instanceof Function||"[object Function]"==lt.call(n)
|
o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},o.isArguments=function(n){return"[object Arguments]"==lt.call(n)},o.isArguments(arguments)||(o.isArguments=function(n){return n?ft.call(n,"callee"):K});var Rt=ht?function(n){return j(n)?ht(n):[]}:h,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},qt=m(Tt),Bt=pt||function(n){return Nt&&n instanceof Array||lt.call(n)==dt};b(/x/)&&(b=function(n){return n instanceof Function||"[object Function]"==lt.call(n)
|
||||||
}),o.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},o.bind=U,o.bindAll=function(n){for(var t=arguments,r=1<t.length?0:(t=_(n),-1),e=t.length;++r<e;){var u=t[r];n[u]=U(n[u],n)}return n},o.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},o.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];return t[0]}},o.countBy=function(n,t,r){var e={},t=f(t,r);return k(n,function(n,r,u){r=t(n,r,u)+"",ft.call(e,r)?e[r]++:e[r]=1
|
}),o.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},o.bind=U,o.bindAll=function(n){for(var t=arguments,r=1<t.length?0:(t=_(n),-1),e=t.length;++r<e;){var u=t[r];n[u]=U(n[u],n)}return n},o.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++t<r;){var u=n[t];u&&e.push(u)}return e},o.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length;r--;)t=[n[r].apply(this,t)];return t[0]}},o.countBy=function(n,t,r){var e={},t=f(t,r);return k(n,function(n,r,u){r=t(n,r,u)+"",ft.call(e,r)?e[r]++:e[r]=1
|
||||||
}),e},o.debounce=function(n,t,r){function e(){a=J,r||(o=n.apply(i,u))}var u,o,i,a;return function(){var f=r&&!a;return u=arguments,i=this,clearTimeout(a),a=setTimeout(e,t),f&&(o=n.apply(i,u)),o}},o.defaults=y,o.defer=function(n){var r=p(arguments,1);return setTimeout(function(){n.apply(t,r)},1)},o.delay=function(n,r){var e=p(arguments,2);return setTimeout(function(){n.apply(t,e)},r)},o.difference=function(n){for(var t=-1,r=n.length,e=it.apply(W,arguments),u=[];++t<r;){var o=n[t];0>I(e,o,r)&&u.push(o)
|
}),e},o.debounce=function(n,t,r){function e(){a=J,r||(o=n.apply(i,u))}var u,o,i,a;return function(){var f=r&&!a;return u=arguments,i=this,clearTimeout(a),a=setTimeout(e,t),f&&(o=n.apply(i,u)),o}},o.defaults=y,o.defer=function(n){var r=p(arguments,1);return setTimeout(function(){n.apply(t,r)},1)},o.delay=function(n,r){var e=p(arguments,2);return setTimeout(function(){n.apply(t,e)},r)},o.difference=function(n){for(var t=-1,r=n.length,e=it.apply(W,arguments),u=[];++t<r;){var o=n[t];0>I(e,o,r)&&u.push(o)
|
||||||
}return u},o.filter=S,o.flatten=$,o.forEach=k,o.functions=_,o.groupBy=function(n,t,r){var e={},t=f(t,r);return k(n,function(n,r,u){r=t(n,r,u)+"",(ft.call(e,r)?e[r]:e[r]=[]).push(n)}),e},o.initial=function(n,t,r){if(!n)return[];var e=n.length;return p(n,0,_t(yt(0,e-(t==J||r?1:t||0)),e))},o.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++e<u;){var i=n[e];if(0>I(o,i)){for(var a=r;--a;)if(0>I(t[a],i))continue n;o.push(i)}}return o},o.invert=m,o.invoke=function(n,t){var r=p(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);
|
}return u},o.filter=S,o.flatten=$,o.forEach=k,o.functions=_,o.groupBy=function(n,t,r){var e={},t=f(t,r);return k(n,function(n,r,u){r=t(n,r,u)+"",(ft.call(e,r)?e[r]:e[r]=[]).push(n)}),e},o.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t=="function")for(var o=u,t=f(t,r);o--&&t(n[o],o,n);)e++;else e=t==J||r?1:t||e;return p(n,0,_t(yt(0,u-e),u))},o.intersection=function(n){var t=arguments,r=t.length,e=-1,u=n?n.length:0,o=[];n:for(;++e<u;){var i=n[e];if(0>I(o,i)){for(var a=r;--a;)if(0>I(t[a],i))continue n;
|
||||||
return k(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},o.keys=Rt,o.map=F,o.max=R,o.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return ft.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},o.min=function(n,t,r){var e=1/0,o=e;if(!t&&Bt(n))for(var r=-1,i=n.length;++r<i;){var a=n[r];a<o&&(o=a)}else t=f(t,r),u(n,function(n,r,u){r=t(n,r,u),r<e&&(e=r,o=n)});return o},o.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var o=n[r];t?u[o]=t[r]:u[o[0]]=o[1]
|
o.push(i)}}return o},o.invert=m,o.invoke=function(n,t){var r=p(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return k(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},o.keys=Rt,o.map=F,o.max=R,o.memoize=function(n,t){var r={};return function(){var e=(t?t.apply(this,arguments):arguments[0])+"";return ft.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},o.min=function(n,t,r){var e=1/0,o=e;if(!t&&Bt(n))for(var r=-1,i=n.length;++r<i;){var a=n[r];a<o&&(o=a)}else t=f(t,r),u(n,function(n,r,u){r=t(n,r,u),r<e&&(e=r,o=n)
|
||||||
}return u},o.omit=function(n){var t=it.apply(W,arguments),r={};return e(n,function(n,e){0>I(t,e,1)&&(r[e]=n)}),r},o.once=function(n){var t,r;return function(){return t?r:(t=H,r=n.apply(this,arguments),n=J,r)}},o.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},o.pick=function(n){for(var t=0,r=it.apply(W,arguments),e=r.length,u={};++t<e;){var o=r[t];o in n&&(u[o]=n[o])}return u},o.pluck=T,o.range=function(n,t,r){n=+n||0,r=+r||1,t==J&&(t=n,n=0);
|
});return o},o.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++r<e;){var o=n[r];t?u[o]=t[r]:u[o[0]]=o[1]}return u},o.omit=function(n){var t=it.apply(W,arguments),r={};return e(n,function(n,e){0>I(t,e,1)&&(r[e]=n)}),r},o.once=function(n){var t,r;return function(){return t?r:(t=H,r=n.apply(this,arguments),n=J,r)}},o.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},o.pick=function(n){for(var t=0,r=it.apply(W,arguments),e=r.length,u={};++t<e;){var o=r[t];
|
||||||
for(var e=-1,t=yt(0,ot((t-n)/r)),u=Array(t);++e<t;)u[e]=n,n+=r;return u},o.reject=function(n,t,r){return t=f(t,r),S(n,function(n,r,e){return!t(n,r,e)})},o.rest=z,o.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return k(n,function(n){var r=at(mt()*(++t+1));e[t]=e[r],e[r]=n}),e},o.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,o=Array(typeof u=="number"?u:0),t=f(t,r);for(k(n,function(n,r,u){o[++e]={a:t(n,r,u),b:e,c:n}}),u=o.length,o.sort(i);u--;)o[u]=o[u].c;return o},o.tap=function(n,t){return t(n),n
|
o in n&&(u[o]=n[o])}return u},o.pluck=T,o.range=function(n,t,r){n=+n||0,r=+r||1,t==J&&(t=n,n=0);for(var e=-1,t=yt(0,ot((t-n)/r)),u=Array(t);++e<t;)u[e]=n,n+=r;return u},o.reject=function(n,t,r){return t=f(t,r),S(n,function(n,r,e){return!t(n,r,e)})},o.rest=z,o.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return k(n,function(n){var r=at(mt()*(++t+1));e[t]=e[r],e[r]=n}),e},o.sortBy=function(n,t,r){var e=-1,u=n?n.length:0,o=Array(typeof u=="number"?u:0),t=f(t,r);for(k(n,function(n,r,u){o[++e]={a:t(n,r,u),b:e,c:n}
|
||||||
},o.throttle=function(n,t){function r(){a=new Date,i=J,u=n.apply(o,e)}var e,u,o,i,a=0;return function(){var f=new Date,c=t-(f-a);return e=arguments,o=this,0<c?i||(i=setTimeout(r,c)):(clearTimeout(i),i=J,a=f,u=n.apply(o,e)),u}},o.times=function(n,t,r){for(var n=+n||0,e=-1,u=Array(n);++e<n;)u[e]=t.call(r,e);return u},o.toArray=function(n){return n&&typeof n.length=="number"?p(n):x(n)},o.union=function(){return P(it.apply(W,arguments))},o.uniq=P,o.values=x,o.where=function(n,t){return S(n,t)},o.without=function(n){for(var t=-1,r=n.length,e=[];++t<r;){var u=n[t];
|
}),u=o.length,o.sort(i);u--;)o[u]=o[u].c;return o},o.tap=function(n,t){return t(n),n},o.throttle=function(n,t){function r(){a=new Date,i=J,u=n.apply(o,e)}var e,u,o,i,a=0;return function(){var f=new Date,c=t-(f-a);return e=arguments,o=this,0<c?i||(i=setTimeout(r,c)):(clearTimeout(i),i=J,a=f,u=n.apply(o,e)),u}},o.times=function(n,t,r){for(var n=+n||0,e=-1,u=Array(n);++e<n;)u[e]=t.call(r,e);return u},o.toArray=function(n){return n&&typeof n.length=="number"?p(n):x(n)},o.union=function(){return P(it.apply(W,arguments))
|
||||||
0>I(arguments,u,1)&&e.push(u)}return e},o.wrap=function(n,t){return function(){var r=[n];return ct.apply(r,arguments),t.apply(this,r)}},o.zip=function(n){for(var t=-1,r=n?R(T(arguments,"length")):0,e=Array(r);++t<r;)e[t]=T(arguments,t);return e},o.collect=F,o.drop=z,o.each=k,o.extend=g,o.methods=_,o.select=S,o.tail=z,o.unique=P,o.clone=function(n){return n&&kt[typeof n]?Bt(n)?p(n):g({},n):n},o.contains=E,o.escape=function(n){return n==J?"":(n+"").replace(et,l)},o.every=O,o.find=N,o.has=function(n,t){return n?ft.call(n,t):K
|
},o.uniq=P,o.values=x,o.where=function(n,t){return S(n,t)},o.without=function(n){for(var t=-1,r=n.length,e=[];++t<r;){var u=n[t];0>I(arguments,u,1)&&e.push(u)}return e},o.wrap=function(n,t){return function(){var r=[n];return ct.apply(r,arguments),t.apply(this,r)}},o.zip=function(n){for(var t=-1,r=n?R(T(arguments,"length")):0,e=Array(r);++t<r;)e[t]=T(arguments,t);return e},o.collect=F,o.drop=z,o.each=k,o.extend=g,o.methods=_,o.select=S,o.tail=z,o.unique=P,o.clone=function(n){return n&&kt[typeof n]?Bt(n)?p(n):g({},n):n
|
||||||
},o.identity=V,o.indexOf=I,o.isArray=Bt,o.isBoolean=function(n){return n===H||n===K||lt.call(n)==bt},o.isDate=function(n){return n instanceof Date||lt.call(n)==jt},o.isElement=function(n){return n?1===n.nodeType:K},o.isEmpty=function(n){if(!n)return H;if(Bt(n)||A(n))return!n.length;for(var t in n)if(ft.call(n,t))return K;return H},o.isEqual=d,o.isFinite=function(n){return vt(n)&&!gt(parseFloat(n))},o.isFunction=b,o.isNaN=function(n){return w(n)&&n!=+n},o.isNull=function(n){return n===J},o.isNumber=w,o.isObject=j,o.isRegExp=function(n){return n instanceof RegExp||lt.call(n)==xt
|
},o.contains=E,o.escape=function(n){return n==J?"":(n+"").replace(et,l)},o.every=O,o.find=N,o.has=function(n,t){return n?ft.call(n,t):K},o.identity=V,o.indexOf=I,o.isArray=Bt,o.isBoolean=function(n){return n===H||n===K||lt.call(n)==bt},o.isDate=function(n){return n instanceof Date||lt.call(n)==jt},o.isElement=function(n){return n?1===n.nodeType:K},o.isEmpty=function(n){if(!n)return H;if(Bt(n)||A(n))return!n.length;for(var t in n)if(ft.call(n,t))return K;return H},o.isEqual=d,o.isFinite=function(n){return vt(n)&&!gt(parseFloat(n))
|
||||||
},o.isString=A,o.isUndefined=function(n){return typeof n=="undefined"},o.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?yt(0,e+r):_t(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=G,o.noConflict=function(){return n._=Z,this},o.random=function(n,t){return n==J&&t==J&&(t=1),n=+n||0,t==J&&(t=n,n=0),n+at(mt()*((+t||0)-n+1))},o.reduce=q,o.reduceRight=B,o.result=function(n,t){var r=n?n[t]:J;return b(r)?n[t]():r},o.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length
|
},o.isFunction=b,o.isNaN=function(n){return w(n)&&n!=+n},o.isNull=function(n){return n===J},o.isNumber=w,o.isObject=j,o.isRegExp=function(n){return n instanceof RegExp||lt.call(n)==xt},o.isString=A,o.isUndefined=function(n){return typeof n=="undefined"},o.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?yt(0,e+r):_t(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=G,o.noConflict=function(){return n._=Z,this},o.random=function(n,t){return n==J&&t==J&&(t=1),n=+n||0,t==J&&(t=n,n=0),n+at(mt()*((+t||0)-n+1))
|
||||||
},o.some=D,o.sortedIndex=C,o.template=function(n,t,r){n||(n="");var r=y({},r,o.templateSettings),e=0,u="__p+='",i=r.variable;n.replace(RegExp((r.escape||rt).source+"|"+(r.interpolate||rt).source+"|"+(r.evaluate||rt).source+"|$","g"),function(t,r,o,i,a){u+=n.slice(e,a).replace(ut,c),u+=r?"'+_['escape']("+r+")+'":i?"';"+i+";__p+='":o?"'+((__t=("+o+"))==null?'':__t)+'":"",e=a+t.length}),u+="';\n",i||(i="obj",u="with("+i+"||{}){"+u+"}"),u="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+u+"return __p}";
|
},o.reduce=q,o.reduceRight=B,o.result=function(n,t){var r=n?n[t]:J;return b(r)?n[t]():r},o.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},o.some=D,o.sortedIndex=C,o.template=function(n,t,r){n||(n="");var r=y({},r,o.templateSettings),e=0,u="__p+='",i=r.variable;n.replace(RegExp((r.escape||rt).source+"|"+(r.interpolate||rt).source+"|"+(r.evaluate||rt).source+"|$","g"),function(t,r,o,i,a){u+=n.slice(e,a).replace(ut,c),u+=r?"'+_['escape']("+r+")+'":i?"';"+i+";__p+='":o?"'+((__t=("+o+"))==null?'':__t)+'":"",e=a+t.length
|
||||||
try{var a=Function("_","return "+u)(o)}catch(f){throw f.source=u,f}return t?a(t):(a.source=u,a)},o.unescape=function(n){return n==J?"":(n+"").replace(nt,v)},o.uniqueId=function(n){var t=++X+"";return n?n+t:t},o.all=O,o.any=D,o.detect=N,o.foldl=q,o.foldr=B,o.include=E,o.inject=q,o.first=M,o.last=function(n,t,r){if(n){var e=n.length;return t==J||r?n[e-1]:p(n,yt(0,e-t))}},o.take=M,o.head=M,o.chain=function(n){return n=new o(n),n.__chain__=H,n},o.VERSION="1.0.0-rc.3",G(o),o.prototype.chain=function(){return this.__chain__=H,this
|
}),u+="';\n",i||(i="obj",u="with("+i+"||{}){"+u+"}"),u="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+u+"return __p}";try{var a=Function("_","return "+u)(o)}catch(f){throw f.source=u,f}return t?a(t):(a.source=u,a)},o.unescape=function(n){return n==J?"":(n+"").replace(nt,v)},o.uniqueId=function(n){var t=++X+"";return n?n+t:t},o.all=O,o.any=D,o.detect=N,o.foldl=q,o.foldr=B,o.include=E,o.inject=q,o.first=M,o.last=function(n,t,r){if(n){var e=0,u=n.length;
|
||||||
},o.prototype.value=function(){return this.__wrapped__},u("pop push reverse shift sort splice unshift".split(" "),function(n){var t=W[n];o.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),St&&0===n.length&&delete n[0],this}}),u(["concat","join","slice"],function(n){var t=W[n];o.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=H),n}}),L?typeof module=="object"&&module&&module.exports==L?(module.exports=o)._=o:L._=o:n._=o
|
if(typeof t=="function")for(var o=u,t=f(t,r);o--&&t(n[o],o,n);)e++;else if(e=t,e==J||r)return n[u-1];return p(n,yt(0,u-e))}},o.take=M,o.head=M,o.chain=function(n){return n=new o(n),n.__chain__=H,n},o.VERSION="1.0.0-rc.3",G(o),o.prototype.chain=function(){return this.__chain__=H,this},o.prototype.value=function(){return this.__wrapped__},u("pop push reverse shift sort splice unshift".split(" "),function(n){var t=W[n];o.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),St&&0===n.length&&delete n[0],this
|
||||||
})(this);
|
}}),u(["concat","join","slice"],function(n){var t=W[n];o.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new o(n),n.__chain__=H),n}}),L?typeof module=="object"&&module&&module.exports==L?(module.exports=o)._=o:L._=o:n._=o})(this);
|
||||||
163
test/test.js
163
test/test.js
@@ -576,6 +576,48 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.first');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var array = [1, 2, 3];
|
||||||
|
|
||||||
|
test('should return the first element', function() {
|
||||||
|
strictEqual(_.first(array), 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should return the first two elements', function() {
|
||||||
|
deepEqual(_.first(array, 2), [1, 2]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with a `callback`', function() {
|
||||||
|
var actual = _.first(array, function(num) {
|
||||||
|
return num < 3;
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(actual, [1, 2]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should pass the correct `callback` arguments', function() {
|
||||||
|
var args;
|
||||||
|
|
||||||
|
_.first(array, function() {
|
||||||
|
args || (args = slice.call(arguments));
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(args, [1, 0, array]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('supports the `thisArg` argument', function() {
|
||||||
|
var actual = _.first(array, function(value, index) {
|
||||||
|
return this[index] < 3;
|
||||||
|
}, array);
|
||||||
|
|
||||||
|
deepEqual(actual, [1, 2]);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.flatten');
|
QUnit.module('lodash.flatten');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -780,8 +822,9 @@
|
|||||||
QUnit.module('lodash.initial');
|
QUnit.module('lodash.initial');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('returns a full collection for `n` of `0`', function() {
|
var array = [1, 2, 3];
|
||||||
var array = [1, 2, 3];
|
|
||||||
|
test('returns all elements for `n` of `0`', function() {
|
||||||
deepEqual(_.initial(array, 0), [1, 2, 3]);
|
deepEqual(_.initial(array, 0), [1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -793,6 +836,40 @@
|
|||||||
deepEqual(actual, []);
|
deepEqual(actual, []);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should exclude last element', function() {
|
||||||
|
deepEqual(_.initial(array), [1, 2]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should exlcude the last two elements', function() {
|
||||||
|
deepEqual(_.initial(array, 2), [1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with a `callback`', function() {
|
||||||
|
var actual = _.initial(array, function(num) {
|
||||||
|
return num > 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(actual, [1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should pass the correct `callback` arguments', function() {
|
||||||
|
var args;
|
||||||
|
|
||||||
|
_.initial(array, function() {
|
||||||
|
args || (args = slice.call(arguments));
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(args, [3, 2, array]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('supports the `thisArg` argument', function() {
|
||||||
|
var actual = _.initial(array, function(value, index) {
|
||||||
|
return this[index] > 1;
|
||||||
|
}, array);
|
||||||
|
|
||||||
|
deepEqual(actual, [1]);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@@ -1051,6 +1128,48 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
QUnit.module('lodash.last');
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var array = [1, 2, 3];
|
||||||
|
|
||||||
|
test('should return the last element', function() {
|
||||||
|
equal(_.last(array), 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should return the last two elements', function() {
|
||||||
|
deepEqual(_.last(array, 2), [2, 3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with a `callback`', function() {
|
||||||
|
var actual = _.last(array, function(num) {
|
||||||
|
return num > 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(actual, [2, 3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should pass the correct `callback` arguments', function() {
|
||||||
|
var args;
|
||||||
|
|
||||||
|
_.last(array, function() {
|
||||||
|
args || (args = slice.call(arguments));
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(args, [3, 2, array]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('supports the `thisArg` argument', function() {
|
||||||
|
var actual = _.last(array, function(value, index) {
|
||||||
|
return this[index] > 1;
|
||||||
|
}, array);
|
||||||
|
|
||||||
|
deepEqual(actual, [2, 3]);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.lastIndexOf');
|
QUnit.module('lodash.lastIndexOf');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -1548,6 +1667,12 @@
|
|||||||
QUnit.module('lodash.rest');
|
QUnit.module('lodash.rest');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
var array = [1, 2, 3];
|
||||||
|
|
||||||
|
test('returns all elements for `n` of `0`', function() {
|
||||||
|
deepEqual(_.rest(array, 0), [1, 2, 3]);
|
||||||
|
});
|
||||||
|
|
||||||
test('should allow a falsey `array` argument', function() {
|
test('should allow a falsey `array` argument', function() {
|
||||||
_.each(falsey, function(index, value) {
|
_.each(falsey, function(index, value) {
|
||||||
try {
|
try {
|
||||||
@@ -1556,6 +1681,40 @@
|
|||||||
deepEqual(actual, []);
|
deepEqual(actual, []);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should exclude the first element', function() {
|
||||||
|
deepEqual(_.rest(array), [2, 3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should exclude the first two elements', function() {
|
||||||
|
deepEqual(_.rest(array, 2), [3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should work with a `callback`', function() {
|
||||||
|
var actual = _.rest(array, function(num) {
|
||||||
|
return num < 3;
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(actual, [3]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should pass the correct `callback` arguments', function() {
|
||||||
|
var args;
|
||||||
|
|
||||||
|
_.rest(array, function() {
|
||||||
|
args || (args = slice.call(arguments));
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(args, [1, 0, array]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('supports the `thisArg` argument', function() {
|
||||||
|
var actual = _.rest(array, function(value, index) {
|
||||||
|
return this[index] < 3;
|
||||||
|
}, array);
|
||||||
|
|
||||||
|
deepEqual(actual, [3]);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user