diff --git a/.gitignore b/.gitignore
index e27563e184..58a3a4336a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,5 +2,5 @@
*.custom.*
*.log
*.map
-lodash.compat.js
+lodash.compat.min.js
node_modules
diff --git a/.travis.yml b/.travis.yml
index 75b5f9fb60..f294006555 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,31 +1,37 @@
language: node_js
node_js:
- - "0.10"
+ - "0.12"
env:
global:
- - BIN="node" BUILD="compat" ISTANBUL=false NODE_BIN=$BIN OPTION=""
- - IOJS_VERSION="v1.0.4" NPM_VERSION="^2.0.0" SAUCE_LABS=false SAUCE_USERNAME="lodash"
+ - BIN="node" BUILD="compat" ISTANBUL=false OPTION=""
+ - NPM_VERSION="^2.0.0" SAUCE_LABS=false SAUCE_USERNAME="lodash"
- secure: "tg1JFsIFnxzLaTboFPOnm+aJCuMm5+JdhLlESlqg9x3fwro++7KCnwHKLNovhchaPe4otC43ZMB/nfWhDnDm11dKbm/V6HlTkED+dadTsaLxVDg6J+7yK41QhokBPJOxLV78iDaNaAQVYEirAgZ0yn8kFubxmNKV+bpCGQNc9yU="
matrix:
- BUILD="compat"
- BUILD="modern"
- BUILD="modern"
- BUILD="modern" ISTANBUL=true
- - BIN="iojs" BUILD="compat" NODE_BIN=$BIN
- - BIN="iojs" BUILD="modern" NODE_BIN=$BIN
- BIN="phantomjs"
- BIN="rhino"
- BIN="rhino" OPTION="-require"
- BIN="ringo"
matrix:
include:
+ - node_js: "io.js"
+ env:
+ - node_js: "io.js"
+ env: BUILD="modern"
- node_js: "0.8"
env: NPM_VERSION="~1.4.0"
- node_js: "0.8"
env: BUILD="modern" NPM_VERSION="~1.4.0"
- node_js: "0.10"
- env: SAUCE_LABS=true
+ env:
- node_js: "0.10"
+ env: BUILD="modern"
+ - node_js: "0.12"
+ env: SAUCE_LABS=true
+ - node_js: "0.12"
env: SAUCE_LABS=true BUILD="modern"
git:
depth: 10
@@ -36,20 +42,18 @@ before_install:
- "nvm use $TRAVIS_NODE_VERSION"
- "npm config set loglevel error"
- "npm i -g npm@\"$NPM_VERSION\""
- - "[ $SAUCE_LABS == false ] || npm i chalk@\"0.5.1\" ecstatic@\"0.5.8\" request@\"^2.0.0\" sauce-tunnel@\"^2.0.0\""
+ - "[ $SAUCE_LABS == false ] || npm i chalk@\"0.5.1\" ecstatic@\"0.5.8\" request@\"^2.0.0\" sauce-tunnel@\"2.1.1\""
- "[ $ISTANBUL == false ] || (npm i -g coveralls@\"^2.0.0\" && npm i istanbul@\"0.3.5\")"
- - "[ $BIN != 'iojs' ] || (wget https://iojs.org/dist/${IOJS_VERSION}/iojs-${IOJS_VERSION}-linux-x64.tar.xz && sudo tar xJf iojs-${IOJS_VERSION}-linux-x64.tar.xz -C /opt && rm iojs-${IOJS_VERSION}-linux-x64.tar.xz)"
- - "[ $BIN != 'iojs' ] || (sudo ln -s /opt/iojs-${IOJS_VERSION}-linux-x64/bin/iojs /usr/local/bin/iojs && sudo chmod +x $_)"
- "[ $BIN != 'rhino' ] || (sudo mkdir /opt/rhino-1.7R5 && sudo wget --no-check-certificate -O $_/js.jar https://lodash.com/_travis/rhino-1.7R5.jar)"
- "[ $BIN != 'rhino' ] || (echo -e '#!/bin/sh\\njava -jar /opt/rhino-1.7R5/js.jar $@' | sudo tee /usr/local/bin/rhino && sudo chmod +x /usr/local/bin/rhino)"
- "[ $BIN != 'ringo' ] || (wget --no-check-certificate https://lodash.com/_travis/ringojs-0.11.zip && sudo unzip ringojs-0.11 -d /opt && rm ringojs-0.11.zip)"
- "[ $BIN != 'ringo' ] || (sudo ln -s /opt/ringojs-0.11/bin/ringo /usr/local/bin/ringo && sudo chmod +x $_)"
- "sed -i'' 's|\"lodash\"|\"lodash-compat\"|' ./package.json"
- "git clone --depth=10 --branch=master git://github.com/lodash/lodash-cli.git ./node_modules/lodash-cli && mkdir $_/node_modules && cd $_ && ln -s ../../../ ./lodash-compat && cd ../ && npm i && cd ../../"
- - "$NODE_BIN ./node_modules/lodash-cli/bin/lodash $BUILD -o ./lodash.$BUILD.js"
+ - "node ./node_modules/lodash-cli/bin/lodash $BUILD -o ./lodash.$BUILD.js"
script:
- - "[ $ISTANBUL == false ] || (nvm install 0.11.11 && cp ./lodash.$BUILD.js ./lodash.js && $BIN --harmony ./node_modules/istanbul/lib/cli.js cover -x \"**/vendor/**\" --report lcovonly ./test/test.js -- ./lodash.js)"
- - "([ $ISTANBUL == true ] && [ $TRAVIS_SECURE_ENV_VARS == true ] && nvm use $TRAVIS_NODE_VERSION && cat ./coverage/lcov.info | coveralls) || true"
+ - "[ $ISTANBUL == false ] || (cp ./lodash.$BUILD.js ./lodash.js && node ./node_modules/istanbul/lib/cli.js cover -x \"**/vendor/**\" --report lcovonly ./test/test.js -- ./lodash.js)"
+ - "[ $ISTANBUL == false ] || [ $TRAVIS_SECURE_ENV_VARS == false ] || (cat ./coverage/lcov.info | coveralls)"
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || cd ./test"
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || $BIN $OPTION ./test.js ../lodash.$BUILD.js"
- "[ $SAUCE_LABS == true ] || [ $ISTANBUL == true ] || $BIN $OPTION ./test.js ../lodash.$BUILD.min.js"
diff --git a/README.md b/README.md
index 2eeb10eec9..a1d253d942 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# lodash v3.1.0
+# lodash v3.2.0
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) with packages for [Bower](http://bower.io/), [Component](http://component.github.io/), & [Volo](http://volojs.org/).
@@ -12,8 +12,8 @@ $ lodash modern -o ./lodash.js
lodash is also available in a variety of other builds & module formats.
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
- * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.1.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.1.0-amd) builds
- * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.1.0-es) build
+ * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.2.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.2.0-amd) builds
+ * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.2.0-es) build
## Further Reading
diff --git a/bower.json b/bower.json
index d9a3cdacd3..a4a1a263d6 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "lodash",
- "version": "3.1.0",
+ "version": "3.2.0",
"main": "lodash.js",
"ignore": [
".*",
diff --git a/component.json b/component.json
index 63fa714de0..cf7b6479db 100644
--- a/component.json
+++ b/component.json
@@ -1,7 +1,7 @@
{
"name": "lodash",
"repo": "lodash/lodash",
- "version": "3.1.0",
+ "version": "3.2.0",
"description": "The modern build of lodash.",
"license": "MIT",
"main": "lodash.js",
diff --git a/doc/README.md b/doc/README.md
index f69e72e0a2..b624f979a1 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,4 +1,4 @@
-# lodash v3.1.0
+# lodash v3.2.0
@@ -12,6 +12,7 @@
* `_.dropRight`
* `_.dropRightWhile`
* `_.dropWhile`
+* `_.fill`
* `_.findIndex`
* `_.findLastIndex`
* `_.first`
@@ -55,7 +56,10 @@
* `_.tap`
* `_.thru`
* `_.prototype.chain`
+* `_.prototype.commit`
+* `_.prototype.plant`
* `_.prototype.reverse`
+* `_.prototype.run` -> `value`
* `_.prototype.toJSON` -> `value`
* `_.prototype.toString`
* `_.prototype.value`
@@ -140,6 +144,7 @@
* `_.partial`
* `_.partialRight`
* `_.rearg`
+* `_.spread`
* `_.throttle`
* `_.wrap`
@@ -160,7 +165,7 @@
* `_.isError`
* `_.isFinite`
* `_.isFunction`
-* `_.isMatch`
+* `_.isMatch`
* `_.isNaN`
* `_.isNative`
* `_.isNull`
@@ -251,6 +256,7 @@
* `_.identity`
* `_.iteratee` -> `callback`
* `_.matches`
+* `_.matchesProperty`
* `_.mixin`
* `_.noConflict`
* `_.noop`
@@ -306,7 +312,7 @@
### `_.chunk(array, [size=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4103 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4167 "View in source") [Ⓣ][1]
Creates an array of elements split into groups the length of `size`.
If `collection` can't be split evenly, the final chunk will be the remaining
@@ -314,7 +320,7 @@ elements.
#### Arguments
1. `array` *(Array)*: The array to process.
-2. `[size=1]` *(numer)*: The length of each chunk.
+2. `[size=1]` *(number)*: The length of each chunk.
#### Returns
*(Array)*: Returns the new array containing chunks.
@@ -334,7 +340,7 @@ _.chunk(['a', 'b', 'c', 'd'], 3);
### `_.compact(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4134 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4198 "View in source") [Ⓣ][1]
Creates an array with all falsey values removed. The values `false`, `null`,
`0`, `""`, `undefined`, and `NaN` are falsey.
@@ -357,7 +363,7 @@ _.compact([0, 1, false, 2, '', 3]);
### `_.difference(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4169 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4233 "View in source") [Ⓣ][1]
Creates an array excluding all values of the provided arrays using
`SameValueZero` for equality comparisons.
@@ -387,7 +393,7 @@ _.difference([1, 2, 3], [5, 2, 10]);
### `_.drop(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4207 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4270 "View in source") [Ⓣ][1]
Creates a slice of `array` with `n` elements dropped from the beginning.
@@ -419,7 +425,7 @@ _.drop([1, 2, 3], 0);
### `_.dropRight(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4243 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4305 "View in source") [Ⓣ][1]
Creates a slice of `array` with `n` elements dropped from the end.
@@ -451,24 +457,29 @@ _.dropRight([1, 2, 3], 0);
### `_.dropRightWhile(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4295 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4364 "View in source") [Ⓣ][1]
Creates a slice of `array` excluding elements dropped from the end.
Elements are dropped until `predicate` returns falsey. The predicate is
bound to `thisArg` and invoked with three arguments; (value, index, array).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
-callback returns `true` for elements that have the properties of the given
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
+callback returns `true` for elements that match the properties of the given
object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per element.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -480,18 +491,22 @@ _.dropRightWhile([1, 2, 3], function(n) { return n > 1; });
// => [1]
var users = [
- { 'user': 'barney', 'status': 'busy', 'active': false },
- { 'user': 'fred', 'status': 'busy', 'active': true },
- { 'user': 'pebbles', 'status': 'away', 'active': true }
+ { 'user': 'barney', 'active': true },
+ { 'user': 'fred', 'active': false },
+ { 'user': 'pebbles', 'active': false }
];
-// using the "_.property" callback shorthand
-_.pluck(_.dropRightWhile(users, 'active'), 'user');
+// using the `_.matches` callback shorthand
+_.pluck(_.dropRightWhile(users, { 'user': pebbles, 'active': false }), 'user');
+// => ['barney', 'fred']
+
+// using the `_.matchesProperty` callback shorthand
+_.pluck(_.dropRightWhile(users, 'active', false), 'user');
// => ['barney']
-// using the "_.matches" callback shorthand
-_.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user');
-// => ['barney', 'fred']
+// using the `_.property` callback shorthand
+_.pluck(_.dropRightWhile(users, 'active'), 'user');
+// => ['barney', 'fred', 'pebbles']
```
* * *
@@ -500,24 +515,29 @@ _.pluck(_.dropRightWhile(users, { 'status': 'away' }), 'user');
### `_.dropWhile(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4345 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4421 "View in source") [Ⓣ][1]
Creates a slice of `array` excluding elements dropped from the beginning.
Elements are dropped until `predicate` returns falsey. The predicate is
bound to `thisArg` and invoked with three arguments; (value, index, array).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per element.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -529,18 +549,22 @@ _.dropWhile([1, 2, 3], function(n) { return n < 3; });
// => [3]
var users = [
- { 'user': 'barney', 'status': 'busy', 'active': true },
- { 'user': 'fred', 'status': 'busy', 'active': false },
- { 'user': 'pebbles', 'status': 'away', 'active': true }
+ { 'user': 'barney', 'active': false },
+ { 'user': 'fred', 'active': false },
+ { 'user': 'pebbles', 'active': true }
];
-// using the "_.property" callback shorthand
-_.pluck(_.dropWhile(users, 'active'), 'user');
+// using the `_.matches` callback shorthand
+_.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
// => ['fred', 'pebbles']
-// using the "_.matches" callback shorthand
-_.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user');
+// using the `_.matchesProperty` callback shorthand
+_.pluck(_.dropWhile(users, 'active', false), 'user');
// => ['pebbles']
+
+// using the `_.property` callback shorthand
+_.pluck(_.dropWhile(users, 'active'), 'user');
+// => ['barney', 'fred', 'pebbles']
```
* * *
@@ -548,24 +572,53 @@ _.pluck(_.dropWhile(users, { 'status': 'busy' }), 'user');
+### `_.fill(array, value, [start=0], [end=array.length])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4447 "View in source") [Ⓣ][1]
+
+Fills elements of `array` with `value` from `start` up to, but not
+including, `end`.
+
+
+**Note:** This method mutates `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to fill.
+2. `value` *(*)*: The value to fill `array` with.
+3. `[start=0]` *(number)*: The start position.
+4. `[end=array.length]` *(number)*: The end position.
+
+#### Returns
+*(Array)*: Returns `array`.
+
+* * *
+
+
+
+
+
### `_.findIndex(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4395 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4505 "View in source") [Ⓣ][1]
This method is like `_.find` except that it returns the index of the first
element `predicate` returns truthy for, instead of the element itself.
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to search.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -574,21 +627,25 @@ object, else `false`.
#### Example
```js
var users = [
- { 'user': 'barney', 'age': 36, 'active': false },
- { 'user': 'fred', 'age': 40, 'active': true },
- { 'user': 'pebbles', 'age': 1, 'active': false }
+ { 'user': 'barney', 'active': false },
+ { 'user': 'fred', 'active': false },
+ { 'user': 'pebbles', 'active': true }
];
-_.findIndex(users, function(chr) { return chr.age < 40; });
+_.findIndex(users, function(chr) { return chr.user == 'barney'; });
// => 0
-// using the "_.matches" callback shorthand
-_.findIndex(users, { 'age': 1 });
-// => 2
+// using the `_.matches` callback shorthand
+_.findIndex(users, { 'user': 'fred', 'active': false });
+// => 1
+
+// using the `_.matchesProperty` callback shorthand
+_.findIndex(users, 'active', false);
+// => 0
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.findIndex(users, 'active');
-// => 1
+// => 2
```
* * *
@@ -597,23 +654,28 @@ _.findIndex(users, 'active');
### `_.findLastIndex(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4447 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4564 "View in source") [Ⓣ][1]
This method is like `_.findIndex` except that it iterates over elements
of `collection` from right to left.
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to search.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -622,19 +684,23 @@ object, else `false`.
#### Example
```js
var users = [
- { 'user': 'barney', 'age': 36, 'active': true },
- { 'user': 'fred', 'age': 40, 'active': false },
- { 'user': 'pebbles', 'age': 1, 'active': false }
+ { 'user': 'barney', 'active': true },
+ { 'user': 'fred', 'active': false },
+ { 'user': 'pebbles', 'active': false }
];
-_.findLastIndex(users, function(chr) { return chr.age < 40; });
+_.findLastIndex(users, function(chr) { return chr.user == 'pebbles'; });
// => 2
-// using the "_.matches" callback shorthand
-_.findLastIndex(users, { 'age': 40 });
+// using the `_.matches` callback shorthand
+_.findLastIndex(users, { user': 'barney', 'active': true });
+// => 0
+
+// using the `_.matchesProperty` callback shorthand
+_.findLastIndex(users, 'active', false);
// => 1
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.findLastIndex(users, 'active');
// => 0
```
@@ -645,7 +711,7 @@ _.findLastIndex(users, 'active');
### `_.first(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4475 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4592 "View in source") [Ⓣ][1]
Gets the first element of `array`.
@@ -670,7 +736,7 @@ _.first([]);
### `_.flatten(array, [isDeep])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4499 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4616 "View in source") [Ⓣ][1]
Flattens a nested array. If `isDeep` is `true` the array is recursively
flattened, otherwise it is only flattened a single level.
@@ -698,7 +764,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
### `_.flattenDeep(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4520 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4637 "View in source") [Ⓣ][1]
Recursively flattens a nested array.
@@ -720,7 +786,7 @@ _.flattenDeep([1, [2], [3, [[4]]]]);
### `_.indexOf(array, value, [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4557 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4674 "View in source") [Ⓣ][1]
Gets the index at which the first occurrence of `value` is found in `array`
using `SameValueZero` for equality comparisons. If `fromIndex` is negative,
@@ -761,7 +827,7 @@ _.indexOf([4, 4, 5, 5, 6, 6], 5, true);
### `_.initial(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4586 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4703 "View in source") [Ⓣ][1]
Gets all but the last element of `array`.
@@ -783,7 +849,7 @@ _.initial([1, 2, 3]);
### `_.intersection([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4609 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4726 "View in source") [Ⓣ][1]
Creates an array of unique values in all provided arrays using `SameValueZero`
for equality comparisons.
@@ -812,7 +878,7 @@ _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
### `_.last(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4664 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4781 "View in source") [Ⓣ][1]
Gets the last element of `array`.
@@ -834,7 +900,7 @@ _.last([1, 2, 3]);
### `_.lastIndexOf(array, value, [fromIndex=array.length-1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4694 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4811 "View in source") [Ⓣ][1]
This method is like `_.indexOf` except that it iterates over elements of
`array` from right to left.
@@ -867,7 +933,7 @@ _.lastIndexOf([4, 4, 5, 5, 6, 6], 5, true);
### `_.pull(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4741 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4858 "View in source") [Ⓣ][1]
Removes all provided values from `array` using `SameValueZero` for equality
comparisons.
@@ -902,7 +968,7 @@ console.log(array);
### `_.pullAt(array, [indexes])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4786 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4903 "View in source") [Ⓣ][1]
Removes elements from `array` corresponding to the given indexes and returns
an array of the removed elements. Indexes may be specified as an array of
@@ -936,18 +1002,23 @@ console.log(evens);
### `_.remove(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4824 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4944 "View in source") [Ⓣ][1]
Removes all elements from `array` that `predicate` returns truthy for
and returns an array of the removed elements. The predicate is bound to
`thisArg` and invoked with three arguments; (value, index, array).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
@@ -956,7 +1027,7 @@ object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to modify.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -980,7 +1051,7 @@ console.log(evens);
### `_.rest(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4855 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4975 "View in source") [Ⓣ][1]
Gets all but the first element of `array`.
@@ -1002,7 +1073,7 @@ _.rest([1, 2, 3]);
### `_.slice(array, [start=0], [end=array.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4873 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L4993 "View in source") [Ⓣ][1]
Creates a slice of `array` from `start` up to, but not including, `end`.
@@ -1025,7 +1096,7 @@ lists in IE < 9 and to ensure dense arrays are returned.
### `_.sortedIndex(array, value, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4930 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5053 "View in source") [Ⓣ][1]
Uses a binary search to determine the lowest index at which `value` should
be inserted into `array` in order to maintain its sort order. If an iteratee
@@ -1034,18 +1105,23 @@ to compute their sort ranking. The iteratee is bound to `thisArg` and
invoked with one argument; (value).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `array` *(Array)*: The sorted array to inspect.
2. `value` *(*)*: The value to evaluate.
-3. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+3. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -1068,7 +1144,7 @@ _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {
}, dict);
// => 1
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
// => 1
```
@@ -1079,7 +1155,7 @@ _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
### `_.sortedLastIndex(array, value, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4958 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5080 "View in source") [Ⓣ][1]
This method is like `_.sortedIndex` except that it returns the highest
index at which `value` should be inserted into `array` in order to
@@ -1088,7 +1164,7 @@ maintain its sort order.
#### Arguments
1. `array` *(Array)*: The sorted array to inspect.
2. `value` *(*)*: The value to evaluate.
-3. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+3. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -1107,7 +1183,7 @@ _.sortedLastIndex([4, 4, 5, 5, 6, 6], 5);
### `_.take(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L4990 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5111 "View in source") [Ⓣ][1]
Creates a slice of `array` with `n` elements taken from the beginning.
@@ -1139,7 +1215,7 @@ _.take([1, 2, 3], 0);
### `_.takeRight(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5026 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5146 "View in source") [Ⓣ][1]
Creates a slice of `array` with `n` elements taken from the end.
@@ -1171,24 +1247,29 @@ _.takeRight([1, 2, 3], 0);
### `_.takeRightWhile(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5078 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5205 "View in source") [Ⓣ][1]
Creates a slice of `array` with elements taken from the end. Elements are
taken until `predicate` returns falsey. The predicate is bound to `thisArg`
and invoked with three arguments; (value, index, array).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per element.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -1200,18 +1281,22 @@ _.takeRightWhile([1, 2, 3], function(n) { return n > 1; });
// => [2, 3]
var users = [
- { 'user': 'barney', 'status': 'busy', 'active': false },
- { 'user': 'fred', 'status': 'busy', 'active': true },
- { 'user': 'pebbles', 'status': 'away', 'active': true }
+ { 'user': 'barney', 'active': true },
+ { 'user': 'fred', 'active': false },
+ { 'user': 'pebbles', 'active': false }
];
-// using the "_.property" callback shorthand
-_.pluck(_.takeRightWhile(users, 'active'), 'user');
+// using the `_.matches` callback shorthand
+_.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
+// => ['pebbles']
+
+// using the `_.matchesProperty` callback shorthand
+_.pluck(_.takeRightWhile(users, 'active', false), 'user');
// => ['fred', 'pebbles']
-// using the "_.matches" callback shorthand
-_.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user');
-// => ['pebbles']
+// using the `_.property` callback shorthand
+_.pluck(_.takeRightWhile(users, 'active'), 'user');
+// => []
```
* * *
@@ -1220,24 +1305,29 @@ _.pluck(_.takeRightWhile(users, { 'status': 'away' }), 'user');
### `_.takeWhile(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5128 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5262 "View in source") [Ⓣ][1]
Creates a slice of `array` with elements taken from the beginning. Elements
are taken until `predicate` returns falsey. The predicate is bound to
`thisArg` and invoked with three arguments; (value, index, array).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to query.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per element.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -1249,18 +1339,22 @@ _.takeWhile([1, 2, 3], function(n) { return n < 3; });
// => [1, 2]
var users = [
- { 'user': 'barney', 'status': 'busy', 'active': true },
- { 'user': 'fred', 'status': 'busy', 'active': false },
- { 'user': 'pebbles', 'status': 'away', 'active': true }
+ { 'user': 'barney', 'active': false },
+ { 'user': 'fred', 'active': false},
+ { 'user': 'pebbles', 'active': true }
];
-// using the "_.property" callback shorthand
-_.pluck(_.takeWhile(users, 'active'), 'user');
+// using the `_.matches` callback shorthand
+_.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
// => ['barney']
-// using the "_.matches" callback shorthand
-_.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user');
+// using the `_.matchesProperty` callback shorthand
+_.pluck(_.takeWhile(users, 'active', false), 'user');
// => ['barney', 'fred']
+
+// using the `_.property` callback shorthand
+_.pluck(_.takeWhile(users, 'active'), 'user');
+// => []
```
* * *
@@ -1269,7 +1363,7 @@ _.pluck(_.takeWhile(users, { 'status': 'busy' }), 'user');
### `_.union([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5158 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5292 "View in source") [Ⓣ][1]
Creates an array of unique values, in order, of the provided arrays using
`SameValueZero` for equality comparisons.
@@ -1298,7 +1392,7 @@ _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]);
### `_.uniq(array, [isSorted], [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5210 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5346 "View in source") [Ⓣ][1]
Creates a duplicate-value-free version of an array using `SameValueZero`
for equality comparisons. Providing `true` for `isSorted` performs a faster
@@ -1308,11 +1402,16 @@ uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked
with three arguments; (value, index, array).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
@@ -1325,7 +1424,7 @@ for more details.
#### Arguments
1. `array` *(Array)*: The array to inspect.
2. `[isSorted]` *(boolean)*: Specify the array is sorted.
-3. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+3. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration.
4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -1344,7 +1443,7 @@ _.uniq([1, 1, 2], true);
_.uniq([1, 2.5, 1.5, 2], function(n) { return this.floor(n); }, Math);
// => [1, 2.5]
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }, { 'x': 2 }]
```
@@ -1355,7 +1454,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
### `_.unzip(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5248 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5384 "View in source") [Ⓣ][1]
This method is like `_.zip` except that it accepts an array of grouped
elements and creates an array regrouping the elements to their pre-`_.zip`
@@ -1382,7 +1481,7 @@ _.unzip(zipped);
### `_.without(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5279 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5415 "View in source") [Ⓣ][1]
Creates an array excluding all provided values using `SameValueZero` for
equality comparisons.
@@ -1412,7 +1511,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
### `_.xor([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5301 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5437 "View in source") [Ⓣ][1]
Creates an array that is the symmetric difference of the provided arrays.
See [Wikipedia](https://en.wikipedia.org/wiki/Symmetric_difference) for
@@ -1439,7 +1538,7 @@ _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]);
### `_.zip([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5331 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5467 "View in source") [Ⓣ][1]
Creates an array of grouped elements, the first of which contains the first
elements of the given arrays, the second of which contains the second elements
@@ -1463,7 +1562,7 @@ _.zip(['fred', 'barney'], [30, 40], [true, false]);
### `_.zipObject(props, [values=[]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5358 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5494 "View in source") [Ⓣ][1]
Creates an object composed from arrays of property names and values. Provide
either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]`
@@ -1494,9 +1593,9 @@ _.zipObject(['fred', 'barney'], [30, 40]);
### `._(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L919 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L920 "View in source") [Ⓣ][1]
-Creates a `lodash` object which wraps `value` to enable intuitive chaining.
+Creates a `lodash` object which wraps `value` to enable implicit chaining.
Methods that operate on and return arrays, collections, and functions can
be chained together. Methods that return a boolean or single value will
automatically end the chain returning the unwrapped value. Explicit chaining
@@ -1519,31 +1618,33 @@ In addition to lodash methods, wrappers also have the following `Array` methods:
and `unshift`
-The wrapper functions that support shortcut fusion are:
-`drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `first`,
-`initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, `slice`,
-`take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `where`
+The wrapper methods that support shortcut fusion are:
+`compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
+`first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
+`slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
+and `where`
-The chainable wrapper functions are:
+The chainable wrapper methods are:
`after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
-`callback`, `chain`, `chunk`, `compact`, `concat`, `constant`, `countBy`,
-`create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, `difference`,
-`drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, `flatten`,
-`flattenDeep`, `flow`, `flowRight`, `forEach`, `forEachRight`, `forIn`,
-`forInRight`, `forOwn`, `forOwnRight`, `functions`, `groupBy`, `indexBy`,
-`initial`, `intersection`, `invert`, `invoke`, `keys`, `keysIn`, `map`,
-`mapValues`, `matches`, `memoize`, `merge`, `mixin`, `negate`, `noop`,
-`omit`, `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`,
-`pluck`, `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`,
-`rearg`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
-`sortBy`, `sortByAll`, `splice`, `take`, `takeRight`, `takeRightWhile`,
-`takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
-`transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`,
-`where`, `without`, `wrap`, `xor`, `zip`, and `zipObject`
-
-
-The wrapper functions that are **not** chainable by default are:
+`callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
+`countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`,
+`difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`,
+`filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`,
+`forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
+`groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
+`keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`,
+`mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
+`partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
+`pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`,
+`shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `splice`, `spread`,
+`take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
+`thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`,
+`unshift`, `unzip`, `values`, `valuesIn`, `where`, `without`, `wrap`, `xor`,
+`zip`, and `zipObject`
+
+
+The wrapper methods that are **not** chainable by default are:
`attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`,
`endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
`findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`,
@@ -1559,14 +1660,14 @@ The wrapper functions that are **not** chainable by default are:
`trunc`, `unescape`, `uniqueId`, `value`, and `words`
-The wrapper function `sample` will return a wrapped value when `n` is provided,
+The wrapper method `sample` will return a wrapped value when `n` is provided,
otherwise an unwrapped value is returned.
#### Arguments
1. `value` *(*)*: The value to wrap in a `lodash` instance.
#### Returns
-*(Object)*: Returns a `lodash` instance.
+*(Object)*: Returns the new `lodash` wrapper instance.
#### Example
```js
@@ -1592,7 +1693,7 @@ _.isArray(squares.value());
### `_.chain(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5403 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5539 "View in source") [Ⓣ][1]
Creates a `lodash` object that wraps `value` with explicit method
chaining enabled.
@@ -1601,7 +1702,7 @@ chaining enabled.
1. `value` *(*)*: The value to wrap.
#### Returns
-*(Object)*: Returns the new `lodash` object.
+*(Object)*: Returns the new `lodash` wrapper instance.
#### Example
```js
@@ -1625,7 +1726,7 @@ var youngest = _.chain(users)
### `_.tap(value, interceptor, [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5430 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5566 "View in source") [Ⓣ][1]
This method invokes `interceptor` and returns `value`. The interceptor is
bound to `thisArg` and invoked with one argument; (value). The purpose of
@@ -1655,7 +1756,7 @@ _([1, 2, 3])
### `_.thru(value, interceptor, [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5453 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5589 "View in source") [Ⓣ][1]
This method is like `_.tap` except that it returns the result of `interceptor`.
@@ -1682,12 +1783,12 @@ _([1, 2, 3])
### `_.prototype.chain()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5482 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5618 "View in source") [Ⓣ][1]
Enables explicit method chaining on the wrapper object.
#### Returns
-*(*)*: Returns the `lodash` object.
+*(Object)*: Returns the new `lodash` wrapper instance.
#### Example
```js
@@ -1713,8 +1814,70 @@ _(users).chain()
+### `_.prototype.commit()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5647 "View in source") [Ⓣ][1]
+
+Executes the chained sequence and returns the wrapped result.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+var array = [1, 2];
+var wrapper = _(array).push(3);
+
+console.log(array);
+// => [1, 2]
+
+wrapper = wrapper.commit();
+console.log(array);
+// => [1, 2, 3]
+
+wrapper.last();
+// => 3
+
+console.log(array);
+// => [1, 2, 3]
+```
+* * *
+
+
+
+
+
+### `_.prototype.plant()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5674 "View in source") [Ⓣ][1]
+
+Creates a clone of the chained sequence planting `value` as the wrapped value.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+var array = [1, 2];
+var wrapper = _(array).map(function(value) {
+ return Math.pow(value, 2);
+});
+
+var other = [3, 4];
+var otherWrapper = wrapper.plant(other);
+
+otherWrapper.value();
+// => [9, 16]
+
+wrapper.value();
+// => [1, 4]
+```
+* * *
+
+
+
+
+
### `_.prototype.reverse()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5506 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5712 "View in source") [Ⓣ][1]
Reverses the wrapped array so the first element becomes the last, the
second element becomes the second to last, and so on.
@@ -1723,7 +1886,7 @@ second element becomes the second to last, and so on.
**Note:** This method mutates the wrapped array.
#### Returns
-*(Object)*: Returns the new reversed `lodash` object.
+*(Object)*: Returns the new reversed `lodash` wrapper instance.
#### Example
```js
@@ -1742,7 +1905,7 @@ console.log(array);
### `_.prototype.toString()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5531 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5737 "View in source") [Ⓣ][1]
Produces the result of coercing the unwrapped value to a string.
@@ -1761,7 +1924,7 @@ _([1, 2, 3]).toString();
### `_.prototype.value()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5548 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5754 "View in source") [Ⓣ][1]
Executes the chained sequence to extract the unwrapped value.
@@ -1786,7 +1949,7 @@ _([1, 2, 3]).value();
### `_.at(collection, [props])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5574 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5780 "View in source") [Ⓣ][1]
Creates an array of elements corresponding to the given keys, or indexes,
of `collection`. Keys may be specified as individual arguments or as arrays
@@ -1814,7 +1977,7 @@ _.at(['fred', 'barney', 'pebbles'], 0, 2);
### `_.countBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5667 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5876 "View in source") [Ⓣ][1]
Creates an object composed of keys generated from the results of running
each element of `collection` through `iteratee`. The corresponding value
@@ -1823,17 +1986,22 @@ The `iteratee` is bound to `thisArg` and invoked with three arguments;
(value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -1857,24 +2025,29 @@ _.countBy(['one', 'two', 'three'], 'length');
### `_.every(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5712 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5928 "View in source") [Ⓣ][1]
Checks if `predicate` returns truthy for **all** elements of `collection`.
The predicate is bound to `thisArg` and invoked with three arguments;
(value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -1883,20 +2056,24 @@ else `false`.
#### Example
```js
-_.every([true, 1, null, 'yes']);
+_.every([true, 1, null, 'yes'], Boolean);
// => false
var users = [
- { 'user': 'barney', 'age': 36 },
- { 'user': 'fred', 'age': 40 }
+ { 'user': 'barney', 'active': false },
+ { 'user': 'fred', 'active': false }
];
-// using the "_.property" callback shorthand
-_.every(users, 'age');
+// using the `_.matches` callback shorthand
+_.every(users, { 'user': 'barney', 'active': false });
+// => false
+
+// using the `_.matchesProperty` callback shorthand
+_.every(users, 'active', false);
// => true
-// using the "_.matches" callback shorthand
-_.every(users, { 'age': 36 });
+// using the `_.property` callback shorthand
+_.every(users, 'active');
// => false
```
* * *
@@ -1906,24 +2083,29 @@ _.every(users, { 'age': 36 });
### `_.filter(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5760 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5983 "View in source") [Ⓣ][1]
Iterates over elements of `collection`, returning an array of all elements
`predicate` returns truthy for. The predicate is bound to `thisArg` and
invoked with three arguments; (value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -1935,16 +2117,20 @@ var evens = _.filter([1, 2, 3, 4], function(n) { return n % 2 == 0; });
// => [2, 4]
var users = [
- { 'user': 'barney', 'age': 36, 'active': false },
- { 'user': 'fred', 'age': 40, 'active': true }
+ { 'user': 'barney', 'age': 36, 'active': true },
+ { 'user': 'fred', 'age': 40, 'active': false }
];
-// using the "_.property" callback shorthand
-_.pluck(_.filter(users, 'active'), 'user');
+// using the `_.matches` callback shorthand
+_.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
+// => ['barney']
+
+// using the `_.matchesProperty` callback shorthand
+_.pluck(_.filter(users, 'active', false), 'user');
// => ['fred']
-// using the "_.matches" callback shorthand
-_.pluck(_.filter(users, { 'age': 36 }), 'user');
+// using the `_.property` callback shorthand
+_.pluck(_.filter(users, 'active'), 'user');
// => ['barney']
```
* * *
@@ -1954,24 +2140,29 @@ _.pluck(_.filter(users, { 'age': 36 }), 'user');
### `_.find(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5807 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6037 "View in source") [Ⓣ][1]
Iterates over elements of `collection`, returning the first element
`predicate` returns truthy for. The predicate is bound to `thisArg` and
invoked with three arguments; (value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to search.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -1980,21 +2171,25 @@ object, else `false`.
#### Example
```js
var users = [
- { 'user': 'barney', 'age': 36, 'active': false },
- { 'user': 'fred', 'age': 40, 'active': true },
- { 'user': 'pebbles', 'age': 1, 'active': false }
+ { 'user': 'barney', 'age': 36, 'active': true },
+ { 'user': 'fred', 'age': 40, 'active': false },
+ { 'user': 'pebbles', 'age': 1, 'active': true }
];
_.result(_.find(users, function(chr) { return chr.age < 40; }), 'user');
// => 'barney'
-// using the "_.matches" callback shorthand
-_.result(_.find(users, { 'age': 1 }), 'user');
+// using the `_.matches` callback shorthand
+_.result(_.find(users, { 'age': 1, 'active': true }), 'user');
// => 'pebbles'
-// using the "_.property" callback shorthand
-_.result(_.find(users, 'active'), 'user');
+// using the `_.matchesProperty` callback shorthand
+_.result(_.find(users, 'active', false), 'user');
// => 'fred'
+
+// using the `_.property` callback shorthand
+_.result(_.find(users, 'active'), 'user');
+// => 'barney'
```
* * *
@@ -2003,14 +2198,14 @@ _.result(_.find(users, 'active'), 'user');
### `_.findLast(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5834 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6063 "View in source") [Ⓣ][1]
This method is like `_.find` except that it iterates over elements of
`collection` from right to left.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to search.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -2028,11 +2223,17 @@ _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; });
### `_.findWhere(collection, source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5863 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6097 "View in source") [Ⓣ][1]
Performs a deep comparison between each element in `collection` and the
source object, returning the first element that has equivalent property
values.
+
+
+**Note:** This method supports comparing arrays, booleans, `Date` objects,
+numbers, `Object` objects, regexes, and strings. Objects are compared by
+their own, not inherited, enumerable properties. For comparing a single
+own or inherited property value see `_.matchesProperty`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to search.
@@ -2044,14 +2245,14 @@ values.
#### Example
```js
var users = [
- { 'user': 'barney', 'age': 36, 'status': 'busy' },
- { 'user': 'fred', 'age': 40, 'status': 'busy' }
+ { 'user': 'barney', 'age': 36, 'active': true },
+ { 'user': 'fred', 'age': 40, 'active': false }
];
-_.result(_.findWhere(users, { 'status': 'busy' }), 'user');
+_.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');
// => 'barney'
-_.result(_.findWhere(users, { 'age': 40 }), 'user');
+_.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');
// => 'fred'
```
* * *
@@ -2061,7 +2262,7 @@ _.result(_.findWhere(users, { 'age': 40 }), 'user');
### `_.forEach(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5893 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6127 "View in source") [Ⓣ][1]
Iterates over elements of `collection` invoking `iteratee` for each element.
The `iteratee` is bound to `thisArg` and invoked with three arguments;
@@ -2096,7 +2297,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n,
### `_.forEachRight(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5916 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6150 "View in source") [Ⓣ][1]
This method is like `_.forEach` except that it iterates over elements of
`collection` from right to left.
@@ -2121,7 +2322,7 @@ _([1, 2, 3]).forEachRight(function(n) { console.log(n); }).join(',');
### `_.groupBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5957 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6194 "View in source") [Ⓣ][1]
Creates an object composed of keys generated from the results of running
each element of `collection` through `iteratee`. The corresponding value
@@ -2130,17 +2331,22 @@ The `iteratee` is bound to `thisArg` and invoked with three arguments;
(value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -2154,7 +2360,7 @@ _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); });
_.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math);
// => { '4': [4.2], '6': [6.1, 6.4] }
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.groupBy(['one', 'two', 'three'], 'length');
// => { '3': ['one', 'two'], '5': ['three'] }
```
@@ -2165,7 +2371,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
### `_.includes(collection, target, [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L5614 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L5820 "View in source") [Ⓣ][1]
Checks if `value` is in `collection` using `SameValueZero` for equality
comparisons. If `fromIndex` is negative, it is used as the offset from
@@ -2206,7 +2412,7 @@ _.includes('pebbles', 'eb');
### `_.indexBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6004 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6244 "View in source") [Ⓣ][1]
Creates an object composed of keys generated from the results of running
each element of `collection` through `iteratee`. The corresponding value
@@ -2215,17 +2421,22 @@ iteratee function is bound to `thisArg` and invoked with three arguments;
(value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -2254,7 +2465,7 @@ _.indexBy(keyData, function(object) { return this.fromCharCode(object.code); },
### `_.invoke(collection, methodName, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6030 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6270 "View in source") [Ⓣ][1]
Invokes the method named by `methodName` on each element in `collection`,
returning an array of the results of each invoked method. Any additional
@@ -2284,24 +2495,40 @@ _.invoke([123, 456], String.prototype.split, '');
### `_.map(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6073 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6326 "View in source") [Ⓣ][1]
Creates an array of values by running each element in `collection` through
`iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
arguments; (value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
+
+
+Many lodash methods are guarded to work as interatees for methods like
+`_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
+
+
+The guarded methods are:
+`ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`,
+`dropRight`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, `slice`,
+`sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, `trimRight`,
+`trunc`, `random`, `range`, `sample`, `uniq`, and `words`
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration. create a `_.property` or `_.matches` style callback respectively.
3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -2320,7 +2547,7 @@ var users = [
{ 'user': 'fred' }
];
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.map(users, 'user');
// => ['barney', 'fred']
```
@@ -2331,7 +2558,7 @@ _.map(users, 'user');
### `_.max(collection, [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6122 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6377 "View in source") [Ⓣ][1]
Gets the maximum value of `collection`. If `collection` is empty or falsey
`-Infinity` is returned. If an iteratee function is provided it is invoked
@@ -2340,17 +2567,22 @@ is ranked. The `iteratee` is bound to `thisArg` and invoked with three
arguments; (value, index, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -2372,7 +2604,7 @@ var users = [
_.max(users, function(chr) { return chr.age; });
// => { 'user': 'fred', 'age': 40 };
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.max(users, 'age');
// => { 'user': 'fred', 'age': 40 };
```
@@ -2383,7 +2615,7 @@ _.max(users, 'age');
### `_.min(collection, [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6167 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6424 "View in source") [Ⓣ][1]
Gets the minimum value of `collection`. If `collection` is empty or falsey
`Infinity` is returned. If an iteratee function is provided it is invoked
@@ -2392,17 +2624,22 @@ is ranked. The `iteratee` is bound to `thisArg` and invoked with three
arguments; (value, index, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -2424,7 +2661,7 @@ var users = [
_.min(users, function(chr) { return chr.age; });
// => { 'user': 'barney', 'age': 36 };
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.min(users, 'age');
// => { 'user': 'barney', 'age': 36 };
```
@@ -2435,7 +2672,7 @@ _.min(users, 'age');
### `_.partition(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6213 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6479 "View in source") [Ⓣ][1]
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, while the second of which
@@ -2443,17 +2680,22 @@ contains elements `predicate` returns falsey for. The predicate is bound
to `thisArg` and invoked with three arguments; (value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -2473,12 +2715,18 @@ var users = [
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
-// using the "_.matches" callback shorthand
-_.map(_.partition(users, { 'age': 1 }), function(array) { return _.pluck(array, 'user'); });
+var mapper = function(array) { return _.pluck(array, 'user'); };
+
+// using the `_.matches` callback shorthand
+_.map(_.partition(users, { 'age': 1, 'active': false }), mapper);
// => [['pebbles'], ['barney', 'fred']]
-// using the "_.property" callback shorthand
-_.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'user'); });
+// using the `_.matchesProperty` callback shorthand
+_.map(_.partition(users, 'active', false), mapper);
+// => [['barney', 'pebbles'], ['fred']]
+
+// using the `_.property` callback shorthand
+_.map(_.partition(users, 'active'), mapper);
// => [['fred'], ['barney', 'pebbles']]
```
* * *
@@ -2488,7 +2736,7 @@ _.map(_.partition(users, 'active'), function(array) { return _.pluck(array, 'use
### `_.pluck(collection, key)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6240 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6506 "View in source") [Ⓣ][1]
Gets the value of `key` from all elements in `collection`.
@@ -2520,7 +2768,7 @@ _.pluck(userIndex, 'age');
### `_.reduce(collection, [iteratee=_.identity], [accumulator], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6272 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6544 "View in source") [Ⓣ][1]
Reduces `collection` to a value which is the accumulated result of running
each element in `collection` through `iteratee`, where each successive
@@ -2528,6 +2776,14 @@ invocation is supplied the return value of the previous. If `accumulator`
is not provided the first element of `collection` is used as the initial
value. The `iteratee` is bound to `thisArg`and invoked with four arguments;
(accumulator, value, index|key, collection).
+
+
+Many lodash methods are guarded to work as interatees for methods like
+`_.reduce`, `_.reduceRight`, and `_.transform`.
+
+
+The guarded methods are:
+`assign`, `defaults`, `merge`, and `sortAllBy`
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
@@ -2556,7 +2812,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, n, key) {
### `_.reduceRight(collection, [iteratee=_.identity], [accumulator], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6296 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6568 "View in source") [Ⓣ][1]
This method is like `_.reduce` except that it iterates over elements of
`collection` from right to left.
@@ -2583,23 +2839,28 @@ _.reduceRight(array, function(flattened, other) { return flattened.concat(other)
### `_.reject(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6339 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6618 "View in source") [Ⓣ][1]
The opposite of `_.filter`; this method returns the elements of `collection`
that `predicate` does **not** return truthy for.
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -2615,13 +2876,17 @@ var users = [
{ 'user': 'fred', 'age': 40, 'active': true }
];
-// using the "_.property" callback shorthand
-_.pluck(_.reject(users, 'active'), 'user');
+// using the `_.matches` callback shorthand
+_.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');
// => ['barney']
-// using the "_.matches" callback shorthand
-_.pluck(_.reject(users, { 'age': 36 }), 'user');
+// using the `_.matchesProperty` callback shorthand
+_.pluck(_.reject(users, 'active', false), 'user');
// => ['fred']
+
+// using the `_.property` callback shorthand
+_.pluck(_.reject(users, 'active'), 'user');
+// => ['barney']
```
* * *
@@ -2630,7 +2895,7 @@ _.pluck(_.reject(users, { 'age': 36 }), 'user');
### `_.sample(collection, [n])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6365 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6644 "View in source") [Ⓣ][1]
Gets a random element or `n` random elements from a collection.
@@ -2656,7 +2921,7 @@ _.sample([1, 2, 3, 4], 2);
### `_.shuffle(collection)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6391 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6670 "View in source") [Ⓣ][1]
Creates an array of shuffled values, using a version of the Fisher-Yates
shuffle. See [Wikipedia](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle)
@@ -2680,7 +2945,7 @@ _.shuffle([1, 2, 3, 4]);
### `_.size(collection)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6428 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6707 "View in source") [Ⓣ][1]
Gets the size of `collection` by returning `collection.length` for
array-like values or the number of own enumerable properties for objects.
@@ -2709,7 +2974,7 @@ _.size('pebbles');
### `_.some(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6475 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6761 "View in source") [Ⓣ][1]
Checks if `predicate` returns truthy for **any** element of `collection`.
The function returns as soon as it finds a passing value and does not iterate
@@ -2717,17 +2982,22 @@ over the entire collection. The predicate is bound to `thisArg` and invoked
with three arguments; (value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration. If a property name or object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
@@ -2740,17 +3010,21 @@ _.some([null, 0, 'yes', false], Boolean);
// => true
var users = [
- { 'user': 'barney', 'age': 36, 'active': false },
- { 'user': 'fred', 'age': 40, 'active': true }
+ { 'user': 'barney', 'active': true },
+ { 'user': 'fred', 'active': false }
];
-// using the "_.property" callback shorthand
-_.some(users, 'active');
+// using the `_.matches` callback shorthand
+_.some(users, { user': 'barney', 'active': false });
+// => false
+
+// using the `_.matchesProperty` callback shorthand
+_.some(users, 'active', false);
// => true
-// using the "_.matches" callback shorthand
-_.some(users, { 'age': 1 });
-// => false
+// using the `_.property` callback shorthand
+_.some(users, 'active');
+// => true
```
* * *
@@ -2759,7 +3033,7 @@ _.some(users, { 'age': 1 });
### `_.sortBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6524 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6814 "View in source") [Ⓣ][1]
Creates an array of elements, sorted in ascending order by the results of
running each element in a collection through `iteratee`. This method performs
@@ -2768,17 +3042,22 @@ The `iteratee` is bound to `thisArg` and invoked with three arguments;
(value, index|key, collection).
-If a property name is provided for `predicate` the created "_.property"
+If a property name is provided for `predicate` the created `_.property`
style callback returns the property value of the given element.
-If an object is provided for `predicate` the created "_.matches" style
+If a value is also provided for `thisArg` the created `_.matchesProperty`
+style callback returns `true` for elements that have a matching property
+value, else `false`.
+
+
+If an object is provided for `predicate` the created `_.matches` style
callback returns `true` for elements that have the properties of the given
object, else `false`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration. If a property name or an object is provided it is used to create a "_.property" or "_.matches" style callback respectively.
+2. `[iteratee=_.identity]` *(Array|Function|Object|string)*: The function invoked per iteration. If a property name or an object is provided it is used to create a `_.property` or `_.matches` style callback respectively.
3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
@@ -2798,7 +3077,7 @@ var users = [
{ 'user': 'barney' }
];
-// using the "_.property" callback shorthand
+// using the `_.property` callback shorthand
_.pluck(_.sortBy(users, 'user'), 'user');
// => ['barney', 'fred', 'pebbles']
```
@@ -2809,7 +3088,7 @@ _.pluck(_.sortBy(users, 'user'), 'user');
### `_.sortByAll(collection, props)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6562 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6852 "View in source") [Ⓣ][1]
This method is like `_.sortBy` except that it sorts by property names
instead of an iteratee function.
@@ -2840,11 +3119,17 @@ _.map(_.sortByAll(users, ['user', 'age']), _.values);
### `_.where(collection, source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6611 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6903 "View in source") [Ⓣ][1]
Performs a deep comparison between each element in `collection` and the
source object, returning an array of all elements that have equivalent
property values.
+
+
+**Note:** This method supports comparing arrays, booleans, `Date` objects,
+numbers, `Object` objects, regexes, and strings. Objects are compared by
+their own, not inherited, enumerable properties. For comparing a single
+own or inherited property value see `_.matchesProperty`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to search.
@@ -2856,18 +3141,15 @@ property values.
#### Example
```js
var users = [
- { 'user': 'barney', 'age': 36, 'status': 'busy', 'pets': ['hoppy'] },
- { 'user': 'fred', 'age': 40, 'status': 'busy', 'pets': ['baby puss', 'dino'] }
+ { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },
+ { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }
];
-_.pluck(_.where(users, { 'age': 36 }), 'user');
+_.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');
// => ['barney']
_.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
// => ['fred']
-
-_.pluck(_.where(users, { 'status': 'busy' }), 'user');
-// => ['barney', 'fred']
```
* * *
@@ -2882,7 +3164,7 @@ _.pluck(_.where(users, { 'status': 'busy' }), 'user');
### `_.now`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6629 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6921 "View in source") [Ⓣ][1]
Gets the number of milliseconds that have elapsed since the Unix epoch
(1 January 1970 00:00:00 UTC).
@@ -2905,7 +3187,7 @@ _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now());
### `_.after(n, func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6658 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6950 "View in source") [Ⓣ][1]
The opposite of `_.before`; this method creates a function that invokes
`func` once it is called `n` or more times.
@@ -2937,7 +3219,7 @@ _.forEach(saves, function(type) {
### `_.ary(func, [n=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6692 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L6984 "View in source") [Ⓣ][1]
Creates a function that accepts up to `n` arguments ignoring any
additional arguments.
@@ -2961,7 +3243,7 @@ _.map(['6', '8', '10'], _.ary(parseInt, 1));
### `_.before(n, func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6716 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7008 "View in source") [Ⓣ][1]
Creates a function that invokes `func`, with the `this` binding and arguments
of the created function, while it is called less than `n` times. Subsequent
@@ -2986,7 +3268,7 @@ jQuery('#add').on('click', _.before(5, addContactToList));
### `_.bind(func, thisArg, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6772 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7064 "View in source") [Ⓣ][1]
Creates a function that invokes `func` with the `this` binding of `thisArg`
and prepends any additional `_.bind` arguments to those provided to the
@@ -3032,7 +3314,7 @@ bound('hi');
### `_.bindAll(object, [methodNames])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6809 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7101 "View in source") [Ⓣ][1]
Binds methods of an object to the object itself, overwriting the existing
method. Method names may be specified as individual arguments or as arrays
@@ -3067,7 +3349,7 @@ jQuery('#docs').on('click', view.onClick);
### `_.bindKey(object, key, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6861 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7153 "View in source") [Ⓣ][1]
Creates a function that invokes the method at `object[key]` and prepends
any additional `_.bindKey` arguments to those provided to the bound function.
@@ -3122,7 +3404,7 @@ bound('hi');
### `_.curry(func, [arity=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6912 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7204 "View in source") [Ⓣ][1]
Creates a function that accepts one or more arguments of `func` that when
called either invokes `func` returning its result, if all `func` arguments
@@ -3172,7 +3454,7 @@ curried(1)(_, 3)(2);
### `_.curryRight(func, [arity=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L6958 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7250 "View in source") [Ⓣ][1]
This method is like `_.curry` except that arguments are applied to `func`
in the manner of `_.partialRight` instead of `_.partial`.
@@ -3219,7 +3501,7 @@ curried(3)(1, _)(2);
### `_.debounce(func, wait, [options])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7029 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7321 "View in source") [Ⓣ][1]
Creates a function that delays invoking `func` until after `wait` milliseconds
have elapsed since the last time it was invoked. The created function comes
@@ -3289,7 +3571,7 @@ delete models.todo;
### `_.defer(func, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7158 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7450 "View in source") [Ⓣ][1]
Defers invoking the `func` until the current call stack has cleared. Any
additional arguments are provided to `func` when it is invoked.
@@ -3313,7 +3595,7 @@ _.defer(function(text) { console.log(text); }, 'deferred');
### `_.delay(func, wait, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7178 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7470 "View in source") [Ⓣ][1]
Invokes `func` after `wait` milliseconds. Any additional arguments are
provided to `func` when it is invoked.
@@ -3338,7 +3620,7 @@ _.delay(function(text) { console.log(text); }, 1000, 'later');
### `_.flow([funcs])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7206 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7498 "View in source") [Ⓣ][1]
Creates a function that returns the result of invoking the provided
functions with the `this` binding of the created function, where each
@@ -3371,7 +3653,7 @@ addSquare(1, 2);
### `_.flowRight([funcs])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7251 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7543 "View in source") [Ⓣ][1]
This method is like `_.flow` except that it creates a function that
invokes the provided functions from right to left.
@@ -3403,7 +3685,7 @@ addSquare(1, 2);
### `_.memoize(func, [resolver])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7325 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7617 "View in source") [Ⓣ][1]
Creates a function that memoizes the result of `func`. If `resolver` is
provided it determines the cache key for storing the result based on the
@@ -3466,7 +3748,7 @@ identity(other);
### `_.negate(predicate)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7363 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7655 "View in source") [Ⓣ][1]
Creates a function that negates the result of the predicate `func`. The
`func` predicate is invoked with the `this` binding and arguments of the
@@ -3494,7 +3776,7 @@ _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
### `_.once(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7390 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7681 "View in source") [Ⓣ][1]
Creates a function that is restricted to invoking `func` once. Repeat calls
to the function return the value of the first call. The `func` is invoked
@@ -3520,7 +3802,7 @@ initialize();
### `_.partial(func, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7426 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7717 "View in source") [Ⓣ][1]
Creates a function that invokes `func` with `partial` arguments prepended
to those provided to the new function. This method is like `_.bind` except
@@ -3563,7 +3845,7 @@ greetFred('hi');
### `_.partialRight(func, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7464 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7755 "View in source") [Ⓣ][1]
This method is like `_.partial` except that partially applied arguments
are appended to those provided to the new function.
@@ -3605,7 +3887,7 @@ sayHelloTo('fred');
### `_.rearg(func, indexes)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7497 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7788 "View in source") [Ⓣ][1]
Creates a function that invokes `func` with arguments arranged according
to the specified indexes where the argument value at the first index is
@@ -3638,8 +3920,47 @@ map(function(n) { return n * 3; }, [1, 2, 3]);
+### `_.spread(func)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7823 "View in source") [Ⓣ][1]
+
+Creates a function that invokes `func` with the `this` binding of the
+created function and the array of arguments provided to the created
+function much like [Function#apply](http://es5.github.io/#x15.3.4.3).
+
+#### Arguments
+1. `func` *(Function)*: The function to spread arguments over.
+
+#### Returns
+*(*)*: Returns the new function.
+
+#### Example
+```js
+var spread = _.spread(function(who, what) {
+ return who + ' says ' + what;
+});
+
+spread(['Fred', 'hello']);
+// => 'Fred says hello'
+
+// with a Promise
+var numbers = Promise.all([
+ Promise.resolve(40),
+ Promise.resolve(36)
+]);
+
+numbers.then(_.spread(function(x, y) {
+ return x + y;
+}));
+// => a Promise of 76
+```
+* * *
+
+
+
+
+
### `_.throttle(func, wait, [options])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7540 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7870 "View in source") [Ⓣ][1]
Creates a function that only invokes `func` at most once per every `wait`
milliseconds. The created function comes with a `cancel` method to cancel
@@ -3686,7 +4007,7 @@ jQuery(window).on('popstate', throttled.cancel);
### `_.wrap(value, wrapper)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7580 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7910 "View in source") [Ⓣ][1]
Creates a function that provides `value` to the wrapper function as its
first argument. Any additional arguments provided to the function are
@@ -3722,7 +4043,7 @@ p('fred, barney, & pebbles');
### `_.clone(value, [isDeep], [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7636 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L7966 "View in source") [Ⓣ][1]
Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
otherwise they are assigned by reference. If `customizer` is provided it is
@@ -3781,7 +4102,7 @@ body.childNodes.length;
### `_.cloneDeep(value, [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7690 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L8020 "View in source") [Ⓣ][1]
Creates a deep clone of `value`. If `customizer` is provided it is invoked
to produce the cloned values. If `customizer` returns `undefined` cloning
@@ -3834,7 +4155,7 @@ body.childNodes.length;
### `_.isArguments(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7711 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L8041 "View in source") [Ⓣ][1]
Checks if `value` is classified as an `arguments` object.
@@ -3859,7 +4180,7 @@ _.isArguments([1, 2, 3]);
### `_.isArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7740 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L8070 "View in source") [Ⓣ][1]
Checks if `value` is classified as an `Array` object.
@@ -3884,7 +4205,7 @@ _.isArray([1, 2, 3]);
### `_.isBoolean(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7760 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L8090 "View in source") [Ⓣ][1]
Checks if `value` is classified as a boolean primitive or object.
@@ -3909,7 +4230,7 @@ _.isBoolean(null);
### `_.isDate(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7780 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L8110 "View in source") [Ⓣ][1]
Checks if `value` is classified as a `Date` object.
@@ -3934,7 +4255,7 @@ _.isDate('Mon April 23 2012');
### `_.isElement(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.1.0/lodash.src.js#L7800 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/3.2.0/lodash.src.js#L8130 "View in source") [Ⓣ][1]
Checks if `value` is a DOM element.
@@ -3959,7 +4280,7 @@ _.isElement('