e?c*("desc"==r[e]?-1:1):c;break n}}e=n.b-t.b}return e})}function wt(n,t){return n=Object(n),l(t,function(t,r){return r in n&&(t[r]=n[r]),
+t},{})}function At(n,t){var r={};return ot(n,function(n,e){t(n)&&(r[e]=n)}),r}function Ot(n){return function(t){return null==t?Z:t[n]}}function Et(n){return function(t){return at(t,n)}}function kt(n,t,r){var e=-1,u=t.length,o=n;for(r&&(o=c(n,function(n){return r(n)}));++et&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e=u){for(;u>e;){var o=e+u>>>1,i=n[o];(r?t>=i:t>i)&&null!==i?e=o+1:u=o}return u}return zt(n,t,Ne,r)}function zt(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!==t,f=null===t,c=t===Z;o>u;){var a=bu((u+o)/2),l=r(n[a]),s=l!==Z,h=l===l;(i?h||e:f?h&&s&&(e||null!=l):c?h&&(e||s):null==l?0:e?t>=l:t>l)?u=a+1:o=a}return Au(o,4294967294)}function Bt(n,t){for(var r=0,e=n.length,u=n[0],o=t?t(u):u,i=o,f=0,c=[u];++r
-
-If a property name is provided for `predicate` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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`.
+invoked with three arguments: (value, index, array).
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
-_.dropRightWhile([1, 2, 3], function(n) {
- return n > 1;
-});
-// => [1]
-
var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': false }
];
-// using the `_.matches` callback shorthand
-_.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
-// => ['barney', 'fred']
+_.dropRightWhile(users, function(o) { return !o.active; });
+// => objects for ['barney']
-// using the `_.matchesProperty` callback shorthand
-_.pluck(_.dropRightWhile(users, 'active', false), 'user');
-// => ['barney']
+// using the `_.matches` iteratee shorthand
+_.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
+// => objects for ['barney', 'fred']
-// using the `_.property` callback shorthand
-_.pluck(_.dropRightWhile(users, 'active'), 'user');
-// => ['barney', 'fred', 'pebbles']
+// using the `_.matchesProperty` iteratee shorthand
+_.dropRightWhile(users, ['active', false]);
+// => objects for ['barney']
+
+// using the `_.property` iteratee shorthand
+_.dropRightWhile(users, 'active');
+// => objects for ['barney', 'fred', 'pebbles']
```
* * *
@@ -535,59 +659,42 @@ _.pluck(_.dropRightWhile(users, 'active'), 'user');
-### `_.dropWhile(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L4867 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package")
+### `_.dropWhile(array, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5545 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropwhile "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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`.
+invoked with three arguments: (value, index, array).
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
-_.dropWhile([1, 2, 3], function(n) {
- return n < 3;
-});
-// => [3]
-
var users = [
{ 'user': 'barney', 'active': false },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': true }
];
-// using the `_.matches` callback shorthand
-_.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
-// => ['fred', 'pebbles']
+_.dropWhile(users, function(o) { return !o.active; });
+// => objects for ['pebbles']
-// using the `_.matchesProperty` callback shorthand
-_.pluck(_.dropWhile(users, 'active', false), 'user');
-// => ['pebbles']
+// using the `_.matches` iteratee shorthand
+_.dropWhile(users, { 'user': 'barney', 'active': false });
+// => objects for ['fred', 'pebbles']
-// using the `_.property` callback shorthand
-_.pluck(_.dropWhile(users, 'active'), 'user');
-// => ['barney', 'fred', 'pebbles']
+// using the `_.matchesProperty` iteratee shorthand
+_.dropWhile(users, ['active', false]);
+// => objects for ['pebbles']
+
+// using the `_.property` iteratee shorthand
+_.dropWhile(users, 'active');
+// => objects for ['barney', 'fred', 'pebbles']
```
* * *
@@ -596,7 +703,7 @@ _.pluck(_.dropWhile(users, 'active'), 'user');
### `_.fill(array, value, [start=0], [end=array.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L4901 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5579 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.fill "See the npm package")
Fills elements of `array` with `value` from `start` up to, but not
including, `end`.
@@ -624,8 +731,8 @@ console.log(array);
_.fill(Array(3), 2);
// => [2, 2, 2]
-_.fill([4, 6, 8], '*', 1, 2);
-// => [4, '*', 8]
+_.fill([4, 6, 8, 10], '*', 1, 3);
+// => [4, '*', '*', 10]
```
* * *
@@ -633,30 +740,15 @@ _.fill([4, 6, 8], '*', 1, 2);
-### `_.findIndex(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L4961 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package")
+### `_.findIndex(array, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5624 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findindex "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(number)*: Returns the index of the found element, else `-1`.
@@ -669,20 +761,18 @@ var users = [
{ 'user': 'pebbles', 'active': true }
];
-_.findIndex(users, function(chr) {
- return chr.user == 'barney';
-});
+_.findIndex(users, function(o) { return o.user == 'barney'; });
// => 0
-// using the `_.matches` callback shorthand
+// using the `_.matches` iteratee shorthand
_.findIndex(users, { 'user': 'fred', 'active': false });
// => 1
-// using the `_.matchesProperty` callback shorthand
-_.findIndex(users, 'active', false);
+// using the `_.matchesProperty` iteratee shorthand
+_.findIndex(users, ['active', false]);
// => 0
-// using the `_.property` callback shorthand
+// using the `_.property` iteratee shorthand
_.findIndex(users, 'active');
// => 2
```
@@ -692,30 +782,15 @@ _.findIndex(users, 'active');
-### `_.findLastIndex(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5011 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package")
+### `_.findLastIndex(array, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5663 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastindex "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(number)*: Returns the index of the found element, else `-1`.
@@ -728,20 +803,18 @@ var users = [
{ 'user': 'pebbles', 'active': false }
];
-_.findLastIndex(users, function(chr) {
- return chr.user == 'pebbles';
-});
+_.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
// => 2
-// using the `_.matches` callback shorthand
+// using the `_.matches` iteratee shorthand
_.findLastIndex(users, { 'user': 'barney', 'active': true });
// => 0
-// using the `_.matchesProperty` callback shorthand
-_.findLastIndex(users, 'active', false);
+// using the `_.matchesProperty` iteratee shorthand
+_.findLastIndex(users, ['active', false]);
// => 2
-// using the `_.property` callback shorthand
+// using the `_.property` iteratee shorthand
_.findLastIndex(users, 'active');
// => 0
```
@@ -751,27 +824,28 @@ _.findLastIndex(users, 'active');
-### `_.first(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5030 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.first "See the npm package")
+### `_.flatMap(array, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5689 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmap "See the npm package")
-Gets the first element of `array`.
-
-#### Aliases
-*_.head*
+Creates an array of flattened values by running each element in `array`
+through `iteratee` and concating its result to the other mapped values.
+The iteratee is invoked with three arguments: (value, index|key, array).
#### Arguments
-1. `array` *(Array)*: The array to query.
+1. `array` *(Array)*: The array to iterate over.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
-*(*)*: Returns the first element of `array`.
+*(Array)*: Returns the new array.
#### Example
```js
-_.first([1, 2, 3]);
-// => 1
+function duplicate(n) {
+ return [n, n];
+}
-_.first([]);
-// => undefined
+_.flatMap([1, 2], duplicate);
+// => [1, 1, 2, 2]
```
* * *
@@ -779,15 +853,13 @@ _.first([]);
-### `_.flatten(array, [isDeep])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5054 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package")
+### `_.flatten(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5707 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package")
-Flattens a nested array. If `isDeep` is `true` the array is recursively
-flattened, otherwise it's only flattened a single level.
+Flattens `array` a single level.
#### Arguments
1. `array` *(Array)*: The array to flatten.
-2. `[isDeep]` *(boolean)*: Specify a deep flatten.
#### Returns
*(Array)*: Returns the new flattened array.
@@ -796,10 +868,6 @@ flattened, otherwise it's only flattened a single level.
```js
_.flatten([1, [2, 3, [4]]]);
// => [1, 2, 3, [4]]
-
-// using `isDeep`
-_.flatten([1, [2, 3, [4]]], true);
-// => [1, 2, 3, 4]
```
* * *
@@ -808,9 +876,9 @@ _.flatten([1, [2, 3, [4]]], true);
### `_.flattenDeep(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5075 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5725 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package")
-Recursively flattens a nested array.
+This method is like `_.flatten` except that it recursively flattens `array`.
#### Arguments
1. `array` *(Array)*: The array to recursively flatten.
@@ -829,8 +897,59 @@ _.flattenDeep([1, [2, 3, [4]]]);
+### `_.fromPairs(pairs)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5744 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.frompairs "See the npm package")
+
+The inverse of `_.toPairs`; this method returns an object composed
+from key-value `pairs`.
+
+#### Arguments
+1. `pairs` *(Array)*: The key-value pairs.
+
+#### Returns
+*(Object)*: Returns the new object.
+
+#### Example
+```js
+_.fromPairs([['fred', 30], ['barney', 40]]);
+// => { 'fred': 30, 'barney': 40 }
+```
+* * *
+
+
+
+
+
+### `_.head(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5773 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.head "See the npm package")
+
+Gets the first element of `array`.
+
+#### Aliases
+*_.first*
+
+#### Arguments
+1. `array` *(Array)*: The array to query.
+
+#### Returns
+*(*)*: Returns the first element of `array`.
+
+#### Example
+```js
+_.head([1, 2, 3]);
+// => 1
+
+_.head([]);
+// => undefined
+```
+* * *
+
+
+
+
+
### `_.indexOf(array, value, [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5108 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5800 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexof "See the npm package")
Gets the index at which the first occurrence of `value` is found in `array`
using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -841,7 +960,7 @@ performs a faster binary search.
#### Arguments
1. `array` *(Array)*: The array to search.
2. `value` *(*)*: The value to search for.
-3. `[fromIndex=0]` *(boolean|number)*: The index to search from or `true` to perform a binary search on a sorted array.
+3. `[fromIndex=0]` *(number)*: The index to search from.
#### Returns
*(number)*: Returns the index of the matched value, else `-1`.
@@ -854,10 +973,6 @@ _.indexOf([1, 2, 1, 2], 2);
// using `fromIndex`
_.indexOf([1, 2, 1, 2], 2, 2);
// => 3
-
-// performing a binary search
-_.indexOf([1, 1, 2, 2], 2, true);
-// => 2
```
* * *
@@ -866,7 +981,7 @@ _.indexOf([1, 1, 2, 2], 2, true);
### `_.initial(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5139 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5825 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package")
Gets all but the last element of `array`.
@@ -888,7 +1003,7 @@ _.initial([1, 2, 3]);
### `_.intersection([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5157 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5843 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersection "See the npm package")
Creates an array of unique values that are included in all of the provided
arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -902,7 +1017,7 @@ for equality comparisons.
#### Example
```js
-_.intersection([1, 2], [4, 2], [2, 1]);
+_.intersection([2, 1], [4, 2], [1, 2]);
// => [2]
```
* * *
@@ -911,8 +1026,88 @@ _.intersection([1, 2], [4, 2], [2, 1]);
+### `_.intersectionBy([arrays], [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5870 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionby "See the npm package")
+
+This method is like `_.intersection` except that it accepts `iteratee`
+which is invoked for each element of each `arrays` to generate the criterion
+by which uniqueness is computed. The iteratee is invoked with one argument: (value).
+
+#### Arguments
+1. `[arrays]` *(...Array)*: The arrays to inspect.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(Array)*: Returns the new array of shared values.
+
+#### Example
+```js
+_.intersectionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
+// => [2.1]
+
+// using the `_.property` iteratee shorthand
+_.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+// => [{ 'x': 1 }]
+```
+* * *
+
+
+
+
+
+### `_.intersectionWith([arrays], [comparator])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5903 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.intersectionwith "See the npm package")
+
+This method is like `_.intersection` except that it accepts `comparator`
+which is invoked to compare elements of `arrays`. The comparator is invoked
+with two arguments: (arrVal, othVal).
+
+#### Arguments
+1. `[arrays]` *(...Array)*: The arrays to inspect.
+2. `[comparator]` *(Function)*: The comparator invoked per element.
+
+#### Returns
+*(Array)*: Returns the new array of shared values.
+
+#### Example
+```js
+var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+
+_.intersectionWith(objects, others, _.isEqual);
+// => [{ 'x': 1, 'y': 2 }]
+```
+* * *
+
+
+
+
+
+### `_.join(array, [separator=','])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5931 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.join "See the npm package")
+
+Converts all elements in `array` into a string separated by `separator`.
+
+#### Arguments
+1. `array` *(Array)*: The array to convert.
+2. `[separator=',']` *(string)*: The element separator.
+
+#### Returns
+*(string)*: Returns the joined string.
+
+#### Example
+```js
+_.join(['a', 'b', 'c'], '~');
+// => 'a~b~c'
+```
+* * *
+
+
+
+
+
### `_.last(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5207 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5948 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package")
Gets the last element of `array`.
@@ -934,7 +1129,7 @@ _.last([1, 2, 3]);
### `_.lastIndexOf(array, value, [fromIndex=array.length-1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5237 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L5973 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lastindexof "See the npm package")
This method is like `_.indexOf` except that it iterates over elements of
`array` from right to left.
@@ -942,7 +1137,7 @@ This method is like `_.indexOf` except that it iterates over elements of
#### Arguments
1. `array` *(Array)*: The array to search.
2. `value` *(*)*: The value to search for.
-3. `[fromIndex=array.length-1]` *(boolean|number)*: The index to search from or `true` to perform a binary search on a sorted array.
+3. `[fromIndex=array.length-1]` *(number)*: The index to search from.
#### Returns
*(number)*: Returns the index of the matched value, else `-1`.
@@ -955,10 +1150,6 @@ _.lastIndexOf([1, 2, 1, 2], 2);
// using `fromIndex`
_.lastIndexOf([1, 2, 1, 2], 2, 2);
// => 1
-
-// performing a binary search
-_.lastIndexOf([1, 1, 2, 2], 2, true);
-// => 3
```
* * *
@@ -967,7 +1158,7 @@ _.lastIndexOf([1, 1, 2, 2], 2, true);
### `_.pull(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5285 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6015 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pull "See the npm package")
Removes all provided values from `array` using
[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -997,19 +1188,79 @@ console.log(array);
-### `_.pullAt(array, [indexes])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5332 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package")
+### `_.pullAll(array, values)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6036 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullall "See the npm package")
-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
-indexes or as individual arguments.
+This method is like `_.pull` except that it accepts an array of values to remove.
+
+
+**Note:** Unlike `_.difference`, this method mutates `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to modify.
+2. `values` *(Array)*: The values to remove.
+
+#### Returns
+*(Array)*: Returns `array`.
+
+#### Example
+```js
+var array = [1, 2, 3, 1, 2, 3];
+
+_.pull(array, [2, 3]);
+console.log(array);
+// => [1, 1]
+```
+* * *
+
+
+
+
+
+### `_.pullAllBy(array, values, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6064 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullallby "See the npm package")
+
+This method is like `_.pullAll` except that it accepts `iteratee` which is
+invoked for each element of `array` and `values` to to generate the criterion
+by which uniqueness is computed. The iteratee is invoked with one argument: (value).
+
+
+**Note:** Unlike `_.differenceBy`, this method mutates `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to modify.
+2. `values` *(Array)*: The values to remove.
+3. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(Array)*: Returns `array`.
+
+#### Example
+```js
+var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
+
+_.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
+console.log(array);
+// => [{ 'x': 2 }]
+```
+* * *
+
+
+
+
+
+### `_.pullAt(array, [indexes])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6094 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullat "See the npm package")
+
+Removes elements from `array` corresponding to `indexes` and returns an
+array of removed elements.
**Note:** Unlike `_.at`, this method mutates `array`.
#### Arguments
1. `array` *(Array)*: The array to modify.
-2. `[indexes]` *(...(number|number[])*: The indexes of elements to remove, specified as individual indexes or arrays of indexes.
+2. `[indexes]` *(...(number|number[])*: The indexes of elements to remove, specified individually or in arrays.
#### Returns
*(Array)*: Returns the new array of removed elements.
@@ -1031,26 +1282,12 @@ console.log(evens);
-### `_.remove(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5379 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package")
+### `_.remove(array, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6128 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.remove "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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`.
+and returns an array of the removed elements. The predicate is invoked with
+three arguments: (value, index, array).
**Note:** Unlike `_.filter`, this method mutates `array`.
@@ -1058,7 +1295,6 @@ object, else `false`.
#### Arguments
1. `array` *(Array)*: The array to modify.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the new array of removed elements.
@@ -1082,39 +1318,14 @@ console.log(evens);
-### `_.rest(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5414 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package")
-
-Gets all but the first element of `array`.
-
-#### Aliases
-*_.tail*
-
-#### Arguments
-1. `array` *(Array)*: The array to query.
-
-#### Returns
-*(Array)*: Returns the slice of `array`.
-
-#### Example
-```js
-_.rest([1, 2, 3]);
-// => [2, 3]
-```
-* * *
-
-
-
-
-
### `_.slice(array, [start=0], [end=array.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5432 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6187 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.slice "See the npm package")
Creates a slice of `array` from `start` up to, but not including, `end`.
-**Note:** This method is used instead of `Array#slice` to support node
-lists in IE < 9 and to ensure dense arrays are returned.
+**Note:** This method is used instead of [`Array#slice`](https://mdn.io/Array/slice)
+to ensure dense arrays are returned.
#### Arguments
1. `array` *(Array)*: The array to slice.
@@ -1130,58 +1341,26 @@ lists in IE < 9 and to ensure dense arrays are returned.
-### `_.sortedIndex(array, value, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5492 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package")
+### `_.sortedIndex(array, value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6221 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindex "See the npm package")
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
-function is provided it's invoked for `value` and each element of `array`
-to compute their sort ranking. The iteratee is bound to `thisArg` and
-invoked with one argument; (value).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+be inserted into `array` in order to 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.
-4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
-*(number)*: Returns the index at which `value` should be inserted
-into `array`.
+*(number)*: Returns the index at which `value` should be inserted into `array`.
#### Example
```js
_.sortedIndex([30, 50], 40);
// => 1
-_.sortedIndex([4, 4, 5, 5], 5);
-// => 2
-
-var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
-
-// using an iteratee function
-_.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {
- return this.data[word];
-}, dict);
-// => 1
-
-// using the `_.property` callback shorthand
-_.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
-// => 1
+_.sortedIndex([4, 5], 4);
+// => 0
```
* * *
@@ -1189,8 +1368,64 @@ _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
-### `_.sortedLastIndex(array, value, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5514 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package")
+### `_.sortedIndexBy(array, value, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6248 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexby "See the npm package")
+
+This method is like `_.sortedIndex` except that it accepts `iteratee`
+which is invoked for `value` and each element of `array` to compute their
+sort ranking. The iteratee is invoked with one argument: (value).
+
+#### Arguments
+1. `array` *(Array)*: The sorted array to inspect.
+2. `value` *(*)*: The value to evaluate.
+3. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(number)*: Returns the index at which `value` should be inserted into `array`.
+
+#### Example
+```js
+var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
+
+_.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));
+// => 1
+
+// using the `_.property` iteratee shorthand
+_.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
+// => 0
+```
+* * *
+
+
+
+
+
+### `_.sortedIndexOf(array, value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6267 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedindexof "See the npm package")
+
+This method is like `_.indexOf` except that it performs a binary
+search on a sorted `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to search.
+2. `value` *(*)*: The value to search for.
+
+#### Returns
+*(number)*: Returns the index of the matched value, else `-1`.
+
+#### Example
+```js
+_.sortedIndexOf([1, 1, 2, 2], 2);
+// => 2
+```
+* * *
+
+
+
+
+
+### `_.sortedLastIndex(array, value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6294 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindex "See the npm package")
This method is like `_.sortedIndex` except that it returns the highest
index at which `value` should be inserted into `array` in order to
@@ -1199,17 +1434,134 @@ 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.
-4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
-*(number)*: Returns the index at which `value` should be inserted
-into `array`.
+*(number)*: Returns the index at which `value` should be inserted into `array`.
#### Example
```js
-_.sortedLastIndex([4, 4, 5, 5], 5);
-// => 4
+_.sortedLastIndex([4, 5], 4);
+// => 1
+```
+* * *
+
+
+
+
+
+### `_.sortedLastIndexBy(array, value, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6316 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexby "See the npm package")
+
+This method is like `_.sortedLastIndex` except that it accepts `iteratee`
+which is invoked for `value` and each element of `array` to compute their
+sort ranking. The iteratee is invoked with one argument: (value).
+
+#### Arguments
+1. `array` *(Array)*: The sorted array to inspect.
+2. `value` *(*)*: The value to evaluate.
+3. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(number)*: Returns the index at which `value` should be inserted into `array`.
+
+#### Example
+```js
+// using the `_.property` iteratee shorthand
+_.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
+// => 1
+```
+* * *
+
+
+
+
+
+### `_.sortedLastIndexOf(array, value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6335 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortedlastindexof "See the npm package")
+
+This method is like `_.lastIndexOf` except that it performs a binary
+search on a sorted `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to search.
+2. `value` *(*)*: The value to search for.
+
+#### Returns
+*(number)*: Returns the index of the matched value, else `-1`.
+
+#### Example
+```js
+_.sortedLastIndexOf([1, 1, 2, 2], 2);
+// => 3
+```
+* * *
+
+
+
+
+
+### `_.sortedUniq(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6360 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniq "See the npm package")
+
+This method is like `_.uniq` except that it's designed and optimized
+for sorted arrays.
+
+#### Arguments
+1. `array` *(Array)*: The array to inspect.
+
+#### Returns
+*(Array)*: Returns the new duplicate free array.
+
+#### Example
+```js
+_.sortedUniq([1, 1, 2]);
+// => [1, 2]
+```
+* * *
+
+
+
+
+
+### `_.sortedUniqBy(array, [iteratee])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6381 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sorteduniqby "See the npm package")
+
+This method is like `_.uniqBy` except that it's designed and optimized
+for sorted arrays.
+
+#### Arguments
+1. `array` *(Array)*: The array to inspect.
+2. `[iteratee]` *(Function)*: The iteratee invoked per element.
+
+#### Returns
+*(Array)*: Returns the new duplicate free array.
+
+#### Example
+```js
+_.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
+// => [1.1, 2.2]
+```
+* * *
+
+
+
+
+
+### `_.tail(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6400 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tail "See the npm package")
+
+Gets all but the first element of `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to query.
+
+#### Returns
+*(Array)*: Returns the slice of `array`.
+
+#### Example
+```js
+_.tail([1, 2, 3]);
+// => [2, 3]
```
* * *
@@ -1218,7 +1570,7 @@ _.sortedLastIndex([4, 4, 5, 5], 5);
### `_.take(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5540 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6428 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.take "See the npm package")
Creates a slice of `array` with `n` elements taken from the beginning.
@@ -1250,7 +1602,7 @@ _.take([1, 2, 3], 0);
### `_.takeRight(array, [n=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5575 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6460 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takeright "See the npm package")
Creates a slice of `array` with `n` elements taken from the end.
@@ -1281,58 +1633,41 @@ _.takeRight([1, 2, 3], 0);
-### `_.takeRightWhile(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5636 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package")
+### `_.takeRightWhile(array, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6504 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takerightwhile "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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`.
+taken until `predicate` returns falsey. The predicate is invoked with three
+arguments: (value, index, array).
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
-_.takeRightWhile([1, 2, 3], function(n) {
- return n > 1;
-});
-// => [2, 3]
-
var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': false }
];
-// using the `_.matches` callback shorthand
-_.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
-// => ['pebbles']
+_.takeRightWhile(users, function(o) { return !o.active; });
+// => objects for ['fred', 'pebbles']
-// using the `_.matchesProperty` callback shorthand
-_.pluck(_.takeRightWhile(users, 'active', false), 'user');
-// => ['fred', 'pebbles']
+// using the `_.matches` iteratee shorthand
+_.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
+// => objects for ['pebbles']
-// using the `_.property` callback shorthand
-_.pluck(_.takeRightWhile(users, 'active'), 'user');
+// using the `_.matchesProperty` iteratee shorthand
+_.takeRightWhile(users, ['active', false]);
+// => objects for ['fred', 'pebbles']
+
+// using the `_.property` iteratee shorthand
+_.takeRightWhile(users, 'active');
// => []
```
* * *
@@ -1341,58 +1676,41 @@ _.pluck(_.takeRightWhile(users, 'active'), 'user');
-### `_.takeWhile(array, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5691 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package")
+### `_.takeWhile(array, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6544 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.takewhile "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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`.
+are taken until `predicate` returns falsey. The predicate is invoked with
+three arguments: (value, index, array).
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
-_.takeWhile([1, 2, 3], function(n) {
- return n < 3;
-});
-// => [1, 2]
-
var users = [
{ 'user': 'barney', 'active': false },
{ 'user': 'fred', 'active': false},
{ 'user': 'pebbles', 'active': true }
];
-// using the `_.matches` callback shorthand
-_.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
-// => ['barney']
+_.takeWhile(users, function(o) { return !o.active; });
+// => objects for ['barney', 'fred']
-// using the `_.matchesProperty` callback shorthand
-_.pluck(_.takeWhile(users, 'active', false), 'user');
-// => ['barney', 'fred']
+// using the `_.matches` iteratee shorthand
+_.takeWhile(users, { 'user': 'barney', 'active': false });
+// => objects for ['barney']
-// using the `_.property` callback shorthand
-_.pluck(_.takeWhile(users, 'active'), 'user');
+// using the `_.matchesProperty` iteratee shorthand
+_.takeWhile(users, ['active', false]);
+// => objects for ['barney', 'fred']
+
+// using the `_.property` iteratee shorthand
+_.takeWhile(users, 'active');
// => []
```
* * *
@@ -1402,7 +1720,7 @@ _.pluck(_.takeWhile(users, 'active'), 'user');
### `_.union([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5712 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6565 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.union "See the npm package")
Creates an array of unique values, in order, from all of the provided arrays
using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -1416,8 +1734,8 @@ for equality comparisons.
#### Example
```js
-_.union([1, 2], [4, 2], [2, 1]);
-// => [1, 2, 4]
+_.union([2, 1], [4, 2], [1, 2]);
+// => [2, 1, 4]
```
* * *
@@ -1425,61 +1743,27 @@ _.union([1, 2], [4, 2], [2, 1]);
-### `_.uniq(array, [isSorted], [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5765 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package")
+### `_.unionBy([arrays], [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6589 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionby "See the npm package")
-Creates a duplicate-free version of an array, using
-[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
-for equality comparisons, in which only the first occurence of each element
-is kept. Providing `true` for `isSorted` performs a faster search algorithm
-for sorted arrays. If an iteratee function is provided it's invoked for
-each element in the array to generate the criterion by which uniqueness
-is computed. The `iteratee` is bound to `thisArg` and invoked with three
-arguments: (value, index, array).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
-
-#### Aliases
-*_.unique*
+This method is like `_.union` except that it accepts `iteratee` which is
+invoked for each element of each `arrays` to generate the criterion by which
+uniqueness is computed. The iteratee is invoked with one argument: (value).
#### 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.
-4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+1. `[arrays]` *(...Array)*: The arrays to inspect.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
#### Returns
-*(Array)*: Returns the new duplicate-value-free array.
+*(Array)*: Returns the new array of combined values.
#### Example
```js
-_.uniq([2, 1, 2]);
-// => [2, 1]
+_.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
+// => [2.1, 1.2, 4.3]
-// using `isSorted`
-_.uniq([1, 1, 2], true);
-// => [1, 2]
-
-// using an iteratee function
-_.uniq([1, 2.5, 1.5, 2], function(n) {
- return this.floor(n);
-}, Math);
-// => [1, 2.5]
-
-// using the `_.property` callback shorthand
-_.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+// using the `_.property` iteratee shorthand
+_.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }, { 'x': 2 }]
```
* * *
@@ -1488,8 +1772,117 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+### `_.unionWith([arrays], [comparator])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6616 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionwith "See the npm package")
+
+This method is like `_.union` except that it accepts `comparator` which
+is invoked to compare elements of `arrays`. The comparator is invoked
+with two arguments: (arrVal, othVal).
+
+#### Arguments
+1. `[arrays]` *(...Array)*: The arrays to inspect.
+2. `[comparator]` *(Function)*: The comparator invoked per element.
+
+#### Returns
+*(Array)*: Returns the new array of combined values.
+
+#### Example
+```js
+var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+
+_.unionWith(objects, others, _.isEqual);
+// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
+```
+* * *
+
+
+
+
+
+### `_.uniq(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6640 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniq "See the npm package")
+
+Creates a duplicate-free version of an array, using
+[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+for equality comparisons, in which only the first occurrence of each element
+is kept.
+
+#### Arguments
+1. `array` *(Array)*: The array to inspect.
+
+#### Returns
+*(Array)*: Returns the new duplicate free array.
+
+#### Example
+```js
+_.uniq([2, 1, 2]);
+// => [2, 1]
+```
+* * *
+
+
+
+
+
+### `_.uniqBy(array, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6666 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqby "See the npm package")
+
+This method is like `_.uniq` except that it accepts `iteratee` which is
+invoked for each element in `array` to generate the criterion by which
+uniqueness is computed. The iteratee is invoked with one argument: (value).
+
+#### Arguments
+1. `array` *(Array)*: The array to inspect.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(Array)*: Returns the new duplicate free array.
+
+#### Example
+```js
+_.uniqBy([2.1, 1.2, 2.3], Math.floor);
+// => [2.1, 1.2]
+
+// using the `_.property` iteratee shorthand
+_.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+// => [{ 'x': 1 }, { 'x': 2 }]
+```
+* * *
+
+
+
+
+
+### `_.uniqWith(array, [comparator])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6690 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqwith "See the npm package")
+
+This method is like `_.uniq` except that it accepts `comparator` which
+is invoked to compare elements of `array`. The comparator is invoked with
+two arguments: (arrVal, othVal).
+
+#### Arguments
+1. `array` *(Array)*: The array to inspect.
+2. `[comparator]` *(Function)*: The comparator invoked per element.
+
+#### Returns
+*(Array)*: Returns the new duplicate free array.
+
+#### Example
+```js
+var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
+
+_.uniqWith(objects, _.isEqual);
+// => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
+```
+* * *
+
+
+
+
+
### `_.unzip(array)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5802 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6714 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzip "See the npm package")
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
@@ -1515,17 +1908,16 @@ _.unzip(zipped);
-### `_.unzipWith(array, [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5842 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package")
+### `_.unzipWith(array, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6749 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package")
-This method is like `_.unzip` except that it accepts an iteratee to specify
-how regrouped values should be combined. The `iteratee` is bound to `thisArg`
-and invoked with four arguments: (accumulator, value, index, group).
+This method is like `_.unzip` except that it accepts `iteratee` to specify
+how regrouped values should be combined. The iteratee is invoked with the
+elements of each group: (...group).
#### Arguments
1. `array` *(Array)*: The array of grouped elements to process.
-2. `[iteratee]` *(Function)*: The function to combine regrouped values.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+2. `[iteratee=_.identity]` *(Function)*: The function to combine regrouped values.
#### Returns
*(Array)*: Returns the new array of regrouped elements.
@@ -1545,7 +1937,7 @@ _.unzipWith(zipped, _.add);
### `_.without(array, [values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5873 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6778 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.without "See the npm package")
Creates an array excluding all provided values using
[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
@@ -1570,7 +1962,7 @@ _.without([1, 2, 1, 3], 1, 2);
### `_.xor([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5893 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6798 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xor "See the npm package")
Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
of the provided arrays.
@@ -1583,7 +1975,7 @@ of the provided arrays.
#### Example
```js
-_.xor([1, 2], [4, 2]);
+_.xor([2, 1], [4, 2]);
// => [1, 4]
```
* * *
@@ -1592,8 +1984,65 @@ _.xor([1, 2], [4, 2]);
+### `_.xorBy([arrays], [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6822 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorby "See the npm package")
+
+This method is like `_.xor` except that it accepts `iteratee` which is
+invoked for each element of each `arrays` to generate the criterion by which
+uniqueness is computed. The iteratee is invoked with one argument: (value).
+
+#### Arguments
+1. `[arrays]` *(...Array)*: The arrays to inspect.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(Array)*: Returns the new array of values.
+
+#### Example
+```js
+_.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
+// => [1.2, 4.3]
+
+// using the `_.property` iteratee shorthand
+_.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
+// => [{ 'x': 2 }]
+```
+* * *
+
+
+
+
+
+### `_.xorWith([arrays], [comparator])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6849 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.xorwith "See the npm package")
+
+This method is like `_.xor` except that it accepts `comparator` which is
+invoked to compare elements of `arrays`. The comparator is invoked with
+two arguments: (arrVal, othVal).
+
+#### Arguments
+1. `[arrays]` *(...Array)*: The arrays to inspect.
+2. `[comparator]` *(Function)*: The comparator invoked per element.
+
+#### Returns
+*(Array)*: Returns the new array of values.
+
+#### Example
+```js
+var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
+var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
+
+_.xorWith(objects, others, _.isEqual);
+// => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
+```
+* * *
+
+
+
+
+
### `_.zip([arrays])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5923 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6872 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zip "See the npm package")
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
@@ -1616,19 +2065,14 @@ _.zip(['fred', 'barney'], [30, 40], [true, false]);
-### `_.zipObject(props, [values=[]])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5946 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package")
+### `_.zipObject([props=[]], [values=[]])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6889 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package")
-The inverse of `_.pairs`; this method returns an object composed from arrays
-of property names and values. Provide either a single two dimensional array,
-e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names
-and one of corresponding values.
-
-#### Aliases
-*_.object*
+This method is like `_.fromPairs` except that it accepts two arrays,
+one of property names and one of corresponding values.
#### Arguments
-1. `props` *(Array)*: The property names.
+1. `[props=[]]` *(Array)*: The property names.
2. `[values=[]]` *(Array)*: The property values.
#### Returns
@@ -1636,9 +2080,6 @@ and one of corresponding values.
#### Example
```js
-_.zipObject([['fred', 30], ['barney', 40]]);
-// => { 'fred': 30, 'barney': 40 }
-
_.zipObject(['fred', 'barney'], [30, 40]);
// => { 'fred': 30, 'barney': 40 }
```
@@ -1648,389 +2089,51 @@ _.zipObject(['fred', 'barney'], [30, 40]);
-### `_.zipWith([arrays], [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L5982 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package")
+### `_.zipWith([arrays], [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6919 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package")
-This method is like `_.zip` except that it accepts an iteratee to specify
-how grouped values should be combined. The `iteratee` is bound to `thisArg`
-and invoked with four arguments: (accumulator, value, index, group).
+This method is like `_.zip` except that it accepts `iteratee` to specify
+how grouped values should be combined. The iteratee is invoked with the
+elements of each group: (...group).
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to process.
-2. `[iteratee]` *(Function)*: The function to combine grouped values.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+2. `[iteratee=_.identity]` *(Function)*: The function to combine grouped values.
#### Returns
*(Array)*: Returns the new array of grouped elements.
#### Example
```js
-_.zipWith([1, 2], [10, 20], [100, 200], _.add);
+_.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
+ return a + b + c;
+});
// => [111, 222]
```
* * *
-
-
-
-
-## `“Chain” Methods`
-
-
-
-### `_(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L944 "View in source") [Ⓣ][1]
-
-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 retrieve a single value or may return a
-primitive value will automatically end the chain returning the unwrapped
-value. Explicit chaining may be enabled using `_.chain`. The execution of
-chained methods is lazy, that is, execution is deferred until `_#value`
-is implicitly or explicitly called.
-
-
-Lazy evaluation allows several methods to support shortcut fusion. Shortcut
-fusion is an optimization strategy which merge iteratee calls; this can help
-to avoid the creation of intermediate data structures and greatly reduce the
-number of iteratee executions.
-
-
-Chaining is supported in custom builds as long as the `_#value` method is
-directly or indirectly included in the build.
-
-
-In addition to lodash methods, wrappers have `Array` and `String` methods.
-
-
-The wrapper `Array` methods are:
-`concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
-`splice`, and `unshift`
-
-
-The wrapper `String` methods are:
-`replace` and `split`
-
-
-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 methods are:
-`after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
-`callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
-`countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
-`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`, `mapKeys`, `mapValues`, `matches`,
-`matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,
-`modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
-`partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
-`pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,
-`reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,
-`sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
-`takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,
-`transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,
-`valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
-
-
-The wrapper methods that are **not** chainable by default are:
-`add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
-`deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,
-`findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,
-`floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,
-`inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
-`isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,
-`isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,
-`isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
-`last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,
-`now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,
-`reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,
-`snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,
-`startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,
-`unescape`, `uniqueId`, `value`, and `words`
-
-
-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 the new `lodash` wrapper instance.
-
-#### Example
-```js
-var wrapped = _([1, 2, 3]);
-
-// returns an unwrapped value
-wrapped.reduce(function(total, n) {
- return total + n;
-});
-// => 6
-
-// returns a wrapped value
-var squares = wrapped.map(function(n) {
- return n * n;
-});
-
-_.isArray(squares);
-// => false
-
-_.isArray(squares.value());
-// => true
-```
-* * *
-
-
-
-
-
-### `_.chain(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6025 "View in source") [Ⓣ][1]
-
-Creates a `lodash` object that wraps `value` with explicit method
-chaining enabled.
-
-#### Arguments
-1. `value` *(*)*: The value to wrap.
-
-#### Returns
-*(Object)*: Returns the new `lodash` wrapper instance.
-
-#### Example
-```js
-var users = [
- { 'user': 'barney', 'age': 36 },
- { 'user': 'fred', 'age': 40 },
- { 'user': 'pebbles', 'age': 1 }
-];
-
-var youngest = _.chain(users)
- .sortBy('age')
- .map(function(chr) {
- return chr.user + ' is ' + chr.age;
- })
- .first()
- .value();
-// => 'pebbles is 1'
-```
-* * *
-
-
-
-
-
-### `_.tap(value, interceptor, [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6054 "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
-this method is to "tap into" a method chain in order to perform operations
-on intermediate results within the chain.
-
-#### Arguments
-1. `value` *(*)*: The value to provide to `interceptor`.
-2. `interceptor` *(Function)*: The function to invoke.
-3. `[thisArg]` *(*)*: The `this` binding of `interceptor`.
-
-#### Returns
-*(*)*: Returns `value`.
-
-#### Example
-```js
-_([1, 2, 3])
- .tap(function(array) {
- array.pop();
- })
- .reverse()
- .value();
-// => [2, 1]
-```
-* * *
-
-
-
-
-
-### `_.thru(value, interceptor, [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6080 "View in source") [Ⓣ][1]
-
-This method is like `_.tap` except that it returns the result of `interceptor`.
-
-#### Arguments
-1. `value` *(*)*: The value to provide to `interceptor`.
-2. `interceptor` *(Function)*: The function to invoke.
-3. `[thisArg]` *(*)*: The `this` binding of `interceptor`.
-
-#### Returns
-*(*)*: Returns the result of `interceptor`.
-
-#### Example
-```js
-_(' abc ')
- .chain()
- .trim()
- .thru(function(value) {
- return [value];
- })
- .value();
-// => ['abc']
-```
-* * *
-
-
-
-
-
-### `_.prototype.chain()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6109 "View in source") [Ⓣ][1]
-
-Enables explicit method chaining on the wrapper object.
-
-#### Returns
-*(Object)*: Returns the new `lodash` wrapper instance.
-
-#### Example
-```js
-var users = [
- { 'user': 'barney', 'age': 36 },
- { 'user': 'fred', 'age': 40 }
-];
-
-// without explicit chaining
-_(users).first();
-// => { 'user': 'barney', 'age': 36 }
-
-// with explicit chaining
-_(users).chain()
- .first()
- .pick('user')
- .value();
-// => { 'user': 'barney' }
-```
-* * *
-
-
-
-
-
-### `_.prototype.commit()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6138 "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 wrapped = _(array).push(3);
-
-console.log(array);
-// => [1, 2]
-
-wrapped = wrapped.commit();
-console.log(array);
-// => [1, 2, 3]
-
-wrapped.last();
-// => 3
-
-console.log(array);
-// => [1, 2, 3]
-```
-* * *
-
-
-
-
-
-### `_.prototype.concat([values])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6162 "View in source") [Ⓣ][1]
-
-Creates a new array joining a wrapped array with any additional arrays
-and/or values.
-
-#### Arguments
-1. `[values]` *(...*)*: The values to concatenate.
-
-#### Returns
-*(Array)*: Returns the new concatenated array.
-
-#### Example
-```js
-var array = [1];
-var wrapped = _(array).concat(2, [3], [[4]]);
-
-console.log(wrapped.value());
-// => [1, 2, 3, [4]]
-
-console.log(array);
-// => [1]
-```
-* * *
-
-
-
-
-
-### `_.prototype.plant()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6192 "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 wrapped = _(array).map(function(value) {
- return Math.pow(value, 2);
-});
-
-var other = [3, 4];
-var otherWrapped = wrapped.plant(other);
-
-otherWrapped.value();
-// => [9, 16]
-
-wrapped.value();
-// => [1, 4]
-```
-* * *
-
-
-
### `_.prototype.reverse()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6230 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6169 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reverse "See the npm package")
-Reverses the wrapped array so the first element becomes the last, the
-second element becomes the second to last, and so on.
+Reverses `array` so that the first element becomes the last, the second
+element becomes the second to last, and so on.
-**Note:** This method mutates the wrapped array.
+**Note:** This method mutates `array` and is based on
+[`Array#reverse`](https://mdn.io/Array/reverse).
#### Returns
-*(Object)*: Returns the new reversed `lodash` wrapper instance.
+*(Array)*: Returns `array`.
#### Example
```js
var array = [1, 2, 3];
-_(array).reverse().value()
+_.reverse(array);
// => [3, 2, 1]
console.log(array);
@@ -2040,47 +2143,6 @@ console.log(array);
-
-
-### `_.prototype.toString()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6260 "View in source") [Ⓣ][1]
-
-Produces the result of coercing the unwrapped value to a string.
-
-#### Returns
-*(string)*: Returns the coerced string value.
-
-#### Example
-```js
-_([1, 2, 3]).toString();
-// => '1,2,3'
-```
-* * *
-
-
-
-
-
-### `_.prototype.value()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6277 "View in source") [Ⓣ][1]
-
-Executes the chained sequence to extract the unwrapped value.
-
-#### Aliases
-*_.prototype.run, _.prototype.toJSON, _.prototype.valueOf*
-
-#### Returns
-*(*)*: Returns the resolved unwrapped value.
-
-#### Example
-```js
-_([1, 2, 3]).value();
-// => [1, 2, 3]
-```
-* * *
-
-
-
@@ -2089,75 +2151,24 @@ _([1, 2, 3]).value();
-### `_.at(collection, [props])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6303 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package")
-
-Creates an array of elements corresponding to the given keys, or indexes,
-of `collection`. Keys may be specified as individual arguments or as arrays
-of keys.
-
-#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[props]` *(...(number|number[]|string|string[])*: The property names or indexes of elements to pick, specified individually or in arrays.
-
-#### Returns
-*(Array)*: Returns the new array of picked elements.
-
-#### Example
-```js
-_.at(['a', 'b', 'c'], [0, 2]);
-// => ['a', 'c']
-
-_.at(['barney', 'fred', 'pebbles'], 0, 2);
-// => ['barney', 'pebbles']
-```
-* * *
-
-
-
-
-
-### `_.countBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6351 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package")
+### `_.countBy(collection, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7299 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.countby "See the npm package")
Creates an object composed of keys generated from the results of running
each element of `collection` through `iteratee`. The corresponding value
of each key is the number of times the key was returned by `iteratee`.
-The `iteratee` is bound to `thisArg` and invoked with three arguments:
-(value, index|key, collection).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+The iteratee is invoked with one argument: (value).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+1. `collection` *(Array|Object)*: The collection to iterate over.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
#### Returns
*(Object)*: Returns the composed aggregate object.
#### Example
```js
-_.countBy([4.3, 6.1, 6.4], function(n) {
- return Math.floor(n);
-});
-// => { '4': 1, '6': 2 }
-
-_.countBy([4.3, 6.1, 6.4], function(n) {
- return this.floor(n);
-}, Math);
+_.countBy([6.1, 4.2, 6.3], Math.floor);
// => { '4': 1, '6': 2 }
_.countBy(['one', 'two', 'three'], 'length');
@@ -2169,38 +2180,19 @@ _.countBy(['one', 'two', 'three'], 'length');
-### `_.every(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6403 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package")
+### `_.every(collection, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7337 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.every "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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`.
-
-#### Aliases
-*_.all*
+Iteration is stopped once `predicate` returns falsey. The predicate is
+invoked with three arguments: (value, index|key, collection).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
-*(boolean)*: Returns `true` if all elements pass the predicate check,
-else `false`.
+*(boolean)*: Returns `true` if all elements pass the predicate check, else `false`.
#### Example
```js
@@ -2212,15 +2204,15 @@ var users = [
{ 'user': 'fred', 'active': false }
];
-// using the `_.matches` callback shorthand
+// using the `_.matches` iteratee shorthand
_.every(users, { 'user': 'barney', 'active': false });
// => false
-// using the `_.matchesProperty` callback shorthand
-_.every(users, 'active', false);
+// using the `_.matchesProperty` iteratee shorthand
+_.every(users, ['active', false]);
// => true
-// using the `_.property` callback shorthand
+// using the `_.property` iteratee shorthand
_.every(users, 'active');
// => false
```
@@ -2230,61 +2222,41 @@ _.every(users, 'active');
-### `_.filter(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6463 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package")
+### `_.filter(collection, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7378 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.filter "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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`.
-
-#### Aliases
-*_.select*
+`predicate` returns truthy for. The predicate is invoked with three arguments:
+(value, index|key, collection).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the new filtered array.
#### Example
```js
-_.filter([4, 5, 6], function(n) {
- return n % 2 == 0;
-});
-// => [4, 6]
-
var users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false }
];
-// using the `_.matches` callback shorthand
-_.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
-// => ['barney']
+_.filter(users, function(o) { return !o.active; });
+// => objects for ['fred']
-// using the `_.matchesProperty` callback shorthand
-_.pluck(_.filter(users, 'active', false), 'user');
-// => ['fred']
+// using the `_.matches` iteratee shorthand
+_.filter(users, { 'age': 36, 'active': true });
+// => objects for ['barney']
-// using the `_.property` callback shorthand
-_.pluck(_.filter(users, 'active'), 'user');
-// => ['barney']
+// using the `_.matchesProperty` iteratee shorthand
+_.filter(users, ['active', false]);
+// => objects for ['fred']
+
+// using the `_.property` iteratee shorthand
+_.filter(users, 'active');
+// => objects for ['barney']
```
* * *
@@ -2292,34 +2264,16 @@ _.pluck(_.filter(users, 'active'), 'user');
-### `_.find(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6519 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package")
+### `_.find(collection, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7417 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.find "See the npm package")
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`
-style callback returns the property value of the given element.
-
-
-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`.
-
-#### Aliases
-*_.detect*
+`predicate` returns truthy for. The predicate is invoked with three arguments:
+(value, index|key, collection).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to search.
+1. `collection` *(Array|Object)*: The collection to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(*)*: Returns the matched element, else `undefined`.
@@ -2332,22 +2286,20 @@ var users = [
{ 'user': 'pebbles', 'age': 1, 'active': true }
];
-_.result(_.find(users, function(chr) {
- return chr.age < 40;
-}), 'user');
-// => 'barney'
+_.find(users, function(o) { return o.age < 40; });
+// => object for 'barney'
-// using the `_.matches` callback shorthand
-_.result(_.find(users, { 'age': 1, 'active': true }), 'user');
-// => 'pebbles'
+// using the `_.matches` iteratee shorthand
+_.find(users, { 'age': 1, 'active': true });
+// => object for 'pebbles'
-// using the `_.matchesProperty` callback shorthand
-_.result(_.find(users, 'active', false), 'user');
-// => 'fred'
+// using the `_.matchesProperty` iteratee shorthand
+_.find(users, ['active', false]);
+// => object for 'fred'
-// using the `_.property` callback shorthand
-_.result(_.find(users, 'active'), 'user');
-// => 'barney'
+// using the `_.property` iteratee shorthand
+_.find(users, 'active');
+// => object for 'barney'
```
* * *
@@ -2355,16 +2307,15 @@ _.result(_.find(users, 'active'), 'user');
-### `_.findLast(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6540 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package")
+### `_.findLast(collection, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7443 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlast "See the npm package")
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.
+1. `collection` *(Array|Object)*: The collection to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(*)*: Returns the matched element, else `undefined`.
@@ -2382,80 +2333,39 @@ _.findLast([1, 2, 3, 4], function(n) {
-### `_.findWhere(collection, source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findwhere "See the npm package")
-
-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.
-2. `source` *(Object)*: The object of property values to match.
-
-#### Returns
-*(*)*: Returns the matched element, else `undefined`.
-
-#### Example
-```js
-var users = [
- { 'user': 'barney', 'age': 36, 'active': true },
- { 'user': 'fred', 'age': 40, 'active': false }
-];
-
-_.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');
-// => 'barney'
-
-_.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');
-// => 'fred'
-```
-* * *
-
-
-
-
-
-### `_.forEach(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6605 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package")
+### `_.forEach(collection, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7480 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreach "See the npm package")
Iterates over elements of `collection` invoking `iteratee` for each element.
-The `iteratee` is bound to `thisArg` and invoked with three arguments:
-(value, index|key, collection). Iteratee functions may exit iteration early
-by explicitly returning `false`.
+The iteratee is invoked with three arguments: (value, index|key, collection).
+Iteratee functions may exit iteration early by explicitly returning `false`.
**Note:** As with other "Collections" methods, objects with a "length" property
-are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
-may be used for object iteration.
+are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn`
+for object iteration.
#### Aliases
*_.each*
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
-*(Array|Object|string)*: Returns `collection`.
+*(Array|Object)*: Returns `collection`.
#### Example
```js
-_([1, 2]).forEach(function(n) {
- console.log(n);
-}).value();
-// => logs each value from left to right and returns the array
-
-_.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
- console.log(n, key);
+_([1, 2]).forEach(function(value) {
+ console.log(value);
});
-// => logs each value-key pair and returns the object (iteration order is not guaranteed)
+// => logs `1` then `2`
+
+_.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
+ console.log(key);
+});
+// => logs 'a' then 'b' (iteration order is not guaranteed)
```
* * *
@@ -2463,8 +2373,8 @@ _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
-### `_.forEachRight(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6626 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package")
+### `_.forEachRight(collection, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7504 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.foreachright "See the npm package")
This method is like `_.forEach` except that it iterates over elements of
`collection` from right to left.
@@ -2473,19 +2383,18 @@ This method is like `_.forEach` except that it iterates over elements of
*_.eachRight*
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
-*(Array|Object|string)*: Returns `collection`.
+*(Array|Object)*: Returns `collection`.
#### Example
```js
-_([1, 2]).forEachRight(function(n) {
- console.log(n);
-}).value();
-// => logs each value from right to left and returns the array
+_.forEachRight([1, 2], function(value) {
+ console.log(value);
+});
+// => logs `2` then `1`
```
* * *
@@ -2493,50 +2402,27 @@ _([1, 2]).forEachRight(function(n) {
-### `_.groupBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6670 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package")
+### `_.groupBy(collection, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7531 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.groupby "See the npm package")
Creates an object composed of keys generated from the results of running
each element of `collection` through `iteratee`. The corresponding value
of each key is an array of the elements responsible for generating the key.
-The `iteratee` is bound to `thisArg` and invoked with three arguments:
-(value, index|key, collection).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+The iteratee is invoked with one argument: (value).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+1. `collection` *(Array|Object)*: The collection to iterate over.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
#### Returns
*(Object)*: Returns the composed aggregate object.
#### Example
```js
-_.groupBy([4.2, 6.1, 6.4], function(n) {
- return Math.floor(n);
-});
-// => { '4': [4.2], '6': [6.1, 6.4] }
+_.groupBy([6.1, 4.2, 6.3], Math.floor);
+// => { '4': [4.2], '6': [6.1, 6.3] }
-_.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` iteratee shorthand
_.groupBy(['one', 'two', 'three'], 'length');
// => { '3': ['one', 'two'], '5': ['three'] }
```
@@ -2546,24 +2432,21 @@ _.groupBy(['one', 'two', 'three'], 'length');
-### `_.includes(collection, target, [fromIndex=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6707 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package")
+### `_.includes(collection, value, [fromIndex=0])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7567 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package")
-Checks if `target` is in `collection` using
-[`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
-for equality comparisons. If `fromIndex` is negative, it's used as the offset
-from the end of `collection`.
-
-#### Aliases
-*_.contains, _.include*
+Checks if `value` is in `collection`. If `collection` is a string it's checked
+for a substring of `value`, otherwise [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+is used for equality comparisons. If `fromIndex` is negative, it's used as
+the offset from the end of `collection`.
#### Arguments
1. `collection` *(Array|Object|string)*: The collection to search.
-2. `target` *(*)*: The value to search for.
+2. `value` *(*)*: The value to search for.
3. `[fromIndex=0]` *(number)*: The index to search from.
#### Returns
-*(boolean)*: Returns `true` if a matching element is found, else `false`.
+*(boolean)*: Returns `true` if `value` is found, else `false`.
#### Example
```js
@@ -2585,33 +2468,47 @@ _.includes('pebbles', 'eb');
-### `_.indexBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6769 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.indexby "See the npm package")
+### `_.invokeMap(collection, path, [args])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7602 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invokemap "See the npm package")
+
+Invokes the method at `path` of each element in `collection`, returning
+an array of the results of each invoked method. Any additional arguments
+are provided to each invoked method. If `methodName` is a function it's
+invoked for, and `this` bound to, each element in `collection`.
+
+#### Arguments
+1. `collection` *(Array|Object)*: The collection to iterate over.
+2. `path` *(Array|Function|string)*: The path of the method to invoke or the function invoked per iteration.
+3. `[args]` *(...*)*: The arguments to invoke each method with.
+
+#### Returns
+*(Array)*: Returns the array of results.
+
+#### Example
+```js
+_.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
+// => [[1, 5, 7], [1, 2, 3]]
+
+_.invokeMap([123, 456], String.prototype.split, '');
+// => [['1', '2', '3'], ['4', '5', '6']]
+```
+* * *
+
+
+
+
+
+### `_.keyBy(collection, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7642 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keyby "See the npm package")
Creates an object composed of keys generated from the results of running
each element of `collection` through `iteratee`. The corresponding value
of each key is the last element responsible for generating the key. The
-iteratee function is bound to `thisArg` and invoked with three arguments:
-(value, index|key, collection).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+iteratee is invoked with one argument: (value).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+1. `collection` *(Array|Object)*: The collection to iterate over.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
#### Returns
*(Object)*: Returns the composed aggregate object.
@@ -2623,18 +2520,13 @@ var keyData = [
{ 'dir': 'right', 'code': 100 }
];
-_.indexBy(keyData, 'dir');
+_.keyBy(keyData, 'dir');
// => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
-_.indexBy(keyData, function(object) {
- return String.fromCharCode(object.code);
+_.keyBy(keyData, function(o) {
+ return String.fromCharCode(o.code);
});
// => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
-
-_.indexBy(keyData, function(object) {
- return this.fromCharCode(object.code);
-}, String);
-// => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
```
* * *
@@ -2642,56 +2534,12 @@ _.indexBy(keyData, function(object) {
-### `_.invoke(collection, path, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6795 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package")
-
-Invokes the method at `path` of each element in `collection`, returning
-an array of the results of each invoked method. Any additional arguments
-are provided to each invoked method. If `methodName` is a function it's
-invoked for, and `this` bound to, each element in `collection`.
-
-#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `path` *(Array|Function|string)*: The path of the method to invoke or the function invoked per iteration.
-3. `[args]` *(...*)*: The arguments to invoke the method with.
-
-#### Returns
-*(Array)*: Returns the array of results.
-
-#### Example
-```js
-_.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
-// => [[1, 5, 7], [1, 2, 3]]
-
-_.invoke([123, 456], String.prototype.split, '');
-// => [['1', '2', '3'], ['4', '5', '6']]
-```
-* * *
-
-
-
-
-
-### `_.map(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6864 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package")
+### `_.map(collection, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.map "See the npm package")
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 `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+`iteratee`. The iteratee is invoked with three arguments:
+(value, index|key, collection).
Many lodash methods are guarded to work as iteratees for methods like
@@ -2699,33 +2547,28 @@ Many lodash methods are guarded to work as iteratees for methods like
The guarded methods are:
-`ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
-`drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
-`parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
-`trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
-`sum`, `uniq`, and `words`
-
-#### Aliases
-*_.collect*
+`ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`, `fill`,
+`invert`, `parseInt`, `random`, `range`, `rangeRight`, `slice`, `some`,
+`sortBy`, `take`, `takeRight`, `template`, `trim`, `trimEnd`, `trimStart`,
+and `words`
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Array)*: Returns the new mapped array.
#### Example
```js
-function timesThree(n) {
- return n * 3;
+function square(n) {
+ return n * n;
}
-_.map([1, 2], timesThree);
+_.map([1, 2], square);
// => [3, 6]
-_.map({ 'a': 1, 'b': 2 }, timesThree);
+_.map({ 'a': 1, 'b': 2 }, square);
// => [3, 6] (iteration order is not guaranteed)
var users = [
@@ -2733,7 +2576,7 @@ var users = [
{ 'user': 'fred' }
];
-// using the `_.property` callback shorthand
+// using the `_.property` iteratee shorthand
_.map(users, 'user');
// => ['barney', 'fred']
```
@@ -2743,69 +2586,78 @@ _.map(users, 'user');
-### `_.partition(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6929 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package")
+### `_.orderBy(collection, [iteratees=[_.identity]], [orders])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7719 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.orderby "See the npm package")
+
+This method is like `_.sortBy` except that it allows specifying the sort
+orders of the iteratees to sort by. If `orders` is unspecified, all values
+are sorted in ascending order. Otherwise, specify an order of "desc" for
+descending or "asc" for ascending sort order of corresponding values.
+
+#### Arguments
+1. `collection` *(Array|Object)*: The collection to iterate over.
+2. `[iteratees=[_.identity]]` *(Function[]|Object[]|string[])*: The iteratees to sort by.
+3. `[orders]` *(string[])*: The sort orders of `iteratees`.
+
+#### Returns
+*(Array)*: Returns the new sorted array.
+
+#### Example
+```js
+var users = [
+ { 'user': 'fred', 'age': 48 },
+ { 'user': 'barney', 'age': 34 },
+ { 'user': 'fred', 'age': 42 },
+ { 'user': 'barney', 'age': 36 }
+];
+
+// sort by `user` in ascending order and by `age` in descending order
+_.orderBy(users, ['user', 'age'], ['asc', 'desc']);
+// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
+```
+* * *
+
+
+
+
+
+### `_.partition(collection, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7768 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partition "See the npm package")
Creates an array of elements split into two groups, the first of which
contains elements `predicate` returns truthy for, while the second of which
-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`
-style callback returns the property value of the given element.
-
-
-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`.
+contains elements `predicate` returns falsey for. The predicate is invoked
+with three arguments: (value, index|key, collection).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the array of grouped elements.
#### Example
```js
-_.partition([1, 2, 3], function(n) {
- return n % 2;
-});
-// => [[1, 3], [2]]
-
-_.partition([1.2, 2.3, 3.4], function(n) {
- return this.floor(n) % 2;
-}, Math);
-// => [[1.2, 3.4], [2.3]]
-
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
-var mapper = function(array) {
- return _.pluck(array, 'user');
-};
+_.partition(users, function(o) { return o.active; });
+// => objects for [['fred'], ['barney', 'pebbles']]
-// using the `_.matches` callback shorthand
-_.map(_.partition(users, { 'age': 1, 'active': false }), mapper);
-// => [['pebbles'], ['barney', 'fred']]
+// using the `_.matches` iteratee shorthand
+_.partition(users, { 'age': 1, 'active': false });
+// => objects for [['pebbles'], ['barney', 'fred']]
-// using the `_.matchesProperty` callback shorthand
-_.map(_.partition(users, 'active', false), mapper);
-// => [['barney', 'pebbles'], ['fred']]
+// using the `_.matchesProperty` iteratee shorthand
+_.partition(users, ['active', false]);
+// => objects for [['barney', 'pebbles'], ['fred']]
-// using the `_.property` callback shorthand
-_.map(_.partition(users, 'active'), mapper);
-// => [['fred'], ['barney', 'pebbles']]
+// using the `_.property` iteratee shorthand
+_.partition(users, 'active');
+// => objects for [['fred'], ['barney', 'pebbles']]
```
* * *
@@ -2813,46 +2665,14 @@ _.map(_.partition(users, 'active'), mapper);
-### `_.pluck(collection, path)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6956 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pluck "See the npm package")
-
-Gets the property value of `path` from all elements in `collection`.
-
-#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `path` *(Array|string)*: The path of the property to pluck.
-
-#### Returns
-*(Array)*: Returns the property values.
-
-#### Example
-```js
-var users = [
- { 'user': 'barney', 'age': 36 },
- { 'user': 'fred', 'age': 40 }
-];
-
-_.pluck(users, 'user');
-// => ['barney', 'fred']
-
-var userIndex = _.indexBy(users, 'user');
-_.pluck(userIndex, 'age');
-// => [36, 40] (iteration order is not guaranteed)
-```
-* * *
-
-
-
-
-
-### `_.reduce(collection, [iteratee=_.identity], [accumulator], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L6997 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package")
+### `_.reduce(collection, [iteratee=_.identity], [accumulator])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7807 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduce "See the npm package")
Reduces `collection` to a value which is the accumulated result of running
each element in `collection` through `iteratee`, where each successive
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:
+value. The iteratee is invoked with four arguments:
(accumulator, value, index|key, collection).
@@ -2861,33 +2681,29 @@ Many lodash methods are guarded to work as iteratees for methods like
The guarded methods are:
-`assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,
-and `sortByOrder`
-
-#### Aliases
-*_.foldl, _.inject*
+`assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
+and `sortBy`
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
3. `[accumulator]` *(*)*: The initial value.
-4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(*)*: Returns the accumulated value.
#### Example
```js
-_.reduce([1, 2], function(total, n) {
- return total + n;
+_.reduce([1, 2], function(sum, n) {
+ return sum + n;
});
// => 3
-_.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {
- result[key] = n * 3;
+_.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
+ (result[value] || (result[value] = [])).push(key);
return result;
}, {});
-// => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)
+// => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
```
* * *
@@ -2895,20 +2711,16 @@ _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {
-### `_.reduceRight(collection, [iteratee=_.identity], [accumulator], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7021 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package")
+### `_.reduceRight(collection, [iteratee=_.identity], [accumulator])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7834 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reduceright "See the npm package")
This method is like `_.reduce` except that it iterates over elements of
`collection` from right to left.
-#### Aliases
-*_.foldr*
-
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
3. `[accumulator]` *(*)*: The initial value.
-4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(*)*: Returns the accumulated value.
@@ -2928,43 +2740,40 @@ _.reduceRight(array, function(flattened, other) {
-### `_.reject(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7059 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package")
+### `_.reject(collection, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7873 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reject "See the npm package")
The opposite of `_.filter`; this method returns the elements of `collection`
that `predicate` does **not** return truthy for.
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(Array)*: Returns the new filtered array.
#### Example
```js
-_.reject([1, 2, 3, 4], function(n) {
- return n % 2 == 0;
-});
-// => [1, 3]
-
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true }
];
-// using the `_.matches` callback shorthand
-_.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');
-// => ['barney']
+_.reject(users, function(o) { return !o.active; });
+// => objects for ['fred']
-// using the `_.matchesProperty` callback shorthand
-_.pluck(_.reject(users, 'active', false), 'user');
-// => ['fred']
+// using the `_.matches` iteratee shorthand
+_.reject(users, { 'age': 40, 'active': true });
+// => objects for ['barney']
-// using the `_.property` callback shorthand
-_.pluck(_.reject(users, 'active'), 'user');
-// => ['barney']
+// using the `_.matchesProperty` iteratee shorthand
+_.reject(users, ['active', false]);
+// => objects for ['fred']
+
+// using the `_.property` iteratee shorthand
+_.reject(users, 'active');
+// => objects for ['barney']
```
* * *
@@ -2972,24 +2781,43 @@ _.pluck(_.reject(users, 'active'), 'user');
-### `_.sample(collection, [n])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7085 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package")
+### `_.sample(collection)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7894 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package")
-Gets a random element or `n` random elements from a collection.
+Gets a random element from `collection`.
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to sample.
-2. `[n]` *(number)*: The number of elements to sample.
+1. `collection` *(Array|Object)*: The collection to sample.
#### Returns
-*(*)*: Returns the random sample(s).
+*(*)*: Returns the random element.
#### Example
```js
_.sample([1, 2, 3, 4]);
// => 2
+```
+* * *
-_.sample([1, 2, 3, 4], 2);
+
+
+
+
+### `_.sampleSize(collection, [n=0])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7915 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.samplesize "See the npm package")
+
+Gets `n` random elements from `collection`.
+
+#### Arguments
+1. `collection` *(Array|Object)*: The collection to sample.
+2. `[n=0]` *(number)*: The number of elements to sample.
+
+#### Returns
+*(Array)*: Returns the random elements.
+
+#### Example
+```js
+_.sampleSize([1, 2, 3, 4], 2);
// => [3, 1]
```
* * *
@@ -2999,13 +2827,13 @@ _.sample([1, 2, 3, 4], 2);
### `_.shuffle(collection)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7122 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7947 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.shuffle "See the npm package")
Creates an array of shuffled values, using a version of the
[Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to shuffle.
+1. `collection` *(Array|Object)*: The collection to shuffle.
#### Returns
*(Array)*: Returns the new shuffled array.
@@ -3022,16 +2850,16 @@ _.shuffle([1, 2, 3, 4]);
### `_.size(collection)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7146 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7971 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.size "See the npm package")
Gets the size of `collection` by returning its length for array-like
values or the number of own enumerable properties for objects.
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to inspect.
+1. `collection` *(Array|Object)*: The collection to inspect.
#### Returns
-*(number)*: Returns the size of `collection`.
+*(number)*: Returns the collection size.
#### Example
```js
@@ -3050,39 +2878,19 @@ _.size('pebbles');
-### `_.some(collection, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7200 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package")
+### `_.some(collection, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8016 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.some "See the npm package")
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
-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`
-style callback returns the property value of the given element.
-
-
-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`.
-
-#### Aliases
-*_.any*
+Iteration is stopped once `predicate` returns truthy. The predicate is
+invoked with three arguments: (value, index|key, collection).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
+1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
-*(boolean)*: Returns `true` if any element passes the predicate check,
-else `false`.
+*(boolean)*: Returns `true` if any element passes the predicate check, else `false`.
#### Example
```js
@@ -3094,15 +2902,15 @@ var users = [
{ 'user': 'fred', 'active': false }
];
-// using the `_.matches` callback shorthand
+// using the `_.matches` iteratee shorthand
_.some(users, { 'user': 'barney', 'active': false });
// => false
-// using the `_.matchesProperty` callback shorthand
-_.some(users, 'active', false);
+// using the `_.matchesProperty` iteratee shorthand
+_.some(users, ['active', false]);
// => true
-// using the `_.property` callback shorthand
+// using the `_.property` iteratee shorthand
_.some(users, 'active');
// => true
```
@@ -3112,83 +2920,17 @@ _.some(users, 'active');
-### `_.sortBy(collection, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7259 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package")
+### `_.sortBy(collection, [iteratees=[_.identity]])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8057 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortby "See the npm package")
Creates an array of elements, sorted in ascending order by the results of
-running each element in a collection through `iteratee`. This method performs
-a stable sort, that is, it preserves the original sort order of equal elements.
-The `iteratee` is bound to `thisArg` and invoked with three arguments:
-(value, index|key, collection).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+running each element in a collection through each iteratee. This method
+performs a stable sort, that is, it preserves the original sort order of
+equal elements. The iteratees are invoked with one argument: (value).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
-
-#### Returns
-*(Array)*: Returns the new sorted array.
-
-#### Example
-```js
-_.sortBy([1, 2, 3], function(n) {
- return Math.sin(n);
-});
-// => [3, 1, 2]
-
-_.sortBy([1, 2, 3], function(n) {
- return this.sin(n);
-}, Math);
-// => [3, 1, 2]
-
-var users = [
- { 'user': 'fred' },
- { 'user': 'pebbles' },
- { 'user': 'barney' }
-];
-
-// using the `_.property` callback shorthand
-_.pluck(_.sortBy(users, 'user'), 'user');
-// => ['barney', 'fred', 'pebbles']
-```
-* * *
-
-
-
-
-
-### `_.sortByAll(collection, iteratees)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7310 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortbyall "See the npm package")
-
-This method is like `_.sortBy` except that it can sort by multiple iteratees
-or property names.
-
-
-If a property name is provided for an iteratee the created `_.property`
-style callback returns the property value of the given element.
-
-
-If an object is provided for an iteratee 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. `iteratees` *(...(Function|Function[]|Object|Object[]|string|string[])*: The iteratees to sort by, specified as individual values or arrays of values.
+1. `collection` *(Array|Object)*: The collection to iterate over.
+2. `[iteratees=[_.identity]]` *(...(Function|Function[]|Object|Object[]|string|string[])*: The iteratees to sort by, specified individually or in arrays.
#### Returns
*(Array)*: Returns the new sorted array.
@@ -3202,96 +2944,16 @@ var users = [
{ 'user': 'barney', 'age': 34 }
];
-_.map(_.sortByAll(users, ['user', 'age']), _.values);
-// => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
+_.sortBy(users, function(o) { return o.user; });
+// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
-_.map(_.sortByAll(users, 'user', function(chr) {
- return Math.floor(chr.age / 10);
-}), _.values);
-// => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
-```
-* * *
+_.sortBy(users, ['user', 'age']);
+// => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
-
-
-
-
-### `_.sortByOrder(collection, iteratees, [orders])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7355 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sortbyorder "See the npm package")
-
-This method is like `_.sortByAll` except that it allows specifying the
-sort orders of the iteratees to sort by. If `orders` is unspecified, all
-values are sorted in ascending order. Otherwise, a value is sorted in
-ascending order if its corresponding order is "asc", and descending if "desc".
-
-
-If a property name is provided for an iteratee the created `_.property`
-style callback returns the property value of the given element.
-
-
-If an object is provided for an iteratee 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. `iteratees` *(Function[]|Object[]|string[])*: The iteratees to sort by.
-3. `[orders]` *(boolean[])*: The sort orders of `iteratees`.
-
-#### Returns
-*(Array)*: Returns the new sorted array.
-
-#### Example
-```js
-var users = [
- { 'user': 'fred', 'age': 48 },
- { 'user': 'barney', 'age': 34 },
- { 'user': 'fred', 'age': 42 },
- { 'user': 'barney', 'age': 36 }
-];
-
-// sort by `user` in ascending order and by `age` in descending order
-_.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values);
-// => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
-```
-* * *
-
-
-
-
-
-### `_.where(collection, source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7400 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.where "See the npm package")
-
-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.
-2. `source` *(Object)*: The object of property values to match.
-
-#### Returns
-*(Array)*: Returns the new filtered array.
-
-#### Example
-```js
-var users = [
- { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },
- { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }
-];
-
-_.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');
-// => ['barney']
-
-_.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
-// => ['fred']
+_.sortBy(users, 'user', function(o) {
+ return Math.floor(o.age / 10);
+});
+// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
```
* * *
@@ -3305,11 +2967,14 @@ _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
-### `_.now`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7420 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package")
+### `_.now()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8088 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package")
-Gets the number of milliseconds that have elapsed since the Unix epoch
-(1 January 1970 00:00:00 UTC).
+Gets the timestamp of the number of milliseconds that have elapsed since
+the Unix epoch (1 January 1970 00:00:00 UTC).
+
+#### Returns
+*(number)*: Returns the timestamp.
#### Example
```js
@@ -3331,7 +2996,7 @@ _.defer(function(stamp) {
### `_.after(n, func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7449 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8115 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.after "See the npm package")
The opposite of `_.before`; this method creates a function that invokes
`func` once it's called `n` or more times.
@@ -3363,9 +3028,9 @@ _.forEach(saves, function(type) {
### `_.ary(func, [n=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7483 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8143 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ary "See the npm package")
-Creates a function that accepts up to `n` arguments ignoring any
+Creates a function that accepts up to `n` arguments, ignoring any
additional arguments.
#### Arguments
@@ -3387,7 +3052,7 @@ _.map(['6', '8', '10'], _.ary(parseInt, 1));
### `_.before(n, func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7507 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8165 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.before "See the npm package")
Creates a function that invokes `func`, with the `this` binding and arguments
of the created function, while it's called less than `n` times. Subsequent
@@ -3402,7 +3067,7 @@ calls to the created function return the result of the last `func` invocation.
#### Example
```js
-jQuery('#add').on('click', _.before(5, addContactToList));
+jQuery(element).on('click', _.before(5, addContactToList));
// => allows adding up to 4 contacts to the list
```
* * *
@@ -3412,7 +3077,7 @@ jQuery('#add').on('click', _.before(5, addContactToList));
### `_.bind(func, thisArg, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7564 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8217 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bind "See the npm package")
Creates a function that invokes `func` with the `this` binding of `thisArg`
and prepends any additional `_.bind` arguments to those provided to the
@@ -3423,7 +3088,7 @@ The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
may be used as a placeholder for partially applied arguments.
-**Note:** Unlike native `Function#bind` this method does not set the "length"
+**Note:** Unlike native `Function#bind` this method doesn't set the "length"
property of bound functions.
#### Arguments
@@ -3457,45 +3122,8 @@ bound('hi');
-### `_.bindAll(object, [methodNames])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7601 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package")
-
-Binds methods of an object to the object itself, overwriting the existing
-method. Method names may be specified as individual arguments or as arrays
-of method names. If no method names are provided all enumerable function
-properties, own and inherited, of `object` are bound.
-
-
-**Note:** This method does not set the "length" property of bound functions.
-
-#### Arguments
-1. `object` *(Object)*: The object to bind and assign the bound methods to.
-2. `[methodNames]` *(...(string|string[])*: The object method names to bind, specified as individual method names or arrays of method names.
-
-#### Returns
-*(Object)*: Returns `object`.
-
-#### Example
-```js
-var view = {
- 'label': 'docs',
- 'onClick': function() {
- console.log('clicked ' + this.label);
- }
-};
-
-_.bindAll(view);
-jQuery('#docs').on('click', view.onClick);
-// => logs 'clicked docs' when the element is clicked
-```
-* * *
-
-
-
-
-
### `_.bindKey(object, key, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7658 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8270 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindkey "See the npm package")
Creates a function that invokes the method at `object[key]` and prepends
any additional `_.bindKey` arguments to those provided to the bound function.
@@ -3511,7 +3139,7 @@ The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
builds, may be used as a placeholder for partially applied arguments.
#### Arguments
-1. `object` *(Object)*: The object the method belongs to.
+1. `object` *(Object)*: The object to invoke the method on.
2. `key` *(string)*: The key of the method.
3. `[partials]` *(...*)*: The arguments to be partially applied.
@@ -3550,20 +3178,20 @@ bound('hi');
### `_.curry(func, [arity=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7707 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8319 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package")
-Creates a function that accepts one or more arguments of `func` that when
-called either invokes `func` returning its result, if all `func` arguments
-have been provided, or returns a function that accepts one or more of the
-remaining `func` arguments, and so on. The arity of `func` may be specified
-if `func.length` is not sufficient.
+Creates a function that accepts arguments of `func` and either invokes
+`func` returning its result, if at least `arity` number of arguments have
+been provided, or returns a function that accepts the remaining `func`
+arguments, and so on. The arity of `func` may be specified if `func.length`
+is not sufficient.
The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
may be used as a placeholder for provided arguments.
-**Note:** This method does not set the "length" property of curried functions.
+**Note:** This method doesn't set the "length" property of curried functions.
#### Arguments
1. `func` *(Function)*: The function to curry.
@@ -3600,7 +3228,7 @@ curried(1)(_, 3)(2);
### `_.curryRight(func, [arity=func.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7746 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8363 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curryright "See the npm package")
This method is like `_.curry` except that arguments are applied to `func`
in the manner of `_.partialRight` instead of `_.partial`.
@@ -3610,7 +3238,7 @@ The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
builds, may be used as a placeholder for provided arguments.
-**Note:** This method does not set the "length" property of curried functions.
+**Note:** This method doesn't set the "length" property of curried functions.
#### Arguments
1. `func` *(Function)*: The function to curry.
@@ -3647,15 +3275,16 @@ curried(3)(1, _)(2);
### `_.debounce(func, [wait=0], [options])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7811 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8419 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.debounce "See the npm package")
Creates a debounced function that delays invoking `func` until after `wait`
milliseconds have elapsed since the last time the debounced function was
invoked. The debounced function comes with a `cancel` method to cancel
-delayed invocations. Provide an options object to indicate that `func`
-should be invoked on the leading and/or trailing edge of the `wait` timeout.
-Subsequent calls to the debounced function return the result of the last
-`func` invocation.
+delayed `func` invocations and a `flush` method to immediately invoke them.
+Provide an options object to indicate whether `func` should be invoked on
+the leading and/or trailing edge of the `wait` timeout. The `func` is invoked
+with the last arguments provided to the debounced function. Subsequent calls
+to the debounced function return the result of the last `func` invocation.
**Note:** If `leading` and `trailing` options are `true`, `func` is invoked
@@ -3682,34 +3311,19 @@ for details over the differences between `_.debounce` and `_.throttle`.
// avoid costly calculations while the window size is in flux
jQuery(window).on('resize', _.debounce(calculateLayout, 150));
-// invoke `sendMail` when the click event is fired, debouncing subsequent calls
-jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
+// invoke `sendMail` when clicked, debouncing subsequent calls
+jQuery(element).on('click', _.debounce(sendMail, 300, {
'leading': true,
'trailing': false
}));
// ensure `batchLog` is invoked once after 1 second of debounced calls
+var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
var source = new EventSource('/stream');
-jQuery(source).on('message', _.debounce(batchLog, 250, {
- 'maxWait': 1000
-}));
+jQuery(source).on('message', debounced);
-// cancel a debounced call
-var todoChanges = _.debounce(batchLog, 1000);
-Object.observe(models.todo, todoChanges);
-
-Object.observe(models, function(changes) {
- if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {
- todoChanges.cancel();
- }
-}, ['delete']);
-
-// ...at some point `models.todo` is changed
-models.todo.completed = true;
-
-// ...before 1 second has passed `models.todo` is deleted
-// which cancels the debounced `todoChanges` call
-delete models.todo;
+// cancel a trailing debounced invocation
+jQuery(window).on('popstate', debounced.cancel);
```
* * *
@@ -3718,14 +3332,14 @@ delete models.todo;
### `_.defer(func, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7936 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8551 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defer "See the npm package")
Defers invoking the `func` until the current call stack has cleared. Any
additional arguments are provided to `func` when it's invoked.
#### Arguments
1. `func` *(Function)*: The function to defer.
-2. `[args]` *(...*)*: The arguments to invoke the function with.
+2. `[args]` *(...*)*: The arguments to invoke `func` with.
#### Returns
*(number)*: Returns the timer id.
@@ -3744,7 +3358,7 @@ _.defer(function(text) {
### `_.delay(func, wait, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7958 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8573 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.delay "See the npm package")
Invokes `func` after `wait` milliseconds. Any additional arguments are
provided to `func` when it's invoked.
@@ -3752,7 +3366,7 @@ provided to `func` when it's invoked.
#### Arguments
1. `func` *(Function)*: The function to delay.
2. `wait` *(number)*: The number of milliseconds to delay invocation.
-3. `[args]` *(...*)*: The arguments to invoke the function with.
+3. `[args]` *(...*)*: The arguments to invoke `func` with.
#### Returns
*(number)*: Returns the timer id.
@@ -3770,59 +3384,25 @@ _.delay(function(text) {
-### `_.flow([funcs])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L7982 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package")
+### `_.flip(func)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8594 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flip "See the npm package")
-Creates a function that returns the result of invoking the provided
-functions with the `this` binding of the created function, where each
-successive invocation is supplied the return value of the previous.
+Creates a function that invokes `func` with arguments reversed.
#### Arguments
-1. `[funcs]` *(...Function)*: Functions to invoke.
+1. `func` *(Function)*: The function to flip arguments for.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
-function square(n) {
- return n * n;
-}
+var flipped = _.flip(function() {
+ return _.toArray(arguments);
+});
-var addSquare = _.flow(_.add, square);
-addSquare(1, 2);
-// => 9
-```
-* * *
-
-
-
-
-
-### `_.flowRight([funcs])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8004 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package")
-
-This method is like `_.flow` except that it creates a function that
-invokes the provided functions from right to left.
-
-#### Aliases
-*_.backflow, _.compose*
-
-#### Arguments
-1. `[funcs]` *(...Function)*: Functions to invoke.
-
-#### Returns
-*(Function)*: Returns the new function.
-
-#### Example
-```js
-function square(n) {
- return n * n;
-}
-
-var addSquare = _.flowRight(square, _.add);
-addSquare(1, 2);
-// => 9
+flipped('a', 'b', 'c', 'd');
+// => ['d', 'c', 'b', 'a']
```
* * *
@@ -3831,20 +3411,19 @@ addSquare(1, 2);
### `_.memoize(func, [resolver])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8057 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8640 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.memoize "See the npm package")
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
arguments provided to the memoized function. By default, the first argument
-provided to the memoized function is coerced to a string and used as the
-cache key. The `func` is invoked with the `this` binding of the memoized
-function.
+provided to the memoized function is used as the map cache key. The `func`
+is invoked with the `this` binding of the memoized function.
**Note:** The cache is exposed as the `cache` property on the memoized
function. Its creation may be customized by replacing the `_.memoize.Cache`
constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)
-method interface of `get`, `has`, and `set`.
+method interface of `delete`, `get`, `has`, and `set`.
#### Arguments
1. `func` *(Function)*: The function to have its output memoized.
@@ -3855,74 +3434,27 @@ method interface of `get`, `has`, and `set`.
#### Example
```js
-var upperCase = _.memoize(function(string) {
- return string.toUpperCase();
-});
+var object = { 'a': 1, 'b': 2 };
+var other = { 'c': 3, 'd': 4 };
-upperCase('fred');
-// => 'FRED'
+var values = _.memoize(_.values);
+values(object);
+// => [1, 2]
+
+values(other);
+// => [3, 4]
+
+object.a = 2;
+values(object);
+// => [1, 2]
// modifying the result cache
-upperCase.cache.set('fred', 'BARNEY');
-upperCase('fred');
-// => 'BARNEY'
+values.cache.set(object, ['a', 'b']);
+values(object);
+// => ['a', 'b']
// replacing `_.memoize.Cache`
-var object = { 'user': 'fred' };
-var other = { 'user': 'barney' };
-var identity = _.memoize(_.identity);
-
-identity(object);
-// => { 'user': 'fred' }
-identity(other);
-// => { 'user': 'fred' }
-
_.memoize.Cache = WeakMap;
-var identity = _.memoize(_.identity);
-
-identity(object);
-// => { 'user': 'fred' }
-identity(other);
-// => { 'user': 'barney' }
-```
-* * *
-
-
-
-
-
-### `_.modArgs(func, [transforms])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8108 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.modargs "See the npm package")
-
-Creates a function that runs each argument through a corresponding
-transform function.
-
-#### Arguments
-1. `func` *(Function)*: The function to wrap.
-2. `[transforms]` *(...(Function|Function[])*: The functions to transform arguments, specified as individual functions or arrays of functions.
-
-#### Returns
-*(Function)*: Returns the new function.
-
-#### Example
-```js
-function doubled(n) {
- return n * 2;
-}
-
-function square(n) {
- return n * n;
-}
-
-var modded = _.modArgs(function(x, y) {
- return [x, y];
-}, square, doubled);
-
-modded(1, 2);
-// => [1, 4]
-
-modded(5, 10);
-// => [25, 20]
```
* * *
@@ -3931,7 +3463,7 @@ modded(5, 10);
### `_.negate(predicate)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8142 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8679 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.negate "See the npm package")
Creates a function that negates the result of the predicate `func`. The
`func` predicate is invoked with the `this` binding and arguments of the
@@ -3959,11 +3491,11 @@ _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
### `_.once(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8168 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8705 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.once "See the npm package")
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
-with the `this` binding and arguments of the created function.
+to the function return the value of the first invocation. The `func` is
+invoked with the `this` binding and arguments of the created function.
#### Arguments
1. `func` *(Function)*: The function to restrict.
@@ -3984,8 +3516,47 @@ initialize();
+### `_.overArgs(func, [transforms])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8740 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overargs "See the npm package")
+
+Creates a function that invokes `func` with arguments transformed by
+corresponding `transforms`.
+
+#### Arguments
+1. `func` *(Function)*: The function to wrap.
+2. `[transforms]` *(...(Function|Function[])*: The functions to transform arguments, specified individually or in arrays.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+function doubled(n) {
+ return n * 2;
+}
+
+function square(n) {
+ return n * n;
+}
+
+var func = _.overArgs(function(x, y) {
+ return [x, y];
+}, square, doubled);
+
+func(9, 3);
+// => [81, 6]
+
+func(10, 5);
+// => [100, 10]
+```
+* * *
+
+
+
+
+
### `_.partial(func, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8204 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8787 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partial "See the npm package")
Creates a function that invokes `func` with `partial` arguments prepended
to those provided to the new function. This method is like `_.bind` except
@@ -3996,7 +3567,7 @@ The `_.partial.placeholder` value, which defaults to `_` in monolithic
builds, may be used as a placeholder for partially applied arguments.
-**Note:** This method does not set the "length" property of partially
+**Note:** This method doesn't set the "length" property of partially
applied functions.
#### Arguments
@@ -4028,7 +3599,7 @@ greetFred('hi');
### `_.partialRight(func, [partials])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8237 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8823 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.partialright "See the npm package")
This method is like `_.partial` except that partially applied arguments
are appended to those provided to the new function.
@@ -4038,7 +3609,7 @@ The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
builds, may be used as a placeholder for partially applied arguments.
-**Note:** This method does not set the "length" property of partially
+**Note:** This method doesn't set the "length" property of partially
applied functions.
#### Arguments
@@ -4070,7 +3641,7 @@ sayHelloTo('fred');
### `_.rearg(func, indexes)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8267 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8850 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rearg "See the npm package")
Creates a function that invokes `func` with arguments arranged according
to the specified indexes where the argument value at the first index is
@@ -4079,7 +3650,7 @@ provided as the second argument, and so on.
#### Arguments
1. `func` *(Function)*: The function to rearrange arguments for.
-2. `indexes` *(...(number|number[])*: The arranged argument indexes, specified as individual indexes or arrays of indexes.
+2. `indexes` *(...(number|number[])*: The arranged argument indexes, specified individually or in arrays.
#### Returns
*(Function)*: Returns the new function.
@@ -4092,12 +3663,6 @@ var rearged = _.rearg(function(a, b, c) {
rearged('b', 'c', 'a')
// => ['a', 'b', 'c']
-
-var map = _.rearg(_.map, [1, 0]);
-map(function(n) {
- return n * 3;
-}, [1, 2, 3]);
-// => [3, 6, 9]
```
* * *
@@ -4105,14 +3670,14 @@ map(function(n) {
-### `_.restParam(func, [start=func.length-1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8293 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.restparam "See the npm package")
+### `_.rest(func, [start=func.length-1])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8876 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rest "See the npm package")
Creates a function that invokes `func` with the `this` binding of the
created function and arguments from `start` and beyond provided as an array.
-**Note:** This method is based on the [rest parameter](https://developer.mozilla.org/Web/JavaScript/Reference/Functions/rest_parameters).
+**Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).
#### Arguments
1. `func` *(Function)*: The function to apply a rest parameter to.
@@ -4123,7 +3688,7 @@ created function and arguments from `start` and beyond provided as an array.
#### Example
```js
-var say = _.restParam(function(what, names) {
+var say = _.rest(function(what, names) {
return what + ' ' + _.initial(names).join(', ') +
(_.size(names) > 1 ? ', & ' : '') + _.last(names);
});
@@ -4138,13 +3703,13 @@ say('hello', 'fred', 'barney', 'pebbles');
### `_.spread(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8353 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8936 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.spread "See the npm package")
Creates a function that invokes `func` with the `this` binding of the created
function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
-**Note:** This method is based on the [spread operator](https://developer.mozilla.org/Web/JavaScript/Reference/Operators/Spread_operator).
+**Note:** This method is based on the [spread operator](https://mdn.io/spread_operator).
#### Arguments
1. `func` *(Function)*: The function to spread arguments over.
@@ -4179,14 +3744,16 @@ numbers.then(_.spread(function(x, y) {
### `_.throttle(func, [wait=0], [options])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8401 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L8985 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.throttle "See the npm package")
Creates a throttled function that only invokes `func` at most once per
every `wait` milliseconds. The throttled function comes with a `cancel`
-method to cancel delayed invocations. Provide an options object to indicate
-that `func` should be invoked on the leading and/or trailing edge of the
-`wait` timeout. Subsequent calls to the throttled function return the
-result of the last `func` call.
+method to cancel delayed `func` invocations and a `flush` method to
+immediately invoke them. Provide an options object to indicate whether
+`func` should be invoked on the leading and/or trailing edge of the `wait`
+timeout. The `func` is invoked with the last arguments provided to the
+throttled function. Subsequent calls to the throttled function return the
+result of the last `func` invocation.
**Note:** If `leading` and `trailing` options are `true`, `func` is invoked
@@ -4213,11 +3780,10 @@ for details over the differences between `_.throttle` and `_.debounce`.
jQuery(window).on('scroll', _.throttle(updatePosition, 100));
// invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
-jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
- 'trailing': false
-}));
+var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
+jQuery(element).on('click', throttled);
-// cancel a trailing throttled call
+// cancel a trailing throttled invocation
jQuery(window).on('popstate', throttled.cancel);
```
* * *
@@ -4226,8 +3792,31 @@ jQuery(window).on('popstate', throttled.cancel);
+### `_.unary(func)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9013 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unary "See the npm package")
+
+Creates a function that accepts up to one argument, ignoring any
+additional arguments.
+
+#### Arguments
+1. `func` *(Function)*: The function to cap arguments for.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+_.map(['6', '8', '10'], _.unary(parseInt));
+// => [6, 8, 10]
+```
+* * *
+
+
+
+
+
### `_.wrap(value, wrapper)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8438 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9038 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.wrap "See the npm package")
Creates a function that provides `value` to the wrapper function as its
first argument. Any additional arguments provided to the function are
@@ -4262,60 +3851,33 @@ p('fred, barney, & pebbles');
-### `_.clone(value, [isDeep], [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8496 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package")
+### `_.clone(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9069 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package")
-Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
-otherwise they are assigned by reference. If `customizer` is provided it's
-invoked to produce the cloned values. If `customizer` returns `undefined`
-cloning is handled by the method instead. The `customizer` is bound to
-`thisArg` and invoked with up to three argument; (value [, index|key, object]).
+Creates a shallow clone of `value`.
**Note:** This method is loosely based on the
-[structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
-The enumerable properties of `arguments` objects and objects created by
-constructors other than `Object` are cloned to plain `Object` objects. An
-empty object is returned for uncloneable values such as functions, DOM nodes,
-Maps, Sets, and WeakMaps.
+[structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
+and supports cloning arrays, array buffers, booleans, date objects, maps,
+numbers, `Object` objects, regexes, sets, strings, symbols, and typed
+arrays. The own enumerable properties of `arguments` objects are cloned
+as plain objects. An empty object is returned for uncloneable values such
+as error objects, functions, DOM nodes, and WeakMaps.
#### Arguments
1. `value` *(*)*: The value to clone.
-2. `[isDeep]` *(boolean)*: Specify a deep clone.
-3. `[customizer]` *(Function)*: The function to customize cloning values.
-4. `[thisArg]` *(*)*: The `this` binding of `customizer`.
#### Returns
*(*)*: Returns the cloned value.
#### Example
```js
-var users = [
- { 'user': 'barney' },
- { 'user': 'fred' }
-];
+var objects = [{ 'a': 1 }, { 'b': 2 }];
-var shallow = _.clone(users);
-shallow[0] === users[0];
+var shallow = _.clone(objects);
+console.log(shallow[0] === objects[0]);
// => true
-
-var deep = _.clone(users, true);
-deep[0] === users[0];
-// => false
-
-// using a customizer callback
-var el = _.clone(document.body, function(value) {
- if (_.isElement(value)) {
- return value.cloneNode(false);
- }
-});
-
-el === document.body
-// => false
-el.nodeName
-// => BODY
-el.childNodes.length;
-// => 0
```
* * *
@@ -4323,53 +3885,58 @@ el.childNodes.length;
-### `_.cloneDeep(value, [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8555 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package")
+### `_.cloneDeep(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9122 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeep "See the npm package")
-Creates a deep clone of `value`. If `customizer` is provided it's invoked
-to produce the cloned values. If `customizer` returns `undefined` cloning
-is handled by the method instead. The `customizer` is bound to `thisArg`
-and invoked with up to three argument; (value [, index|key, object]).
-
-
-**Note:** This method is loosely based on the
-[structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
-The enumerable properties of `arguments` objects and objects created by
-constructors other than `Object` are cloned to plain `Object` objects. An
-empty object is returned for uncloneable values such as functions, DOM nodes,
-Maps, Sets, and WeakMaps.
+This method is like `_.clone` except that it recursively clones `value`.
#### Arguments
-1. `value` *(*)*: The value to deep clone.
-2. `[customizer]` *(Function)*: The function to customize cloning values.
-3. `[thisArg]` *(*)*: The `this` binding of `customizer`.
+1. `value` *(*)*: The value to recursively clone.
#### Returns
*(*)*: Returns the deep cloned value.
#### Example
```js
-var users = [
- { 'user': 'barney' },
- { 'user': 'fred' }
-];
+var objects = [{ 'a': 1 }, { 'b': 2 }];
-var deep = _.cloneDeep(users);
-deep[0] === users[0];
+var deep = _.cloneDeep(objects);
+console.log(deep[0] === objects[0]);
// => false
+```
+* * *
-// using a customizer callback
-var el = _.cloneDeep(document.body, function(value) {
+
+
+
+
+### `_.cloneDeepWith(value, [customizer])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9152 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonedeepwith "See the npm package")
+
+This method is like `_.cloneWith` except that it recursively clones `value`.
+
+#### Arguments
+1. `value` *(*)*: The value to recursively clone.
+2. `[customizer]` *(Function)*: The function to customize cloning.
+
+#### Returns
+*(*)*: Returns the deep cloned value.
+
+#### Example
+```js
+function customizer(value) {
if (_.isElement(value)) {
return value.cloneNode(true);
}
-});
+}
-el === document.body
+var el = _.cloneDeep(document.body, customizer);
+
+console.log(el === document.body);
// => false
-el.nodeName
-// => BODY
-el.childNodes.length;
+console.log(el.nodeName);
+// => 'BODY'
+console.log(el.childNodes.length);
// => 20
```
* * *
@@ -4378,8 +3945,85 @@ el.childNodes.length;
+### `_.cloneWith(value, [customizer])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9102 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clonewith "See the npm package")
+
+This method is like `_.clone` except that it accepts `customizer` which
+is invoked to produce the cloned value. If `customizer` returns `undefined`
+cloning is handled by the method instead. The `customizer` is invoked with
+up to five arguments; (value [, index|key, object, stack]).
+
+#### Arguments
+1. `value` *(*)*: The value to clone.
+2. `[customizer]` *(Function)*: The function to customize cloning.
+
+#### Returns
+*(*)*: Returns the cloned value.
+
+#### Example
+```js
+function customizer(value) {
+ if (_.isElement(value)) {
+ return value.cloneNode(false);
+ }
+}
+
+var el = _.clone(document.body, customizer);
+
+console.log(el === document.body);
+// => false
+console.log(el.nodeName);
+// => 'BODY'
+console.log(el.childNodes.length);
+// => 0
+```
+* * *
+
+
+
+
+
+### `_.eq(value, other)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9186 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.eq "See the npm package")
+
+Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
+comparison between two values to determine if they are equivalent.
+
+#### Arguments
+1. `value` *(*)*: The value to compare.
+2. `other` *(*)*: The other value to compare.
+
+#### Returns
+*(boolean)*: Returns `true` if the values are equivalent, else `false`.
+
+#### Example
+```js
+var object = { 'user': 'fred' };
+var other = { 'user': 'fred' };
+
+_.eq(object, object);
+// => true
+
+_.eq(object, other);
+// => false
+
+_.eq('a', 'a');
+// => true
+
+_.eq('a', Object('a'));
+// => false
+
+_.eq(NaN, NaN);
+// => true
+```
+* * *
+
+
+
+
+
### `_.gt(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8581 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gt "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9210 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gt "See the npm package")
Checks if `value` is greater than `other`.
@@ -4408,7 +4052,7 @@ _.gt(1, 3);
### `_.gte(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8605 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gte "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9234 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.gte "See the npm package")
Checks if `value` is greater than or equal to `other`.
@@ -4437,9 +4081,9 @@ _.gte(1, 3);
### `_.isArguments(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8625 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9254 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarguments "See the npm package")
-Checks if `value` is classified as an `arguments` object.
+Checks if `value` is likely an `arguments` object.
#### Arguments
1. `value` *(*)*: The value to check.
@@ -4462,7 +4106,7 @@ _.isArguments([1, 2, 3]);
### `_.isArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8646 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9283 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarray "See the npm package")
Checks if `value` is classified as an `Array` object.
@@ -4477,7 +4121,78 @@ Checks if `value` is classified as an `Array` object.
_.isArray([1, 2, 3]);
// => true
-_.isArray(function() { return arguments; }());
+_.isArray(document.body.children);
+// => false
+
+_.isArray('abc');
+// => false
+
+_.isArray(_.noop);
+// => false
+```
+* * *
+
+
+
+
+
+### `_.isArrayLike(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9310 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylike "See the npm package")
+
+Checks if `value` is array-like. A value is considered array-like if it's
+not a function and has a `value.length` that's an integer greater than or
+equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is array-like, else `false`.
+
+#### Example
+```js
+_.isArrayLike([1, 2, 3]);
+// => true
+
+_.isArrayLike(document.body.children);
+// => true
+
+_.isArrayLike('abc');
+// => true
+
+_.isArrayLike(_.noop);
+// => false
+```
+* * *
+
+
+
+
+
+### `_.isArrayLikeObject(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9339 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isarraylikeobject "See the npm package")
+
+This method is like `_.isArrayLike` except that it also checks if `value`
+is an object.
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is an array-like object, else `false`.
+
+#### Example
+```js
+_.isArrayLikeObject([1, 2, 3]);
+// => true
+
+_.isArrayLikeObject(document.body.children);
+// => true
+
+_.isArrayLikeObject('abc');
+// => false
+
+_.isArrayLikeObject(_.noop);
// => false
```
* * *
@@ -4487,7 +4202,7 @@ _.isArray(function() { return arguments; }());
### `_.isBoolean(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8666 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9359 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isboolean "See the npm package")
Checks if `value` is classified as a boolean primitive or object.
@@ -4512,7 +4227,7 @@ _.isBoolean(null);
### `_.isDate(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8686 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9380 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isdate "See the npm package")
Checks if `value` is classified as a `Date` object.
@@ -4537,9 +4252,9 @@ _.isDate('Mon April 23 2012');
### `_.isElement(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8706 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9400 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iselement "See the npm package")
-Checks if `value` is a DOM element.
+Checks if `value` is likely a DOM element.
#### Arguments
1. `value` *(*)*: The value to check.
@@ -4562,7 +4277,7 @@ _.isElement('');
### `_.isEmpty(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8737 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9431 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isempty "See the npm package")
Checks if `value` is empty. A value is considered empty unless it's an
`arguments` object, array, string, or jQuery-like collection with a length
@@ -4597,30 +4312,22 @@ _.isEmpty({ 'a': 1 });
-### `_.isEqual(value, other, [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8792 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package")
+### `_.isEqual(value, other)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9464 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequal "See the npm package")
Performs a deep comparison between two values to determine if they are
-equivalent. If `customizer` is provided it's invoked to compare values.
-If `customizer` returns `undefined` comparisons are handled by the method
-instead. The `customizer` is bound to `thisArg` and invoked with up to
-three arguments: (value, other [, index|key]).
+equivalent.
-**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. Functions and DOM nodes
-are **not** supported. Provide a customizer function to extend support
-for comparing other values.
-
-#### Aliases
-*_.eq*
+**Note:** This method supports comparing arrays, array buffers, booleans,
+date objects, error objects, maps, numbers, `Object` objects, regexes,
+sets, strings, symbols, and typed arrays. `Object` objects are compared
+by their own, not inherited, enumerable properties. Functions and DOM
+nodes are **not** supported.
#### Arguments
1. `value` *(*)*: The value to compare.
2. `other` *(*)*: The other value to compare.
-3. `[customizer]` *(Function)*: The function to customize value comparisons.
-4. `[thisArg]` *(*)*: The `this` binding of `customizer`.
#### Returns
*(boolean)*: Returns `true` if the values are equivalent, else `false`.
@@ -4630,21 +4337,50 @@ for comparing other values.
var object = { 'user': 'fred' };
var other = { 'user': 'fred' };
-object == other;
-// => false
-
_.isEqual(object, other);
// => true
-// using a customizer callback
+object === other;
+// => false
+```
+* * *
+
+
+
+
+
+### `_.isEqualWith(value, other, [customizer])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9499 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isequalwith "See the npm package")
+
+This method is like `_.isEqual` except that it accepts `customizer` which is
+invoked to compare values. If `customizer` returns `undefined` comparisons are
+handled by the method instead. The `customizer` is invoked with up to seven arguments:
+(objValue, othValue [, index|key, object, other, stack]).
+
+#### Arguments
+1. `value` *(*)*: The value to compare.
+2. `other` *(*)*: The other value to compare.
+3. `[customizer]` *(Function)*: The function to customize comparisons.
+
+#### Returns
+*(boolean)*: Returns `true` if the values are equivalent, else `false`.
+
+#### Example
+```js
+function isGreeting(value) {
+ return /^h(?:i|ello)$/.test(value);
+}
+
+function customizer(objValue, othValue) {
+ if (isGreeting(objValue) && isGreeting(othValue)) {
+ return true;
+ }
+}
+
var array = ['hello', 'goodbye'];
var other = ['hi', 'goodbye'];
-_.isEqual(array, other, function(value, other) {
- if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
- return true;
- }
-});
+_.isEqualWith(array, other, customizer);
// => true
```
* * *
@@ -4654,7 +4390,7 @@ _.isEqual(array, other, function(value, other) {
### `_.isError(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8815 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9522 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iserror "See the npm package")
Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
`SyntaxError`, `TypeError`, or `URIError` object.
@@ -4680,12 +4416,12 @@ _.isError(Error);
### `_.isFinite(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8846 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9551 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfinite "See the npm package")
Checks if `value` is a finite primitive number.
-**Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).
+**Note:** This method is based on [`Number.isFinite`](https://mdn.io/Number/isFinite).
#### Arguments
1. `value` *(*)*: The value to check.
@@ -4695,17 +4431,14 @@ Checks if `value` is a finite primitive number.
#### Example
```js
-_.isFinite(10);
+_.isFinite(3);
// => true
-_.isFinite('10');
-// => false
+_.isFinite(Number.MAX_VALUE);
+// => true
-_.isFinite(true);
-// => false
-
-_.isFinite(Object(10));
-// => false
+_.isFinite(3.14);
+// => true
_.isFinite(Infinity);
// => false
@@ -4717,7 +4450,7 @@ _.isFinite(Infinity);
### `_.isFunction(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8866 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isfunction "See the npm package")
Checks if `value` is classified as a `Function` object.
@@ -4741,26 +4474,86 @@ _.isFunction(/abc/);
-### `_.isMatch(object, source, [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8939 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package")
+### `_.isInteger(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9603 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isinteger "See the npm package")
+
+Checks if `value` is an integer.
+
+
+**Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger).
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is an integer, else `false`.
+
+#### Example
+```js
+_.isInteger(3);
+// => true
+
+_.isInteger(Number.MIN_VALUE);
+// => false
+
+_.isInteger(Infinity);
+// => false
+
+_.isInteger('3');
+// => false
+```
+* * *
+
+
+
+
+
+### `_.isLength(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9631 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.islength "See the npm package")
+
+Checks if `value` is a valid array-like length.
+
+
+**Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is a valid length, else `false`.
+
+#### Example
+```js
+_.isLength(3);
+// => true
+
+_.isLength(Number.MIN_VALUE);
+// => false
+
+_.isLength(Infinity);
+// => false
+
+_.isLength('3');
+// => false
+```
+* * *
+
+
+
+
+
+### `_.isMatch(object, source)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9714 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatch "See the npm package")
Performs a deep comparison between `object` and `source` to determine if
-`object` contains equivalent property values. If `customizer` is provided
-it's invoked to compare values. If `customizer` returns `undefined`
-comparisons are handled by the method instead. The `customizer` is bound
-to `thisArg` and invoked with three arguments: (value, other, index|key).
+`object` contains equivalent property values.
-**Note:** This method supports comparing properties of arrays, booleans,
-`Date` objects, numbers, `Object` objects, regexes, and strings. Functions
-and DOM nodes are **not** supported. Provide a customizer function to extend
-support for comparing other values.
+**Note:** This method supports comparing the same values as `_.isEqual`.
#### Arguments
1. `object` *(Object)*: The object to inspect.
2. `source` *(Object)*: The object of property values to match.
-3. `[customizer]` *(Function)*: The function to customize value comparisons.
-4. `[thisArg]` *(*)*: The `this` binding of `customizer`.
#### Returns
*(boolean)*: Returns `true` if `object` is a match, else `false`.
@@ -4774,14 +4567,45 @@ _.isMatch(object, { 'age': 40 });
_.isMatch(object, { 'age': 36 });
// => false
+```
+* * *
+
+
+
+
+
+### `_.isMatchWith(object, source, [customizer])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9749 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ismatchwith "See the npm package")
+
+This method is like `_.isMatch` except that it accepts `customizer` which
+is invoked to compare values. If `customizer` returns `undefined` comparisons
+are handled by the method instead. The `customizer` is invoked with three
+arguments: (objValue, srcValue, index|key, object, source).
+
+#### Arguments
+1. `object` *(Object)*: The object to inspect.
+2. `source` *(Object)*: The object of property values to match.
+3. `[customizer]` *(Function)*: The function to customize comparisons.
+
+#### Returns
+*(boolean)*: Returns `true` if `object` is a match, else `false`.
+
+#### Example
+```js
+function isGreeting(value) {
+ return /^h(?:i|ello)$/.test(value);
+}
+
+function customizer(objValue, srcValue) {
+ if (isGreeting(objValue) && isGreeting(srcValue)) {
+ return true;
+ }
+}
-// using a customizer callback
var object = { 'greeting': 'hello' };
var source = { 'greeting': 'hi' };
-_.isMatch(object, source, function(value, other) {
- return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
-});
+_.isMatchWith(object, source, customizer);
// => true
```
* * *
@@ -4791,7 +4615,7 @@ _.isMatch(object, source, function(value, other) {
### `_.isNaN(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8969 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9779 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnan "See the npm package")
Checks if `value` is `NaN`.
@@ -4826,7 +4650,7 @@ _.isNaN(undefined);
### `_.isNative(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8991 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9801 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnative "See the npm package")
Checks if `value` is a native function.
@@ -4850,8 +4674,36 @@ _.isNative(_);
+### `_.isNil(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9851 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnil "See the npm package")
+
+Checks if `value` is `null` or `undefined`.
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is nullish, else `false`.
+
+#### Example
+```js
+_.isNil(null);
+// => true
+
+_.isNil(void 0);
+// => true
+
+_.isNil(NaN);
+// => false
+```
+* * *
+
+
+
+
+
### `_.isNull(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9017 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9828 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnull "See the npm package")
Checks if `value` is `null`.
@@ -4876,7 +4728,7 @@ _.isNull(void 0);
### `_.isNumber(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9043 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9880 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isnumber "See the npm package")
Checks if `value` is classified as a `Number` primitive or object.
@@ -4892,13 +4744,16 @@ as numbers, use the `_.isFinite` method.
#### Example
```js
-_.isNumber(8.4);
+_.isNumber(3);
// => true
-_.isNumber(NaN);
+_.isNumber(Number.MIN_VALUE);
// => true
-_.isNumber('8.4');
+_.isNumber(Infinity);
+// => true
+
+_.isNumber('3');
// => false
```
* * *
@@ -4908,7 +4763,7 @@ _.isNumber('8.4');
### `_.isObject(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L8893 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9658 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobject "See the npm package")
Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
@@ -4927,7 +4782,42 @@ _.isObject({});
_.isObject([1, 2, 3]);
// => true
-_.isObject(1);
+_.isObject(_.noop);
+// => true
+
+_.isObject(null);
+// => false
+```
+* * *
+
+
+
+
+
+### `_.isObjectLike(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9688 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isobjectlike "See the npm package")
+
+Checks if `value` is object-like. A value is object-like if it's not `null`
+and has a `typeof` result of "object".
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is object-like, else `false`.
+
+#### Example
+```js
+_.isObjectLike({});
+// => true
+
+_.isObjectLike([1, 2, 3]);
+// => true
+
+_.isObjectLike(_.noop);
+// => false
+
+_.isObjectLike(null);
// => false
```
* * *
@@ -4937,14 +4827,10 @@ _.isObject(1);
### `_.isPlainObject(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9077 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9912 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isplainobject "See the npm package")
Checks if `value` is a plain object, that is, an object created by the
`Object` constructor or one with a `[[Prototype]]` of `null`.
-
-
-**Note:** This method assumes objects created by the `Object` constructor
-have no inherited enumerable properties.
#### Arguments
1. `value` *(*)*: The value to check.
@@ -4977,7 +4863,7 @@ _.isPlainObject(Object.create(null));
### `_.isRegExp(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9121 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9944 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isregexp "See the npm package")
Checks if `value` is classified as a `RegExp` object.
@@ -5001,8 +4887,43 @@ _.isRegExp('/abc/');
+### `_.isSafeInteger(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9973 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issafeinteger "See the npm package")
+
+Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
+double precision number which isn't the result of a rounded unsafe integer.
+
+
+**Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is a safe integer, else `false`.
+
+#### Example
+```js
+_.isSafeInteger(3);
+// => true
+
+_.isSafeInteger(Number.MIN_VALUE);
+// => false
+
+_.isSafeInteger(Infinity);
+// => false
+
+_.isSafeInteger('3');
+// => false
+```
+* * *
+
+
+
+
+
### `_.isString(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9141 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L9993 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isstring "See the npm package")
Checks if `value` is classified as a `String` primitive or object.
@@ -5026,8 +4947,33 @@ _.isString(1);
+### `_.isSymbol(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10014 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.issymbol "See the npm package")
+
+Checks if `value` is classified as a `Symbol` primitive or object.
+
+#### Arguments
+1. `value` *(*)*: The value to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `value` is correctly classified, else `false`.
+
+#### Example
+```js
+_.isSymbol(Symbol.iterator);
+// => true
+
+_.isSymbol('abc');
+// => false
+```
+* * *
+
+
+
+
+
### `_.isTypedArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9161 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10035 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.istypedarray "See the npm package")
Checks if `value` is classified as a typed array.
@@ -5052,7 +4998,7 @@ _.isTypedArray([]);
### `_.isUndefined(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9181 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10055 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.isundefined "See the npm package")
Checks if `value` is `undefined`.
@@ -5077,7 +5023,7 @@ _.isUndefined(null);
### `_.lt(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9205 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lt "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10079 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lt "See the npm package")
Checks if `value` is less than `other`.
@@ -5106,7 +5052,7 @@ _.lt(3, 1);
### `_.lte(value, other)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9229 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lte "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10103 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lte "See the npm package")
Checks if `value` is less than or equal to `other`.
@@ -5135,7 +5081,7 @@ _.lte(3, 1);
### `_.toArray(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9248 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10129 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toarray "See the npm package")
Converts `value` to an array.
@@ -5147,10 +5093,114 @@ Converts `value` to an array.
#### Example
```js
-(function() {
- return _.toArray(arguments).slice(1);
-}(1, 2, 3));
-// => [2, 3]
+_.toArray({ 'a': 1, 'b': 2 });
+// => [1, 2]
+
+_.toArray('abc');
+// => ['a', 'b', 'c']
+
+_.toArray(1);
+// => []
+
+_.toArray(null);
+// => []
+```
+* * *
+
+
+
+
+
+### `_.toInteger(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10169 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tointeger "See the npm package")
+
+Converts `value` to an integer.
+
+
+**Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
+
+#### Arguments
+1. `value` *(*)*: The value to convert.
+
+#### Returns
+*(number)*: Returns the converted integer.
+
+#### Example
+```js
+_.toInteger(3);
+// => 3
+
+_.toInteger(Number.MIN_VALUE);
+// => 0
+
+_.toInteger(Infinity);
+// => 1.7976931348623157e+308
+
+_.toInteger('3');
+// => 3
+```
+* * *
+
+
+
+
+
+### `_.toLength(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10207 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolength "See the npm package")
+
+Converts `value` to an integer suitable for use as the length of an
+array-like object.
+
+
+**Note:** This method is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+
+#### Arguments
+1. `value` *(*)*: The value to convert.
+
+#### Example
+```js
+_.toLength(3);
+// => 3
+
+_.toLength(Number.MIN_VALUE);
+// => 0
+
+_.toLength(Infinity);
+// => 4294967295
+
+_.toLength('3');
+// => 3
+```
+* * *
+
+
+
+
+
+### `_.toNumber(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10233 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tonumber "See the npm package")
+
+Converts `value` to a number.
+
+#### Arguments
+1. `value` *(*)*: The value to process.
+
+#### Returns
+*(number)*: Returns the number.
+
+#### Example
+```js
+_.toNumber(3);
+// => 3
+
+_.toNumber(Number.MIN_VALUE);
+// => 5e-324
+
+_.toNumber(Infinity);
+// => Infinity
+
+_.toNumber('3');
+// => 3
```
* * *
@@ -5159,7 +5209,7 @@ Converts `value` to an array.
### `_.toPlainObject(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9284 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10271 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toplainobject "See the npm package")
Converts `value` to a plain object flattening inherited enumerable
properties of `value` to own properties of the plain object.
@@ -5188,6 +5238,67 @@ _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
+
+
+### `_.toSafeInteger(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10298 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tosafeinteger "See the npm package")
+
+Converts `value` to a safe integer. A safe integer can be compared and
+represented correctly.
+
+#### Arguments
+1. `value` *(*)*: The value to convert.
+
+#### Returns
+*(number)*: Returns the converted integer.
+
+#### Example
+```js
+_.toSafeInteger(3);
+// => 3
+
+_.toSafeInteger(Number.MIN_VALUE);
+// => 0
+
+_.toSafeInteger(Infinity);
+// => 9007199254740991
+
+_.toSafeInteger('3');
+// => 3
+```
+* * *
+
+
+
+
+
+### `_.toString(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10322 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tostring "See the npm package")
+
+Converts `value` to a string if it's not one. An empty string is returned
+for `null` and `undefined` values. The sign of `-0` is preserved.
+
+#### Arguments
+1. `value` *(*)*: The value to process.
+
+#### Returns
+*(string)*: Returns the string.
+
+#### Example
+```js
+_.toString(null);
+// => ''
+
+_.toString(-0);
+// => '-0'
+
+_.toString([1, 2, 3]);
+// => '1,2,3'
+```
+* * *
+
+
+
@@ -5197,16 +5308,16 @@ _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
### `_.add(augend, addend)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11803 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13547 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.add "See the npm package")
Adds two numbers.
#### Arguments
-1. `augend` *(number)*: The first number to add.
-2. `addend` *(number)*: The second number to add.
+1. `augend` *(number)*: The first number in an addition.
+2. `addend` *(number)*: The second number in an addition.
#### Returns
-*(number)*: Returns the sum.
+*(number)*: Returns the total.
#### Example
```js
@@ -5219,13 +5330,13 @@ _.add(6, 4);
-### `_.ceil(n, [precision=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11827 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ceil "See the npm package")
+### `_.ceil(number, [precision=0])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13578 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ceil "See the npm package")
-Calculates `n` rounded up to `precision`.
+Computes `number` rounded up to `precision`.
#### Arguments
-1. `n` *(number)*: The number to round up.
+1. `number` *(number)*: The number to round up.
2. `[precision=0]` *(number)*: The precision to round up to.
#### Returns
@@ -5248,13 +5359,13 @@ _.ceil(6040, -2);
-### `_.floor(n, [precision=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11849 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.floor "See the npm package")
+### `_.floor(number, [precision=0])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13600 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.floor "See the npm package")
-Calculates `n` rounded down to `precision`.
+Computes `number` rounded down to `precision`.
#### Arguments
-1. `n` *(number)*: The number to round down.
+1. `number` *(number)*: The number to round down.
2. `[precision=0]` *(number)*: The precision to round down to.
#### Returns
@@ -5277,33 +5388,14 @@ _.floor(4060, -2);
-### `_.max(collection, [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11898 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package")
+### `_.max(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13619 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.max "See the npm package")
-Gets the maximum value of `collection`. If `collection` is empty or falsey
-`-Infinity` is returned. If an iteratee function is provided it's invoked
-for each value in `collection` to generate the criterion by which the value
-is ranked. The `iteratee` is bound to `thisArg` and invoked with three
-arguments: (value, index, collection).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+Computes the maximum value of `array`. If `array` is empty or falsey
+`undefined` is returned.
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+1. `array` *(Array)*: The array to iterate over.
#### Returns
*(*)*: Returns the maximum value.
@@ -5314,21 +5406,7 @@ _.max([4, 2, 8, 6]);
// => 8
_.max([]);
-// => -Infinity
-
-var users = [
- { 'user': 'barney', 'age': 36 },
- { 'user': 'fred', 'age': 40 }
-];
-
-_.max(users, function(chr) {
- return chr.age;
-});
-// => { 'user': 'fred', 'age': 40 }
-
-// using the `_.property` callback shorthand
-_.max(users, 'age');
-// => { 'user': 'fred', 'age': 40 }
+// => undefined
```
* * *
@@ -5336,33 +5414,67 @@ _.max(users, 'age');
-### `_.min(collection, [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11947 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package")
+### `_.maxBy(array, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13647 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.maxby "See the npm package")
-Gets the minimum value of `collection`. If `collection` is empty or falsey
-`Infinity` is returned. If an iteratee function is provided it's invoked
-for each value in `collection` to generate the criterion by which the value
-is ranked. The `iteratee` is bound to `thisArg` and invoked with three
-arguments: (value, index, collection).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+This method is like `_.max` except that it accepts `iteratee` which is
+invoked for each element in `array` to generate the criterion by which
+the value is ranked. The iteratee is invoked with one argument: (value).
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+1. `array` *(Array)*: The array to iterate over.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(*)*: Returns the maximum value.
+
+#### Example
+```js
+var objects = [{ 'n': 1 }, { 'n': 2 }];
+
+_.maxBy(objects, function(o) { return o.a; });
+// => { 'n': 2 }
+
+// using the `_.property` iteratee shorthand
+_.maxBy(objects, 'n');
+// => { 'n': 2 }
+```
+* * *
+
+
+
+
+
+### `_.mean(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13666 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mean "See the npm package")
+
+Computes the mean of the values in `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to iterate over.
+
+#### Returns
+*(number)*: Returns the mean.
+
+#### Example
+```js
+_.mean([4, 2, 8, 6]);
+// => 5
+```
+* * *
+
+
+
+
+
+### `_.min(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.min "See the npm package")
+
+Computes the minimum value of `array`. If `array` is empty or falsey
+`undefined` is returned.
+
+#### Arguments
+1. `array` *(Array)*: The array to iterate over.
#### Returns
*(*)*: Returns the minimum value.
@@ -5373,21 +5485,7 @@ _.min([4, 2, 8, 6]);
// => 2
_.min([]);
-// => Infinity
-
-var users = [
- { 'user': 'barney', 'age': 36 },
- { 'user': 'fred', 'age': 40 }
-];
-
-_.min(users, function(chr) {
- return chr.age;
-});
-// => { 'user': 'barney', 'age': 36 }
-
-// using the `_.property` callback shorthand
-_.min(users, 'age');
-// => { 'user': 'barney', 'age': 36 }
+// => undefined
```
* * *
@@ -5395,13 +5493,44 @@ _.min(users, 'age');
-### `_.round(n, [precision=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11969 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.round "See the npm package")
+### `_.minBy(array, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13715 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.minby "See the npm package")
-Calculates `n` rounded to `precision`.
+This method is like `_.min` except that it accepts `iteratee` which is
+invoked for each element in `array` to generate the criterion by which
+the value is ranked. The iteratee is invoked with one argument: (value).
#### Arguments
-1. `n` *(number)*: The number to round.
+1. `array` *(Array)*: The array to iterate over.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(*)*: Returns the minimum value.
+
+#### Example
+```js
+var objects = [{ 'n': 1 }, { 'n': 2 }];
+
+_.minBy(objects, function(o) { return o.a; });
+// => { 'n': 1 }
+
+// using the `_.property` iteratee shorthand
+_.minBy(objects, 'n');
+// => { 'n': 1 }
+```
+* * *
+
+
+
+
+
+### `_.round(number, [precision=0])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13741 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.round "See the npm package")
+
+Computes `number` rounded to `precision`.
+
+#### Arguments
+1. `number` *(number)*: The number to round.
2. `[precision=0]` *(number)*: The precision to round to.
#### Returns
@@ -5424,40 +5553,75 @@ _.round(4060, -2);
-### `_.sum(collection, [iteratee], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L12003 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package")
+### `_.subtract(minuend, subtrahend)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13757 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.subtract "See the npm package")
-Gets the sum of the values in `collection`.
+Subtract two numbers.
#### Arguments
-1. `collection` *(Array|Object|string)*: The collection to iterate over.
-2. `[iteratee]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
+1. `minuend` *(number)*: The first number in a subtraction.
+2. `subtrahend` *(number)*: The second number in a subtraction.
+
+#### Returns
+*(number)*: Returns the difference.
+
+#### Example
+```js
+_.subtract(6, 4);
+// => 2
+```
+* * *
+
+
+
+
+
+### `_.sum(array)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13781 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sum "See the npm package")
+
+Computes the sum of the values in `array`.
+
+#### Arguments
+1. `array` *(Array)*: The array to iterate over.
#### Returns
*(number)*: Returns the sum.
#### Example
```js
-_.sum([4, 6]);
-// => 10
+_.sum([4, 2, 8, 6]);
+// => 20
+```
+* * *
-_.sum({ 'a': 4, 'b': 6 });
-// => 10
+
-var objects = [
- { 'n': 4 },
- { 'n': 6 }
-];
+
-_.sum(objects, function(object) {
- return object.n;
-});
-// => 10
+### `_.sumBy(array, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13809 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sumby "See the npm package")
-// using the `_.property` callback shorthand
-_.sum(objects, 'n');
-// => 10
+This method is like `_.sum` except that it accepts `iteratee` which is
+invoked for each element in `array` to generate the value to be summed.
+The iteratee is invoked with one argument: (value).
+
+#### Arguments
+1. `array` *(Array)*: The array to iterate over.
+2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
+
+#### Returns
+*(number)*: Returns the sum.
+
+#### Example
+```js
+var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
+
+_.sumBy(objects, function(o) { return o.n; });
+// => 20
+
+// using the `_.property` iteratee shorthand
+_.sumBy(objects, 'n');
+// => 20
```
* * *
@@ -5471,19 +5635,48 @@ _.sum(objects, 'n');
-### `_.inRange(n, [start=0], end)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10321 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package")
+### `_.clamp(number, [lower], upper)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11575 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clamp "See the npm package")
+
+Clamps `number` within the inclusive `lower` and `upper` bounds.
+
+#### Arguments
+1. `number` *(number)*: The number to clamp.
+2. `[lower]` *(number)*: The lower bound.
+3. `upper` *(number)*: The upper bound.
+
+#### Returns
+*(number)*: Returns the clamped number.
+
+#### Example
+```js
+_.clamp(-10, -5, 5);
+// => -5
+
+_.clamp(10, -5, 5);
+// => 5
+```
+* * *
+
+
+
+
+
+### `_.inRange(number, [start=0], end)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11627 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.inrange "See the npm package")
Checks if `n` is between `start` and up to but not including, `end`. If
`end` is not specified it's set to `start` with `start` then set to `0`.
+If `start` is greater than `end` the params are swapped to support
+negative ranges.
#### Arguments
-1. `n` *(number)*: The number to check.
+1. `number` *(number)*: The number to check.
2. `[start=0]` *(number)*: The start of the range.
3. `end` *(number)*: The end of the range.
#### Returns
-*(boolean)*: Returns `true` if `n` is in the range, else `false`.
+*(boolean)*: Returns `true` if `number` is in the range, else `false`.
#### Example
```js
@@ -5504,6 +5697,9 @@ _.inRange(1.2, 2);
_.inRange(5.2, 4);
// => false
+
+_.inRange(-3, -2, -6);
+// => true
```
* * *
@@ -5511,17 +5707,21 @@ _.inRange(5.2, 4);
-### `_.random([min=0], [max=1], [floating])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10359 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package")
+### `_.random([lower=0], [upper=1], [floating])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11669 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.random "See the npm package")
-Produces a random number between `min` and `max` (inclusive). If only one
-argument is provided a number between `0` and the given number is returned.
-If `floating` is `true`, or either `min` or `max` are floats, a floating-point
-number is returned instead of an integer.
+Produces a random number between the inclusive `lower` and `upper` bounds.
+If only one argument is provided a number between `0` and the given number
+is returned. If `floating` is `true`, or either `lower` or `upper` are floats,
+a floating-point number is returned instead of an integer.
+
+
+**Note:** JavaScript follows the IEEE-754 standard for resolving
+floating-point values which can produce unexpected results.
#### Arguments
-1. `[min=0]` *(number)*: The minimum possible value.
-2. `[max=1]` *(number)*: The maximum possible value.
+1. `[lower=0]` *(number)*: The lower bound.
+2. `[upper=1]` *(number)*: The upper bound.
3. `[floating]` *(boolean)*: Specify returning a floating-point number.
#### Returns
@@ -5553,18 +5753,54 @@ _.random(1.2, 5.2);
-### `_.assign(object, [sources], [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9372 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package")
+### `_.assign(object, [sources])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10369 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assign "See the npm package")
-Assigns own enumerable properties of source object(s) to the destination
-object. Subsequent sources overwrite property assignments of previous sources.
-If `customizer` is provided it's invoked to produce the assigned values.
-The `customizer` is bound to `thisArg` and invoked with five arguments:
-(objectValue, sourceValue, key, object, source).
+Assigns own enumerable properties of source objects to the destination
+object. Source objects are applied from left to right. Subsequent sources
+overwrite property assignments of previous sources.
-**Note:** This method mutates `object` and is based on
-[`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).
+**Note:** This method mutates `object` and is loosely based on
+[`Object.assign`](https://mdn.io/Object/assign).
+
+#### Arguments
+1. `object` *(Object)*: The destination object.
+2. `[sources]` *(...Object)*: The source objects.
+
+#### Returns
+*(Object)*: Returns `object`.
+
+#### Example
+```js
+function Foo() {
+ this.c = 3;
+}
+
+function Bar() {
+ this.e = 5;
+}
+
+Foo.prototype.d = 4;
+Bar.prototype.f = 6;
+
+_.assign({ 'a': 1 }, new Foo, new Bar);
+// => { 'a': 1, 'c': 3, 'e': 5 }
+```
+* * *
+
+
+
+
+
+### `_.assignIn(object, [sources])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10402 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignin "See the npm package")
+
+This method is like `_.assign` except that it iterates over own and
+inherited source properties.
+
+
+**Note:** This method mutates `object`.
#### Aliases
*_.extend*
@@ -5572,24 +5808,128 @@ The `customizer` is bound to `thisArg` and invoked with five arguments:
#### Arguments
1. `object` *(Object)*: The destination object.
2. `[sources]` *(...Object)*: The source objects.
-3. `[customizer]` *(Function)*: The function to customize assigned values.
-4. `[thisArg]` *(*)*: The `this` binding of `customizer`.
#### Returns
*(Object)*: Returns `object`.
#### Example
```js
-_.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
-// => { 'user': 'fred', 'age': 40 }
+function Foo() {
+ this.b = 2;
+}
-// using a customizer callback
-var defaults = _.partialRight(_.assign, function(value, other) {
- return _.isUndefined(value) ? other : value;
-});
+function Bar() {
+ this.d = 4;
+}
-defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
-// => { 'user': 'barney', 'age': 36 }
+Foo.prototype.c = 3;
+Bar.prototype.e = 5;
+
+_.assignIn({ 'a': 1 }, new Foo, new Bar);
+// => { 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5 }
+```
+* * *
+
+
+
+
+
+### `_.assignInWith(object, sources, [customizer])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10433 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assigninwith "See the npm package")
+
+This method is like `_.assignIn` except that it accepts `customizer` which
+is invoked to produce the assigned values. If `customizer` returns `undefined`
+assignment is handled by the method instead. The `customizer` is invoked
+with five arguments: (objValue, srcValue, key, object, source).
+
+
+**Note:** This method mutates `object`.
+
+#### Aliases
+*_.extendWith*
+
+#### Arguments
+1. `object` *(Object)*: The destination object.
+2. `sources` *(...Object)*: The source objects.
+3. `[customizer]` *(Function)*: The function to customize assigned values.
+
+#### Returns
+*(Object)*: Returns `object`.
+
+#### Example
+```js
+function customizer(objValue, srcValue) {
+ return _.isUndefined(objValue) ? srcValue : objValue;
+}
+
+var defaults = _.partialRight(_.assignInWith, customizer);
+
+defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+// => { 'a': 1, 'b': 2 }
+```
+* * *
+
+
+
+
+
+### `_.assignWith(object, sources, [customizer])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10463 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.assignwith "See the npm package")
+
+This method is like `_.assign` except that it accepts `customizer` which
+is invoked to produce the assigned values. If `customizer` returns `undefined`
+assignment is handled by the method instead. The `customizer` is invoked
+with five arguments: (objValue, srcValue, key, object, source).
+
+
+**Note:** This method mutates `object`.
+
+#### Arguments
+1. `object` *(Object)*: The destination object.
+2. `sources` *(...Object)*: The source objects.
+3. `[customizer]` *(Function)*: The function to customize assigned values.
+
+#### Returns
+*(Object)*: Returns `object`.
+
+#### Example
+```js
+function customizer(objValue, srcValue) {
+ return _.isUndefined(objValue) ? srcValue : objValue;
+}
+
+var defaults = _.partialRight(_.assignWith, customizer);
+
+defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+// => { 'a': 1, 'b': 2 }
+```
+* * *
+
+
+
+
+
+### `_.at(object, [paths])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10487 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.at "See the npm package")
+
+Creates an array of values corresponding to `paths` of `object`.
+
+#### Arguments
+1. `object` *(Object)*: The object to iterate over.
+2. `[paths]` *(...(string|string[])*: The property paths of elements to pick, specified individually or in arrays.
+
+#### Returns
+*(Array)*: Returns the new array of picked elements.
+
+#### Example
+```js
+var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
+
+_.at(object, ['a[0].b.c', 'a[1]']);
+// => [3, 4]
+
+_.at(['a', 'b', 'c'], 0, 2);
+// => ['a', 'c']
```
* * *
@@ -5598,11 +5938,10 @@ defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
### `_.create(prototype, [properties])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9412 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10523 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.create "See the npm package")
-Creates an object that inherits from the given `prototype` object. If a
-`properties` object is provided its own enumerable properties are assigned
-to the created object.
+Creates an object that inherits from the `prototype` object. If a `properties`
+object is provided its own enumerable properties are assigned to the created object.
#### Arguments
1. `prototype` *(Object)*: The object to inherit from.
@@ -5640,11 +5979,12 @@ circle instanceof Shape;
### `_.defaults(object, [sources])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9438 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10547 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaults "See the npm package")
-Assigns own enumerable properties of source object(s) to the destination
-object for all destination properties that resolve to `undefined`. Once a
-property is set, additional values of the same property are ignored.
+Assigns own and inherited enumerable properties of source objects to the
+destination object for all destination properties that resolve to `undefined`.
+Source objects are applied from left to right. Once a property is set,
+additional values of the same property are ignored.
**Note:** This method mutates `object`.
@@ -5668,7 +6008,7 @@ _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
### `_.defaultsDeep(object, [sources])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9458 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaultsdeep "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10570 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.defaultsdeep "See the npm package")
This method is like `_.defaults` except that it recursively assigns
default properties.
@@ -5694,30 +6034,15 @@ _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'ag
-### `_.findKey(object, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9508 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package")
+### `_.findKey(object, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10608 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findkey "See the npm package")
This method is like `_.find` except that it returns the key of the first
element `predicate` returns truthy for instead of the element itself.
-
-
-If a property name is provided for `predicate` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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. `object` *(Object)*: The object to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(string|undefined)*: Returns the key of the matched element, else `undefined`.
@@ -5730,20 +6055,18 @@ var users = {
'pebbles': { 'age': 1, 'active': true }
};
-_.findKey(users, function(chr) {
- return chr.age < 40;
-});
+_.findKey(users, function(o) { return o.age < 40; });
// => 'barney' (iteration order is not guaranteed)
-// using the `_.matches` callback shorthand
+// using the `_.matches` iteratee shorthand
_.findKey(users, { 'age': 1, 'active': true });
// => 'pebbles'
-// using the `_.matchesProperty` callback shorthand
-_.findKey(users, 'active', false);
+// using the `_.matchesProperty` iteratee shorthand
+_.findKey(users, ['active', false]);
// => 'fred'
-// using the `_.property` callback shorthand
+// using the `_.property` iteratee shorthand
_.findKey(users, 'active');
// => 'barney'
```
@@ -5753,30 +6076,15 @@ _.findKey(users, 'active');
-### `_.findLastKey(object, [predicate=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9558 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package")
+### `_.findLastKey(object, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10645 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.findlastkey "See the npm package")
This method is like `_.findKey` except that it iterates over elements of
a collection in the opposite order.
-
-
-If a property name is provided for `predicate` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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. `object` *(Object)*: The object to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
#### Returns
*(string|undefined)*: Returns the key of the matched element, else `undefined`.
@@ -5789,20 +6097,18 @@ var users = {
'pebbles': { 'age': 1, 'active': true }
};
-_.findLastKey(users, function(chr) {
- return chr.age < 40;
-});
-// => returns `pebbles` assuming `_.findKey` returns `barney`
+_.findLastKey(users, function(o) { return o.age < 40; });
+// => returns 'pebbles' assuming `_.findKey` returns 'barney'
-// using the `_.matches` callback shorthand
+// using the `_.matches` iteratee shorthand
_.findLastKey(users, { 'age': 36, 'active': true });
// => 'barney'
-// using the `_.matchesProperty` callback shorthand
-_.findLastKey(users, 'active', false);
+// using the `_.matchesProperty` iteratee shorthand
+_.findLastKey(users, ['active', false]);
// => 'fred'
-// using the `_.property` callback shorthand
+// using the `_.property` iteratee shorthand
_.findLastKey(users, 'active');
// => 'pebbles'
```
@@ -5812,18 +6118,17 @@ _.findLastKey(users, 'active');
-### `_.forIn(object, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9587 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package")
+### `_.forIn(object, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10675 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forin "See the npm package")
Iterates over own and inherited enumerable properties of an object invoking
-`iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
-with three arguments: (value, key, object). Iteratee functions may exit
-iteration early by explicitly returning `false`.
+`iteratee` for each property. The iteratee is invoked with three arguments:
+(value, key, object). Iteratee functions may exit iteration early by explicitly
+returning `false`.
#### Arguments
1. `object` *(Object)*: The object to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Object)*: Returns `object`.
@@ -5840,7 +6145,7 @@ Foo.prototype.c = 3;
_.forIn(new Foo, function(value, key) {
console.log(key);
});
-// => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
+// => logs 'a', 'b', then 'c' (iteration order is not guaranteed)
```
* * *
@@ -5848,8 +6153,8 @@ _.forIn(new Foo, function(value, key) {
-### `_.forInRight(object, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9614 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package")
+### `_.forInRight(object, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10703 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forinright "See the npm package")
This method is like `_.forIn` except that it iterates over properties of
`object` in the opposite order.
@@ -5857,7 +6162,6 @@ This method is like `_.forIn` except that it iterates over properties of
#### Arguments
1. `object` *(Object)*: The object to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Object)*: Returns `object`.
@@ -5874,7 +6178,7 @@ Foo.prototype.c = 3;
_.forInRight(new Foo, function(value, key) {
console.log(key);
});
-// => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
+// => logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'
```
* * *
@@ -5882,18 +6186,17 @@ _.forInRight(new Foo, function(value, key) {
-### `_.forOwn(object, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9643 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package")
+### `_.forOwn(object, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10733 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forown "See the npm package")
Iterates over own enumerable properties of an object invoking `iteratee`
-for each property. The `iteratee` is bound to `thisArg` and invoked with
-three arguments: (value, key, object). Iteratee functions may exit iteration
-early by explicitly returning `false`.
+for each property. The iteratee is invoked with three arguments:
+(value, key, object). Iteratee functions may exit iteration early by
+explicitly returning `false`.
#### Arguments
1. `object` *(Object)*: The object to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Object)*: Returns `object`.
@@ -5910,7 +6213,7 @@ Foo.prototype.c = 3;
_.forOwn(new Foo, function(value, key) {
console.log(key);
});
-// => logs 'a' and 'b' (iteration order is not guaranteed)
+// => logs 'a' then 'b' (iteration order is not guaranteed)
```
* * *
@@ -5918,8 +6221,8 @@ _.forOwn(new Foo, function(value, key) {
-### `_.forOwnRight(object, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9670 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package")
+### `_.forOwnRight(object, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10761 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.forownright "See the npm package")
This method is like `_.forOwn` except that it iterates over properties of
`object` in the opposite order.
@@ -5927,7 +6230,6 @@ This method is like `_.forOwn` except that it iterates over properties of
#### Arguments
1. `object` *(Object)*: The object to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Object)*: Returns `object`.
@@ -5944,7 +6246,7 @@ Foo.prototype.c = 3;
_.forOwnRight(new Foo, function(value, key) {
console.log(key);
});
-// => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
+// => logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'
```
* * *
@@ -5953,13 +6255,10 @@ _.forOwnRight(new Foo, function(value, key) {
### `_.functions(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9687 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10786 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functions "See the npm package")
-Creates an array of function property names from all enumerable properties,
-own and inherited, of `object`.
-
-#### Aliases
-*_.methods*
+Creates an array of function property names from own enumerable properties
+of `object`.
#### Arguments
1. `object` *(Object)*: The object to inspect.
@@ -5969,8 +6268,45 @@ own and inherited, of `object`.
#### Example
```js
-_.functions(_);
-// => ['after', 'ary', 'assign', ...]
+function Foo() {
+ this.a = _.constant('a');
+ this.b = _.constant('b');
+}
+
+Foo.prototype.c = _.constant('c');
+
+_.functions(new Foo);
+// => ['a', 'b']
+```
+* * *
+
+
+
+
+
+### `_.functionsIn(object)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10811 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.functionsin "See the npm package")
+
+Creates an array of function property names from own and inherited
+enumerable properties of `object`.
+
+#### Arguments
+1. `object` *(Object)*: The object to inspect.
+
+#### Returns
+*(Array)*: Returns the new array of property names.
+
+#### Example
+```js
+function Foo() {
+ this.a = _.constant('a');
+ this.b = _.constant('b');
+}
+
+Foo.prototype.c = _.constant('c');
+
+_.functionsIn(new Foo);
+// => ['a', 'b', 'c']
```
* * *
@@ -5979,9 +6315,9 @@ _.functions(_);
### `_.get(object, path, [defaultValue])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9715 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10839 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.get "See the npm package")
-Gets the property value at `path` of `object`. If the resolved value is
+Gets the value at `path` of `object`. If the resolved value is
`undefined` the `defaultValue` is used in its place.
#### Arguments
@@ -6012,20 +6348,21 @@ _.get(object, 'a.b.c', 'default');
### `_.has(object, path)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9742 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10870 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.has "See the npm package")
-Checks if `path` is a direct property.
+Checks if `path` is a direct property of `object`.
#### Arguments
1. `object` *(Object)*: The object to query.
2. `path` *(Array|string)*: The path to check.
#### Returns
-*(boolean)*: Returns `true` if `path` is a direct property, else `false`.
+*(boolean)*: Returns `true` if `path` exists, else `false`.
#### Example
```js
var object = { 'a': { 'b': { 'c': 3 } } };
+var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
_.has(object, 'a');
// => true
@@ -6035,6 +6372,9 @@ _.has(object, 'a.b.c');
_.has(object, ['a', 'b', 'c']);
// => true
+
+_.has(other, 'a');
+// => false
```
* * *
@@ -6042,16 +6382,50 @@ _.has(object, ['a', 'b', 'c']);
-### `_.invert(object, [multiValue])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9783 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package")
+### `_.hasIn(object, path)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10899 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.hasin "See the npm package")
+
+Checks if `path` is a direct or inherited property of `object`.
+
+#### Arguments
+1. `object` *(Object)*: The object to query.
+2. `path` *(Array|string)*: The path to check.
+
+#### Returns
+*(boolean)*: Returns `true` if `path` exists, else `false`.
+
+#### Example
+```js
+var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
+
+_.hasIn(object, 'a');
+// => true
+
+_.hasIn(object, 'a.b.c');
+// => true
+
+_.hasIn(object, ['a', 'b', 'c']);
+// => true
+
+_.hasIn(object, 'b');
+// => false
+```
+* * *
+
+
+
+
+
+### `_.invert(object, [multiVal])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10926 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invert "See the npm package")
Creates an object composed of the inverted keys and values of `object`.
If `object` contains duplicate values, subsequent values overwrite property
-assignments of previous values unless `multiValue` is `true`.
+assignments of previous values unless `multiVal` is `true`.
#### Arguments
1. `object` *(Object)*: The object to invert.
-2. `[multiValue]` *(boolean)*: Allow multiple values per key.
+2. `[multiVal]` *(boolean)*: Allow multiple values per key.
#### Returns
*(Object)*: Returns the new inverted object.
@@ -6063,7 +6437,7 @@ var object = { 'a': 1, 'b': 2, 'c': 1 };
_.invert(object);
// => { '1': 'c', '2': 'b' }
-// with `multiValue`
+// with `multiVal`
_.invert(object, true);
// => { '1': ['a', 'c'], '2': ['b'] }
```
@@ -6073,8 +6447,34 @@ _.invert(object, true);
+### `_.invoke(object, path, [args])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10960 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.invoke "See the npm package")
+
+Invokes the method at `path` of `object`.
+
+#### Arguments
+1. `object` *(Object)*: The object to query.
+2. `path` *(Array|string)*: The path of the method to invoke.
+3. `[args]` *(...*)*: The arguments to invoke the method with.
+
+#### Returns
+*(*)*: Returns the result of the invoked method.
+
+#### Example
+```js
+var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
+
+_.invoke(object, 'a[0].b.c.slice', 1, 3);
+// => [2, 3]
+```
+* * *
+
+
+
+
+
### `_.keys(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9837 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L10989 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keys "See the npm package")
Creates an array of the own enumerable property names of `object`.
@@ -6111,7 +6511,7 @@ _.keys('hi');
### `_.keysIn(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9868 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11031 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.keysin "See the npm package")
Creates an array of the own and inherited enumerable property names of `object`.
@@ -6142,8 +6542,8 @@ _.keysIn(new Foo);
-### `_.mapKeys(object, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9945 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package")
+### `_.mapKeys(object, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11069 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapkeys "See the npm package")
The opposite of `_.mapValues`; this method creates an object with the
same values as `object` and keys generated by running each own enumerable
@@ -6152,7 +6552,6 @@ property of `object` through `iteratee`.
#### Arguments
1. `object` *(Object)*: The object to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Object)*: Returns the new mapped object.
@@ -6170,49 +6569,31 @@ _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
-### `_.mapValues(object, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9988 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package")
+### `_.mapValues(object, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11104 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mapvalues "See the npm package")
Creates an object with the same keys as `object` and values generated by
running each own enumerable property of `object` through `iteratee`. The
-iteratee function is bound to `thisArg` and invoked with three arguments:
-(value, key, object).
-
-
-If a property name is provided for `iteratee` the created `_.property`
-style callback returns the property value of the given element.
-
-
-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 `iteratee` the created `_.matches` style
-callback returns `true` for elements that have the properties of the given
-object, else `false`.
+iteratee function is invoked with three arguments: (value, key, object).
#### Arguments
1. `object` *(Object)*: The object to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Object)*: Returns the new mapped object.
#### Example
```js
-_.mapValues({ 'a': 1, 'b': 2 }, function(n) {
- return n * 3;
-});
-// => { 'a': 3, 'b': 6 }
-
var users = {
'fred': { 'user': 'fred', 'age': 40 },
'pebbles': { 'user': 'pebbles', 'age': 1 }
};
-// using the `_.property` callback shorthand
+_.mapValues(users, function(o) { return o.age; });
+// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
+
+// using the `_.property` iteratee shorthand
_.mapValues(users, 'age');
// => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
```
@@ -6222,22 +6603,22 @@ _.mapValues(users, 'age');
-### `_.merge(object, [sources], [customizer], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L9338 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package")
+### `_.merge(object, [sources])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11143 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.merge "See the npm package")
-Recursively merges own enumerable properties of the source object(s), that
-don't resolve to `undefined` into the destination object. Subsequent sources
-overwrite property assignments of previous sources. If `customizer` is
-provided it's invoked to produce the merged values of the destination and
-source properties. If `customizer` returns `undefined` merging is handled
-by the method instead. The `customizer` is bound to `thisArg` and invoked
-with five arguments: (objectValue, sourceValue, key, object, source).
+Recursively merges own and inherited enumerable properties of source
+objects into the destination object, skipping source properties that resolve
+to `undefined`. Array and plain object properties are merged recursively.
+Other objects and value types are overridden by assignment. Source objects
+are applied from left to right. Subsequent sources overwrite property
+assignments of previous sources.
+
+
+**Note:** This method mutates `object`.
#### Arguments
1. `object` *(Object)*: The destination object.
2. `[sources]` *(...Object)*: The source objects.
-3. `[customizer]` *(Function)*: The function to customize assigned values.
-4. `[thisArg]` *(*)*: The `this` binding of `customizer`.
#### Returns
*(Object)*: Returns `object`.
@@ -6254,8 +6635,38 @@ var ages = {
_.merge(users, ages);
// => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
+```
+* * *
+
+
+
+
+
+### `_.mergeWith(object, sources, customizer)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11182 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mergewith "See the npm package")
+
+This method is like `_.merge` except that it accepts `customizer` which
+is invoked to produce the merged values of the destination and source
+properties. If `customizer` returns `undefined` merging is handled by the
+method instead. The `customizer` is invoked with seven arguments:
+(objValue, srcValue, key, object, source, stack).
+
+#### Arguments
+1. `object` *(Object)*: The destination object.
+2. `sources` *(...Object)*: The source objects.
+3. `customizer` *(Function)*: The function to customize assigned values.
+
+#### Returns
+*(Object)*: Returns `object`.
+
+#### Example
+```js
+function customizer(objValue, srcValue) {
+ if (_.isArray(objValue)) {
+ return objValue.concat(srcValue);
+ }
+}
-// using a customizer callback
var object = {
'fruits': ['apple'],
'vegetables': ['beet']
@@ -6266,11 +6677,7 @@ var other = {
'vegetables': ['carrot']
};
-_.merge(object, other, function(a, b) {
- if (_.isArray(a)) {
- return a.concat(b);
- }
-});
+_.mergeWith(object, other, customizer);
// => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
```
* * *
@@ -6279,29 +6686,25 @@ _.merge(object, other, function(a, b) {
-### `_.omit(object, [predicate], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10013 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package")
+### `_.omit(object, [props])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11204 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omit "See the npm package")
The opposite of `_.pick`; this method creates an object composed of the
own and inherited enumerable properties of `object` that are not omitted.
#### Arguments
1. `object` *(Object)*: The source object.
-2. `[predicate]` *(Function|...(string|string[])*: The function invoked per iteration or property names to omit, specified as individual property names or arrays of property names.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
+2. `[props]` *(...(string|string[])*: The property names to omit, specified individually or in arrays..
#### Returns
*(Object)*: Returns the new object.
#### Example
```js
-var object = { 'user': 'fred', 'age': 40 };
+var object = { 'a': 1, 'b': '2', 'c': 3 };
-_.omit(object, 'age');
-// => { 'user': 'fred' }
-
-_.omit(object, _.isNumber);
-// => { 'user': 'fred' }
+_.omit(object, ['a', 'c']);
+// => { 'b': '2' }
```
* * *
@@ -6309,55 +6712,77 @@ _.omit(object, _.isNumber);
-### `_.pairs(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10041 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pairs "See the npm package")
+### `_.omitBy(object, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11230 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.omitby "See the npm package")
-Creates a two dimensional array of the key-value pairs for `object`,
-e.g. `[[key1, value1], [key2, value2]]`.
-
-#### Arguments
-1. `object` *(Object)*: The object to query.
-
-#### Returns
-*(Array)*: Returns the new array of key-value pairs.
-
-#### Example
-```js
-_.pairs({ 'barney': 36, 'fred': 40 });
-// => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
-```
-* * *
-
-
-
-
-
-### `_.pick(object, [predicate], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10082 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package")
-
-Creates an object composed of the picked `object` properties. Property
-names may be specified as individual arguments or as arrays of property
-names. If `predicate` is provided it's invoked for each property of `object`
-picking the properties `predicate` returns truthy for. The predicate is
-bound to `thisArg` and invoked with three arguments: (value, key, object).
+The opposite of `_.pickBy`; this method creates an object composed of the
+own and inherited enumerable properties of `object` that `predicate`
+doesn't return truthy for.
#### Arguments
1. `object` *(Object)*: The source object.
-2. `[predicate]` *(Function|...(string|string[])*: The function invoked per iteration or property names to pick, specified as individual property names or arrays of property names.
-3. `[thisArg]` *(*)*: The `this` binding of `predicate`.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per property.
#### Returns
*(Object)*: Returns the new object.
#### Example
```js
-var object = { 'user': 'fred', 'age': 40 };
+var object = { 'a': 1, 'b': '2', 'c': 3 };
-_.pick(object, 'user');
-// => { 'user': 'fred' }
+_.omitBy(object, _.isNumber);
+// => { 'b': '2' }
+```
+* * *
-_.pick(object, _.isString);
-// => { 'user': 'fred' }
+
+
+
+
+### `_.pick(object, [props])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11254 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pick "See the npm package")
+
+Creates an object composed of the picked `object` properties.
+
+#### Arguments
+1. `object` *(Object)*: The source object.
+2. `[props]` *(...(string|string[])*: The property names to pick, specified individually or in arrays.
+
+#### Returns
+*(Object)*: Returns the new object.
+
+#### Example
+```js
+var object = { 'a': 1, 'b': '2', 'c': 3 };
+
+_.pick(object, ['a', 'c']);
+// => { 'a': 1, 'c': 3 }
+```
+* * *
+
+
+
+
+
+### `_.pickBy(object, [predicate=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11275 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pickby "See the npm package")
+
+Creates an object composed of the `object` properties `predicate` returns
+truthy for. The predicate is invoked with one argument: (value).
+
+#### Arguments
+1. `object` *(Object)*: The source object.
+2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per property.
+
+#### Returns
+*(Object)*: Returns the new object.
+
+#### Example
+```js
+var object = { 'a': 1, 'b': '2', 'c': 3 };
+
+_.pickBy(object, _.isNumber);
+// => { 'a': 1, 'c': 3 }
```
* * *
@@ -6366,7 +6791,7 @@ _.pick(object, _.isString);
### `_.result(object, path, [defaultValue])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10119 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11307 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.result "See the npm package")
This method is like `_.get` except that if the resolved value is a function
it's invoked with the `this` binding of its parent object and its result
@@ -6390,10 +6815,10 @@ _.result(object, 'a[0].b.c1');
_.result(object, 'a[0].b.c2');
// => 4
-_.result(object, 'a.b.c', 'default');
+_.result(object, 'a[0].b.c3', 'default');
// => 'default'
-_.result(object, 'a.b.c', _.constant('default'));
+_.result(object, 'a[0].b.c3', _.constant('default'));
// => 'default'
```
* * *
@@ -6403,13 +6828,15 @@ _.result(object, 'a.b.c', _.constant('default'));
### `_.set(object, path, value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10155 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11346 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.set "See the npm package")
-Sets the property value of `path` on `object`. If a portion of `path`
-does not exist it's created.
+Sets the value at `path` of `object`. If a portion of `path` doesn't exist
+it's created. Arrays are created for missing index properties while objects
+are created for all other missing properties. Use `_.setWith` to customize
+`path` creation.
#### Arguments
-1. `object` *(Object)*: The object to augment.
+1. `object` *(Object)*: The object to modify.
2. `path` *(Array|string)*: The path of the property to set.
3. `value` *(*)*: The value to set.
@@ -6434,21 +6861,106 @@ console.log(object.x[0].y.z);
-### `_.transform(object, [iteratee=_.identity], [accumulator], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10210 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package")
+### `_.setWith(object, path, value, [customizer])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11369 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.setwith "See the npm package")
+
+This method is like `_.set` except that it accepts `customizer` which is
+invoked to produce the objects of `path`. If `customizer` returns `undefined`
+path creation is handled by the method instead. The `customizer` is invoked
+with three arguments: (nsValue, key, nsObject).
+
+#### Arguments
+1. `object` *(Object)*: The object to modify.
+2. `path` *(Array|string)*: The path of the property to set.
+3. `value` *(*)*: The value to set.
+4. `[customizer]` *(Function)*: The function to customize assigned values.
+
+#### Returns
+*(Object)*: Returns `object`.
+
+#### Example
+```js
+_.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object);
+// => { '0': { '1': { '2': 3 }, 'length': 2 } }
+```
+* * *
+
+
+
+
+
+### `_.toPairs(object)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11394 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairs "See the npm package")
+
+Creates an array of own enumerable key-value pairs for `object`.
+
+#### Arguments
+1. `object` *(Object)*: The object to query.
+
+#### Returns
+*(Array)*: Returns the new array of key-value pairs.
+
+#### Example
+```js
+function Foo() {
+ this.a = 1;
+ this.b = 2;
+}
+
+Foo.prototype.c = 3;
+
+_.toPairs(new Foo);
+// => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
+```
+* * *
+
+
+
+
+
+### `_.toPairsIn(object)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11418 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topairsin "See the npm package")
+
+Creates an array of own and inherited enumerable key-value pairs for `object`.
+
+#### Arguments
+1. `object` *(Object)*: The object to query.
+
+#### Returns
+*(Array)*: Returns the new array of key-value pairs.
+
+#### Example
+```js
+function Foo() {
+ this.a = 1;
+ this.b = 2;
+}
+
+Foo.prototype.c = 3;
+
+_.toPairsIn(new Foo);
+// => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed)
+```
+* * *
+
+
+
+
+
+### `_.transform(object, [iteratee=_.identity], [accumulator])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11450 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.transform "See the npm package")
An alternative to `_.reduce`; this method transforms `object` to a new
`accumulator` object which is the result of running each of its own enumerable
properties through `iteratee`, with each invocation potentially mutating
-the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
-with four arguments: (accumulator, value, key, object). Iteratee functions
-may exit iteration early by explicitly returning `false`.
+the `accumulator` object. The iteratee is invoked with four arguments:
+(accumulator, value, key, object). Iteratee functions may exit iteration
+early by explicitly returning `false`.
#### Arguments
1. `object` *(Array|Object)*: The object to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
3. `[accumulator]` *(*)*: The custom accumulator value.
-4. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(*)*: Returns the accumulated value.
@@ -6461,10 +6973,43 @@ _.transform([2, 3, 4], function(result, n) {
});
// => [4, 9]
-_.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {
- result[key] = n * 3;
+_.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
+ (result[value] || (result[value] = [])).push(key);
});
-// => { 'a': 3, 'b': 6 }
+// => { '1': ['a', 'c'], '2': ['b'] }
+```
+* * *
+
+
+
+
+
+### `_.unset(object, path)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11496 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unset "See the npm package")
+
+Removes the property at `path` of `object`.
+
+#### Arguments
+1. `object` *(Object)*: The object to modify.
+2. `path` *(Array|string)*: The path of the property to unset.
+
+#### Returns
+*(boolean)*: Returns `true` if the property is deleted, else `false`.
+
+#### Example
+```js
+var object = { 'a': [{ 'b': { 'c': 7 } }] };
+_.unset(object, 'a[0].b.c');
+// => true
+
+console.log(object);
+// => { 'a': [{ 'b': {} }] };
+
+_.unset(object, 'a[0].b.c');
+// => true
+
+console.log(object);
+// => { 'a': [{ 'b': {} }] };
```
* * *
@@ -6473,7 +7018,7 @@ _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {
### `_.values(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10257 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11525 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.values "See the npm package")
Creates an array of the own enumerable property values of `object`.
@@ -6508,10 +7053,9 @@ _.values('hi');
### `_.valuesIn(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10284 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11551 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.valuesin "See the npm package")
-Creates an array of the own and inherited enumerable property values
-of `object`.
+Creates an array of the own and inherited enumerable property values of `object`.
**Note:** Non-object values are coerced to objects.
@@ -6542,12 +7086,494 @@ _.valuesIn(new Foo);
+## `“Seq” Methods`
+
+
+
+### `_(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1439 "View in source") [Ⓣ][1]
+
+Creates a `lodash` object which wraps `value` to enable implicit method
+chaining. Methods that operate on and return arrays, collections, and
+functions can be chained together. Methods that retrieve a single value or
+may return a primitive value will automatically end the chain sequence and
+return the unwrapped value. Otherwise, the value must be unwrapped with
+`_#value`.
+
+
+Explicit chaining, which must be unwrapped with `_#value` in all cases,
+may be enabled using `_.chain`.
+
+
+The execution of chained methods is lazy, that is, it's deferred until
+`_#value` is implicitly or explicitly called.
+
+
+Lazy evaluation allows several methods to support shortcut fusion. Shortcut
+fusion is an optimization to merge iteratee calls; this avoids the creation
+of intermediate arrays and can greatly reduce the number of iteratee executions.
+Sections of a chain sequence qualify for shortcut fusion if the section is
+applied to an array of at least two hundred elements and any iteratees
+accept only one argument. The heuristic for whether a section qualifies
+for shortcut fusion is subject to change.
+
+
+Chaining is supported in custom builds as long as the `_#value` method is
+directly or indirectly included in the build.
+
+
+In addition to lodash methods, wrappers have `Array` and `String` methods.
+
+
+The wrapper `Array` methods are:
+`concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
+
+
+The wrapper `String` methods are:
+`replace` and `split`
+
+
+The wrapper methods that support shortcut fusion are:
+`at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
+`findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
+`tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
+
+
+The chainable wrapper methods are:
+`after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`,
+`at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`,
+`compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`,
+`debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`,
+`differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`,
+`dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`,
+`flowRight`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
+`forOwnRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`,
+`intersection`, `intersectionBy`, `intersectionWith`, invert`, `invokeMap`,
+`iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`,
+`matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`,
+`methodOf`, `mixin`, `negate`, `nthArg`, `omit`, `omitBy`, `once`, `orderBy`,
+`over`, `overArgs`, `overEvery`, `overSome`, `partial`, `partialRight`,
+`partition`, `pick`, `pickBy`, `plant`, `property`, `propertyOf`, `pull`,
+`pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`,
+`reject`, `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`,
+`shuffle`, `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`,
+`takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`,
+`toArray`, `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`,
+`unary`, `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`,
+`unset`, `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `without`,
+`wrap`, `xor`, `xorBy`, `xorWith`, `zip`, `zipObject`, and `zipWith`
+
+
+The wrapper methods that are **not** chainable by default are:
+`add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
+`cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`,
+`escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
+`findLast`, `findLastIndex`, `findLastKey`, `floor`, `get`, `gt`, `gte`,
+`has`, `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`,
+`invoke`, `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`,
+`isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`,
+`isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`,
+`isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
+`isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,
+`isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, `last`,
+`lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`,
+`mean`, `min`, `minBy`, `noConflict`, `noop`, `now`, `pad`, `padEnd`,
+`padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`,
+`result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`,
+`some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`,
+`startCase`, `startsWith`, `subtract`, `sum`, sumBy`, `template`, `times`,
+`toLower`, `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, toString`,
+`toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`,
+`upperCase`, `upperFirst`, `value`, and `words`
+
+#### Arguments
+1. `value` *(*)*: The value to wrap in a `lodash` instance.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+function square(n) {
+ return n * n;
+}
+
+var wrapped = _([1, 2, 3]);
+
+// returns an unwrapped value
+wrapped.reduce(_.add);
+// => 6
+
+// returns a wrapped value
+var squares = wrapped.map(square);
+
+_.isArray(squares);
+// => false
+
+_.isArray(squares.value());
+// => true
+```
+* * *
+
+
+
+
+
+### `_.chain(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6956 "View in source") [Ⓣ][1]
+
+Creates a `lodash` object that wraps `value` with explicit method chaining enabled.
+The result of such method chaining must be unwrapped with `_#value`.
+
+#### Arguments
+1. `value` *(*)*: The value to wrap.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+var users = [
+ { 'user': 'barney', 'age': 36 },
+ { 'user': 'fred', 'age': 40 },
+ { 'user': 'pebbles', 'age': 1 }
+];
+
+var youngest = _
+ .chain(users)
+ .sortBy('age')
+ .map(function(o) {
+ return o.user + ' is ' + o.age;
+ })
+ .head()
+ .value();
+// => 'pebbles is 1'
+```
+* * *
+
+
+
+
+
+### `_.tap(value, interceptor)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L6984 "View in source") [Ⓣ][1]
+
+This method invokes `interceptor` and returns `value`. The interceptor is
+invoked with one argument; (value). The purpose of this method is to "tap into"
+a method chain in order to perform operations on intermediate results within
+the chain.
+
+#### Arguments
+1. `value` *(*)*: The value to provide to `interceptor`.
+2. `interceptor` *(Function)*: The function to invoke.
+
+#### Returns
+*(*)*: Returns `value`.
+
+#### Example
+```js
+_([1, 2, 3])
+ .tap(function(array) {
+ array.pop();
+ })
+ .reverse()
+ .value();
+// => [2, 1]
+```
+* * *
+
+
+
+
+
+### `_.thru(value, interceptor)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7009 "View in source") [Ⓣ][1]
+
+This method is like `_.tap` except that it returns the result of `interceptor`.
+
+#### Arguments
+1. `value` *(*)*: The value to provide to `interceptor`.
+2. `interceptor` *(Function)*: The function to invoke.
+
+#### Returns
+*(*)*: Returns the result of `interceptor`.
+
+#### Example
+```js
+_(' abc ')
+ .chain()
+ .trim()
+ .thru(function(value) {
+ return [value];
+ })
+ .value();
+// => ['abc']
+```
+* * *
+
+
+
+
+
+### `_.wrapperFlatMap([iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7128 "View in source") [Ⓣ][1]
+
+This method is the wrapper version of `_.flatMap`.
+
+#### Arguments
+1. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+function duplicate(n) {
+ return [n, n];
+}
+
+_([1, 2]).flatMap(duplicate).value();
+// => [1, 1, 2, 2]
+```
+* * *
+
+
+
+
+
+### `_.prototype[Symbol.iterator]()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7180 "View in source") [Ⓣ][1]
+
+Enables the wrapper to be iterable.
+
+#### Returns
+*(Object)*: Returns the wrapper object.
+
+#### Example
+```js
+var wrapped = _([1, 2]);
+
+wrapped[Symbol.iterator]() === wrapped;
+// => true
+
+Array.from(wrapped);
+// => [1, 2]
+```
+* * *
+
+
+
+
+
+### `_.prototype.at([paths])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7032 "View in source") [Ⓣ][1]
+
+This method is the wrapper version of `_.at`.
+
+#### Arguments
+1. `[paths]` *(...(string|string[])*: The property paths of elements to pick, specified individually or in arrays.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
+
+_(object).at(['a[0].b.c', 'a[1]']).value();
+// => [3, 4]
+
+_(['a', 'b', 'c']).at(0, 2).value();
+// => ['a', 'c']
+```
+* * *
+
+
+
+
+
+### `_.prototype.chain()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7078 "View in source") [Ⓣ][1]
+
+Enables explicit method chaining on the wrapper object.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+var users = [
+ { 'user': 'barney', 'age': 36 },
+ { 'user': 'fred', 'age': 40 }
+];
+
+// without explicit chaining
+_(users).head();
+// => { 'user': 'barney', 'age': 36 }
+
+// with explicit chaining
+_(users)
+ .chain()
+ .head()
+ .pick('user')
+ .value();
+// => { 'user': 'barney' }
+```
+* * *
+
+
+
+
+
+### `_.prototype.commit()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7107 "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 wrapped = _(array).push(3);
+
+console.log(array);
+// => [1, 2]
+
+wrapped = wrapped.commit();
+console.log(array);
+// => [1, 2, 3]
+
+wrapped.last();
+// => 3
+
+console.log(array);
+// => [1, 2, 3]
+```
+* * *
+
+
+
+
+
+### `_.prototype.next()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7153 "View in source") [Ⓣ][1]
+
+Gets the next value on a wrapped object following the
+[iterator protocol](https://mdn.io/iteration_protocols#iterator).
+
+#### Returns
+*(Object)*: Returns the next iterator value.
+
+#### Example
+```js
+var wrapped = _([1, 2]);
+
+wrapped.next();
+// => { 'done': false, 'value': 1 }
+
+wrapped.next();
+// => { 'done': false, 'value': 2 }
+
+wrapped.next();
+// => { 'done': true, 'value': undefined }
+```
+* * *
+
+
+
+
+
+### `_.prototype.plant(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7207 "View in source") [Ⓣ][1]
+
+Creates a clone of the chained sequence planting `value` as the wrapped value.
+
+#### Arguments
+1. `value` *(*)*: The value to plant.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+function square(n) {
+ return n * n;
+}
+
+var wrapped = _([1, 2]).map(square);
+var other = wrapped.plant([3, 4]);
+
+other.value();
+// => [9, 16]
+
+wrapped.value();
+// => [1, 4]
+```
+* * *
+
+
+
+
+
+### `_.prototype.reverse()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7246 "View in source") [Ⓣ][1]
+
+This method is the wrapper version of `_.reverse`.
+
+
+**Note:** This method mutates the wrapped array.
+
+#### Returns
+*(Object)*: Returns the new `lodash` wrapper instance.
+
+#### Example
+```js
+var array = [1, 2, 3];
+
+_(array).reverse().value()
+// => [3, 2, 1]
+
+console.log(array);
+// => [3, 2, 1]
+```
+* * *
+
+
+
+
+
+### `_.prototype.value()`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L7273 "View in source") [Ⓣ][1]
+
+Executes the chained sequence to extract the unwrapped value.
+
+#### Aliases
+*_.prototype.run, _.prototype.toJSON, _.prototype.valueOf*
+
+#### Returns
+*(*)*: Returns the resolved unwrapped value.
+
+#### Example
+```js
+_([1, 2, 3]).value();
+// => [1, 2, 3]
+```
+* * *
+
+
+
+
+
+
+
## `“String” Methods`
### `_.camelCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10415 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11729 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.camelcase "See the npm package")
Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
@@ -6575,9 +7601,10 @@ _.camelCase('__foo_bar__');
### `_.capitalize([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10433 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11748 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.capitalize "See the npm package")
-Capitalizes the first character of `string`.
+Converts the first character of `string` to upper case and the remaining
+to lower case.
#### Arguments
1. `[string='']` *(string)*: The string to capitalize.
@@ -6587,7 +7614,7 @@ Capitalizes the first character of `string`.
#### Example
```js
-_.capitalize('fred');
+_.capitalize('FRED');
// => 'Fred'
```
* * *
@@ -6597,7 +7624,7 @@ _.capitalize('fred');
### `_.deburr([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10452 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11766 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.deburr "See the npm package")
Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
@@ -6620,7 +7647,7 @@ _.deburr('déjà vu');
### `_.endsWith([string=''], [target], [position=string.length])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10478 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11792 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.endswith "See the npm package")
Checks if `string` ends with the given target string.
@@ -6650,14 +7677,14 @@ _.endsWith('abc', 'b', 2);
### `_.escape([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10523 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11837 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escape "See the npm package")
-Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to
+Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to
their corresponding HTML entities.
-**Note:** No other characters are escaped. To escape additional characters
-use a third-party library like [_he_](https://mths.be/he).
+**Note:** No other characters are escaped. To escape additional
+characters use a third-party library like [_he_](https://mths.be/he).
Though the ">" character is escaped for symmetry, characters like
@@ -6667,8 +7694,8 @@ See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersan
(under "semi-related fun fact") for more details.
-Backticks are escaped because in Internet Explorer < 9, they can break out
-of attribute values or HTML comments. See [#59](https://html5sec.org/#59),
+Backticks are escaped because in IE < 9, they can break out of
+attribute values or HTML comments. See [#59](https://html5sec.org/#59),
[#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
[#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
for more details.
@@ -6695,10 +7722,10 @@ _.escape('fred, barney, & pebbles');
### `_.escapeRegExp([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10545 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11858 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.escaperegexp "See the npm package")
-Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
-"*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
+Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
+"?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
#### Arguments
1. `[string='']` *(string)*: The string to escape.
@@ -6709,7 +7736,7 @@ Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
#### Example
```js
_.escapeRegExp('[lodash](https://lodash.com/)');
-// => '\[lodash\]\(https:\/\/lodash\.com\/\)'
+// => '\[lodash\]\(https://lodash\.com/\)'
```
* * *
@@ -6718,7 +7745,7 @@ _.escapeRegExp('[lodash](https://lodash.com/)');
### `_.kebabCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11884 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.kebabcase "See the npm package")
Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
@@ -6745,8 +7772,61 @@ _.kebabCase('__foo_bar__');
+### `_.lowerCase([string=''])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11907 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowercase "See the npm package")
+
+Converts `string`, as space separated words, to lower case.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to convert.
+
+#### Returns
+*(string)*: Returns the lower cased string.
+
+#### Example
+```js
+_.lowerCase('--Foo-Bar');
+// => 'foo bar'
+
+_.lowerCase('fooBar');
+// => 'foo bar'
+
+_.lowerCase('__FOO_BAR__');
+// => 'foo bar'
+```
+* * *
+
+
+
+
+
+### `_.lowerFirst([string=''])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11927 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.lowerfirst "See the npm package")
+
+Converts the first character of `string` to lower case.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to convert.
+
+#### Returns
+*(string)*: Returns the converted string.
+
+#### Example
+```js
+_.lowerFirst('Fred');
+// => 'fred'
+
+_.lowerFirst('FRED');
+// => 'fRED'
+```
+* * *
+
+
+
+
+
### `_.pad([string=''], [length=0], [chars=' '])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10597 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11969 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pad "See the npm package")
Pads `string` on the left and right sides if it's shorter than `length`.
Padding characters are truncated if they can't be evenly divided by `length`.
@@ -6776,39 +7856,8 @@ _.pad('abc', 3);
-### `_.padLeft([string=''], [length=0], [chars=' '])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10635 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padleft "See the npm package")
-
-Pads `string` on the left side if it's shorter than `length`. Padding
-characters are truncated if they exceed `length`.
-
-#### Arguments
-1. `[string='']` *(string)*: The string to pad.
-2. `[length=0]` *(number)*: The padding length.
-3. `[chars=' ']` *(string)*: The string used as padding.
-
-#### Returns
-*(string)*: Returns the padded string.
-
-#### Example
-```js
-_.padLeft('abc', 6);
-// => ' abc'
-
-_.padLeft('abc', 6, '_-');
-// => '_-_abc'
-
-_.padLeft('abc', 3);
-// => 'abc'
-```
-* * *
-
-
-
-
-
-### `_.padRight([string=''], [length=0], [chars=' '])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10659 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padright "See the npm package")
+### `_.padEnd([string=''], [length=0], [chars=' '])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12006 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padend "See the npm package")
Pads `string` on the right side if it's shorter than `length`. Padding
characters are truncated if they exceed `length`.
@@ -6823,13 +7872,44 @@ characters are truncated if they exceed `length`.
#### Example
```js
-_.padRight('abc', 6);
+_.padEnd('abc', 6);
// => 'abc '
-_.padRight('abc', 6, '_-');
+_.padEnd('abc', 6, '_-');
// => 'abc_-_'
-_.padRight('abc', 3);
+_.padEnd('abc', 3);
+// => 'abc'
+```
+* * *
+
+
+
+
+
+### `_.padStart([string=''], [length=0], [chars=' '])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12033 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.padstart "See the npm package")
+
+Pads `string` on the left side if it's shorter than `length`. Padding
+characters are truncated if they exceed `length`.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to pad.
+2. `[length=0]` *(number)*: The padding length.
+3. `[chars=' ']` *(string)*: The string used as padding.
+
+#### Returns
+*(string)*: Returns the padded string.
+
+#### Example
+```js
+_.padStart('abc', 6);
+// => ' abc'
+
+_.padStart('abc', 6, '_-');
+// => '_-_abc'
+
+_.padStart('abc', 3);
// => 'abc'
```
* * *
@@ -6839,7 +7919,7 @@ _.padRight('abc', 3);
### `_.parseInt(string, [radix])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10684 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12061 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.parseint "See the npm package")
Converts `string` to an integer of the specified radix. If `radix` is
`undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
@@ -6871,7 +7951,7 @@ _.map(['6', '08', '10'], _.parseInt);
### `_.repeat([string=''], [n=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10717 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12093 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.repeat "See the npm package")
Repeats the given string `n` times.
@@ -6899,8 +7979,35 @@ _.repeat('abc', 0);
+### `_.replace([string=''], pattern, replacement)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12131 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.replace "See the npm package")
+
+Replaces matches for `pattern` in `string` with `replacement`.
+
+
+**Note:** This method is based on [`String#replace`](https://mdn.io/String/replace).
+
+#### Arguments
+1. `[string='']` *(string)*: The string to modify.
+2. `pattern` *(RegExp|string)*: The pattern to replace.
+3. `replacement` *(Function|string)*: The match replacement.
+
+#### Returns
+*(string)*: Returns the modified string.
+
+#### Example
+```js
+_.replace('Hi Fred', 'Fred', 'Barney');
+// => 'Hi Barney'
+```
+* * *
+
+
+
+
+
### `_.snakeCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10756 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12157 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.snakecase "See the npm package")
Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
@@ -6927,8 +8034,35 @@ _.snakeCase('--foo-bar');
+### `_.split([string=''], separator, [limit])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12178 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.split "See the npm package")
+
+Splits `string` by `separator`.
+
+
+**Note:** This method is based on [`String#split`](https://mdn.io/String/split).
+
+#### Arguments
+1. `[string='']` *(string)*: The string to split.
+2. `separator` *(RegExp|string)*: The separator pattern to split by.
+3. `[limit]` *(number)*: The length to truncate results to.
+
+#### Returns
+*(Array)*: Returns the new array of string segments.
+
+#### Example
+```js
+_.split('a-b-c', '-', 2);
+// => ['a', 'b']
+```
+* * *
+
+
+
+
+
### `_.startCase([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10779 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12201 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startcase "See the npm package")
Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
@@ -6956,7 +8090,7 @@ _.startCase('__foo_bar__');
### `_.startsWith([string=''], [target], [position=0])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10804 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12226 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.startswith "See the npm package")
Checks if `string` starts with the given target string.
@@ -6986,7 +8120,7 @@ _.startsWith('abc', 'b', 1);
### `_.template([string=''], [options])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L10909 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12328 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.template "See the npm package")
Creates a compiled template function that can interpolate data properties
in "interpolate" delimiters, HTML-escape interpolated data properties in
@@ -7092,8 +8226,64 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+### `_.toLower([string=''])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12453 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.tolower "See the npm package")
+
+Converts `string`, as a whole, to lower case.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to convert.
+
+#### Returns
+*(string)*: Returns the lower cased string.
+
+#### Example
+```js
+_.toLower('--Foo-Bar');
+// => '--foo-bar'
+
+_.toLower('fooBar');
+// => 'foobar'
+
+_.toLower('__FOO_BAR__');
+// => '__foo_bar__'
+```
+* * *
+
+
+
+
+
+### `_.toUpper([string=''])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12476 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.toupper "See the npm package")
+
+Converts `string`, as a whole, to upper case.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to convert.
+
+#### Returns
+*(string)*: Returns the upper cased string.
+
+#### Example
+```js
+_.toUpper('--foo-bar');
+// => '--FOO-BAR'
+
+_.toUpper('fooBar');
+// => 'FOOBAR'
+
+_.toUpper('__foo_bar__');
+// => '__FOO_BAR__'
+```
+* * *
+
+
+
+
+
### `_.trim([string=''], [chars=whitespace])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11036 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12501 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trim "See the npm package")
Removes leading and trailing whitespace or specified characters from `string`.
@@ -7121,34 +8311,8 @@ _.map([' foo ', ' bar '], _.trim);
-### `_.trimLeft([string=''], [chars=whitespace])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11067 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimleft "See the npm package")
-
-Removes leading whitespace or specified characters from `string`.
-
-#### Arguments
-1. `[string='']` *(string)*: The string to trim.
-2. `[chars=whitespace]` *(string)*: The characters to trim.
-
-#### Returns
-*(string)*: Returns the trimmed string.
-
-#### Example
-```js
-_.trimLeft(' abc ');
-// => 'abc '
-
-_.trimLeft('-_-abc-_-', '_-');
-// => 'abc-_-'
-```
-* * *
-
-
-
-
-
-### `_.trimRight([string=''], [chars=whitespace])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11097 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimright "See the npm package")
+### `_.trimEnd([string=''], [chars=whitespace])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12537 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimend "See the npm package")
Removes trailing whitespace or specified characters from `string`.
@@ -7161,10 +8325,10 @@ Removes trailing whitespace or specified characters from `string`.
#### Example
```js
-_.trimRight(' abc ');
+_.trimEnd(' abc ');
// => ' abc'
-_.trimRight('-_-abc-_-', '_-');
+_.trimEnd('-_-abc-_-', '_-');
// => '-_-abc'
```
* * *
@@ -7173,8 +8337,34 @@ _.trimRight('-_-abc-_-', '_-');
-### `_.trunc([string=''], [options], [options.length=30], [options.omission='...'], [options.separator])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11149 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trunc "See the npm package")
+### `_.trimStart([string=''], [chars=whitespace])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12571 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.trimstart "See the npm package")
+
+Removes leading whitespace or specified characters from `string`.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to trim.
+2. `[chars=whitespace]` *(string)*: The characters to trim.
+
+#### Returns
+*(string)*: Returns the trimmed string.
+
+#### Example
+```js
+_.trimStart(' abc ');
+// => 'abc '
+
+_.trimStart('-_-abc-_-', '_-');
+// => 'abc-_-'
+```
+* * *
+
+
+
+
+
+### `_.truncate([string=''], [options])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12623 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.truncate "See the npm package")
Truncates `string` if it's longer than the given maximum string length.
The last characters of the truncated string are replaced with the omission
@@ -7182,7 +8372,7 @@ string which defaults to "...".
#### Arguments
1. `[string='']` *(string)*: The string to truncate.
-2. `[options]` *(Object|number)*: The options object or maximum string length.
+2. `[options]` *(Object)*: The options object.
3. `[options.length=30]` *(number)*: The maximum string length.
4. `[options.omission='...']` *(string)*: The string to indicate text is omitted.
5. `[options.separator]` *(RegExp|string)*: The separator pattern to truncate to.
@@ -7192,25 +8382,22 @@ string which defaults to "...".
#### Example
```js
-_.trunc('hi-diddly-ho there, neighborino');
+_.truncate('hi-diddly-ho there, neighborino');
// => 'hi-diddly-ho there, neighbo...'
-_.trunc('hi-diddly-ho there, neighborino', 24);
-// => 'hi-diddly-ho there, n...'
-
-_.trunc('hi-diddly-ho there, neighborino', {
+_.truncate('hi-diddly-ho there, neighborino', {
'length': 24,
'separator': ' '
});
// => 'hi-diddly-ho there,...'
-_.trunc('hi-diddly-ho there, neighborino', {
+_.truncate('hi-diddly-ho there, neighborino', {
'length': 24,
'separator': /,? +/
});
// => 'hi-diddly-ho there...'
-_.trunc('hi-diddly-ho there, neighborino', {
+_.truncate('hi-diddly-ho there, neighborino', {
'omission': ' [...]'
});
// => 'hi-diddly-ho there, neig [...]'
@@ -7222,7 +8409,7 @@ _.trunc('hi-diddly-ho there, neighborino', {
### `_.unescape([string=''])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11219 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12697 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unescape "See the npm package")
The inverse of `_.escape`; this method converts the HTML entities
`&`, `<`, `>`, `"`, `'`, and ``` in `string` to their
@@ -7249,8 +8436,61 @@ _.unescape('fred, barney, & pebbles');
+### `_.upperCase([string=''])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12723 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uppercase "See the npm package")
+
+Converts `string`, as space separated words, to upper case.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to convert.
+
+#### Returns
+*(string)*: Returns the upper cased string.
+
+#### Example
+```js
+_.upperCase('--foo-bar');
+// => 'FOO BAR'
+
+_.upperCase('fooBar');
+// => 'FOO BAR'
+
+_.upperCase('__foo_bar__');
+// => 'FOO BAR'
+```
+* * *
+
+
+
+
+
+### `_.upperFirst([string=''])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L11945 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.upperfirst "See the npm package")
+
+Converts the first character of `string` to upper case.
+
+#### Arguments
+1. `[string='']` *(string)*: The string to convert.
+
+#### Returns
+*(string)*: Returns the converted string.
+
+#### Example
+```js
+_.upperFirst('fred');
+// => 'Fred'
+
+_.upperFirst('FRED');
+// => 'FRED'
+```
+* * *
+
+
+
+
+
### `_.words([string=''], [pattern])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11244 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12745 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.words "See the npm package")
Splits `string` into an array of its words.
@@ -7277,12 +8517,12 @@ _.words('fred, barney, & pebbles', /[^, ]+/g);
-## `“Utility” Methods`
+## `“Util” Methods`
### `_.attempt(func)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11274 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12777 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.attempt "See the npm package")
Attempts to invoke `func`, returning either the result or the caught error
object. Any additional arguments are provided to `func` when it's invoked.
@@ -7310,24 +8550,90 @@ if (_.isError(elements)) {
-### `_.callback([func=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11320 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.callback "See the npm package")
+### `_.bindAll(object, methodNames)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12811 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.bindall "See the npm package")
-Creates a function that invokes `func` with the `this` binding of `thisArg`
-and arguments of the created function. If `func` is a property name the
-created callback returns the property value for a given element. If `func`
-is an object the created callback returns `true` for elements that contain
-the equivalent object properties, otherwise it returns `false`.
-
-#### Aliases
-*_.iteratee*
+Binds methods of an object to the object itself, overwriting the existing
+method.
+
+
+**Note:** This method doesn't set the "length" property of bound functions.
#### Arguments
-1. `[func=_.identity]` *(*)*: The value to convert to a callback.
-2. `[thisArg]` *(*)*: The `this` binding of `func`.
+1. `object` *(Object)*: The object to bind and assign the bound methods to.
+2. `methodNames` *(...(string|string[])*: The object method names to bind, specified individually or in arrays.
#### Returns
-*(Function)*: Returns the callback.
+*(Object)*: Returns `object`.
+
+#### Example
+```js
+var view = {
+ 'label': 'docs',
+ 'onClick': function() {
+ console.log('clicked ' + this.label);
+ }
+};
+
+_.bindAll(view, 'onClick');
+jQuery(element).on('click', view.onClick);
+// => logs 'clicked docs' when clicked
+```
+* * *
+
+
+
+
+
+### `_.cond(pairs)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12846 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.cond "See the npm package")
+
+Creates a function that iterates over `pairs` invoking the corresponding
+function of the first predicate to return truthy. The predicate-function
+pairs are invoked with the `this` binding and arguments of the created
+function.
+
+#### Arguments
+1. `pairs` *(Array)*: The predicate-function pairs.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+var func = _.cond([
+ [_.matches({ 'a': 1 }), _.constant('matches A')],
+ [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
+ [_.constant(true), _.constant('no match')]
+])
+
+func({ 'a': 1, 'b': 2 });
+// => 'matches A'
+
+func({ 'a': 0, 'b': 1 });
+// => 'matches B'
+
+func({ 'a': '1', 'b': '2' });
+// => 'no match'
+```
+* * *
+
+
+
+
+
+### `_.conforms(source)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12888 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.conforms "See the npm package")
+
+Creates a function that invokes the predicate properties of `source` with
+the corresponding property values of a given object, returning `true` if
+all predicates return truthy, else `false`.
+
+#### Arguments
+1. `source` *(Object)*: The object of property predicates to conform to.
+
+#### Returns
+*(Function)*: Returns the new function.
#### Example
```js
@@ -7336,20 +8642,7 @@ var users = [
{ 'user': 'fred', 'age': 40 }
];
-// wrap to create custom callback shorthands
-_.callback = _.wrap(_.callback, function(callback, func, thisArg) {
- var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
- if (!match) {
- return callback(func, thisArg);
- }
- return function(object) {
- return match[2] == 'gt'
- ? object[match[1]] > match[3]
- : object[match[1]] < match[3];
- };
-});
-
-_.filter(users, 'age__gt36');
+_.filter(users, _.conforms({ 'age': _.partial(_.gt, _, 38) }));
// => [{ 'user': 'fred', 'age': 40 }]
```
* * *
@@ -7359,7 +8652,7 @@ _.filter(users, 'age__gt36');
### `_.constant(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11345 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12908 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.constant "See the npm package")
Creates a function that returns `value`.
@@ -7383,8 +8676,65 @@ getter() === object;
+### `_.flow([funcs])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12934 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flow "See the npm package")
+
+Creates a function that returns the result of invoking the provided
+functions with the `this` binding of the created function, where each
+successive invocation is supplied the return value of the previous.
+
+#### Arguments
+1. `[funcs]` *(...(Function|Function[])*: Functions to invoke.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+function square(n) {
+ return n * n;
+}
+
+var addSquare = _.flow(_.add, square);
+addSquare(1, 2);
+// => 9
+```
+* * *
+
+
+
+
+
+### `_.flowRight([funcs])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12955 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flowright "See the npm package")
+
+This method is like `_.flow` except that it creates a function that
+invokes the provided functions from right to left.
+
+#### Arguments
+1. `[funcs]` *(...(Function|Function[])*: Functions to invoke.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+function square(n) {
+ return n * n;
+}
+
+var addSquare = _.flowRight(square, _.add);
+addSquare(1, 2);
+// => 9
+```
+* * *
+
+
+
+
+
### `_.identity(value)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11366 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L12972 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.identity "See the npm package")
This method returns the first argument provided to it.
@@ -7407,18 +8757,53 @@ _.identity(object) === object;
-### `_.matches(source)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11395 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package")
+### `_.iteratee([func=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13005 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.iteratee "See the npm package")
-Creates a function that performs a deep comparison between a given object
-and `source`, returning `true` if the given object has equivalent property
-values, else `false`.
+Creates a function that invokes `func` with the arguments of the created
+function. If `func` is a property name the created callback returns the
+property value for a given element. If `func` is an object the created
+callback returns `true` for elements that contain the equivalent object properties, otherwise it returns `false`.
+
+#### Arguments
+1. `[func=_.identity]` *(*)*: The value to convert to a callback.
+
+#### Returns
+*(Function)*: Returns the callback.
+
+#### Example
+```js
+var users = [
+ { 'user': 'barney', 'age': 36 },
+ { 'user': 'fred', 'age': 40 }
+];
+
+// create custom iteratee shorthands
+_.iteratee = _.wrap(_.iteratee, function(callback, func) {
+ var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);
+ return !p ? callback(func) : function(object) {
+ return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]);
+ };
+});
+
+_.filter(users, 'age > 36');
+// => [{ 'user': 'fred', 'age': 40 }]
+```
+* * *
+
+
+
+
+
+### `_.matches(source)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13033 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matches "See the npm package")
+
+Creates a function that performs a deep partial comparison between a given
+object and `source`, returning `true` if the given object has equivalent
+property values, else `false`.
-**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`.
+**Note:** This method supports comparing the same values as `_.isEqual`.
#### Arguments
1. `source` *(Object)*: The object of property values to match.
@@ -7443,15 +8828,14 @@ _.filter(users, _.matches({ 'age': 40, 'active': false }));
### `_.matchesProperty(path, srcValue)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11423 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13060 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.matchesproperty "See the npm package")
-Creates a function that compares the property value of `path` on a given
-object to `value`.
+Creates a function that performs a deep partial comparison between the
+value at `path` of a given object to `srcValue`, returning `true` if the
+object value is equivalent, else `false`.
-**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.
+**Note:** This method supports comparing the same values as `_.isEqual`.
#### Arguments
1. `path` *(Array|string)*: The path of the property to get.
@@ -7477,9 +8861,9 @@ _.find(users, _.matchesProperty('user', 'fred'));
### `_.method(path, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11450 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13087 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.method "See the npm package")
-Creates a function that invokes the method at `path` on a given object.
+Creates a function that invokes the method at `path` of a given object.
Any additional arguments are provided to the invoked method.
#### Arguments
@@ -7499,7 +8883,7 @@ var objects = [
_.map(objects, _.method('a.b.c'));
// => [2, 1]
-_.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
+_.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
// => [1, 2]
```
* * *
@@ -7509,10 +8893,10 @@ _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
### `_.methodOf(object, [args])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11478 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13115 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.methodof "See the npm package")
The opposite of `_.method`; this method creates a function that invokes
-the method at a given path on `object`. Any additional arguments are
+the method at a given path of `object`. Any additional arguments are
provided to the invoked method.
#### Arguments
@@ -7540,7 +8924,7 @@ _.map([['a', '2'], ['c', '0']], _.methodOf(object));
### `_.mixin([object=lodash], source, [options])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11520 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13157 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.mixin "See the npm package")
Adds all own enumerable function properties of a source object to the
destination object. If `object` is a function then methods are added to
@@ -7585,7 +8969,7 @@ _('fred').vowels();
### `_.noConflict()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11583 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13205 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noconflict "See the npm package")
Reverts the `_` variable to its previous value and returns a reference to
the `lodash` function.
@@ -7604,7 +8988,7 @@ var lodash = _.noConflict();
### `_.noop()`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11602 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13224 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.noop "See the npm package")
A no-operation function that returns `undefined` regardless of the
arguments it receives.
@@ -7622,11 +9006,121 @@ _.noop(object) === undefined;
-### `_.property(path)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11628 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package")
+### `_.nthArg([n=0])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13243 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.ntharg "See the npm package")
-Creates a function that returns the property value at `path` on a
-given object.
+Creates a function that returns its nth argument.
+
+#### Arguments
+1. `[n=0]` *(number)*: The index of the argument to return.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+var func = _.nthArg(1);
+
+func('a', 'b', 'c');
+// => 'b'
+```
+* * *
+
+
+
+
+
+### `_.over(iteratees)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13266 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.over "See the npm package")
+
+Creates a function that invokes `iteratees` with the arguments provided
+to the created function and returns their results.
+
+#### Arguments
+1. `iteratees` *(...(Function|Function[])*: The iteratees to invoke.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+var func = _.over(Math.max, Math.min);
+
+func(1, 2, 3, 4);
+// => [4, 1]
+```
+* * *
+
+
+
+
+
+### `_.overEvery(predicates)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13290 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.overevery "See the npm package")
+
+Creates a function that checks if **all** of the `predicates` return
+truthy when invoked with the arguments provided to the created function.
+
+#### Arguments
+1. `predicates` *(...(Function|Function[])*: The predicates to check.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+var func = _.overEvery(Boolean, isFinite);
+
+func('1');
+// => true
+
+func(null);
+// => false
+
+func(NaN);
+// => false
+```
+* * *
+
+
+
+
+
+### `_.overSome(predicates)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13314 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.oversome "See the npm package")
+
+Creates a function that checks if **any** of the `predicates` return
+truthy when invoked with the arguments provided to the created function.
+
+#### Arguments
+1. `predicates` *(...(Function|Function[])*: The predicates to check.
+
+#### Returns
+*(Function)*: Returns the new function.
+
+#### Example
+```js
+var func = _.overSome(Boolean, isFinite);
+
+func('1');
+// => true
+
+func(null);
+// => true
+
+func(NaN);
+// => false
+```
+* * *
+
+
+
+
+
+### `_.property(path)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13337 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.property "See the npm package")
+
+Creates a function that returns the value at `path` of a given object.
#### Arguments
1. `path` *(Array|string)*: The path of the property to get.
@@ -7644,7 +9138,7 @@ var objects = [
_.map(objects, _.property('a.b.c'));
// => [2, 1]
-_.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
+_.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
// => [1, 2]
```
* * *
@@ -7654,10 +9148,10 @@ _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
### `_.propertyOf(object)`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11652 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13361 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.propertyof "See the npm package")
The opposite of `_.property`; this method creates a function that returns
-the property value at a given path on `object`.
+the value at a given path of `object`.
#### Arguments
1. `object` *(Object)*: The object to query.
@@ -7683,12 +9177,17 @@ _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
### `_.range([start=0], end, [step=1])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11691 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13407 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.range "See the npm package")
Creates an array of numbers (positive and/or negative) progressing from
-`start` up to, but not including, `end`. If `end` is not specified it's
-set to `start` with `start` then set to `0`. If `end` is less than `start`
-a zero-length range is created unless a negative `step` is specified.
+`start` up to, but not including, `end`. A step of `-1` is used if a negative
+`start` is specified without an `end` or `step`. If `end` is not specified
+it's set to `start` with `start` then set to `0`. If `end` is less than
+`start` a zero-length range is created unless a negative `step` is specified.
+
+
+**Note:** JavaScript follows the IEEE-754 standard for resolving
+floating-point values which can produce unexpected results.
#### Arguments
1. `[start=0]` *(number)*: The start of the range.
@@ -7703,6 +9202,9 @@ a zero-length range is created unless a negative `step` is specified.
_.range(4);
// => [0, 1, 2, 3]
+_.range(-4);
+// => [0, -1, -2, -3]
+
_.range(1, 5);
// => [1, 2, 3, 4]
@@ -7724,10 +9226,53 @@ _.range(0);
-### `_.runInContext([context=root])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L723 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package")
+### `_.rangeRight([start=0], end, [step=1])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13443 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.rangeright "See the npm package")
-Create a new pristine `lodash` function using the given `context` object.
+This method is like `_.range` except that it populates values in
+descending order.
+
+#### Arguments
+1. `[start=0]` *(number)*: The start of the range.
+2. `end` *(number)*: The end of the range.
+3. `[step=1]` *(number)*: The value to increment or decrement by.
+
+#### Returns
+*(Array)*: Returns the new array of numbers.
+
+#### Example
+```js
+_.rangeRight(4);
+// => [3, 2, 1, 0]
+
+_.rangeRight(-4);
+// => [-3, -2, -1, 0]
+
+_.rangeRight(1, 5);
+// => [4, 3, 2, 1]
+
+_.rangeRight(0, 20, 5);
+// => [15, 10, 5, 0]
+
+_.rangeRight(0, -4, -1);
+// => [-3, -2, -1, 0]
+
+_.rangeRight(1, 4, 0);
+// => [1, 1, 1]
+
+_.rangeRight(0);
+// => []
+```
+* * *
+
+
+
+
+
+### `_.runInContext([context=root])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1240 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.runincontext "See the npm package")
+
+Create a new pristine `lodash` function using the `context` object.
#### Arguments
1. `[context=root]` *(Object)*: The context object.
@@ -7768,35 +9313,60 @@ var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
-### `_.times(n, [iteratee=_.identity], [thisArg])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11744 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package")
+### `_.times(n, [iteratee=_.identity])`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13463 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.times "See the npm package")
Invokes the iteratee function `n` times, returning an array of the results
-of each invocation. The `iteratee` is bound to `thisArg` and invoked with
-one argument; (index).
+of each invocation. The iteratee is invoked with one argument; (index).
#### Arguments
1. `n` *(number)*: The number of times to invoke `iteratee`.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
-3. `[thisArg]` *(*)*: The `this` binding of `iteratee`.
#### Returns
*(Array)*: Returns the array of results.
#### Example
```js
-var diceRolls = _.times(3, _.partial(_.random, 1, 6, false));
-// => [3, 6, 4]
+_.times(3, String);
+// => ['0', '1', '2']
-_.times(3, function(n) {
- mage.castSpell(n);
-});
-// => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
+ _.times(4, _.constant(true));
+// => [true, true, true, true]
+```
+* * *
-_.times(3, function(n) {
- this.cast(n);
-}, mage);
-// => also invokes `mage.castSpell(n)` three times
+
+
+
+
+### `_.toPath(value)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13506 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.topath "See the npm package")
+
+Converts `value` to a property path array.
+
+#### Arguments
+1. `value` *(*)*: The value to convert.
+
+#### Returns
+*(Array)*: Returns the new property path array.
+
+#### Example
+```js
+_.toPath('a.b.c');
+// => ['a', 'b', 'c']
+
+_.toPath('a[0].b.c');
+// => ['a', '0', 'b', 'c']
+
+var path = ['a', 'b', 'c'],
+ newPath = _.toPath(path);
+
+console.log(newPath);
+// => ['a', 'b', 'c']
+
+console.log(path === newPath);
+// => false
```
* * *
@@ -7805,7 +9375,7 @@ _.times(3, function(n) {
### `_.uniqueId([prefix])`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L11782 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L13526 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.uniqueid "See the npm package")
Generates a unique ID. If `prefix` is provided the ID is appended to it.
@@ -7836,7 +9406,7 @@ _.uniqueId();
### `_.templateSettings.imports._`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1122 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1532 "View in source") [Ⓣ][1]
A reference to the `lodash` function.
@@ -7844,6 +9414,23 @@ A reference to the `lodash` function.
+
+
+### `stringSize(string)`
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1170 "View in source") [Ⓣ][1]
+
+Gets the number of symbols in `string`.
+
+#### Arguments
+1. `string` *(string)*: The string to inspect.
+
+#### Returns
+*(number)*: Returns the string size.
+
+* * *
+
+
+
@@ -7853,7 +9440,7 @@ A reference to the `lodash` function.
### `_.VERSION`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L12300 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L14157 "View in source") [Ⓣ][1]
(string): The semantic version number.
@@ -7863,108 +9450,8 @@ A reference to the `lodash` function.
-### `_.support`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L986 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.support "See the npm package")
-
-(Object): An object environment feature flags.
-
-* * *
-
-
-
-
-
-### `_.support.enumErrorProps`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1003 "View in source") [Ⓣ][1]
-
-(boolean): Detect if `name` or `message` properties of `Error.prototype` are
-enumerable by default (IE < 9, Safari < 5.1).
-
-* * *
-
-
-
-
-
-### `_.support.enumPrototypes`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1017 "View in source") [Ⓣ][1]
-
-(boolean): Detect if `prototype` properties are enumerable by default.
-
-
-Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
-(if the prototype or a property on the prototype has been set)
-incorrectly set the `[[Enumerable]]` value of a function's `prototype`
-property to `true`.
-
-* * *
-
-
-
-
-
-### `_.support.nonEnumShadows`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1028 "View in source") [Ⓣ][1]
-
-(boolean): Detect if properties shadowing those on `Object.prototype` are non-enumerable.
-
-
-In IE < 9 an object's own properties, shadowing non-enumerable ones,
-are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
-
-* * *
-
-
-
-
-
-### `_.support.ownLast`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1036 "View in source") [Ⓣ][1]
-
-(boolean): Detect if own properties are iterated after inherited properties (IE < 9).
-
-* * *
-
-
-
-
-
-### `_.support.spliceObjects`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1051 "View in source") [Ⓣ][1]
-
-(boolean): Detect if `Array#shift` and `Array#splice` augment array-like objects
-correctly.
-
-
-Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
-`shift()` and `splice()` functions that fail to remove the last element,
-`value[0]`, of array-like objects even though the "length" property is
-set to `0`. The `shift()` method is buggy in compatibility modes of IE 8,
-while `splice()` is buggy regardless of mode in IE < 9.
-
-* * *
-
-
-
-
-
-### `_.support.unindexedChars`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1062 "View in source") [Ⓣ][1]
-
-(boolean): Detect lack of support for accessing string characters by index.
-
-
-IE < 8 can't access characters by index. IE 8 can only access characters
-by index on string literals, not string objects.
-
-* * *
-
-
-
-
-
### `_.templateSettings`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1074 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package")
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1484 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.templatesettings "See the npm package")
(Object): By default, the template delimiters used by lodash are like those in
embedded Ruby (ERB). Change the following template settings to use
@@ -7977,7 +9464,7 @@ alternative delimiters.
### `_.templateSettings.escape`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1082 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1492 "View in source") [Ⓣ][1]
(RegExp): Used to detect `data` property values to be HTML-escaped.
@@ -7988,7 +9475,7 @@ alternative delimiters.
### `_.templateSettings.evaluate`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1090 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1500 "View in source") [Ⓣ][1]
(RegExp): Used to detect code to be evaluated.
@@ -7999,7 +9486,7 @@ alternative delimiters.
### `_.templateSettings.imports`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1114 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1524 "View in source") [Ⓣ][1]
(Object): Used to import variables into the compiled template.
@@ -8010,7 +9497,7 @@ alternative delimiters.
### `_.templateSettings.interpolate`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1098 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1508 "View in source") [Ⓣ][1]
(RegExp): Used to detect `data` property values to inject.
@@ -8021,7 +9508,7 @@ alternative delimiters.
### `_.templateSettings.variable`
-# [Ⓢ](https://github.com/lodash/lodash/blob/3.10.1/lodash.src.js#L1106 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/lodash/lodash/blob/4.0.0/lodash.js#L1516 "View in source") [Ⓣ][1]
(string): Used to reference the data object in the template text.
diff --git a/lodash.js b/lodash.js
index 039eda348..e20df3884 100644
--- a/lodash.js
+++ b/lodash.js
@@ -1,6 +1,7 @@
/**
* @license
- * lodash 4.0.0-pre