mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Update vendors, builds, and docs.
Former-commit-id: d57931d657ac0e73d91ac1bd1b33e24be5a16f35
This commit is contained in:
@@ -4,4 +4,4 @@ node_js:
|
|||||||
- 0.8
|
- 0.8
|
||||||
before_script:
|
before_script:
|
||||||
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/a2787b470c577cee2404d186c562dd9835f779f5 | tar xvz -C vendor"
|
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/a2787b470c577cee2404d186c562dd9835f779f5 | tar xvz -C vendor"
|
||||||
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/3390b259e04829538e4d3635d12b317dd6103eca | tar xvz -C vendor"
|
- "curl -H 'Accept: application/vnd.github.v3.raw' https://api.github.com/repos/bestiejs/lodash/git/blobs/7ecae09d413eb48dd5785fe877f24e60ac3bbcef | tar xvz -C vendor"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
var closureId = 'a2787b470c577cee2404d186c562dd9835f779f5';
|
var closureId = 'a2787b470c577cee2404d186c562dd9835f779f5';
|
||||||
|
|
||||||
/** The Git object ID of `uglifyjs.tar.gz` */
|
/** The Git object ID of `uglifyjs.tar.gz` */
|
||||||
var uglifyId = '3390b259e04829538e4d3635d12b317dd6103eca';
|
var uglifyId = '7ecae09d413eb48dd5785fe877f24e60ac3bbcef';
|
||||||
|
|
||||||
/** The media type for raw blob data */
|
/** The media type for raw blob data */
|
||||||
var mediaType = 'application/vnd.github.v3.raw';
|
var mediaType = 'application/vnd.github.v3.raw';
|
||||||
|
|||||||
227
doc/README.md
227
doc/README.md
@@ -107,6 +107,7 @@
|
|||||||
## `Objects`
|
## `Objects`
|
||||||
* [`_.assign`](#_assignobject--source1-source2-)
|
* [`_.assign`](#_assignobject--source1-source2-)
|
||||||
* [`_.clone`](#_clonevalue-deep)
|
* [`_.clone`](#_clonevalue-deep)
|
||||||
|
* [`_.cloneDeep`](#_clonedeepvalue)
|
||||||
* [`_.defaults`](#_defaultsobject--default1-default2-)
|
* [`_.defaults`](#_defaultsobject--default1-default2-)
|
||||||
* [`_.extend`](#_assignobject--source1-source2-)
|
* [`_.extend`](#_assignobject--source1-source2-)
|
||||||
* [`_.forIn`](#_forinobject--callbackidentity-thisarg)
|
* [`_.forIn`](#_forinobject--callbackidentity-thisarg)
|
||||||
@@ -185,7 +186,7 @@
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_compactarray"></a>`_.compact(array)`
|
### <a id="_compactarray"></a>`_.compact(array)`
|
||||||
<a href="#_compactarray">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2694 "View in source") [Ⓣ][1]
|
<a href="#_compactarray">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2714 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
|
Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
|
||||||
|
|
||||||
@@ -209,7 +210,7 @@ _.compact([0, 1, false, 2, '', 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
|
### <a id="_differencearray--array1-array2-"></a>`_.difference(array [, array1, array2, ...])`
|
||||||
<a href="#_differencearray--array1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2724 "View in source") [Ⓣ][1]
|
<a href="#_differencearray--array1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2744 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
|
Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`.
|
||||||
|
|
||||||
@@ -234,7 +235,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_firstarray--n"></a>`_.first(array [, n])`
|
### <a id="_firstarray--n"></a>`_.first(array [, n])`
|
||||||
<a href="#_firstarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2759 "View in source") [Ⓣ][1]
|
<a href="#_firstarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2779 "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`. Pass `n` to return the first `n` elements of the `array`.
|
||||||
|
|
||||||
@@ -262,7 +263,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#L2786 "View in source") [Ⓣ][1]
|
<a href="#_flattenarray-shallow">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2806 "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.
|
||||||
|
|
||||||
@@ -290,7 +291,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#L2828 "View in source") [Ⓣ][1]
|
<a href="#_indexofarray-value--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2848 "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.
|
||||||
|
|
||||||
@@ -322,7 +323,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_initialarray--n1"></a>`_.initial(array [, n=1])`
|
### <a id="_initialarray--n1"></a>`_.initial(array [, n=1])`
|
||||||
<a href="#_initialarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2863 "View in source") [Ⓣ][1]
|
<a href="#_initialarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2883 "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`. Pass `n` to exclude the last `n` elements from the result.
|
||||||
|
|
||||||
@@ -347,7 +348,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#L2887 "View in source") [Ⓣ][1]
|
<a href="#_intersectionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2907 "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. `===`.
|
||||||
|
|
||||||
@@ -355,7 +356,7 @@ Computes the intersection of all the passed-in arrays using strict equality for
|
|||||||
1. `[array1, array2, ...]` *(Array)*: Arrays to process.
|
1. `[array1, array2, ...]` *(Array)*: Arrays to process.
|
||||||
|
|
||||||
#### Returns
|
#### Returns
|
||||||
*(Array)*: Returns a new array of unique elements, in order, that are present in **all** of the arrays.
|
*(Array)*: Returns a new array of unique elements that are present in **all** of the arrays.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
```js
|
```js
|
||||||
@@ -371,7 +372,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_lastarray--n"></a>`_.last(array [, n])`
|
### <a id="_lastarray--n"></a>`_.last(array [, n])`
|
||||||
<a href="#_lastarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2929 "View in source") [Ⓣ][1]
|
<a href="#_lastarray--n">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2959 "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`. Pass `n` to return the last `n` elements of the `array`.
|
||||||
|
|
||||||
@@ -396,7 +397,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#L2956 "View in source") [Ⓣ][1]
|
<a href="#_lastindexofarray-value--fromindexarraylength-1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2986 "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.
|
||||||
|
|
||||||
@@ -425,7 +426,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#L2986 "View in source") [Ⓣ][1]
|
<a href="#_objectkeys--values">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3016 "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`.
|
||||||
|
|
||||||
@@ -450,7 +451,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#L3031 "View in source") [Ⓣ][1]
|
<a href="#_rangestart0-end--step1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3061 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
|
Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range.
|
||||||
|
|
||||||
@@ -488,7 +489,7 @@ _.range(0);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_restarray--n1"></a>`_.rest(array [, n=1])`
|
### <a id="_restarray--n1"></a>`_.rest(array [, n=1])`
|
||||||
<a href="#_restarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3070 "View in source") [Ⓣ][1]
|
<a href="#_restarray--n1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3100 "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`. Pass `n` to exclude the first `n` values from the result.
|
||||||
|
|
||||||
@@ -516,7 +517,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#L3114 "View in source") [Ⓣ][1]
|
<a href="#_sortedindexarray-value--callbackidentityproperty-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3144 "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.
|
||||||
|
|
||||||
@@ -560,7 +561,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#L3146 "View in source") [Ⓣ][1]
|
<a href="#_unionarray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3176 "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. `===`.
|
||||||
|
|
||||||
@@ -584,7 +585,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#L3180 "View in source") [Ⓣ][1]
|
<a href="#_uniqarray--issortedfalse-callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3210 "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)*.
|
||||||
|
|
||||||
@@ -623,7 +624,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#L3240 "View in source") [Ⓣ][1]
|
<a href="#_withoutarray--value1-value2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3268 "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. `===`.
|
||||||
|
|
||||||
@@ -648,7 +649,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#L3271 "View in source") [Ⓣ][1]
|
<a href="#_ziparray1-array2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3299 "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.
|
||||||
|
|
||||||
@@ -681,7 +682,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
|
|||||||
### <a id="_value"></a>`_(value)`
|
### <a id="_value"></a>`_(value)`
|
||||||
<a href="#_value">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L275 "View in source") [Ⓣ][1]
|
<a href="#_value">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L275 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a `lodash` object, that wraps the given `value`, to enable method chaining. The chainable wrapper functions are: `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `countBy`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forIn`, `forOwn`, `functions`, `groupBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, `once`, `pairs`, `partial`, `pick`, `pluck`, `push`, `range`, `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `values`, `where`, `without`, `wrap`, and `zip` The non-chainable wrapper functions are: `clone`, `contains`, `escape`, `every`, `find`, `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `template`, `unescape`, and `uniqueId` The wrapper functions `first` and `last` return wrapped values when `n` is passed, otherwise they return unwrapped values.
|
Creates a `lodash` object, that wraps the given `value`, to enable method chaining. The chainable wrapper functions are: `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `countBy`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forIn`, `forOwn`, `functions`, `groupBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, `once`, `pairs`, `partial`, `pick`, `pluck`, `push`, `range`, `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `values`, `where`, `without`, `wrap`, and `zip` The non-chainable wrapper functions are: `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `template`, `unescape`, and `uniqueId` The wrapper functions `first` and `last` return wrapped values when `n` is passed, otherwise they return unwrapped values.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `value` *(Mixed)*: The value to wrap in a `lodash` instance.
|
1. `value` *(Mixed)*: The value to wrap in a `lodash` instance.
|
||||||
@@ -697,7 +698,7 @@ Creates a `lodash` object, that wraps the given `value`, to enable method chaini
|
|||||||
<!-- 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#L4140 "View in source") [Ⓣ][1]
|
<a href="#_tapvalue-interceptor">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4166 "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.
|
||||||
|
|
||||||
@@ -727,7 +728,7 @@ _.chain([1, 2, 3, 200])
|
|||||||
<!-- 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#L4157 "View in source") [Ⓣ][1]
|
<a href="#_prototypetostring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4183 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Produces the `toString` result of the wrapped value.
|
Produces the `toString` result of the wrapped value.
|
||||||
|
|
||||||
@@ -748,7 +749,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#L4174 "View in source") [Ⓣ][1]
|
<a href="#_prototypevalueof">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4200 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Extracts the wrapped value.
|
Extracts the wrapped value.
|
||||||
|
|
||||||
@@ -779,7 +780,7 @@ _([1, 2, 3]).valueOf();
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_containscollection-target--fromindex0"></a>`_.contains(collection, target [, fromIndex=0])`
|
### <a id="_containscollection-target--fromindex0"></a>`_.contains(collection, target [, fromIndex=0])`
|
||||||
<a href="#_containscollection-target--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1930 "View in source") [Ⓣ][1]
|
<a href="#_containscollection-target--fromindex0">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1950 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection.
|
Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection.
|
||||||
|
|
||||||
@@ -817,7 +818,7 @@ _.contains('curly', 'ur');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
|
### <a id="_countbycollection-callbackproperty--thisarg"></a>`_.countBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1977 "View in source") [Ⓣ][1]
|
<a href="#_countbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1997 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
|
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is the number of times the key was returned by `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to count by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -849,7 +850,7 @@ _.countBy(['one', 'two', 'three'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
|
### <a id="_everycollection--callbackidentity-thisarg"></a>`_.every(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_everycollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2007 "View in source") [Ⓣ][1]
|
<a href="#_everycollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2027 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -878,7 +879,7 @@ _.every([true, 1, null, 'yes'], Boolean);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
|
### <a id="_filtercollection--callbackidentity-thisarg"></a>`_.filter(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2046 "View in source") [Ⓣ][1]
|
<a href="#_filtercollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2066 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -907,7 +908,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; })
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_findcollection--callbackidentity-thisarg"></a>`_.find(collection [, callback=identity, thisArg])`
|
### <a id="_findcollection--callbackidentity-thisarg"></a>`_.find(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_findcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2090 "View in source") [Ⓣ][1]
|
<a href="#_findcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2110 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Examines each element in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable element, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -936,7 +937,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_foreachcollection--callbackidentity-thisarg"></a>`_.forEach(collection [, callback=identity, thisArg])`
|
### <a id="_foreachcollection--callbackidentity-thisarg"></a>`_.forEach(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_foreachcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2125 "View in source") [Ⓣ][1]
|
<a href="#_foreachcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2145 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
|
Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`.
|
||||||
|
|
||||||
@@ -968,7 +969,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
|
### <a id="_groupbycollection-callbackproperty--thisarg"></a>`_.groupBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2170 "View in source") [Ⓣ][1]
|
<a href="#_groupbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2190 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to group by *(e.g. 'length')*.
|
Creates an object composed of keys returned from running each element of `collection` through a `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to group by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -1000,7 +1001,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <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#L2203 "View in source") [Ⓣ][1]
|
<a href="#_invokecollection-methodname--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2223 "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`.
|
||||||
|
|
||||||
@@ -1029,7 +1030,7 @@ _.invoke([123, 456], String.prototype.split, '');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
|
### <a id="_mapcollection--callbackidentity-thisarg"></a>`_.map(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2235 "View in source") [Ⓣ][1]
|
<a href="#_mapcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2255 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Creates an array of values by running each element in the `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1061,7 +1062,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_maxcollection--callback-thisarg"></a>`_.max(collection [, callback, thisArg])`
|
### <a id="_maxcollection--callback-thisarg"></a>`_.max(collection [, callback, thisArg])`
|
||||||
<a href="#_maxcollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2277 "View in source") [Ⓣ][1]
|
<a href="#_maxcollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2297 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
||||||
|
|
||||||
@@ -1093,7 +1094,7 @@ _.max(stooges, function(stooge) { return stooge.age; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mincollection--callback-thisarg"></a>`_.min(collection [, callback, thisArg])`
|
### <a id="_mincollection--callback-thisarg"></a>`_.min(collection [, callback, thisArg])`
|
||||||
<a href="#_mincollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2323 "View in source") [Ⓣ][1]
|
<a href="#_mincollection--callback-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2343 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*.
|
||||||
|
|
||||||
@@ -1119,7 +1120,7 @@ _.min([10, 5, 100, 2, 1000]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
|
### <a id="_pluckcollection-property"></a>`_.pluck(collection, property)`
|
||||||
<a href="#_pluckcollection-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2372 "View in source") [Ⓣ][1]
|
<a href="#_pluckcollection-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2392 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Retrieves the value of a specified property from all elements in the `collection`.
|
Retrieves the value of a specified property from all elements in the `collection`.
|
||||||
|
|
||||||
@@ -1150,7 +1151,7 @@ _.pluck(stooges, 'name');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_reducecollection--callbackidentity-accumulator-thisarg"></a>`_.reduce(collection [, callback=identity, accumulator, thisArg])`
|
### <a id="_reducecollection--callbackidentity-accumulator-thisarg"></a>`_.reduce(collection [, callback=identity, accumulator, thisArg])`
|
||||||
<a href="#_reducecollection--callbackidentity-accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2396 "View in source") [Ⓣ][1]
|
<a href="#_reducecollection--callbackidentity-accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2416 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
|
Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1180,7 +1181,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_reducerightcollection--callbackidentity-accumulator-thisarg"></a>`_.reduceRight(collection [, callback=identity, accumulator, thisArg])`
|
### <a id="_reducerightcollection--callbackidentity-accumulator-thisarg"></a>`_.reduceRight(collection [, callback=identity, accumulator, thisArg])`
|
||||||
<a href="#_reducerightcollection--callbackidentity-accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2438 "View in source") [Ⓣ][1]
|
<a href="#_reducerightcollection--callbackidentity-accumulator-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2458 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The right-associative version of `_.reduce`.
|
The right-associative version of `_.reduce`.
|
||||||
|
|
||||||
@@ -1211,7 +1212,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
|
### <a id="_rejectcollection--callbackidentity-thisarg"></a>`_.reject(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2476 "View in source") [Ⓣ][1]
|
<a href="#_rejectcollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2496 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
|
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for.
|
||||||
|
|
||||||
@@ -1237,7 +1238,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_shufflecollection"></a>`_.shuffle(collection)`
|
### <a id="_shufflecollection"></a>`_.shuffle(collection)`
|
||||||
<a href="#_shufflecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2497 "View in source") [Ⓣ][1]
|
<a href="#_shufflecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2517 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
|
Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
|
||||||
|
|
||||||
@@ -1261,7 +1262,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sizecollection"></a>`_.size(collection)`
|
### <a id="_sizecollection"></a>`_.size(collection)`
|
||||||
<a href="#_sizecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2529 "View in source") [Ⓣ][1]
|
<a href="#_sizecollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2549 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects.
|
Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects.
|
||||||
|
|
||||||
@@ -1291,7 +1292,7 @@ _.size('curly');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
|
### <a id="_somecollection--callbackidentity-thisarg"></a>`_.some(collection [, callback=identity, thisArg])`
|
||||||
<a href="#_somecollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2554 "View in source") [Ⓣ][1]
|
<a href="#_somecollection--callbackidentity-thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2574 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*.
|
||||||
|
|
||||||
@@ -1320,7 +1321,7 @@ _.some([null, 0, 'yes', false], Boolean);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
|
### <a id="_sortbycollection-callbackproperty--thisarg"></a>`_.sortBy(collection, callback|property [, thisArg])`
|
||||||
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2600 "View in source") [Ⓣ][1]
|
<a href="#_sortbycollection-callbackproperty--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2620 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
|
Creates an array, stable sorted in ascending order by the results of running each element of `collection` through a `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*.
|
||||||
|
|
||||||
@@ -1352,7 +1353,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_toarraycollection"></a>`_.toArray(collection)`
|
### <a id="_toarraycollection"></a>`_.toArray(collection)`
|
||||||
<a href="#_toarraycollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2633 "View in source") [Ⓣ][1]
|
<a href="#_toarraycollection">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2653 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Converts the `collection` to an array.
|
Converts the `collection` to an array.
|
||||||
|
|
||||||
@@ -1376,7 +1377,7 @@ Converts the `collection` to an array.
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
|
### <a id="_wherecollection-properties"></a>`_.where(collection, properties)`
|
||||||
<a href="#_wherecollection-properties">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2664 "View in source") [Ⓣ][1]
|
<a href="#_wherecollection-properties">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2684 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
|
Examines each element in a `collection`, returning an array of all elements that contain the given `properties`.
|
||||||
|
|
||||||
@@ -1414,7 +1415,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#L3304 "View in source") [Ⓣ][1]
|
<a href="#_aftern-func">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3332 "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.
|
||||||
|
|
||||||
@@ -1442,7 +1443,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#L3337 "View in source") [Ⓣ][1]
|
<a href="#_bindfunc--thisarg-arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3365 "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.
|
||||||
|
|
||||||
@@ -1473,7 +1474,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#L3367 "View in source") [Ⓣ][1]
|
<a href="#_bindallobject--methodname1-methodname2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3395 "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.
|
||||||
|
|
||||||
@@ -1504,7 +1505,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#L3413 "View in source") [Ⓣ][1]
|
<a href="#_bindkeyobject-key--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3441 "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.
|
||||||
|
|
||||||
@@ -1545,7 +1546,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#L3436 "View in source") [Ⓣ][1]
|
<a href="#_composefunc1-func2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3464 "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.
|
||||||
|
|
||||||
@@ -1572,7 +1573,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#L3469 "View in source") [Ⓣ][1]
|
<a href="#_debouncefunc-wait-immediate">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3497 "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.
|
||||||
|
|
||||||
@@ -1598,7 +1599,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#L3533 "View in source") [Ⓣ][1]
|
<a href="#_deferfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3561 "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.
|
||||||
|
|
||||||
@@ -1623,7 +1624,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#L3513 "View in source") [Ⓣ][1]
|
<a href="#_delayfunc-wait--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3541 "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.
|
||||||
|
|
||||||
@@ -1650,7 +1651,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#L3557 "View in source") [Ⓣ][1]
|
<a href="#_memoizefunc--resolver">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3585 "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.
|
||||||
|
|
||||||
@@ -1676,7 +1677,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#L3584 "View in source") [Ⓣ][1]
|
<a href="#_oncefunc">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3612 "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.
|
||||||
|
|
||||||
@@ -1702,7 +1703,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#L3619 "View in source") [Ⓣ][1]
|
<a href="#_partialfunc--arg1-arg2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3647 "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.
|
||||||
|
|
||||||
@@ -1729,7 +1730,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#L3641 "View in source") [Ⓣ][1]
|
<a href="#_throttlefunc-wait">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3669 "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.
|
||||||
|
|
||||||
@@ -1754,7 +1755,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#L3694 "View in source") [Ⓣ][1]
|
<a href="#_wrapvalue-wrapper">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3722 "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.
|
||||||
|
|
||||||
@@ -1818,9 +1819,9 @@ _.assign({ 'name': 'moe' }, { 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_clonevalue-deep"></a>`_.clone(value, deep)`
|
### <a id="_clonevalue-deep"></a>`_.clone(value, deep)`
|
||||||
<a href="#_clonevalue-deep">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1009 "View in source") [Ⓣ][1]
|
<a href="#_clonevalue-deep">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1000 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a clone of `value`. If `deep` is `true`, all nested objects will also be cloned, otherwise they will be assigned by reference. Functions and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and objects created by constructors other than `Object` are cloned to plain `Object` objects. Note: Lo-Dash's deep clone functionality is loosely based on the structured clone algorithm. See http://www.w3.org/TR/html5/common-dom-interfaces.html#internal-structured-cloning-algorithm.
|
Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `value` *(Mixed)*: The value to clone.
|
1. `value` *(Mixed)*: The value to clone.
|
||||||
@@ -1837,9 +1838,6 @@ var stooges = [
|
|||||||
{ 'name': 'curly', 'age': 60 }
|
{ 'name': 'curly', 'age': 60 }
|
||||||
];
|
];
|
||||||
|
|
||||||
_.clone({ 'name': 'moe' });
|
|
||||||
// => { 'name': 'moe' }
|
|
||||||
|
|
||||||
var shallow = _.clone(stooges);
|
var shallow = _.clone(stooges);
|
||||||
shallow[0] === stooges[0];
|
shallow[0] === stooges[0];
|
||||||
// => true
|
// => true
|
||||||
@@ -1854,10 +1852,41 @@ deep[0] === stooges[0];
|
|||||||
<!-- /div -->
|
<!-- /div -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- div -->
|
||||||
|
|
||||||
|
### <a id="_clonedeepvalue"></a>`_.cloneDeep(value)`
|
||||||
|
<a href="#_clonedeepvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1095 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
|
Creates a deep clone of `value`. Functions and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and objects created by constructors other than `Object` are cloned to plain `Object` objects. Note: Lo-Dash's deep clone functionality is loosely based on the structured clone algorithm. See http://www.w3.org/TR/html5/common-dom-interfaces.html#internal-structured-cloning-algorithm.
|
||||||
|
|
||||||
|
#### Arguments
|
||||||
|
1. `value` *(Mixed)*: The value to deep clone.
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
*(Mixed)*: Returns the deep cloned `value`.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
```js
|
||||||
|
var stooges = [
|
||||||
|
{ 'name': 'moe', 'age': 40 },
|
||||||
|
{ 'name': 'larry', 'age': 50 },
|
||||||
|
{ 'name': 'curly', 'age': 60 }
|
||||||
|
];
|
||||||
|
|
||||||
|
var deep = _.cloneDeep(stooges);
|
||||||
|
deep[0] === stooges[0];
|
||||||
|
// => false
|
||||||
|
```
|
||||||
|
|
||||||
|
* * *
|
||||||
|
|
||||||
|
<!-- /div -->
|
||||||
|
|
||||||
|
|
||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])`
|
### <a id="_defaultsobject--default1-default2-"></a>`_.defaults(object [, default1, default2, ...])`
|
||||||
<a href="#_defaultsobject--default1-default2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1097 "View in source") [Ⓣ][1]
|
<a href="#_defaultsobject--default1-default2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1117 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Assigns own enumerable properties of source object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
|
Assigns own enumerable properties of source object(s) to the `destination` object for all `destination` properties that resolve to `null`/`undefined`. Once a property is set, additional defaults of the same property will be ignored.
|
||||||
|
|
||||||
@@ -1947,7 +1976,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_functionsobject"></a>`_.functions(object)`
|
### <a id="_functionsobject"></a>`_.functions(object)`
|
||||||
<a href="#_functionsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1116 "View in source") [Ⓣ][1]
|
<a href="#_functionsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1136 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
|
Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values.
|
||||||
|
|
||||||
@@ -1974,7 +2003,7 @@ _.functions(_);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_hasobject-property"></a>`_.has(object, property)`
|
### <a id="_hasobject-property"></a>`_.has(object, property)`
|
||||||
<a href="#_hasobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1141 "View in source") [Ⓣ][1]
|
<a href="#_hasobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1161 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
|
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
|
||||||
|
|
||||||
@@ -1999,7 +2028,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_invertobject"></a>`_.invert(object)`
|
### <a id="_invertobject"></a>`_.invert(object)`
|
||||||
<a href="#_invertobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1158 "View in source") [Ⓣ][1]
|
<a href="#_invertobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1178 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an object composed of the inverted keys and values of the given `object`.
|
Creates an object composed of the inverted keys and values of the given `object`.
|
||||||
|
|
||||||
@@ -2050,7 +2079,7 @@ _.isArguments([1, 2, 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isarrayvalue"></a>`_.isArray(value)`
|
### <a id="_isarrayvalue"></a>`_.isArray(value)`
|
||||||
<a href="#_isarrayvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1182 "View in source") [Ⓣ][1]
|
<a href="#_isarrayvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1202 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is an array.
|
Checks if `value` is an array.
|
||||||
|
|
||||||
@@ -2077,7 +2106,7 @@ _.isArray([1, 2, 3]);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <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#L1201 "View in source") [Ⓣ][1]
|
<a href="#_isbooleanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1221 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a boolean *(`true` or `false`)* value.
|
Checks if `value` is a boolean *(`true` or `false`)* value.
|
||||||
|
|
||||||
@@ -2101,7 +2130,7 @@ _.isBoolean(null);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isdatevalue"></a>`_.isDate(value)`
|
### <a id="_isdatevalue"></a>`_.isDate(value)`
|
||||||
<a href="#_isdatevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1218 "View in source") [Ⓣ][1]
|
<a href="#_isdatevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1238 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a date.
|
Checks if `value` is a date.
|
||||||
|
|
||||||
@@ -2125,7 +2154,7 @@ _.isDate(new Date);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_iselementvalue"></a>`_.isElement(value)`
|
### <a id="_iselementvalue"></a>`_.isElement(value)`
|
||||||
<a href="#_iselementvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1235 "View in source") [Ⓣ][1]
|
<a href="#_iselementvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1255 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a DOM element.
|
Checks if `value` is a DOM element.
|
||||||
|
|
||||||
@@ -2149,7 +2178,7 @@ _.isElement(document.body);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isemptyvalue"></a>`_.isEmpty(value)`
|
### <a id="_isemptyvalue"></a>`_.isEmpty(value)`
|
||||||
<a href="#_isemptyvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1260 "View in source") [Ⓣ][1]
|
<a href="#_isemptyvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1280 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty".
|
Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty".
|
||||||
|
|
||||||
@@ -2179,7 +2208,7 @@ _.isEmpty('');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isequala-b"></a>`_.isEqual(a, b)`
|
### <a id="_isequala-b"></a>`_.isEqual(a, b)`
|
||||||
<a href="#_isequala-b">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1302 "View in source") [Ⓣ][1]
|
<a href="#_isequala-b">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1322 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Performs a deep comparison between two values to determine if they are equivalent to each other.
|
Performs a deep comparison between two values to determine if they are equivalent to each other.
|
||||||
|
|
||||||
@@ -2210,7 +2239,7 @@ _.isEqual(moe, clone);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isfinitevalue"></a>`_.isFinite(value)`
|
### <a id="_isfinitevalue"></a>`_.isFinite(value)`
|
||||||
<a href="#_isfinitevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1454 "View in source") [Ⓣ][1]
|
<a href="#_isfinitevalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1474 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is, or can be coerced to, a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and empty strings. See http://es5.github.com/#x15.1.2.5.
|
Checks if `value` is, or can be coerced to, a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and empty strings. See http://es5.github.com/#x15.1.2.5.
|
||||||
|
|
||||||
@@ -2246,7 +2275,7 @@ _.isFinite(Infinity);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isfunctionvalue"></a>`_.isFunction(value)`
|
### <a id="_isfunctionvalue"></a>`_.isFunction(value)`
|
||||||
<a href="#_isfunctionvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1471 "View in source") [Ⓣ][1]
|
<a href="#_isfunctionvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1491 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a function.
|
Checks if `value` is a function.
|
||||||
|
|
||||||
@@ -2270,7 +2299,7 @@ _.isFunction(_);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnanvalue"></a>`_.isNaN(value)`
|
### <a id="_isnanvalue"></a>`_.isNaN(value)`
|
||||||
<a href="#_isnanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1534 "View in source") [Ⓣ][1]
|
<a href="#_isnanvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1554 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return `true` for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
|
Checks if `value` is `NaN`. Note: This is not the same as native `isNaN`, which will return `true` for `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
|
||||||
|
|
||||||
@@ -2303,7 +2332,7 @@ _.isNaN(undefined);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnullvalue"></a>`_.isNull(value)`
|
### <a id="_isnullvalue"></a>`_.isNull(value)`
|
||||||
<a href="#_isnullvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1]
|
<a href="#_isnullvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1576 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `null`.
|
Checks if `value` is `null`.
|
||||||
|
|
||||||
@@ -2330,7 +2359,7 @@ _.isNull(undefined);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isnumbervalue"></a>`_.isNumber(value)`
|
### <a id="_isnumbervalue"></a>`_.isNumber(value)`
|
||||||
<a href="#_isnumbervalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1573 "View in source") [Ⓣ][1]
|
<a href="#_isnumbervalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1593 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a number.
|
Checks if `value` is a number.
|
||||||
|
|
||||||
@@ -2354,7 +2383,7 @@ _.isNumber(8.4 * 5);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isobjectvalue"></a>`_.isObject(value)`
|
### <a id="_isobjectvalue"></a>`_.isObject(value)`
|
||||||
<a href="#_isobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1501 "View in source") [Ⓣ][1]
|
<a href="#_isobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1521 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)*
|
Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)*
|
||||||
|
|
||||||
@@ -2384,7 +2413,7 @@ _.isObject(1);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isplainobjectvalue"></a>`_.isPlainObject(value)`
|
### <a id="_isplainobjectvalue"></a>`_.isPlainObject(value)`
|
||||||
<a href="#_isplainobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1601 "View in source") [Ⓣ][1]
|
<a href="#_isplainobjectvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1621 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if a given `value` is an object created by the `Object` constructor.
|
Checks if a given `value` is an object created by the `Object` constructor.
|
||||||
|
|
||||||
@@ -2419,7 +2448,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isregexpvalue"></a>`_.isRegExp(value)`
|
### <a id="_isregexpvalue"></a>`_.isRegExp(value)`
|
||||||
<a href="#_isregexpvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1626 "View in source") [Ⓣ][1]
|
<a href="#_isregexpvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1646 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a regular expression.
|
Checks if `value` is a regular expression.
|
||||||
|
|
||||||
@@ -2443,7 +2472,7 @@ _.isRegExp(/moe/);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isstringvalue"></a>`_.isString(value)`
|
### <a id="_isstringvalue"></a>`_.isString(value)`
|
||||||
<a href="#_isstringvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1643 "View in source") [Ⓣ][1]
|
<a href="#_isstringvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1663 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is a string.
|
Checks if `value` is a string.
|
||||||
|
|
||||||
@@ -2467,7 +2496,7 @@ _.isString('moe');
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_isundefinedvalue"></a>`_.isUndefined(value)`
|
### <a id="_isundefinedvalue"></a>`_.isUndefined(value)`
|
||||||
<a href="#_isundefinedvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1660 "View in source") [Ⓣ][1]
|
<a href="#_isundefinedvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1680 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Checks if `value` is `undefined`.
|
Checks if `value` is `undefined`.
|
||||||
|
|
||||||
@@ -2491,7 +2520,7 @@ _.isUndefined(void 0);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_keysobject"></a>`_.keys(object)`
|
### <a id="_keysobject"></a>`_.keys(object)`
|
||||||
<a href="#_keysobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1677 "View in source") [Ⓣ][1]
|
<a href="#_keysobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1697 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array composed of the own enumerable property names of `object`.
|
Creates an array composed of the own enumerable property names of `object`.
|
||||||
|
|
||||||
@@ -2515,7 +2544,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_mergeobject--source1-source2-"></a>`_.merge(object [, source1, source2, ...])`
|
### <a id="_mergeobject--source1-source2-"></a>`_.merge(object [, source1, source2, ...])`
|
||||||
<a href="#_mergeobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1715 "View in source") [Ⓣ][1]
|
<a href="#_mergeobject--source1-source2-">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1735 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
Merges enumerable properties of the source object(s) into the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
|
||||||
|
|
||||||
@@ -2550,7 +2579,7 @@ _.merge(stooges, ages);
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_omitobject-callback-prop1-prop2--thisarg"></a>`_.omit(object, callback|[prop1, prop2, ..., thisArg])`
|
### <a id="_omitobject-callback-prop1-prop2--thisarg"></a>`_.omit(object, callback|[prop1, prop2, ..., thisArg])`
|
||||||
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1789 "View in source") [Ⓣ][1]
|
<a href="#_omitobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1809 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
||||||
|
|
||||||
@@ -2581,7 +2610,7 @@ _.omit({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(va
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pairsobject"></a>`_.pairs(object)`
|
### <a id="_pairsobject"></a>`_.pairs(object)`
|
||||||
<a href="#_pairsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1823 "View in source") [Ⓣ][1]
|
<a href="#_pairsobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1843 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
|
Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`.
|
||||||
|
|
||||||
@@ -2605,7 +2634,7 @@ _.pairs({ 'moe': 30, 'larry': 40, 'curly': 50 });
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
|
### <a id="_pickobject-callback-prop1-prop2--thisarg"></a>`_.pick(object, callback|[prop1, prop2, ..., thisArg])`
|
||||||
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1856 "View in source") [Ⓣ][1]
|
<a href="#_pickobject-callback-prop1-prop2--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1876 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*.
|
||||||
|
|
||||||
@@ -2636,7 +2665,7 @@ _.pick({ 'name': 'moe', '_hint': 'knucklehead', '_seed': '96c4eb' }, function(va
|
|||||||
<!-- div -->
|
<!-- div -->
|
||||||
|
|
||||||
### <a id="_valuesobject"></a>`_.values(object)`
|
### <a id="_valuesobject"></a>`_.values(object)`
|
||||||
<a href="#_valuesobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1893 "View in source") [Ⓣ][1]
|
<a href="#_valuesobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1913 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
Creates an array composed of the own enumerable property values of `object`.
|
Creates an array composed of the own enumerable property values of `object`.
|
||||||
|
|
||||||
@@ -2667,7 +2696,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#L3718 "View in source") [Ⓣ][1]
|
<a href="#_escapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3746 "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.
|
||||||
|
|
||||||
@@ -2691,9 +2720,9 @@ _.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#L3738 "View in source") [Ⓣ][1]
|
<a href="#_identityvalue">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3764 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
This function returns the first argument passed to it. Note: This function is used throughout Lo-Dash as a default callback.
|
This function returns the first argument passed to it.
|
||||||
|
|
||||||
#### Arguments
|
#### Arguments
|
||||||
1. `value` *(Mixed)*: Any value.
|
1. `value` *(Mixed)*: Any value.
|
||||||
@@ -2716,7 +2745,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#L3764 "View in source") [Ⓣ][1]
|
<a href="#_mixinobject">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3790 "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.
|
||||||
|
|
||||||
@@ -2746,7 +2775,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#L3790 "View in source") [Ⓣ][1]
|
<a href="#_noconflict">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3816 "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.
|
||||||
|
|
||||||
@@ -2766,7 +2795,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#L3813 "View in source") [Ⓣ][1]
|
<a href="#_randommin0-max1">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3839 "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.
|
||||||
|
|
||||||
@@ -2794,7 +2823,7 @@ _.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#L3851 "View in source") [Ⓣ][1]
|
<a href="#_resultobject-property">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3877 "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.
|
||||||
|
|
||||||
@@ -2829,7 +2858,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#L3936 "View in source") [Ⓣ][1]
|
<a href="#_templatetext-data-options">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3962 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
|
A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. Note: In the development build `_.template` utilizes sourceURLs for easier debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` build and avoiding `_.template` use, or loading Lo-Dash in a sandboxed page. See http://developer.chrome.com/trunk/extensions/sandboxingEval.html
|
||||||
|
|
||||||
@@ -2903,7 +2932,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#L4067 "View in source") [Ⓣ][1]
|
<a href="#_timesn-callback--thisarg">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4093 "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)*.
|
||||||
|
|
||||||
@@ -2935,7 +2964,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#L4093 "View in source") [Ⓣ][1]
|
<a href="#_unescapestring">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4119 "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.
|
||||||
|
|
||||||
@@ -2959,7 +2988,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#L4113 "View in source") [Ⓣ][1]
|
<a href="#_uniqueidprefix">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4139 "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.
|
||||||
|
|
||||||
@@ -2993,7 +3022,7 @@ _.uniqueId();
|
|||||||
<!-- 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#L4337 "View in source") [Ⓣ][1]
|
<a href="#_version">#</a> [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4364 "View in source") [Ⓣ][1]
|
||||||
|
|
||||||
*(String)*: The semantic version number.
|
*(String)*: The semantic version number.
|
||||||
|
|
||||||
|
|||||||
32
lodash.min.js
vendored
32
lodash.min.js
vendored
@@ -17,7 +17,7 @@ t))){for(var f=u.length;f--;)if(i=u[f]==t)break;i?e[n]=a[f]:(u.push(t),a.push(o=
|
|||||||
i?i:0),t=l(t,n);if(gn(e))for(;++r<i;)s[r]=t(e[r],r,e);else ln(e,function(e,n,i){s[++r]=t(e,n,i)});return s}function j(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&L(e)?u:l(t,n),ln(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++i<s;)e[i]>o&&(o=e[i]);return o}function F(e,t){return B(e,t+"")}function I(e,t,r,s){var o=3>arguments.length,t=l(t,s,n);if(gn(e)){var u=-1,a=e.length;for(o&&(r=e[++u]);++u<a;)r=t(r,e[u],u,e)}else ln(e,function(e,n,s){r=o?(o=i,e):t(r,e,n,s)});
|
i?i:0),t=l(t,n);if(gn(e))for(;++r<i;)s[r]=t(e[r],r,e);else ln(e,function(e,n,i){s[++r]=t(e,n,i)});return s}function j(e,t,n){var r=-Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&L(e)?u:l(t,n),ln(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,o=e)});else for(;++i<s;)e[i]>o&&(o=e[i]);return o}function F(e,t){return B(e,t+"")}function I(e,t,r,s){var o=3>arguments.length,t=l(t,s,n);if(gn(e)){var u=-1,a=e.length;for(o&&(r=e[++u]);++u<a;)r=t(r,e[u],u,e)}else ln(e,function(e,n,s){r=o?(o=i,e):t(r,e,n,s)});
|
||||||
return r}function q(e,t,r,s){var o=e,u=e?e.length:0,a=3>arguments.length;if("number"!=typeof u)var f=bn(e),u=f.length;else Zt&&L(e)&&(o=e.split(""));return t=l(t,s,n),H(e,function(e,n,s){n=f?f[--u]:--u,r=a?(a=i,o[n]):t(r,o[n],n,s)}),r}function R(e,t,n){var r,t=l(t,n);if(gn(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else ln(e,function(e,n,i){return!(r=t(e,n,i))});return!!r}function U(e,t,n){if(e){var i=e.length;return t==r||n?e[0]:m(e,0,Pt(Dt(0,t),i))}}function z(e,t){for(var n=-1,r=e?e.
|
return r}function q(e,t,r,s){var o=e,u=e?e.length:0,a=3>arguments.length;if("number"!=typeof u)var f=bn(e),u=f.length;else Zt&&L(e)&&(o=e.split(""));return t=l(t,s,n),H(e,function(e,n,s){n=f?f[--u]:--u,r=a?(a=i,o[n]):t(r,o[n],n,s)}),r}function R(e,t,n){var r,t=l(t,n);if(gn(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else ln(e,function(e,n,i){return!(r=t(e,n,i))});return!!r}function U(e,t,n){if(e){var i=e.length;return t==r||n?e[0]:m(e,0,Pt(Dt(0,t),i))}}function z(e,t){for(var n=-1,r=e?e.
|
||||||
length:0,i=[];++n<r;){var s=e[n];gn(s)?Nt.apply(i,t?s:z(s)):i.push(s)}return i}function W(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?Dt(0,i+n):n||0)-1;else if(n)return r=V(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function X(e,t,n){return m(e,t==r||n?1:Dt(0,t))}function V(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?l(n,r):K,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function $(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=u;"function"==typeof t&&(r=n,n=t,t=i);var f=!
|
length:0,i=[];++n<r;){var s=e[n];gn(s)?Nt.apply(i,t?s:z(s)):i.push(s)}return i}function W(e,t,n){var r=-1,i=e?e.length:0;if("number"==typeof n)r=(0>n?Dt(0,i+n):n||0)-1;else if(n)return r=V(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function X(e,t,n){return m(e,t==r||n?1:Dt(0,t))}function V(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?l(n,r):K,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i=r+1:s=r;return i}function $(e,t,n,r){var s=-1,o=e?e.length:0,u=[],a=u;"function"==typeof t&&(r=n,n=t,t=i);var f=!
|
||||||
t&&74<o;if(f)var c={};n&&(a=[],n=l(n,r));for(;++s<o;){var r=e[s],h=n?n(r,s,e):r;if(f)var p=Tt.call(c,h+"")?!(a=c[h]):a=[];if(t?!s||a[a.length-1]!==h:p||0>W(a,h))(n||f)&&a.push(h),u.push(r)}return u}function J(e,t){return Vt||Lt&&2<arguments.length?Lt.call.apply(Lt,arguments):f(e,t,m(arguments,2))}function K(e){return e}function Q(e){H(S(e),function(t){var n=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return Nt.apply(e,arguments),e=n.apply(s,e),new s(e)}})}function G(){return this
|
t&&75<=o;if(f)var c={};n&&(a=[],n=l(n,r));for(;++s<o;){var r=e[s],h=n?n(r,s,e):r;if(f)var p=Tt.call(c,h+"")?!(a=c[h]):a=c[h]=[];if(t?!s||a[a.length-1]!==h:p||0>W(a,h))(n||f)&&a.push(h),u.push(r)}return u}function J(e,t){return Vt||Lt&&2<arguments.length?Lt.call.apply(Lt,arguments):f(e,t,m(arguments,2))}function K(e){return e}function Q(e){H(S(e),function(t){var n=s[t]=e[t];s.prototype[t]=function(){var e=[this.__wrapped__];return Nt.apply(e,arguments),e=n.apply(s,e),new s(e)}})}function G(){return this
|
||||||
.__wrapped__}var n=!0,r=null,i=!1,Y="object"==typeof exports&&exports,Z="object"==typeof global&&global;Z.global===Z&&(e=Z);var et=[],tt=new function(){},nt=0,rt=tt,it=30,st=e._,ot=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,ut=/&(?:amp|lt|gt|quot|#x27);/g,at=/\b__p\+='';/g,ft=/\b(__p\+=)''\+/g,lt=/(__e\(.*?\)|\b__t\))\+'';/g,ct=/\w*$/,ht=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,pt=RegExp("^"+(tt.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g
|
.__wrapped__}var n=!0,r=null,i=!1,Y="object"==typeof exports&&exports,Z="object"==typeof global&&global;Z.global===Z&&(e=Z);var et=[],tt=new function(){},nt=0,rt=tt,it=30,st=e._,ot=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,ut=/&(?:amp|lt|gt|quot|#x27);/g,at=/\b__p\+='';/g,ft=/\b(__p\+=)''\+/g,lt=/(__e\(.*?\)|\b__t\))\+'';/g,ct=/\w*$/,ht=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,pt=RegExp("^"+(tt.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g
|
||||||
,".+?")+"$"),dt=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,vt=/<%=([\s\S]+?)%>/g,mt=/($^)/,gt=/[&<>"']/g,yt=/['\n\r\t\u2028\u2029\\]/g,bt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),wt=Math.ceil,Et=et.concat,St=Math.floor,xt=pt.test(xt=Object.getPrototypeOf)&&xt,Tt=tt.hasOwnProperty,Nt=et.push,Ct=tt.propertyIsEnumerable,kt=tt.toString,Lt=pt.test(Lt=m.bind)&&Lt,At=pt.test(At=Array.isArray)&&At,Ot=e.isFinite,Mt=e.isNaN,_t=pt.test(_t=Object.keys)&&
|
,".+?")+"$"),dt=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,vt=/<%=([\s\S]+?)%>/g,mt=/($^)/,gt=/[&<>"']/g,yt=/['\n\r\t\u2028\u2029\\]/g,bt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),wt=Math.ceil,Et=et.concat,St=Math.floor,xt=pt.test(xt=Object.getPrototypeOf)&&xt,Tt=tt.hasOwnProperty,Nt=et.push,Ct=tt.propertyIsEnumerable,kt=tt.toString,Lt=pt.test(Lt=m.bind)&&Lt,At=pt.test(At=Array.isArray)&&At,Ot=e.isFinite,Mt=e.isNaN,_t=pt.test(_t=Object.keys)&&
|
||||||
_t,Dt=Math.max,Pt=Math.min,Ht=Math.random,Bt="[object Arguments]",jt="[object Array]",Ft="[object Boolean]",It="[object Date]",qt="[object Number]",Rt="[object Object]",Ut="[object RegExp]",zt="[object String]",Wt=!!e.attachEvent,Xt=Lt&&!/\n|true/.test(Lt+Wt),Vt=Lt&&!Xt,$t=_t&&(Wt||Xt),Jt,Kt,Qt=(Qt={0:1,length:1},et.splice.call(Qt,0,1),Qt[0]),Gt=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)Gt=!n;Jt=!/valueOf/.test(t),Kt="x"!=
|
_t,Dt=Math.max,Pt=Math.min,Ht=Math.random,Bt="[object Arguments]",jt="[object Array]",Ft="[object Boolean]",It="[object Date]",qt="[object Number]",Rt="[object Object]",Ut="[object RegExp]",zt="[object String]",Wt=!!e.attachEvent,Xt=Lt&&!/\n|true/.test(Lt+Wt),Vt=Lt&&!Xt,$t=_t&&(Wt||Xt),Jt,Kt,Qt=(Qt={0:1,length:1},et.splice.call(Qt,0,1),Qt[0]),Gt=n;(function(){function e(){this.x=1}var t=[];e.prototype={valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)Gt=!n;Jt=!/valueOf/.test(t),Kt="x"!=
|
||||||
@@ -26,18 +26,18 @@ t[0]})(1);var Yt=!y(arguments),Zt="xx"!="x"[0]+Object("x")[0];try{var en=("[obje
|
|||||||
},vn=x(dn),mn=c(un,{g:"if(t[i]==null)"+un.g}),gn=At||function(e){return e instanceof Array||kt.call(e)==jt};N(/x/)&&(N=function(e){return e instanceof Function||"[object Function]"==kt.call(e)});var yn=xt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=xt(t))&&xt(n);return n?e==n||xt(e)==n&&!y(e):b(e)}:b,bn=_t?function(e){return"function"==typeof e&&Ct.call(e,"prototype")?w(e):C(e)?_t(e):[]}:w;s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t
|
},vn=x(dn),mn=c(un,{g:"if(t[i]==null)"+un.g}),gn=At||function(e){return e instanceof Array||kt.call(e)==jt};N(/x/)&&(N=function(e){return e instanceof Function||"[object Function]"==kt.call(e)});var yn=xt?function(e){if(!e||"object"!=typeof e)return i;var t=e.valueOf,n="function"==typeof t&&(n=xt(t))&&xt(n);return n?e==n||xt(e)==n&&!y(e):b(e)}:b,bn=_t?function(e){return"function"==typeof e&&Ct.call(e,"prototype")?w(e):C(e)?_t(e):[]}:w;s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t
|
||||||
.apply(this,arguments)}},s.assign=cn,s.bind=J,s.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=S(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=J(e[i],e)}return e},s.bindKey=function(e,t){return f(e,t,m(arguments,2))},s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.countBy=function(e,t,n){var r={},t=l(t,n);return H
|
.apply(this,arguments)}},s.assign=cn,s.bind=J,s.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=S(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=J(e[i],e)}return e},s.bindKey=function(e,t){return f(e,t,m(arguments,2))},s.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},s.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},s.countBy=function(e,t,n){var r={},t=l(t,n);return H
|
||||||
(e,function(e,n,i){n=t(e,n,i),Tt.call(r,n)?r[n]++:r[n]=1}),r},s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=mn,s.defer=function(e){var n=m(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=m(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},s.difference=function(e){for(var t=-1,n=e?e.length:0,r=Et
|
(e,function(e,n,i){n=t(e,n,i),Tt.call(r,n)?r[n]++:r[n]=1}),r},s.debounce=function(e,t,n){function i(){a=r,n||(o=e.apply(u,s))}var s,o,u,a;return function(){var r=n&&!a;return s=arguments,u=this,clearTimeout(a),a=setTimeout(i,t),r&&(o=e.apply(u,s)),o}},s.defaults=mn,s.defer=function(e){var n=m(arguments,1);return setTimeout(function(){e.apply(t,n)},1)},s.delay=function(e,n){var r=m(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},s.difference=function(e){for(var t=-1,n=e?e.length:0,r=Et
|
||||||
.apply(et,arguments),r=o(r,n),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.filter=D,s.flatten=z,s.forEach=H,s.forIn=hn,s.forOwn=pn,s.functions=S,s.groupBy=function(e,t,n){var r={},t=l(t,n);return H(e,function(e,n,i){n=t(e,n,i),(Tt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},s.initial=function(e,t,n){if(!e)return[];var i=e.length;return m(e,0,Pt(Dt(0,i-(t==r||n?1:t||0)),i))},s.intersection=function(e){var t=arguments,n=t.length,r=-1,i=e?e.length:0,s={},u=[];e:for(;++r<i;){var a=e[r];if(0>W(u,a)){for(
|
.apply(et,arguments),r=o(r,n),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.filter=D,s.flatten=z,s.forEach=H,s.forIn=hn,s.forOwn=pn,s.functions=S,s.groupBy=function(e,t,n){var r={},t=l(t,n);return H(e,function(e,n,i){n=t(e,n,i),(Tt.call(r,n)?r[n]:r[n]=[]).push(e)}),r},s.initial=function(e,t,n){if(!e)return[];var i=e.length;return m(e,0,Pt(Dt(0,i-(t==r||n?1:t||0)),i))},s.intersection=function(e){var t=arguments,n=t.length,r={0:{}},i=-1,s=e?e.length:0,u=100<=s,a=[],f=a;e:for(;++i<s;){var l=e[
|
||||||
var f=n;--f;)if(!(s[f]||(s[f]=o(t[f])))(a))continue e;u.push(a)}}return u},s.invert=x,s.invoke=function(e,t){var n=m(arguments,2),r="function"==typeof t,i=[];return H(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.keys=bn,s.map=B,s.max=j,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=A,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&L(e)?u:l(t,n),ln(
|
i];if(u)var c=Tt.call(r[0],l+"")?!(f=r[0][l]):f=r[0][l]=[];if(c||0>W(f,l)){u&&f.push(l);for(var h=n;--h;)if(!(r[h]||(r[h]=o(t[h],0,100)))(l))continue e;a.push(l)}}return a},s.invert=x,s.invoke=function(e,t){var n=m(arguments,2),r="function"==typeof t,i=[];return H(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},s.keys=bn,s.map=B,s.max=j,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Tt.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.merge=A
|
||||||
e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},s.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},s.omit=function(e,t,n){var r="function"==typeof t,i={};if(r)t=l(t,n);else var s=Et.apply(et,arguments);return hn(e,function(e,n,o){if(r?!t(e,n,o):0>W(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return pn
|
,s.min=function(e,t,n){var r=Infinity,i=-1,s=e?e.length:0,o=r;if(t||!gn(e))t=!t&&L(e)?u:l(t,n),ln(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,o=e)});else for(;++i<s;)e[i]<o&&(o=e[i]);return o},s.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},s.omit=function(e,t,n){var r="function"==typeof t,i={};if(r)t=l(t,n);else var s=Et.apply(et,arguments);return hn(e,function(e,n,o){if(r?!t(e,n,o):0>W(s,n,1))i[n]=e}),i},s.once=function(e){var t,s=i;return function(
|
||||||
(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return f(e,m(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=Et.apply(et,arguments),o=s.length;++i<o;){var u=s[i];u in e&&(r[u]=e[u])}else t=l(t,n),hn(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},s.pluck=F,s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=Dt(0,wt((t-e)/n)),s=Array(t);++i<t;)s[i]=e,e+=n;return s},s.reject=function(e,t,n){return t=l(t,n),D(e,function(e,n,r){return!
|
){return s?t:(s=n,t=e.apply(this,arguments),e=r,t)}},s.pairs=function(e){var t=[];return pn(e,function(e,n){t.push([n,e])}),t},s.partial=function(e){return f(e,m(arguments,1))},s.pick=function(e,t,n){var r={};if("function"!=typeof t)for(var i=0,s=Et.apply(et,arguments),o=s.length;++i<o;){var u=s[i];u in e&&(r[u]=e[u])}else t=l(t,n),hn(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},s.pluck=F,s.range=function(e,t,n){e=+e||0,n=+n||1,t==r&&(t=e,e=0);for(var i=-1,t=Dt(0,wt((t-e)/n)),s=Array(t);++i<t
|
||||||
t(e,n,r)})},s.rest=X,s.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return H(e,function(e){var r=St(Ht()*(++t+1));n[t]=n[r],n[r]=e}),n},s.sortBy=function(e,t,n){var r=[],t=l(t,n);H(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(a);e--;)r[e]=r[e].c;return r},s.tap=function(e,t){return t(e),e},s.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(){var f=new Date,l=t-(f-a);return i=arguments,o=this,0>=l?(clearTimeout(u),u=r
|
;)s[i]=e,e+=n;return s},s.reject=function(e,t,n){return t=l(t,n),D(e,function(e,n,r){return!t(e,n,r)})},s.rest=X,s.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return H(e,function(e){var r=St(Ht()*(++t+1));n[t]=n[r],n[r]=e}),n},s.sortBy=function(e,t,n){var r=[],t=l(t,n);H(e,function(e,n,i){r.push({a:t(e,n,i),b:n,c:e})}),e=r.length;for(r.sort(a);e--;)r[e]=r[e].c;return r},s.tap=function(e,t){return t(e),e},s.throttle=function(e,t){function n(){a=new Date,u=r,s=e.apply(o,i)}var i,s,o,u,a=0;return function(
|
||||||
,a=f,s=e.apply(o,i)):u||(u=setTimeout(n,l)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},s.toArray=function(e){return"number"==typeof (e?e.length:0)?Zt&&L(e)?e.split(""):m(e):O(e)},s.union=function(){return $(Et.apply(et,arguments))},s.uniq=$,s.values=O,s.where=function(e,t){var n=bn(t);return D(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},s.without=function(e){for(var t=-1,n=e?e.length:0,r=o(arguments,1,20
|
){var f=new Date,l=t-(f-a);return i=arguments,o=this,0>=l?(clearTimeout(u),u=r,a=f,s=e.apply(o,i)):u||(u=setTimeout(n,l)),s}},s.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},s.toArray=function(e){return"number"==typeof (e?e.length:0)?Zt&&L(e)?e.split(""):m(e):O(e)},s.union=function(){return $(Et.apply(et,arguments))},s.uniq=$,s.values=O,s.where=function(e,t){var n=bn(t);return D(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!
|
||||||
),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.wrap=function(e,t){return function(){var n=[e];return Nt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){for(var t=-1,n=e?j(F(arguments,"length")):0,r=Array(n);++t<n;)r[t]=F(arguments,t);return r},s.collect=B,s.drop=X,s.each=H,s.extend=cn,s.methods=S,s.select=D,s.tail=X,s.unique=$,Q(s),s.clone=E,s.contains=M,s.escape=function(e){return e==r?"":(e+"").replace(gt,p)},s.every=_,s.find=P,s.has=function(e,t){return e?Tt.call(e,t):i},s.identity=
|
i})},s.without=function(e){for(var t=-1,n=e?e.length:0,r=o(arguments,1,20),i=[];++t<n;){var s=e[t];r(s)||i.push(s)}return i},s.wrap=function(e,t){return function(){var n=[e];return Nt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){for(var t=-1,n=e?j(F(arguments,"length")):0,r=Array(n);++t<n;)r[t]=F(arguments,t);return r},s.collect=B,s.drop=X,s.each=H,s.extend=cn,s.methods=S,s.select=D,s.tail=X,s.unique=$,Q(s),s.clone=E,s.cloneDeep=function(e){return E(e,n)},s.contains=M,s.escape=function(
|
||||||
K,s.indexOf=W,s.isArguments=y,s.isArray=gn,s.isBoolean=function(e){return e===n||e===i||kt.call(e)==Ft},s.isDate=function(e){return e instanceof Date||kt.call(e)==It},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=kt.call(e),s=e.length;return r==jt||r==zt||r==Bt||Yt&&y(e)||r==Rt&&"number"==typeof s&&N(e.splice)?!s:(pn(e,function(){return t=i}),t)},s.isEqual=T,s.isFinite=function(e){return Ot(e)&&!Mt(parseFloat(e))},s.isFunction=N,s.isNaN=function(
|
e){return e==r?"":(e+"").replace(gt,p)},s.every=_,s.find=P,s.has=function(e,t){return e?Tt.call(e,t):i},s.identity=K,s.indexOf=W,s.isArguments=y,s.isArray=gn,s.isBoolean=function(e){return e===n||e===i||kt.call(e)==Ft},s.isDate=function(e){return e instanceof Date||kt.call(e)==It},s.isElement=function(e){return e?1===e.nodeType:i},s.isEmpty=function(e){var t=n;if(!e)return t;var r=kt.call(e),s=e.length;return r==jt||r==zt||r==Bt||Yt&&y(e)||r==Rt&&"number"==typeof s&&N(e.splice)?!s:(pn(e,function(
|
||||||
e){return k(e)&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=k,s.isObject=C,s.isPlainObject=yn,s.isRegExp=function(e){return e instanceof RegExp||kt.call(e)==Ut},s.isString=L,s.isUndefined=function(e){return"undefined"==typeof e},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?Dt(0,r+n):Pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.mixin=Q,s.noConflict=function(){return e._=st,this},s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0
|
){return t=i}),t)},s.isEqual=T,s.isFinite=function(e){return Ot(e)&&!Mt(parseFloat(e))},s.isFunction=N,s.isNaN=function(e){return k(e)&&e!=+e},s.isNull=function(e){return e===r},s.isNumber=k,s.isObject=C,s.isPlainObject=yn,s.isRegExp=function(e){return e instanceof RegExp||kt.call(e)==Ut},s.isString=L,s.isUndefined=function(e){return"undefined"==typeof e},s.lastIndexOf=function(e,t,n){var r=e?e.length:0;for("number"==typeof n&&(r=(0>n?Dt(0,r+n):Pt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.
|
||||||
),e+St(Ht()*((+t||0)-e+1))},s.reduce=I,s.reduceRight=q,s.result=function(e,t){var n=e?e[t]:r;return N(n)?e[t]():n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:bn(e).length},s.some=R,s.sortedIndex=V,s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=s.templateSettings,u=0,a=n.interpolate||o.interpolate||mt,f="__p+='",l=n.variable||o.variable,c=l;e.replace(RegExp((n.escape||o.escape||mt).source+"|"+a.source+"|"+(a===vt?dt:mt).source+"|"+(n.evaluate||o.evaluate||mt).source+"|$"
|
mixin=Q,s.noConflict=function(){return e._=st,this},s.random=function(e,t){return e==r&&t==r&&(t=1),e=+e||0,t==r&&(t=e,e=0),e+St(Ht()*((+t||0)-e+1))},s.reduce=I,s.reduceRight=q,s.result=function(e,t){var n=e?e[t]:r;return N(n)?e[t]():n},s.size=function(e){var t=e?e.length:0;return"number"==typeof t?t:bn(e).length},s.some=R,s.sortedIndex=V,s.template=function(e,t,n){e||(e=""),n||(n={});var r,i,o=s.templateSettings,u=0,a=n.interpolate||o.interpolate||mt,f="__p+='",l=n.variable||o.variable,c=l;e.replace
|
||||||
,"g"),function(t,n,i,s,o,a){return i||(i=s),f+=e.slice(u,a).replace(yt,h),n&&(f+="'+__e("+n+")+'"),o&&(f+="';"+o+";__p+='"),i&&(f+="'+((__t=("+i+"))==null?'':__t)+'"),r||(r=o||ot.test(n||i)),u=a+t.length,t}),f+="';\n",c||(l="obj",r?f="with("+l+"){"+f+"}":(n=RegExp("(\\(\\s*)"+l+"\\."+l+"\\b","g"),f=f.replace(ht,"$&"+l+".").replace(n,"$1__d"))),f=(r?f.replace(at,""):f).replace(ft,"$1").replace(lt,"$1;"),f="function("+l+"){"+(c?"":l+"||("+l+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"
|
(RegExp((n.escape||o.escape||mt).source+"|"+a.source+"|"+(a===vt?dt:mt).source+"|"+(n.evaluate||o.evaluate||mt).source+"|$","g"),function(t,n,i,s,o,a){return i||(i=s),f+=e.slice(u,a).replace(yt,h),n&&(f+="'+__e("+n+")+'"),o&&(f+="';"+o+";__p+='"),i&&(f+="'+((__t=("+i+"))==null?'':__t)+'"),r||(r=o||ot.test(n||i)),u=a+t.length,t}),f+="';\n",c||(l="obj",r?f="with("+l+"){"+f+"}":(n=RegExp("(\\(\\s*)"+l+"\\."+l+"\\b","g"),f=f.replace(ht,"$&"+l+".").replace(n,"$1__d"))),f=(r?f.replace(at,""):f).replace
|
||||||
:(c?"":",__d="+l+"."+l+"||"+l)+";")+f+"return __p}";try{i=Function("_","return "+f)(s)}catch(p){throw p.source=f,p}return t?i(t):(i.source=f,i)},s.unescape=function(e){return e==r?"":(e+"").replace(ut,g)},s.uniqueId=function(e){return(e==r?"":e+"")+ ++nt},s.all=_,s.any=R,s.detect=P,s.foldl=I,s.foldr=q,s.include=M,s.inject=I,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(){var t=[this.__wrapped__];return Nt.apply(t,arguments),e.apply(s,t)})}),s.first=U,s.last=function(e,t,n){if(e){var i=
|
(ft,"$1").replace(lt,"$1;"),f="function("+l+"){"+(c?"":l+"||("+l+"={});")+"var __t,__p='',__e=_.escape"+(r?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(c?"":",__d="+l+"."+l+"||"+l)+";")+f+"return __p}";try{i=Function("_","return "+f)(s)}catch(p){throw p.source=f,p}return t?i(t):(i.source=f,i)},s.unescape=function(e){return e==r?"":(e+"").replace(ut,g)},s.uniqueId=function(e){return(e==r?"":e+"")+ ++nt},s.all=_,s.any=R,s.detect=P,s.foldl=I,s.foldr=q,s.include=M,s.inject=
|
||||||
e.length;return t==r||n?e[i-1]:m(e,Dt(0,i-t))}},s.take=U,s.head=U,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(t,n){var i=e(this.__wrapped__,t,n);return t==r||n?i:new s(i)})}),s.VERSION="1.0.0-rc.2",s.prototype.toString=function(){return this.__wrapped__+""},s.prototype.value=G,s.prototype.valueOf=G,ln(["join","pop","shift"],function(e){var t=et[e];s.prototype[e]=function(){return t.apply(this.__wrapped__,arguments)}}),ln(["push","reverse","sort","unshift"],function(e){var t=et[e];
|
I,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(){var t=[this.__wrapped__];return Nt.apply(t,arguments),e.apply(s,t)})}),s.first=U,s.last=function(e,t,n){if(e){var i=e.length;return t==r||n?e[i-1]:m(e,Dt(0,i-t))}},s.take=U,s.head=U,pn(s,function(e,t){s.prototype[t]||(s.prototype[t]=function(t,n){var i=e(this.__wrapped__,t,n);return t==r||n?i:new s(i)})}),s.VERSION="1.0.0-rc.2",s.prototype.toString=function(){return this.__wrapped__+""},s.prototype.value=G,s.prototype.valueOf=G,ln(["join"
|
||||||
s.prototype[e]=function(){return t.apply(this.__wrapped__,arguments),this}}),ln(["concat","slice","splice"],function(e){var t=et[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return new s(e)}}),Qt&&ln(["shift","splice"],function(e){var t=s.prototype[e];s.prototype[e]=function(){var e=this.__wrapped__,n=t.apply(this,arguments);return 0===e.length&&delete e[0],n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):Y?"object"==typeof
|
,"pop","shift"],function(e){var t=et[e];s.prototype[e]=function(){return t.apply(this.__wrapped__,arguments)}}),ln(["push","reverse","sort","unshift"],function(e){var t=et[e];s.prototype[e]=function(){return t.apply(this.__wrapped__,arguments),this}}),ln(["concat","slice","splice"],function(e){var t=et[e];s.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return new s(e)}}),Qt&&ln(["shift","splice"],function(e){var t=s.prototype[e];s.prototype[e]=function(){var e=this.__wrapped__
|
||||||
module&&module&&module.exports==Y?(module.exports=s)._=s:Y._=s:e._=s})(this);
|
,n=t.apply(this,arguments);return 0===e.length&&delete e[0],n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=s,define(function(){return s})):Y?"object"==typeof module&&module&&module.exports==Y?(module.exports=s)._=s:Y._=s:e._=s})(this);
|
||||||
@@ -196,8 +196,8 @@
|
|||||||
* `unshift`, `values`, `where`, `without`, `wrap`, and `zip`
|
* `unshift`, `values`, `where`, `without`, `wrap`, and `zip`
|
||||||
*
|
*
|
||||||
* The non-chainable wrapper functions are:
|
* The non-chainable wrapper functions are:
|
||||||
* `clone`, `contains`, `escape`, `every`, `find`, `has`, `identity`, `indexOf`,
|
* `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, `identity`,
|
||||||
* `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`,
|
* `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`,
|
||||||
* `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`,
|
* `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`,
|
||||||
* `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`,
|
* `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`,
|
||||||
* `mixin`, `noConflict`, `pop`, `random`, `reduce`, `reduceRight`, `result`,
|
* `mixin`, `noConflict`, `pop`, `random`, `reduce`, `reduceRight`, `result`,
|
||||||
@@ -780,14 +780,8 @@
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a clone of `value`. If `deep` is `true`, all nested objects will
|
* Creates a clone of `value`. If `deep` is `true`, nested objects will also
|
||||||
* also be cloned, otherwise they will be assigned by reference. Functions and
|
* be cloned, otherwise they will be assigned by reference.
|
||||||
* DOM nodes are **not** cloned. The enumerable properties of `arguments` objects
|
|
||||||
* and objects created by constructors other than `Object` are cloned to plain
|
|
||||||
* `Object` objects.
|
|
||||||
*
|
|
||||||
* Note: Lo-Dash's deep clone functionality is loosely based on the structured clone algorithm.
|
|
||||||
* See http://www.w3.org/TR/html5/common-dom-interfaces.html#internal-structured-cloning-algorithm.
|
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -808,9 +802,6 @@
|
|||||||
* { 'name': 'curly', 'age': 60 }
|
* { 'name': 'curly', 'age': 60 }
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* _.clone({ 'name': 'moe' });
|
|
||||||
* // => { 'name': 'moe' }
|
|
||||||
*
|
|
||||||
* var shallow = _.clone(stooges);
|
* var shallow = _.clone(stooges);
|
||||||
* shallow[0] === stooges[0];
|
* shallow[0] === stooges[0];
|
||||||
* // => true
|
* // => true
|
||||||
@@ -2475,8 +2466,8 @@
|
|||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Arrays
|
* @category Arrays
|
||||||
* @param {Array} [array1, array2, ...] Arrays to process.
|
* @param {Array} [array1, array2, ...] Arrays to process.
|
||||||
* @returns {Array} Returns a new array of unique elements, in order, that are
|
* @returns {Array} Returns a new array of unique elements that are present
|
||||||
* present in **all** of the arrays.
|
* in **all** of the arrays.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
* _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||||
@@ -3245,8 +3236,6 @@
|
|||||||
/**
|
/**
|
||||||
* This function returns the first argument passed to it.
|
* This function returns the first argument passed to it.
|
||||||
*
|
*
|
||||||
* Note: This function is used throughout Lo-Dash as a default callback.
|
|
||||||
*
|
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
* @category Utilities
|
* @category Utilities
|
||||||
|
|||||||
410
vendor/backbone/backbone.js
vendored
410
vendor/backbone/backbone.js
vendored
@@ -1,4 +1,4 @@
|
|||||||
// Backbone.js 0.9.9-pre
|
// Backbone.js 0.9.9
|
||||||
|
|
||||||
// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||||
// Backbone may be freely distributed under the MIT license.
|
// Backbone may be freely distributed under the MIT license.
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
var previousBackbone = root.Backbone;
|
var previousBackbone = root.Backbone;
|
||||||
|
|
||||||
// Create a local reference to array methods.
|
// Create a local reference to array methods.
|
||||||
var ArrayProto = Array.prototype;
|
var array = [];
|
||||||
var push = ArrayProto.push;
|
var push = array.push;
|
||||||
var slice = ArrayProto.slice;
|
var slice = array.slice;
|
||||||
var splice = ArrayProto.splice;
|
var splice = array.splice;
|
||||||
|
|
||||||
// The top-level namespace. All public Backbone classes and modules will
|
// The top-level namespace. All public Backbone classes and modules will
|
||||||
// be attached to this. Exported for both CommonJS and the browser.
|
// be attached to this. Exported for both CommonJS and the browser.
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Current version of the library. Keep in sync with `package.json`.
|
// Current version of the library. Keep in sync with `package.json`.
|
||||||
Backbone.VERSION = '0.9.9-pre';
|
Backbone.VERSION = '0.9.9';
|
||||||
|
|
||||||
// Require Underscore, if we're on the server, and it's not already present.
|
// Require Underscore, if we're on the server, and it's not already present.
|
||||||
var _ = root._;
|
var _ = root._;
|
||||||
@@ -64,15 +64,49 @@
|
|||||||
// Backbone.Events
|
// Backbone.Events
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
||||||
// Regular expression used to split event strings
|
// Regular expression used to split event strings.
|
||||||
var eventSplitter = /\s+/;
|
var eventSplitter = /\s+/;
|
||||||
|
|
||||||
// Internal flag used to set event callbacks `once`.
|
// Implement fancy features of the Events API such as multiple event
|
||||||
var once = false;
|
// names `"change blur"` and jQuery-style event maps `{change: action}`
|
||||||
|
// in terms of the existing API.
|
||||||
|
var eventsApi = function(obj, action, name, rest) {
|
||||||
|
if (!name) return true;
|
||||||
|
if (typeof name === 'object') {
|
||||||
|
for (var key in name) {
|
||||||
|
obj[action].apply(obj, [key, name[key]].concat(rest));
|
||||||
|
}
|
||||||
|
} else if (eventSplitter.test(name)) {
|
||||||
|
var names = name.split(eventSplitter);
|
||||||
|
for (var i = 0, l = names.length; i < l; i++) {
|
||||||
|
obj[action].apply(obj, [names[i]].concat(rest));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Optimized internal dispatch function for triggering events. Tries to
|
||||||
|
// keep the usual cases speedy (most Backbone events have 3 arguments).
|
||||||
|
var triggerEvents = function(obj, events, args) {
|
||||||
|
var ev, i = -1, l = events.length;
|
||||||
|
switch (args.length) {
|
||||||
|
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx);
|
||||||
|
return;
|
||||||
|
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0]);
|
||||||
|
return;
|
||||||
|
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0], args[1]);
|
||||||
|
return;
|
||||||
|
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0], args[1], args[2]);
|
||||||
|
return;
|
||||||
|
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// A module that can be mixed in to *any object* in order to provide it with
|
// A module that can be mixed in to *any object* in order to provide it with
|
||||||
// custom events. You may bind with `on` or remove with `off` callback functions
|
// custom events. You may bind with `on` or remove with `off` callback
|
||||||
// to an event; `trigger`-ing an event fires all callbacks in succession.
|
// functions to an event; `trigger`-ing an event fires all callbacks in
|
||||||
|
// succession.
|
||||||
//
|
//
|
||||||
// var object = {};
|
// var object = {};
|
||||||
// _.extend(object, Backbone.Events);
|
// _.extend(object, Backbone.Events);
|
||||||
@@ -81,72 +115,58 @@
|
|||||||
//
|
//
|
||||||
var Events = Backbone.Events = {
|
var Events = Backbone.Events = {
|
||||||
|
|
||||||
// Bind one or more space separated events, `events`, to a `callback`
|
// Bind one or more space separated events, or an events map,
|
||||||
// function. Passing `"all"` will bind the callback to all events fired.
|
// to a `callback` function. Passing `"all"` will bind the callback to
|
||||||
on: function(events, callback, context) {
|
// all events fired.
|
||||||
if (_.isObject(events)) {
|
on: function(name, callback, context) {
|
||||||
for (var key in events) {
|
if (!(eventsApi(this, 'on', name, [callback, context]) && callback)) return this;
|
||||||
this.on(key, events[key], callback);
|
this._events || (this._events = {});
|
||||||
}
|
var list = this._events[name] || (this._events[name] = []);
|
||||||
return this;
|
list.push({callback: callback, context: context, ctx: context || this});
|
||||||
}
|
|
||||||
|
|
||||||
var calls, event, list;
|
|
||||||
if (!callback) return this;
|
|
||||||
|
|
||||||
events = events.split(eventSplitter);
|
|
||||||
calls = this._callbacks || (this._callbacks = {});
|
|
||||||
|
|
||||||
while (event = events.shift()) {
|
|
||||||
list = calls[event] || (calls[event] = []);
|
|
||||||
list.push(callback, context, once ? {} : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Bind events to only be triggered a single time. After the first time
|
// Bind events to only be triggered a single time. After the first time
|
||||||
// the callback is invoked, it will be removed.
|
// the callback is invoked, it will be removed.
|
||||||
once: function(events, callback, context) {
|
once: function(name, callback, context) {
|
||||||
once = true;
|
if (!(eventsApi(this, 'once', name, [callback, context]) && callback)) return this;
|
||||||
this.on(events, callback, context);
|
var self = this;
|
||||||
once = false;
|
var once = _.once(function() {
|
||||||
|
self.off(name, once);
|
||||||
|
callback.apply(this, arguments);
|
||||||
|
});
|
||||||
|
once._callback = callback;
|
||||||
|
this.on(name, once, context);
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Remove one or many callbacks. If `context` is null, removes all callbacks
|
// Remove one or many callbacks. If `context` is null, removes all
|
||||||
// with that function. If `callback` is null, removes all callbacks for the
|
// callbacks with that function. If `callback` is null, removes all
|
||||||
// event. If `events` is null, removes all bound callbacks for all events.
|
// callbacks for the event. If `events` is null, removes all bound
|
||||||
off: function(events, callback, context) {
|
// callbacks for all events.
|
||||||
if (_.isObject(events)) {
|
off: function(name, callback, context) {
|
||||||
for (var key in events) {
|
var list, ev, events, names, i, l, j, k;
|
||||||
this.off(key, events[key], callback);
|
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
|
||||||
}
|
if (!name && !callback && !context) {
|
||||||
|
this._events = {};
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
var event, calls, list, i;
|
names = name ? [name] : _.keys(this._events);
|
||||||
|
for (i = 0, l = names.length; i < l; i++) {
|
||||||
// No events, or removing *all* events.
|
name = names[i];
|
||||||
if (!(calls = this._callbacks)) return this;
|
if (list = this._events[name]) {
|
||||||
if (!(events || callback || context)) {
|
events = [];
|
||||||
delete this._callbacks;
|
if (callback || context) {
|
||||||
return this;
|
for (j = 0, k = list.length; j < k; j++) {
|
||||||
}
|
ev = list[j];
|
||||||
|
if ((callback && callback !== (ev.callback._callback || ev.callback)) ||
|
||||||
events = events ? events.split(eventSplitter) : _.keys(calls);
|
(context && context !== ev.context)) {
|
||||||
|
events.push(ev);
|
||||||
// Loop through the callback list, splicing where appropriate.
|
}
|
||||||
while (event = events.shift()) {
|
}
|
||||||
if (!(list = calls[event]) || !(callback || context)) {
|
|
||||||
delete calls[event];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = list.length - 3; i >= 0; i -= 3) {
|
|
||||||
if (!(callback && list[i] !== callback || context && list[i + 1] !== context)) {
|
|
||||||
list.splice(i, 3);
|
|
||||||
}
|
}
|
||||||
|
this._events[name] = events;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,48 +177,43 @@
|
|||||||
// passed the same arguments as `trigger` is, apart from the event name
|
// passed the same arguments as `trigger` is, apart from the event name
|
||||||
// (unless you're listening on `"all"`, which will cause your callback to
|
// (unless you're listening on `"all"`, which will cause your callback to
|
||||||
// receive the true name of the event as the first argument).
|
// receive the true name of the event as the first argument).
|
||||||
trigger: function(events) {
|
trigger: function(name) {
|
||||||
var event, calls, list, i, length, args, all, rest, callback, context, onced;
|
if (!this._events) return this;
|
||||||
if (!(calls = this._callbacks)) return this;
|
var args = slice.call(arguments, 1);
|
||||||
|
if (!eventsApi(this, 'trigger', name, args)) return this;
|
||||||
|
var events = this._events[name];
|
||||||
|
var allEvents = this._events.all;
|
||||||
|
if (events) triggerEvents(this, events, args);
|
||||||
|
if (allEvents) triggerEvents(this, allEvents, arguments);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
rest = [];
|
// An inversion-of-control version of `on`. Tell *this* object to listen to
|
||||||
events = events.split(eventSplitter);
|
// an event in another object ... keeping track of what it's listening to.
|
||||||
|
listenTo: function(object, events, callback) {
|
||||||
|
var listeners = this._listeners || (this._listeners = {});
|
||||||
|
var id = object._listenerId || (object._listenerId = _.uniqueId('l'));
|
||||||
|
listeners[id] = object;
|
||||||
|
object.on(events, callback || this, this);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
// Fill up `rest` with the callback arguments. Since we're only copying
|
// Tell this object to stop listening to either specific events ... or
|
||||||
// the tail of `arguments`, a loop is much faster than Array#slice.
|
// to every object it's currently listening to.
|
||||||
for (i = 1, length = arguments.length; i < length; i++) {
|
stopListening: function(object, events, callback) {
|
||||||
rest[i - 1] = arguments[i];
|
var listeners = this._listeners;
|
||||||
}
|
if (!listeners) return;
|
||||||
|
if (object) {
|
||||||
// For each event, walk through the list of callbacks twice, first to
|
object.off(events, callback, this);
|
||||||
// trigger the event, then to trigger any `"all"` callbacks.
|
if (!events && !callback) delete listeners[object._listenerId];
|
||||||
while (event = events.shift()) {
|
} else {
|
||||||
// Copy callback lists to prevent modification.
|
for (var id in listeners) {
|
||||||
if (all = calls.all) all = all.slice();
|
listeners[id].off(null, null, this);
|
||||||
if (list = calls[event]) list = list.slice();
|
|
||||||
|
|
||||||
// Execute event callbacks.
|
|
||||||
if (list) {
|
|
||||||
for (i = 0, length = list.length; i < length; i += 3) {
|
|
||||||
callback = list[i], context = list[i + 1], onced = list[i + 2];
|
|
||||||
if (onced) calls[event].splice(i, 3);
|
|
||||||
if (!onced || !onced.dead) callback.apply(context || this, rest);
|
|
||||||
if (onced) onced.dead = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute "all" callbacks.
|
|
||||||
if (all) {
|
|
||||||
args = [event].concat(rest);
|
|
||||||
for (i = 0, length = all.length; i < length; i += 3) {
|
|
||||||
all[i].apply(all[i + 1] || this, args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this._listeners = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Aliases for backwards compatibility.
|
// Aliases for backwards compatibility.
|
||||||
@@ -220,17 +235,12 @@
|
|||||||
this.cid = _.uniqueId('c');
|
this.cid = _.uniqueId('c');
|
||||||
this.changed = {};
|
this.changed = {};
|
||||||
this.attributes = {};
|
this.attributes = {};
|
||||||
this._escapedAttributes = {};
|
this._changes = [];
|
||||||
this._modelState = [];
|
|
||||||
if (options && options.collection) this.collection = options.collection;
|
if (options && options.collection) this.collection = options.collection;
|
||||||
if (options && options.parse) attrs = this.parse(attrs);
|
if (options && options.parse) attrs = this.parse(attrs);
|
||||||
if (defaults = _.result(this, 'defaults')) {
|
if (defaults = _.result(this, 'defaults')) _.defaults(attrs, defaults);
|
||||||
attrs = _.extend({}, defaults, attrs);
|
|
||||||
}
|
|
||||||
this.set(attrs, {silent: true});
|
this.set(attrs, {silent: true});
|
||||||
this._cleanChange = true;
|
this._currentAttributes = _.clone(this.attributes);
|
||||||
this._modelState = [];
|
|
||||||
this._currentState = _.clone(this.attributes);
|
|
||||||
this._previousAttributes = _.clone(this.attributes);
|
this._previousAttributes = _.clone(this.attributes);
|
||||||
this.initialize.apply(this, arguments);
|
this.initialize.apply(this, arguments);
|
||||||
};
|
};
|
||||||
@@ -241,27 +251,6 @@
|
|||||||
// A hash of attributes whose current and previous value differ.
|
// A hash of attributes whose current and previous value differ.
|
||||||
changed: null,
|
changed: null,
|
||||||
|
|
||||||
// Whether there is a pending request to fire in the final `change` loop.
|
|
||||||
_pending: false,
|
|
||||||
|
|
||||||
// Whether the model is in the midst of a change cycle.
|
|
||||||
_changing: false,
|
|
||||||
|
|
||||||
// Whether there has been a `set` call since the last
|
|
||||||
// calculation of the changed hash, for efficiency.
|
|
||||||
_cleanChange: true,
|
|
||||||
|
|
||||||
// The model state used for comparison in determining if a
|
|
||||||
// change should be fired.
|
|
||||||
_currentState: null,
|
|
||||||
|
|
||||||
// An array queue of all changes attributed to a model
|
|
||||||
// on the next non-silent change event.
|
|
||||||
_modelState: null,
|
|
||||||
|
|
||||||
// A hash of the model's attributes when the last `change` occured.
|
|
||||||
_previousAttributes: null,
|
|
||||||
|
|
||||||
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
|
// The default name for the JSON `id` attribute is `"id"`. MongoDB and
|
||||||
// CouchDB users may want to set this to `"_id"`.
|
// CouchDB users may want to set this to `"_id"`.
|
||||||
idAttribute: 'id',
|
idAttribute: 'id',
|
||||||
@@ -287,10 +276,7 @@
|
|||||||
|
|
||||||
// Get the HTML-escaped value of an attribute.
|
// Get the HTML-escaped value of an attribute.
|
||||||
escape: function(attr) {
|
escape: function(attr) {
|
||||||
var html;
|
return _.escape(this.get(attr));
|
||||||
if (html = this._escapedAttributes[attr]) return html;
|
|
||||||
var val = this.get(attr);
|
|
||||||
return this._escapedAttributes[attr] = _.escape(val == null ? '' : '' + val);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns `true` if the attribute contains a value that is not null
|
// Returns `true` if the attribute contains a value that is not null
|
||||||
@@ -317,9 +303,6 @@
|
|||||||
var silent = options && options.silent;
|
var silent = options && options.silent;
|
||||||
var unset = options && options.unset;
|
var unset = options && options.unset;
|
||||||
|
|
||||||
if (attrs instanceof Model) attrs = attrs.attributes;
|
|
||||||
if (unset) for (attr in attrs) attrs[attr] = void 0;
|
|
||||||
|
|
||||||
// Run validation.
|
// Run validation.
|
||||||
if (!this._validate(attrs, options)) return false;
|
if (!this._validate(attrs, options)) return false;
|
||||||
|
|
||||||
@@ -327,24 +310,19 @@
|
|||||||
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
|
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
|
||||||
|
|
||||||
var now = this.attributes;
|
var now = this.attributes;
|
||||||
var esc = this._escapedAttributes;
|
|
||||||
|
|
||||||
// For each `set` attribute...
|
// For each `set` attribute...
|
||||||
for (attr in attrs) {
|
for (attr in attrs) {
|
||||||
val = attrs[attr];
|
val = attrs[attr];
|
||||||
|
|
||||||
// If an escaped attr exists, and the new and current value differ, remove the escaped attr.
|
// Update or delete the current value, and track the change.
|
||||||
if (esc[attr] && !_.isEqual(now[attr], val) || (unset && _.has(now, attr))) delete esc[attr];
|
|
||||||
|
|
||||||
// Update or delete the current value.
|
|
||||||
unset ? delete now[attr] : now[attr] = val;
|
unset ? delete now[attr] : now[attr] = val;
|
||||||
|
this._changes.push(attr, val);
|
||||||
// Track any action on the attribute.
|
|
||||||
this._modelState.push(attr, val, unset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal that the model's state has potentially changed.
|
// Signal that the model's state has potentially changed, and we need
|
||||||
this._cleanChange = false;
|
// to recompute the actual changes.
|
||||||
|
this._hasComputed = false;
|
||||||
|
|
||||||
// Fire the `"change"` events.
|
// Fire the `"change"` events.
|
||||||
if (!silent) this.change(options);
|
if (!silent) this.change(options);
|
||||||
@@ -354,15 +332,15 @@
|
|||||||
// Remove an attribute from the model, firing `"change"` unless you choose
|
// Remove an attribute from the model, firing `"change"` unless you choose
|
||||||
// to silence it. `unset` is a noop if the attribute doesn't exist.
|
// to silence it. `unset` is a noop if the attribute doesn't exist.
|
||||||
unset: function(attr, options) {
|
unset: function(attr, options) {
|
||||||
options = _.extend({}, options, {unset: true});
|
return this.set(attr, void 0, _.extend({}, options, {unset: true}));
|
||||||
return this.set(attr, null, options);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Clear all attributes on the model, firing `"change"` unless you choose
|
// Clear all attributes on the model, firing `"change"` unless you choose
|
||||||
// to silence it.
|
// to silence it.
|
||||||
clear: function(options) {
|
clear: function(options) {
|
||||||
options = _.extend({}, options, {unset: true});
|
var attrs = {};
|
||||||
return this.set(_.clone(this.attributes), options);
|
for (var key in this.attributes) attrs[key] = void 0;
|
||||||
|
return this.set(attrs, _.extend({}, options, {unset: true}));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Fetch the model from the server. If the server's representation of the
|
// Fetch the model from the server. If the server's representation of the
|
||||||
@@ -374,7 +352,7 @@
|
|||||||
var model = this;
|
var model = this;
|
||||||
var success = options.success;
|
var success = options.success;
|
||||||
options.success = function(resp, status, xhr) {
|
options.success = function(resp, status, xhr) {
|
||||||
if (!model.set(model.parse(resp, xhr), options)) return false;
|
if (!model.set(model.parse(resp), options)) return false;
|
||||||
if (success) success(model, resp, options);
|
if (success) success(model, resp, options);
|
||||||
};
|
};
|
||||||
return this.sync('read', this, options);
|
return this.sync('read', this, options);
|
||||||
@@ -416,7 +394,7 @@
|
|||||||
var success = options.success;
|
var success = options.success;
|
||||||
options.success = function(resp, status, xhr) {
|
options.success = function(resp, status, xhr) {
|
||||||
done = true;
|
done = true;
|
||||||
var serverAttrs = model.parse(resp, xhr);
|
var serverAttrs = model.parse(resp);
|
||||||
if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
|
if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
|
||||||
if (!model.set(serverAttrs, options)) return false;
|
if (!model.set(serverAttrs, options)) return false;
|
||||||
if (success) success(model, resp, options);
|
if (success) success(model, resp, options);
|
||||||
@@ -475,7 +453,7 @@
|
|||||||
|
|
||||||
// **parse** converts a response into the hash of attributes to be `set` on
|
// **parse** converts a response into the hash of attributes to be `set` on
|
||||||
// the model. The default implementation is just to pass the response along.
|
// the model. The default implementation is just to pass the response along.
|
||||||
parse: function(resp, xhr) {
|
parse: function(resp) {
|
||||||
return resp;
|
return resp;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -493,14 +471,15 @@
|
|||||||
// a `"change:attribute"` event for each changed attribute.
|
// a `"change:attribute"` event for each changed attribute.
|
||||||
// Calling this will cause all objects observing the model to update.
|
// Calling this will cause all objects observing the model to update.
|
||||||
change: function(options) {
|
change: function(options) {
|
||||||
var i, changing = this._changing;
|
var changing = this._changing;
|
||||||
this._changing = true;
|
this._changing = true;
|
||||||
|
|
||||||
// Generate the changes to be triggered on the model.
|
// Generate the changes to be triggered on the model.
|
||||||
var triggers = this._changeCenter(true);
|
var triggers = this._computeChanges(true);
|
||||||
this._pending = triggers.length;
|
|
||||||
|
|
||||||
for (i = triggers.length - 2; i >= 0; i -= 2) {
|
this._pending = !!triggers.length;
|
||||||
|
|
||||||
|
for (var i = triggers.length - 2; i >= 0; i -= 2) {
|
||||||
this.trigger('change:' + triggers[i], this, triggers[i + 1], options);
|
this.trigger('change:' + triggers[i], this, triggers[i + 1], options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,14 +492,14 @@
|
|||||||
this._previousAttributes = _.clone(this.attributes);
|
this._previousAttributes = _.clone(this.attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._changing = null;
|
this._changing = false;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Determine if the model has changed since the last `"change"` event.
|
// Determine if the model has changed since the last `"change"` event.
|
||||||
// If you specify an attribute name, determine if that attribute has changed.
|
// If you specify an attribute name, determine if that attribute has changed.
|
||||||
hasChanged: function(attr) {
|
hasChanged: function(attr) {
|
||||||
if (!this._cleanChange) this._changeCenter();
|
if (!this._hasComputed) this._computeChanges();
|
||||||
if (attr == null) return !_.isEmpty(this.changed);
|
if (attr == null) return !_.isEmpty(this.changed);
|
||||||
return _.has(this.changed, attr);
|
return _.has(this.changed, attr);
|
||||||
},
|
},
|
||||||
@@ -541,39 +520,36 @@
|
|||||||
return changed;
|
return changed;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Calculates and handles any changes in `this._modelState`,
|
// Looking at the built up list of `set` attribute changes, compute how
|
||||||
// checking against `this._currentState` to determine current changes.
|
// many of the attributes have actually changed. If `loud`, return a
|
||||||
_changeCenter: function (change) {
|
// boiled-down list of only the real changes.
|
||||||
|
_computeChanges: function(loud) {
|
||||||
this.changed = {};
|
this.changed = {};
|
||||||
var local = {};
|
var already = {};
|
||||||
var triggers = [];
|
var triggers = [];
|
||||||
var modelState = this._modelState;
|
var current = this._currentAttributes;
|
||||||
var currentState = this._currentState;
|
var changes = this._changes;
|
||||||
|
|
||||||
// Loop through the current queue of potential model changes.
|
// Loop through the current queue of potential model changes.
|
||||||
for (var i = modelState.length - 3; i >= 0; i -= 3) {
|
for (var i = changes.length - 2; i >= 0; i -= 2) {
|
||||||
var key = modelState[i], val = modelState[i + 1], unset = modelState[i + 2];
|
var key = changes[i], val = changes[i + 1];
|
||||||
|
if (already[key]) continue;
|
||||||
|
already[key] = true;
|
||||||
|
|
||||||
// If the item hasn't been set locally this round, proceed.
|
// Check if the attribute has been modified since the last change,
|
||||||
if (!local[key]) {
|
// and update `this.changed` accordingly. If we're inside of a `change`
|
||||||
local[key] = val;
|
// call, also add a trigger to the list.
|
||||||
|
if (current[key] !== val) {
|
||||||
// Check if the attribute has been modified since the last change,
|
this.changed[key] = val;
|
||||||
// and update `this.changed` accordingly.
|
if (!loud) continue;
|
||||||
if (currentState[key] !== val || (_.has(currentState, key) && unset)) {
|
triggers.push(key, val);
|
||||||
this.changed[key] = val;
|
current[key] = val;
|
||||||
|
|
||||||
// Triggers & modifications are only created inside a `change` call.
|
|
||||||
if (!change) continue;
|
|
||||||
triggers.push(key, val);
|
|
||||||
(!unset) ? currentState[key] = val : delete currentState[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
modelState.splice(i,3);
|
|
||||||
}
|
}
|
||||||
|
if (loud) this._changes = [];
|
||||||
|
|
||||||
// Signals `this.changed` is current to prevent duplicate calls from `this.hasChanged`.
|
// Signals `this.changed` is current to prevent duplicate calls from `this.hasChanged`.
|
||||||
this._cleanChange = true;
|
this._hasComputed = true;
|
||||||
return triggers;
|
return triggers;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -590,12 +566,6 @@
|
|||||||
return _.clone(this._previousAttributes);
|
return _.clone(this._previousAttributes);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Check if the model is currently in a valid state. It's only possible to
|
|
||||||
// get into an *invalid* state if you're using silent changes.
|
|
||||||
isValid: function(options) {
|
|
||||||
return !this.validate || !this.validate(this.attributes, options);
|
|
||||||
},
|
|
||||||
|
|
||||||
// Run validation against the next complete set of model attributes,
|
// Run validation against the next complete set of model attributes,
|
||||||
// returning `true` if all is well. If a specific `error` callback has
|
// returning `true` if all is well. If a specific `error` callback has
|
||||||
// been passed, call that instead of firing the general `"error"` event.
|
// been passed, call that instead of firing the general `"error"` event.
|
||||||
@@ -651,8 +621,9 @@
|
|||||||
// Add a model, or list of models to the set. Pass **silent** to avoid
|
// Add a model, or list of models to the set. Pass **silent** to avoid
|
||||||
// firing the `add` event for every new model.
|
// firing the `add` event for every new model.
|
||||||
add: function(models, options) {
|
add: function(models, options) {
|
||||||
var i, args, length, model, existing, sort;
|
var i, args, length, model, existing, needsSort;
|
||||||
var at = options && options.at;
|
var at = options && options.at;
|
||||||
|
var sort = ((options && options.sort) == null ? true : options.sort);
|
||||||
models = _.isArray(models) ? models.slice() : [models];
|
models = _.isArray(models) ? models.slice() : [models];
|
||||||
|
|
||||||
// Turn bare objects into model references, and prevent invalid models
|
// Turn bare objects into model references, and prevent invalid models
|
||||||
@@ -670,8 +641,8 @@
|
|||||||
// optionally merge it into the existing model.
|
// optionally merge it into the existing model.
|
||||||
if (existing || this._byCid[model.cid]) {
|
if (existing || this._byCid[model.cid]) {
|
||||||
if (options && options.merge && existing) {
|
if (options && options.merge && existing) {
|
||||||
existing.set(model, options);
|
existing.set(model.attributes, options);
|
||||||
sort = true;
|
needsSort = sort;
|
||||||
}
|
}
|
||||||
models.splice(i, 1);
|
models.splice(i, 1);
|
||||||
continue;
|
continue;
|
||||||
@@ -685,14 +656,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if sorting is needed, update `length` and splice in new models.
|
// See if sorting is needed, update `length` and splice in new models.
|
||||||
if (models.length) sort = true;
|
if (models.length) needsSort = sort;
|
||||||
this.length += models.length;
|
this.length += models.length;
|
||||||
args = [at != null ? at : this.models.length, 0];
|
args = [at != null ? at : this.models.length, 0];
|
||||||
push.apply(args, models);
|
push.apply(args, models);
|
||||||
splice.apply(this.models, args);
|
splice.apply(this.models, args);
|
||||||
|
|
||||||
// Sort the collection if appropriate.
|
// Sort the collection if appropriate.
|
||||||
if (sort && this.comparator && at == null) this.sort({silent: true});
|
if (needsSort && this.comparator && at == null) this.sort({silent: true});
|
||||||
|
|
||||||
if (options && options.silent) return this;
|
if (options && options.silent) return this;
|
||||||
|
|
||||||
@@ -730,7 +701,7 @@
|
|||||||
// Add a model to the end of the collection.
|
// Add a model to the end of the collection.
|
||||||
push: function(model, options) {
|
push: function(model, options) {
|
||||||
model = this._prepareModel(model, options);
|
model = this._prepareModel(model, options);
|
||||||
this.add(model, options);
|
this.add(model, _.extend({at: this.length}, options));
|
||||||
return model;
|
return model;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -808,21 +779,31 @@
|
|||||||
// Smartly update a collection with a change set of models, adding,
|
// Smartly update a collection with a change set of models, adding,
|
||||||
// removing, and merging as necessary.
|
// removing, and merging as necessary.
|
||||||
update: function(models, options) {
|
update: function(models, options) {
|
||||||
var model, i, l, id, cid, existing;
|
var model, i, l, existing;
|
||||||
var add = [], remove = [];
|
var add = [], remove = [], modelMap = {};
|
||||||
options = _.extend({add: true, merge: true, remove: false}, options);
|
var idAttr = this.model.prototype.idAttribute;
|
||||||
|
options = _.extend({add: true, merge: true, remove: true}, options);
|
||||||
|
if (options.parse) models = this.parse(models);
|
||||||
|
|
||||||
|
// Allow a single model (or no argument) to be passed.
|
||||||
|
if (!_.isArray(models)) models = models ? [models] : [];
|
||||||
|
|
||||||
|
// Proxy to `add` for this case, no need to iterate...
|
||||||
|
if (options.add && !options.remove) return this.add(models, options);
|
||||||
|
|
||||||
// Determine which models to add and merge, and which to remove.
|
// Determine which models to add and merge, and which to remove.
|
||||||
for (i = 0, l = models.length; i < l; i++) {
|
for (i = 0, l = models.length; i < l; i++) {
|
||||||
model = models[i];
|
model = models[i];
|
||||||
existing = this.get(model);
|
existing = this.get(model.id || model.cid || model[idAttr]);
|
||||||
if (options.add || options.merge && existing) add.push(model);
|
if (options.remove && existing) modelMap[existing.cid] = true;
|
||||||
|
if ((options.add && !existing) || (options.merge && existing)) {
|
||||||
|
add.push(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (options.remove) {
|
if (options.remove) {
|
||||||
var changeset = new Collection(models);
|
|
||||||
for (i = 0, l = this.models.length; i < l; i++) {
|
for (i = 0, l = this.models.length; i < l; i++) {
|
||||||
model = this.models[i];
|
model = this.models[i];
|
||||||
if (!changeset.get(model)) remove.push(model);
|
if (!modelMap[model.cid]) remove.push(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,7 +839,7 @@
|
|||||||
var success = options.success;
|
var success = options.success;
|
||||||
options.success = function(resp, status, xhr) {
|
options.success = function(resp, status, xhr) {
|
||||||
var method = options.update ? 'update' : 'reset';
|
var method = options.update ? 'update' : 'reset';
|
||||||
collection[method](collection.parse(resp, xhr), options);
|
collection[method](resp, options);
|
||||||
if (success) success(collection, resp, options);
|
if (success) success(collection, resp, options);
|
||||||
};
|
};
|
||||||
return this.sync('read', this, options);
|
return this.sync('read', this, options);
|
||||||
@@ -884,7 +865,7 @@
|
|||||||
|
|
||||||
// **parse** converts a response into a list of models to be added to the
|
// **parse** converts a response into a list of models to be added to the
|
||||||
// collection. The default implementation is just to pass it through.
|
// collection. The default implementation is just to pass it through.
|
||||||
parse: function(resp, xhr) {
|
parse: function(resp) {
|
||||||
return resp;
|
return resp;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1309,20 +1290,11 @@
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Clean up references to this view in order to prevent latent effects and
|
// Remove this view by taking the element out of the DOM, and removing any
|
||||||
// memory leaks.
|
// applicable Backbone.Events listeners.
|
||||||
dispose: function() {
|
|
||||||
this.undelegateEvents();
|
|
||||||
if (this.model && this.model.off) this.model.off(null, null, this);
|
|
||||||
if (this.collection && this.collection.off) this.collection.off(null, null, this);
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Remove this view from the DOM. Note that the view isn't present in the
|
|
||||||
// DOM by default, so calling this method may be a no-op.
|
|
||||||
remove: function() {
|
remove: function() {
|
||||||
this.dispose();
|
|
||||||
this.$el.remove();
|
this.$el.remove();
|
||||||
|
this.stopListening();
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1460,7 +1432,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that we have the appropriate request data.
|
// Ensure that we have the appropriate request data.
|
||||||
if (options.data == null && model && (method === 'create' || method === 'update')) {
|
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
|
||||||
params.contentType = 'application/json';
|
params.contentType = 'application/json';
|
||||||
params.data = JSON.stringify(options.attrs || model.toJSON(options));
|
params.data = JSON.stringify(options.attrs || model.toJSON(options));
|
||||||
}
|
}
|
||||||
@@ -1473,7 +1445,7 @@
|
|||||||
|
|
||||||
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
|
// For older servers, emulate HTTP by mimicking the HTTP method with `_method`
|
||||||
// And an `X-HTTP-Method-Override` header.
|
// And an `X-HTTP-Method-Override` header.
|
||||||
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE')) {
|
if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
|
||||||
params.type = 'POST';
|
params.type = 'POST';
|
||||||
if (options.emulateJSON) params.data._method = type;
|
if (options.emulateJSON) params.data._method = type;
|
||||||
var beforeSend = options.beforeSend;
|
var beforeSend = options.beforeSend;
|
||||||
|
|||||||
90
vendor/backbone/test/collection.js
vendored
90
vendor/backbone/test/collection.js
vendored
@@ -386,6 +386,19 @@ $(document).ready(function() {
|
|||||||
equal(this.syncArgs.options.parse, false);
|
equal(this.syncArgs.options.parse, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("ensure fetch only parses once", 1, function() {
|
||||||
|
var collection = new Backbone.Collection;
|
||||||
|
var counter = 0;
|
||||||
|
collection.parse = function(models) {
|
||||||
|
counter++;
|
||||||
|
return models;
|
||||||
|
};
|
||||||
|
collection.url = '/test';
|
||||||
|
collection.fetch();
|
||||||
|
this.syncArgs.options.success([]);
|
||||||
|
equal(counter, 1);
|
||||||
|
});
|
||||||
|
|
||||||
test("create", 4, function() {
|
test("create", 4, function() {
|
||||||
var collection = new Backbone.Collection;
|
var collection = new Backbone.Collection;
|
||||||
collection.url = '/test';
|
collection.url = '/test';
|
||||||
@@ -809,7 +822,7 @@ $(document).ready(function() {
|
|||||||
strictEqual(c.length, 2);
|
strictEqual(c.length, 2);
|
||||||
|
|
||||||
// merge: false doesn't change any models
|
// merge: false doesn't change any models
|
||||||
c.update([m1, {id: 2, a: 1}], {merge: false, remove: true});
|
c.update([m1, {id: 2, a: 1}], {merge: false});
|
||||||
strictEqual(m2.get('a'), void 0);
|
strictEqual(m2.get('a'), void 0);
|
||||||
|
|
||||||
// add: false, remove: false only merges existing models
|
// add: false, remove: false only merges existing models
|
||||||
@@ -819,13 +832,82 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// default options add/remove/merge as appropriate
|
// default options add/remove/merge as appropriate
|
||||||
c.update([{id: 2, a: 1}, m3]);
|
c.update([{id: 2, a: 1}, m3]);
|
||||||
strictEqual(c.length, 3);
|
strictEqual(c.length, 2);
|
||||||
strictEqual(m2.get('a'), 1);
|
strictEqual(m2.get('a'), 1);
|
||||||
|
|
||||||
// Test removing models not passing an argument
|
// Test removing models not passing an argument
|
||||||
c.off('remove');
|
c.off('remove').on('remove', function(model) {
|
||||||
c.update([], {remove: true});
|
ok(model === m2 || model === m3);
|
||||||
|
});
|
||||||
|
c.update([]);
|
||||||
strictEqual(c.length, 0);
|
strictEqual(c.length, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("update with only cids", 3, function() {
|
||||||
|
var m1 = new Backbone.Model;
|
||||||
|
var m2 = new Backbone.Model;
|
||||||
|
var c = new Backbone.Collection;
|
||||||
|
c.update([m1, m2]);
|
||||||
|
equal(c.length, 2);
|
||||||
|
c.update([m1]);
|
||||||
|
equal(c.length, 1);
|
||||||
|
c.update([m1, m1, m1, m2, m2], {remove: false});
|
||||||
|
equal(c.length, 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("update with only idAttribute", 3, function() {
|
||||||
|
var m1 = { _id: 1 };
|
||||||
|
var m2 = { _id: 2 };
|
||||||
|
var col = Backbone.Collection.extend({
|
||||||
|
model: Backbone.Model.extend({
|
||||||
|
idAttribute: '_id'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
var c = new col;
|
||||||
|
c.update([m1, m2]);
|
||||||
|
equal(c.length, 2);
|
||||||
|
c.update([m1]);
|
||||||
|
equal(c.length, 1);
|
||||||
|
c.update([m1, m1, m1, m2, m2], {remove: false});
|
||||||
|
equal(c.length, 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("#1894 - Push should not trigger a sort", 0, function() {
|
||||||
|
var Collection = Backbone.Collection.extend({
|
||||||
|
comparator: 'id',
|
||||||
|
sort: function() {
|
||||||
|
ok(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
new Collection().push({id: 1});
|
||||||
|
});
|
||||||
|
|
||||||
|
// test("`update` with non-normal id", function() {
|
||||||
|
// var Collection = Backbone.Collection.extend({
|
||||||
|
// model: Backbone.Model.extend({idAttribute: '_id'})
|
||||||
|
// });
|
||||||
|
// var collection = new Collection({_id: 1});
|
||||||
|
// collection.update([{_id: 1, a: 1}], {add: false});
|
||||||
|
// equal(collection.first().get('a'), 1);
|
||||||
|
// });
|
||||||
|
|
||||||
|
test("#1894 - `sort` can optionally be turned off", 0, function() {
|
||||||
|
var Collection = Backbone.Collection.extend({
|
||||||
|
comparator: 'id',
|
||||||
|
sort: function() { ok(true); }
|
||||||
|
});
|
||||||
|
new Collection().add({id: 1}, {sort: false});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("#1915 - `parse` data in the right order in `update`", function() {
|
||||||
|
var collection = new (Backbone.Collection.extend({
|
||||||
|
parse: function (data) {
|
||||||
|
strictEqual(data.status, 'ok');
|
||||||
|
return data.data;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
var res = {status: 'ok', data:[{id: 1}]}
|
||||||
|
collection.update(res, {parse: true});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
58
vendor/backbone/test/events.js
vendored
58
vendor/backbone/test/events.js
vendored
@@ -66,6 +66,25 @@ $(document).ready(function() {
|
|||||||
equal(obj.counter, 5);
|
equal(obj.counter, 5);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("listenTo and stopListening", 1, function() {
|
||||||
|
var a = _.extend({}, Backbone.Events);
|
||||||
|
var b = _.extend({}, Backbone.Events);
|
||||||
|
a.listenTo(b, 'all', function(){ ok(true); });
|
||||||
|
b.trigger('anything');
|
||||||
|
a.listenTo(b, 'all', function(){ ok(false); });
|
||||||
|
a.stopListening();
|
||||||
|
b.trigger('anything');
|
||||||
|
});
|
||||||
|
|
||||||
|
test("listenTo and stopListening with event maps", 1, function() {
|
||||||
|
var a = _.extend({}, Backbone.Events);
|
||||||
|
var b = _.extend({}, Backbone.Events);
|
||||||
|
a.listenTo(b, {change: function(){ ok(true); }});
|
||||||
|
b.trigger('change');
|
||||||
|
a.listenTo(b, {change: function(){ ok(false); }});
|
||||||
|
a.stopListening();
|
||||||
|
b.trigger('change');
|
||||||
|
});
|
||||||
|
|
||||||
test("trigger all for each event", 3, function() {
|
test("trigger all for each event", 3, function() {
|
||||||
var a, b, obj = { counter: 0 };
|
var a, b, obj = { counter: 0 };
|
||||||
@@ -227,14 +246,12 @@ $(document).ready(function() {
|
|||||||
test("once", 2, function() {
|
test("once", 2, function() {
|
||||||
// Same as the previous test, but we use once rather than having to explicitly unbind
|
// Same as the previous test, but we use once rather than having to explicitly unbind
|
||||||
var obj = { counterA: 0, counterB: 0 };
|
var obj = { counterA: 0, counterB: 0 };
|
||||||
_.extend(obj,Backbone.Events);
|
_.extend(obj, Backbone.Events);
|
||||||
var incrA = function(){ obj.counterA += 1; obj.trigger('event'); };
|
var incrA = function(){ obj.counterA += 1; obj.trigger('event'); };
|
||||||
var incrB = function(){ obj.counterB += 1 };
|
var incrB = function(){ obj.counterB += 1; };
|
||||||
obj.once('event', incrA);
|
obj.once('event', incrA);
|
||||||
obj.once('event', incrB);
|
obj.once('event', incrB);
|
||||||
obj.trigger('event');
|
obj.trigger('event');
|
||||||
obj.trigger('event');
|
|
||||||
obj.trigger('event');
|
|
||||||
equal(obj.counterA, 1, 'counterA should have only been incremented once.');
|
equal(obj.counterA, 1, 'counterA should have only been incremented once.');
|
||||||
equal(obj.counterB, 1, 'counterB should have only been incremented once.');
|
equal(obj.counterB, 1, 'counterB should have only been incremented once.');
|
||||||
});
|
});
|
||||||
@@ -298,6 +315,14 @@ $(document).ready(function() {
|
|||||||
equal(obj.counter, 3);
|
equal(obj.counter, 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("once with off only by context", 0, function() {
|
||||||
|
var context = {};
|
||||||
|
var obj = _.extend({}, Backbone.Events);
|
||||||
|
obj.once('event', function(){ ok(false); }, context);
|
||||||
|
obj.off(null, null, context);
|
||||||
|
obj.trigger('event');
|
||||||
|
});
|
||||||
|
|
||||||
test("Backbone object inherits Events", function() {
|
test("Backbone object inherits Events", function() {
|
||||||
ok(Backbone.on === Backbone.Events.on);
|
ok(Backbone.on === Backbone.Events.on);
|
||||||
});
|
});
|
||||||
@@ -310,4 +335,29 @@ $(document).ready(function() {
|
|||||||
obj.trigger('async');
|
obj.trigger('async');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("once with multiple events.", 2, function() {
|
||||||
|
var obj = _.extend({}, Backbone.Events);
|
||||||
|
obj.once('x y', function() { ok(true); });
|
||||||
|
obj.trigger('x y');
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Off during iteration with once.", 2, function() {
|
||||||
|
var obj = _.extend({}, Backbone.Events);
|
||||||
|
var f = function(){ this.off('event', f); };
|
||||||
|
obj.on('event', f);
|
||||||
|
obj.once('event', function(){});
|
||||||
|
obj.on('event', function(){ ok(true); });
|
||||||
|
|
||||||
|
obj.trigger('event');
|
||||||
|
obj.trigger('event');
|
||||||
|
});
|
||||||
|
|
||||||
|
test("`once` on `all` should work as expected", 1, function() {
|
||||||
|
Backbone.once('all', function() {
|
||||||
|
ok(true);
|
||||||
|
Backbone.trigger('all');
|
||||||
|
});
|
||||||
|
Backbone.trigger('all');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
61
vendor/backbone/test/model.js
vendored
61
vendor/backbone/test/model.js
vendored
@@ -55,6 +55,18 @@ $(document).ready(function() {
|
|||||||
equal(model.get('value'), 2);
|
equal(model.get('value'), 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("initialize with defaults", 2, function() {
|
||||||
|
var Model = Backbone.Model.extend({
|
||||||
|
defaults: {
|
||||||
|
first_name: 'Unknown',
|
||||||
|
last_name: 'Unknown'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var model = new Model({'first_name': 'John'});
|
||||||
|
equal(model.get('first_name'), 'John');
|
||||||
|
equal(model.get('last_name'), 'Unknown');
|
||||||
|
});
|
||||||
|
|
||||||
test("parse can return null", 1, function() {
|
test("parse can return null", 1, function() {
|
||||||
var Model = Backbone.Model.extend({
|
var Model = Backbone.Model.extend({
|
||||||
parse: function(obj) {
|
parse: function(obj) {
|
||||||
@@ -114,7 +126,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var foo = new Backbone.Model({p: 1});
|
var foo = new Backbone.Model({p: 1});
|
||||||
var bar = new Backbone.Model({p: 2});
|
var bar = new Backbone.Model({p: 2});
|
||||||
bar.set(foo.clone(), {unset: true});
|
bar.set(foo.clone().attributes, {unset: true});
|
||||||
equal(foo.get('p'), 1);
|
equal(foo.get('p'), 1);
|
||||||
equal(bar.get('p'), undefined);
|
equal(bar.get('p'), undefined);
|
||||||
});
|
});
|
||||||
@@ -201,6 +213,27 @@ $(document).ready(function() {
|
|||||||
equal(a.id, undefined, "Unsetting the id should remove the id property.");
|
equal(a.id, undefined, "Unsetting the id should remove the id property.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("set triggers changes in the correct order", function() {
|
||||||
|
var value = null;
|
||||||
|
var model = new Backbone.Model;
|
||||||
|
model.on('last', function(){ value = 'last'; });
|
||||||
|
model.on('first', function(){ value = 'first'; });
|
||||||
|
model.trigger('first');
|
||||||
|
model.trigger('last');
|
||||||
|
equal(value, 'last');
|
||||||
|
});
|
||||||
|
|
||||||
|
test("set falsy values in the correct order", 1, function() {
|
||||||
|
var model = new Backbone.Model({result: 'result'});
|
||||||
|
model.on('change', function() {
|
||||||
|
equal(model.changed.result, false);
|
||||||
|
});
|
||||||
|
model.set({result: void 0}, {silent: true});
|
||||||
|
model.set({result: null}, {silent: true});
|
||||||
|
model.set({result: false}, {silent: true});
|
||||||
|
model.change();
|
||||||
|
});
|
||||||
|
|
||||||
test("multiple unsets", 1, function() {
|
test("multiple unsets", 1, function() {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var counter = function(){ i++; };
|
var counter = function(){ i++; };
|
||||||
@@ -261,7 +294,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
var model = new Defaulted({two: null});
|
var model = new Defaulted({two: null});
|
||||||
equal(model.get('one'), 1);
|
equal(model.get('one'), 1);
|
||||||
equal(model.get('two'), null);
|
equal(model.get('two'), 2);
|
||||||
Defaulted = Backbone.Model.extend({
|
Defaulted = Backbone.Model.extend({
|
||||||
defaults: function() {
|
defaults: function() {
|
||||||
return {
|
return {
|
||||||
@@ -272,7 +305,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
model = new Defaulted({two: null});
|
model = new Defaulted({two: null});
|
||||||
equal(model.get('one'), 3);
|
equal(model.get('one'), 3);
|
||||||
equal(model.get('two'), null);
|
equal(model.get('two'), 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("change, hasChanged, changedAttributes, previous, previousAttributes", 12, function() {
|
test("change, hasChanged, changedAttributes, previous, previousAttributes", 12, function() {
|
||||||
@@ -351,17 +384,6 @@ $(document).ready(function() {
|
|||||||
equal(lastError, "Can't change admin status.");
|
equal(lastError, "Can't change admin status.");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("isValid", function() {
|
|
||||||
var model = new Backbone.Model({valid: true});
|
|
||||||
model.validate = function(attrs) {
|
|
||||||
if (!attrs.valid) return "invalid";
|
|
||||||
};
|
|
||||||
equal(model.isValid(), true);
|
|
||||||
equal(model.set({valid: false}), false);
|
|
||||||
equal(model.isValid(), true);
|
|
||||||
ok(!model.set('valid', false, {silent: true}));
|
|
||||||
});
|
|
||||||
|
|
||||||
test("save", 2, function() {
|
test("save", 2, function() {
|
||||||
doc.save({title : "Henry V"});
|
doc.save({title : "Henry V"});
|
||||||
equal(this.syncArgs.method, 'update');
|
equal(this.syncArgs.method, 'update');
|
||||||
@@ -379,6 +401,7 @@ $(document).ready(function() {
|
|||||||
equal(_.size(this.syncArgs.options.attrs), 2);
|
equal(_.size(this.syncArgs.options.attrs), 2);
|
||||||
equal(this.syncArgs.options.attrs.d, 4);
|
equal(this.syncArgs.options.attrs.d, 4);
|
||||||
equal(this.syncArgs.options.attrs.a, undefined);
|
equal(this.syncArgs.options.attrs.a, undefined);
|
||||||
|
equal(this.ajaxSettings.data, "{\"b\":2,\"d\":4}");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("save in positional style", 1, function() {
|
test("save in positional style", 1, function() {
|
||||||
@@ -570,9 +593,9 @@ $(document).ready(function() {
|
|||||||
ok(model.get('x') === a);
|
ok(model.get('x') === a);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("unset fires change for undefined attributes", 1, function() {
|
test("unset does not fire a change for undefined attributes", 0, function() {
|
||||||
var model = new Backbone.Model({x: undefined});
|
var model = new Backbone.Model({x: undefined});
|
||||||
model.on('change:x', function(){ ok(true); });
|
model.on('change:x', function(){ ok(false); });
|
||||||
model.unset('x');
|
model.unset('x');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -784,12 +807,6 @@ $(document).ready(function() {
|
|||||||
model.set({a: true});
|
model.set({a: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("#1179 - isValid returns true in the absence of validate.", 1, function() {
|
|
||||||
var model = new Backbone.Model();
|
|
||||||
model.validate = null;
|
|
||||||
ok(model.isValid());
|
|
||||||
});
|
|
||||||
|
|
||||||
test("#1122 - clear does not alter options.", 1, function() {
|
test("#1122 - clear does not alter options.", 1, function() {
|
||||||
var model = new Backbone.Model();
|
var model = new Backbone.Model();
|
||||||
var options = {};
|
var options = {};
|
||||||
|
|||||||
4
vendor/backbone/test/router.js
vendored
4
vendor/backbone/test/router.js
vendored
@@ -107,7 +107,7 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
optionalItem: function(arg){
|
optionalItem: function(arg){
|
||||||
this.arg = arg !== void 0 ? arg : null;
|
this.arg = arg != void 0 ? arg : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
splat : function(args) {
|
splat : function(args) {
|
||||||
@@ -207,7 +207,7 @@ $(document).ready(function() {
|
|||||||
test("routes (optional)", 2, function() {
|
test("routes (optional)", 2, function() {
|
||||||
location.replace('http://example.com#optional');
|
location.replace('http://example.com#optional');
|
||||||
Backbone.history.checkUrl();
|
Backbone.history.checkUrl();
|
||||||
equal(router.arg, null);
|
ok(!router.arg);
|
||||||
location.replace('http://example.com#optional/thing');
|
location.replace('http://example.com#optional/thing');
|
||||||
Backbone.history.checkUrl();
|
Backbone.history.checkUrl();
|
||||||
equal(router.arg, 'thing');
|
equal(router.arg, 'thing');
|
||||||
|
|||||||
34
vendor/backbone/test/view.js
vendored
34
vendor/backbone/test/view.js
vendored
@@ -41,7 +41,7 @@ $(document).ready(function() {
|
|||||||
var div = view.make('div', {id: 'test-div'}, 0);
|
var div = view.make('div', {id: 'test-div'}, 0);
|
||||||
equal($(div).text(), '0');
|
equal($(div).text(), '0');
|
||||||
|
|
||||||
var div = view.make('div', {id: 'test-div'}, '');
|
div = view.make('div', {id: 'test-div'}, '');
|
||||||
equal($(div).text(), '');
|
equal($(div).text(), '');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ $(document).ready(function() {
|
|||||||
return {
|
return {
|
||||||
title: 'title1',
|
title: 'title1',
|
||||||
acceptText: 'confirm'
|
acceptText: 'confirm'
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -310,14 +310,11 @@ $(document).ready(function() {
|
|||||||
ok(new View().$el.is('p'));
|
ok(new View().$el.is('p'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("dispose", 0, function() {
|
test("views stopListening", 0, function() {
|
||||||
var View = Backbone.View.extend({
|
var View = Backbone.View.extend({
|
||||||
events: {
|
|
||||||
click: function() { ok(false); }
|
|
||||||
},
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
this.model.on('all x', function(){ ok(false); }, this);
|
this.listenTo(this.model, 'all x', function(){ ok(false); }, this);
|
||||||
this.collection.on('all x', function(){ ok(false); }, this);
|
this.listenTo(this.collection, 'all x', function(){ ok(false); }, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -326,22 +323,9 @@ $(document).ready(function() {
|
|||||||
collection: new Backbone.Collection
|
collection: new Backbone.Collection
|
||||||
});
|
});
|
||||||
|
|
||||||
view.dispose();
|
view.stopListening();
|
||||||
view.model.trigger('x');
|
view.model.trigger('x');
|
||||||
view.collection.trigger('x');
|
view.collection.trigger('x');
|
||||||
view.$el.click();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("dispose with non Backbone objects", 0, function() {
|
|
||||||
var view = new Backbone.View({model: {}, collection: {}});
|
|
||||||
view.dispose();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("view#remove calls dispose.", 1, function() {
|
|
||||||
var view = new Backbone.View();
|
|
||||||
|
|
||||||
view.dispose = function() { ok(true); };
|
|
||||||
view.remove();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Provide function for el.", 1, function() {
|
test("Provide function for el.", 1, function() {
|
||||||
@@ -364,16 +348,16 @@ $(document).ready(function() {
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var view = new View({events:{'click #test':'increment'}});
|
var view = new View({events:{'click #test':'increment'}});
|
||||||
var view2 = new View({events:function(){
|
var view2 = new View({events:function(){
|
||||||
return {'click #test':'increment'};
|
return {'click #test':'increment'};
|
||||||
}});
|
}});
|
||||||
|
|
||||||
view.$('#test').trigger('click');
|
view.$('#test').trigger('click');
|
||||||
view2.$('#test').trigger('click');
|
view2.$('#test').trigger('click');
|
||||||
equal(counter, 2);
|
equal(counter, 2);
|
||||||
|
|
||||||
view.$('#test').trigger('click');
|
view.$('#test').trigger('click');
|
||||||
view2.$('#test').trigger('click');
|
view2.$('#test').trigger('click');
|
||||||
equal(counter, 4);
|
equal(counter, 4);
|
||||||
|
|||||||
6
vendor/underscore/underscore-min.js
vendored
6
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
7
vendor/underscore/underscore.js
vendored
7
vendor/underscore/underscore.js
vendored
@@ -594,7 +594,7 @@
|
|||||||
// all callbacks defined on an object belong to it.
|
// all callbacks defined on an object belong to it.
|
||||||
_.bindAll = function(obj) {
|
_.bindAll = function(obj) {
|
||||||
var funcs = slice.call(arguments, 1);
|
var funcs = slice.call(arguments, 1);
|
||||||
if (funcs.length == 0) funcs = _.functions(obj);
|
if (funcs.length === 0) funcs = _.functions(obj);
|
||||||
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
|
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
@@ -1075,7 +1075,7 @@
|
|||||||
// Useful for temporary DOM ids.
|
// Useful for temporary DOM ids.
|
||||||
var idCounter = 0;
|
var idCounter = 0;
|
||||||
_.uniqueId = function(prefix) {
|
_.uniqueId = function(prefix) {
|
||||||
var id = '' + ++idCounter;
|
var id = '' + (++idCounter);
|
||||||
return prefix ? prefix + id : id;
|
return prefix ? prefix + id : id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1110,6 +1110,7 @@
|
|||||||
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
||||||
// and correctly escapes quotes within interpolated code.
|
// and correctly escapes quotes within interpolated code.
|
||||||
_.template = function(text, data, settings) {
|
_.template = function(text, data, settings) {
|
||||||
|
var render;
|
||||||
settings = _.defaults({}, settings, _.templateSettings);
|
settings = _.defaults({}, settings, _.templateSettings);
|
||||||
|
|
||||||
// Combine delimiters into one regular expression via alternation.
|
// Combine delimiters into one regular expression via alternation.
|
||||||
@@ -1148,7 +1149,7 @@
|
|||||||
source + "return __p;\n";
|
source + "return __p;\n";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var render = new Function(settings.variable || 'obj', '_', source);
|
render = new Function(settings.variable || 'obj', '_', source);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
e.source = source;
|
e.source = source;
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
Reference in New Issue
Block a user