# lodash v4.2.1
## `Array`
* `_.chunk`
* `_.compact`
* `_.concat`
* `_.difference`
* `_.differenceBy`
* `_.differenceWith`
* `_.drop`
* `_.dropRight`
* `_.dropRightWhile`
* `_.dropWhile`
* `_.fill`
* `_.findIndex`
* `_.findLastIndex`
* `_.first` -> `head`
* `_.flatten`
* `_.flattenDeep`
* `_.fromPairs`
* `_.head`
* `_.indexOf`
* `_.initial`
* `_.intersection`
* `_.intersectionBy`
* `_.intersectionWith`
* `_.join`
* `_.last`
* `_.lastIndexOf`
* `_.pull`
* `_.pullAll`
* `_.pullAllBy`
* `_.pullAt`
* `_.remove`
* `_.reverse`
* `_.slice`
* `_.sortedIndex`
* `_.sortedIndexBy`
* `_.sortedIndexOf`
* `_.sortedLastIndex`
* `_.sortedLastIndexBy`
* `_.sortedLastIndexOf`
* `_.sortedUniq`
* `_.sortedUniqBy`
* `_.tail`
* `_.take`
* `_.takeRight`
* `_.takeRightWhile`
* `_.takeWhile`
* `_.union`
* `_.unionBy`
* `_.unionWith`
* `_.uniq`
* `_.uniqBy`
* `_.uniqWith`
* `_.unzip`
* `_.unzipWith`
* `_.without`
* `_.xor`
* `_.xorBy`
* `_.xorWith`
* `_.zip`
* `_.zipObject`
* `_.zipObjectDeep`
* `_.zipWith`
## `Collection`
* `_.countBy`
* `_.each` -> `forEach`
* `_.eachRight` -> `forEachRight`
* `_.every`
* `_.filter`
* `_.find`
* `_.findLast`
* `_.flatMap`
* `_.forEach`
* `_.forEachRight`
* `_.groupBy`
* `_.includes`
* `_.invokeMap`
* `_.keyBy`
* `_.map`
* `_.orderBy`
* `_.partition`
* `_.reduce`
* `_.reduceRight`
* `_.reject`
* `_.sample`
* `_.sampleSize`
* `_.shuffle`
* `_.size`
* `_.some`
* `_.sortBy`
## `Date`
* `_.now`
## `Function`
* `_.after`
* `_.ary`
* `_.before`
* `_.bind`
* `_.bindKey`
* `_.curry`
* `_.curryRight`
* `_.debounce`
* `_.defer`
* `_.delay`
* `_.flip`
* `_.memoize`
* `_.negate`
* `_.once`
* `_.overArgs`
* `_.partial`
* `_.partialRight`
* `_.rearg`
* `_.rest`
* `_.spread`
* `_.throttle`
* `_.unary`
* `_.wrap`
## `Lang`
* `_.clone`
* `_.cloneDeep`
* `_.cloneDeepWith`
* `_.cloneWith`
* `_.eq`
* `_.gt`
* `_.gte`
* `_.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`
* `_.isSymbol`
* `_.isTypedArray`
* `_.isUndefined`
* `_.lt`
* `_.lte`
* `_.toArray`
* `_.toInteger`
* `_.toLength`
* `_.toNumber`
* `_.toPlainObject`
* `_.toSafeInteger`
* `_.toString`
## `Math`
* `_.add`
* `_.ceil`
* `_.floor`
* `_.max`
* `_.maxBy`
* `_.mean`
* `_.min`
* `_.minBy`
* `_.round`
* `_.subtract`
* `_.sum`
* `_.sumBy`
## `Number`
* `_.clamp`
* `_.inRange`
* `_.random`
## `Object`
* `_.assign`
* `_.assignIn`
* `_.assignInWith`
* `_.assignWith`
* `_.at`
* `_.create`
* `_.defaults`
* `_.defaultsDeep`
* `_.extend` -> `assignIn`
* `_.extendWith` -> `assignInWith`
* `_.findKey`
* `_.findLastKey`
* `_.forIn`
* `_.forInRight`
* `_.forOwn`
* `_.forOwnRight`
* `_.functions`
* `_.functionsIn`
* `_.get`
* `_.has`
* `_.hasIn`
* `_.invert`
* `_.invertBy`
* `_.invoke`
* `_.keys`
* `_.keysIn`
* `_.mapKeys`
* `_.mapValues`
* `_.merge`
* `_.mergeWith`
* `_.omit`
* `_.omitBy`
* `_.pick`
* `_.pickBy`
* `_.result`
* `_.set`
* `_.setWith`
* `_.toPairs`
* `_.toPairsIn`
* `_.transform`
* `_.unset`
* `_.values`
* `_.valuesIn`
## `Seq`
* `_`
* `_.chain`
* `_.tap`
* `_.thru`
* `_.prototype[Symbol.iterator]`
* `_.prototype.at`
* `_.prototype.chain`
* `_.prototype.commit`
* `_.prototype.flatMap`
* `_.prototype.next`
* `_.prototype.plant`
* `_.prototype.reverse`
* `_.prototype.toJSON` -> `value`
* `_.prototype.value`
* `_.prototype.valueOf` -> `value`
## `String`
* `_.camelCase`
* `_.capitalize`
* `_.deburr`
* `_.endsWith`
* `_.escape`
* `_.escapeRegExp`
* `_.kebabCase`
* `_.lowerCase`
* `_.lowerFirst`
* `_.pad`
* `_.padEnd`
* `_.padStart`
* `_.parseInt`
* `_.repeat`
* `_.replace`
* `_.snakeCase`
* `_.split`
* `_.startCase`
* `_.startsWith`
* `_.template`
* `_.toLower`
* `_.toUpper`
* `_.trim`
* `_.trimEnd`
* `_.trimStart`
* `_.truncate`
* `_.unescape`
* `_.upperCase`
* `_.upperFirst`
* `_.words`
## `Util`
* `_.attempt`
* `_.bindAll`
* `_.cond`
* `_.conforms`
* `_.constant`
* `_.flow`
* `_.flowRight`
* `_.identity`
* `_.iteratee`
* `_.matches`
* `_.matchesProperty`
* `_.method`
* `_.methodOf`
* `_.mixin`
* `_.noConflict`
* `_.noop`
* `_.nthArg`
* `_.over`
* `_.overEvery`
* `_.overSome`
* `_.property`
* `_.propertyOf`
* `_.range`
* `_.rangeRight`
* `_.runInContext`
* `_.times`
* `_.toPath`
* `_.uniqueId`
## `Properties`
* `_.VERSION`
* `_.templateSettings`
* `_.templateSettings.escape`
* `_.templateSettings.evaluate`
* `_.templateSettings.imports`
* `_.templateSettings.interpolate`
* `_.templateSettings.variable`
## `Methods`
* `_.templateSettings.imports._`
## `“Array” Methods`
### `_.chunk(array, [size=0])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5359 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.chunk "See the npm package")
Creates an array of elements split into groups the length of `size`.
If `array` can't be split evenly, the final chunk will be the remaining
elements.
#### Arguments
1. `array` *(Array)*: The array to process.
2. `[size=0]` *(number)*: The length of each chunk.
#### Returns
*(Array)*: Returns the new array containing chunks.
#### Example
```js
_.chunk(['a', 'b', 'c', 'd'], 2);
// => [['a', 'b'], ['c', 'd']]
_.chunk(['a', 'b', 'c', 'd'], 3);
// => [['a', 'b', 'c'], ['d']]
```
* * *
### `_.compact(array)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5390 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.compact "See the npm package")
Creates an array with all falsey values removed. The values `false`, `null`,
`0`, `""`, `undefined`, and `NaN` are falsey.
#### Arguments
1. `array` *(Array)*: The array to compact.
#### Returns
*(Array)*: Returns the new array of filtered values.
#### Example
```js
_.compact([0, 1, false, 2, '', 3]);
// => [1, 2, 3]
```
* * *
### `_.concat(array, [values])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5426 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.concat "See the npm package")
Creates a new array concatenating `array` with any additional arrays
and/or values.
#### Arguments
1. `array` *(Array)*: The array to concatenate.
2. `[values]` *(...*)*: The values to concatenate.
#### Returns
*(Array)*: Returns the new concatenated array.
#### Example
```js
var array = [1];
var other = _.concat(array, 2, [3], [[4]]);
console.log(other);
// => [1, 2, 3, [4]]
console.log(array);
// => [1]
```
* * *
### `_.difference(array, [values])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5450 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.difference "See the npm package")
Creates an array of unique `array` values not included in the other
provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
for equality comparisons.
#### Arguments
1. `array` *(Array)*: The array to inspect.
2. `[values]` *(...Array)*: The values to exclude.
#### Returns
*(Array)*: Returns the new array of filtered values.
#### Example
```js
_.difference([3, 2, 1], [4, 2]);
// => [3, 1]
```
* * *
### `_.differenceBy(array, [values], [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5477 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differenceby "See the npm package")
This method is like `_.difference` except that it accepts `iteratee` which
is invoked for each element of `array` and `values` 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. `[values]` *(...Array)*: The values to exclude.
3. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns the new array of filtered values.
#### Example
```js
_.differenceBy([3.1, 2.2, 1.3], [4.4, 2.5], Math.floor);
// => [3.1, 1.3]
// The `_.property` iteratee shorthand.
_.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
// => [{ 'x': 2 }]
```
* * *
### `_.differenceWith(array, [values], [comparator])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5506 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.differencewith "See the npm package")
This method is like `_.difference` except that it accepts `comparator`
which is invoked to compare elements of `array` to `values`. The comparator
is invoked with two arguments: (arrVal, othVal).
#### Arguments
1. `array` *(Array)*: The array to inspect.
2. `[values]` *(...Array)*: The values to exclude.
3. `[comparator]` *(Function)*: The comparator invoked per element.
#### Returns
*(Array)*: Returns the new array of filtered values.
#### Example
```js
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
_.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
// => [{ 'x': 2, 'y': 1 }]
```
* * *
### `_.drop(array, [n=1])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5540 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.drop "See the npm package")
Creates a slice of `array` with `n` elements dropped from the beginning.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n=1]` *(number)*: The number of elements to drop.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
_.drop([1, 2, 3]);
// => [2, 3]
_.drop([1, 2, 3], 2);
// => [3]
_.drop([1, 2, 3], 5);
// => []
_.drop([1, 2, 3], 0);
// => [1, 2, 3]
```
* * *
### `_.dropRight(array, [n=1])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5573 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.dropright "See the npm package")
Creates a slice of `array` with `n` elements dropped from the end.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n=1]` *(number)*: The number of elements to drop.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
_.dropRight([1, 2, 3]);
// => [1, 2]
_.dropRight([1, 2, 3], 2);
// => [1]
_.dropRight([1, 2, 3], 5);
// => []
_.dropRight([1, 2, 3], 0);
// => [1, 2, 3]
```
* * *
### `_.dropRightWhile(array, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5617 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.droprightwhile "See the npm package")
Creates a slice of `array` excluding elements dropped from the end.
Elements are dropped 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.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': false }
];
_.dropRightWhile(users, function(o) { return !o.active; });
// => objects for ['barney']
// The `_.matches` iteratee shorthand.
_.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
// => objects for ['barney', 'fred']
// The `_.matchesProperty` iteratee shorthand.
_.dropRightWhile(users, ['active', false]);
// => objects for ['barney']
// The `_.property` iteratee shorthand.
_.dropRightWhile(users, 'active');
// => objects for ['barney', 'fred', 'pebbles']
```
* * *
### `_.dropWhile(array, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5657 "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
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.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
var users = [
{ 'user': 'barney', 'active': false },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': true }
];
_.dropWhile(users, function(o) { return !o.active; });
// => objects for ['pebbles']
// The `_.matches` iteratee shorthand.
_.dropWhile(users, { 'user': 'barney', 'active': false });
// => objects for ['fred', 'pebbles']
// The `_.matchesProperty` iteratee shorthand.
_.dropWhile(users, ['active', false]);
// => objects for ['pebbles']
// The `_.property` iteratee shorthand.
_.dropWhile(users, 'active');
// => objects for ['barney', 'fred', 'pebbles']
```
* * *
### `_.fill(array, value, [start=0], [end=array.length])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5691 "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`.
**Note:** This method mutates `array`.
#### Arguments
1. `array` *(Array)*: The array to fill.
2. `value` *(*)*: The value to fill `array` with.
3. `[start=0]` *(number)*: The start position.
4. `[end=array.length]` *(number)*: The end position.
#### Returns
*(Array)*: Returns `array`.
#### Example
```js
var array = [1, 2, 3];
_.fill(array, 'a');
console.log(array);
// => ['a', 'a', 'a']
_.fill(Array(3), 2);
// => [2, 2, 2]
_.fill([4, 6, 8, 10], '*', 1, 3);
// => [4, '*', '*', 10]
```
* * *
### `_.findIndex(array, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5736 "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.
#### Arguments
1. `array` *(Array)*: The array to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(number)*: Returns the index of the found element, else `-1`.
#### Example
```js
var users = [
{ 'user': 'barney', 'active': false },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': true }
];
_.findIndex(users, function(o) { return o.user == 'barney'; });
// => 0
// The `_.matches` iteratee shorthand.
_.findIndex(users, { 'user': 'fred', 'active': false });
// => 1
// The `_.matchesProperty` iteratee shorthand.
_.findIndex(users, ['active', false]);
// => 0
// The `_.property` iteratee shorthand.
_.findIndex(users, 'active');
// => 2
```
* * *
### `_.findLastIndex(array, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5775 "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.
#### Arguments
1. `array` *(Array)*: The array to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(number)*: Returns the index of the found element, else `-1`.
#### Example
```js
var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': false }
];
_.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
// => 2
// The `_.matches` iteratee shorthand.
_.findLastIndex(users, { 'user': 'barney', 'active': true });
// => 0
// The `_.matchesProperty` iteratee shorthand.
_.findLastIndex(users, ['active', false]);
// => 2
// The `_.property` iteratee shorthand.
_.findLastIndex(users, 'active');
// => 0
```
* * *
### `_.flatten(array)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5794 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatten "See the npm package")
Flattens `array` a single level.
#### Arguments
1. `array` *(Array)*: The array to flatten.
#### Returns
*(Array)*: Returns the new flattened array.
#### Example
```js
_.flatten([1, [2, 3, [4]]]);
// => [1, 2, 3, [4]]
```
* * *
### `_.flattenDeep(array)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5812 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flattendeep "See the npm package")
This method is like `_.flatten` except that it recursively flattens `array`.
#### Arguments
1. `array` *(Array)*: The array to recursively flatten.
#### Returns
*(Array)*: Returns the new flattened array.
#### Example
```js
_.flattenDeep([1, [2, 3, [4]]]);
// => [1, 2, 3, 4]
```
* * *
### `_.fromPairs(pairs)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5831 "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.2.1/lodash.js#L5860 "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/4.2.1/lodash.js#L5886 "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)
for equality comparisons. If `fromIndex` is negative, it's used as the offset
from the end of `array`.
#### Arguments
1. `array` *(Array)*: The array to search.
2. `value` *(*)*: The value to search for.
3. `[fromIndex=0]` *(number)*: The index to search from.
#### Returns
*(number)*: Returns the index of the matched value, else `-1`.
#### Example
```js
_.indexOf([1, 2, 1, 2], 2);
// => 1
// Search from the `fromIndex`.
_.indexOf([1, 2, 1, 2], 2, 2);
// => 3
```
* * *
### `_.initial(array)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5911 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.initial "See the npm package")
Gets all but the last element of `array`.
#### Arguments
1. `array` *(Array)*: The array to query.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
_.initial([1, 2, 3]);
// => [1, 2]
```
* * *
### `_.intersection([arrays])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5930 "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)
for equality comparisons.
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to inspect.
#### Returns
*(Array)*: Returns the new array of shared values.
#### Example
```js
_.intersection([2, 1], [4, 2], [1, 2]);
// => [2]
```
* * *
### `_.intersectionBy([arrays], [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5957 "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]
// The `_.property` iteratee shorthand.
_.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }]
```
* * *
### `_.intersectionWith([arrays], [comparator])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L5990 "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.2.1/lodash.js#L6018 "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/4.2.1/lodash.js#L6035 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.last "See the npm package")
Gets the last element of `array`.
#### Arguments
1. `array` *(Array)*: The array to query.
#### Returns
*(*)*: Returns the last element of `array`.
#### Example
```js
_.last([1, 2, 3]);
// => 3
```
* * *
### `_.lastIndexOf(array, value, [fromIndex=array.length-1])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6060 "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.
#### Arguments
1. `array` *(Array)*: The array to search.
2. `value` *(*)*: The value to search for.
3. `[fromIndex=array.length-1]` *(number)*: The index to search from.
#### Returns
*(number)*: Returns the index of the matched value, else `-1`.
#### Example
```js
_.lastIndexOf([1, 2, 1, 2], 2);
// => 3
// Search from the `fromIndex`.
_.lastIndexOf([1, 2, 1, 2], 2, 2);
// => 1
```
* * *
### `_.pull(array, [values])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6102 "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)
for equality comparisons.
**Note:** Unlike `_.without`, this method mutates `array`.
#### Arguments
1. `array` *(Array)*: The array to modify.
2. `[values]` *(...*)*: 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]
```
* * *
### `_.pullAll(array, values)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6123 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.pullall "See the npm package")
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];
_.pullAll(array, [2, 3]);
console.log(array);
// => [1, 1]
```
* * *
### `_.pullAllBy(array, values, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6151 "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 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.2.1/lodash.js#L6181 "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 individually or in arrays.
#### Returns
*(Array)*: Returns the new array of removed elements.
#### Example
```js
var array = [5, 10, 15, 20];
var evens = _.pullAt(array, 1, 3);
console.log(array);
// => [5, 15]
console.log(evens);
// => [10, 20]
```
* * *
### `_.remove(array, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6215 "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 invoked with
three arguments: (value, index, array).
**Note:** Unlike `_.filter`, this method mutates `array`.
#### Arguments
1. `array` *(Array)*: The array to modify.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new array of removed elements.
#### Example
```js
var array = [1, 2, 3, 4];
var evens = _.remove(array, function(n) {
return n % 2 == 0;
});
console.log(array);
// => [1, 3]
console.log(evens);
// => [2, 4]
```
* * *
### `_.reverse()`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6257 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.reverse "See the npm package")
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 `array` and is based on
[`Array#reverse`](https://mdn.io/Array/reverse).
#### Returns
*(Array)*: Returns `array`.
#### Example
```js
var array = [1, 2, 3];
_.reverse(array);
// => [3, 2, 1]
console.log(array);
// => [3, 2, 1]
```
* * *
### `_.slice(array, [start=0], [end=array.length])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6275 "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`](https://mdn.io/Array/slice)
to ensure dense arrays are returned.
#### Arguments
1. `array` *(Array)*: The array to slice.
2. `[start=0]` *(number)*: The start position.
3. `[end=array.length]` *(number)*: The end position.
#### Returns
*(Array)*: Returns the slice of `array`.
* * *
### `_.sortedIndex(array, value)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6309 "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.
#### Arguments
1. `array` *(Array)*: The sorted array to inspect.
2. `value` *(*)*: The value to evaluate.
#### Returns
*(number)*: Returns the index at which `value` should be inserted into `array`.
#### Example
```js
_.sortedIndex([30, 50], 40);
// => 1
_.sortedIndex([4, 5], 4);
// => 0
```
* * *
### `_.sortedIndexBy(array, value, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6336 "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
// The `_.property` iteratee shorthand.
_.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
// => 0
```
* * *
### `_.sortedIndexOf(array, value)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6355 "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.2.1/lodash.js#L6382 "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
maintain its sort order.
#### Arguments
1. `array` *(Array)*: The sorted array to inspect.
2. `value` *(*)*: The value to evaluate.
#### Returns
*(number)*: Returns the index at which `value` should be inserted into `array`.
#### Example
```js
_.sortedLastIndex([4, 5], 4);
// => 1
```
* * *
### `_.sortedLastIndexBy(array, value, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6404 "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
// The `_.property` iteratee shorthand.
_.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
// => 1
```
* * *
### `_.sortedLastIndexOf(array, value)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6423 "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.2.1/lodash.js#L6448 "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.2.1/lodash.js#L6469 "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.3]
```
* * *
### `_.tail(array)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6488 "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]
```
* * *
### `_.take(array, [n=1])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6516 "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.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n=1]` *(number)*: The number of elements to take.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
_.take([1, 2, 3]);
// => [1]
_.take([1, 2, 3], 2);
// => [1, 2]
_.take([1, 2, 3], 5);
// => [1, 2, 3]
_.take([1, 2, 3], 0);
// => []
```
* * *
### `_.takeRight(array, [n=1])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6548 "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.
#### Arguments
1. `array` *(Array)*: The array to query.
2. `[n=1]` *(number)*: The number of elements to take.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
_.takeRight([1, 2, 3]);
// => [3]
_.takeRight([1, 2, 3], 2);
// => [2, 3]
_.takeRight([1, 2, 3], 5);
// => [1, 2, 3]
_.takeRight([1, 2, 3], 0);
// => []
```
* * *
### `_.takeRightWhile(array, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6592 "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 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.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false },
{ 'user': 'pebbles', 'active': false }
];
_.takeRightWhile(users, function(o) { return !o.active; });
// => objects for ['fred', 'pebbles']
// The `_.matches` iteratee shorthand.
_.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
// => objects for ['pebbles']
// The `_.matchesProperty` iteratee shorthand.
_.takeRightWhile(users, ['active', false]);
// => objects for ['fred', 'pebbles']
// The `_.property` iteratee shorthand.
_.takeRightWhile(users, 'active');
// => []
```
* * *
### `_.takeWhile(array, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6632 "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 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.
#### Returns
*(Array)*: Returns the slice of `array`.
#### Example
```js
var users = [
{ 'user': 'barney', 'active': false },
{ 'user': 'fred', 'active': false},
{ 'user': 'pebbles', 'active': true }
];
_.takeWhile(users, function(o) { return !o.active; });
// => objects for ['barney', 'fred']
// The `_.matches` iteratee shorthand.
_.takeWhile(users, { 'user': 'barney', 'active': false });
// => objects for ['barney']
// The `_.matchesProperty` iteratee shorthand.
_.takeWhile(users, ['active', false]);
// => objects for ['barney', 'fred']
// The `_.property` iteratee shorthand.
_.takeWhile(users, 'active');
// => []
```
* * *
### `_.union([arrays])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6653 "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)
for equality comparisons.
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to inspect.
#### Returns
*(Array)*: Returns the new array of combined values.
#### Example
```js
_.union([2, 1], [4, 2], [1, 2]);
// => [2, 1, 4]
```
* * *
### `_.unionBy([arrays], [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6677 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unionby "See the npm package")
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. `[arrays]` *(...Array)*: The arrays to inspect.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee invoked per element.
#### Returns
*(Array)*: Returns the new array of combined values.
#### Example
```js
_.unionBy([2.1, 1.2], [4.3, 2.4], Math.floor);
// => [2.1, 1.2, 4.3]
// The `_.property` iteratee shorthand.
_.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 1 }, { 'x': 2 }]
```
* * *
### `_.unionWith([arrays], [comparator])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6704 "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.2.1/lodash.js#L6728 "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.2.1/lodash.js#L6754 "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]
// 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.2.1/lodash.js#L6778 "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/4.2.1/lodash.js#L6802 "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
configuration.
#### Arguments
1. `array` *(Array)*: The array of grouped elements to process.
#### Returns
*(Array)*: Returns the new array of regrouped elements.
#### Example
```js
var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
// => [['fred', 30, true], ['barney', 40, false]]
_.unzip(zipped);
// => [['fred', 'barney'], [30, 40], [true, false]]
```
* * *
### `_.unzipWith(array, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6837 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.unzipwith "See the npm package")
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=_.identity]` *(Function)*: The function to combine regrouped values.
#### Returns
*(Array)*: Returns the new array of regrouped elements.
#### Example
```js
var zipped = _.zip([1, 2], [10, 20], [100, 200]);
// => [[1, 10, 100], [2, 20, 200]]
_.unzipWith(zipped, _.add);
// => [3, 30, 300]
```
* * *
### `_.without(array, [values])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6866 "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)
for equality comparisons.
#### Arguments
1. `array` *(Array)*: The array to filter.
2. `[values]` *(...*)*: The values to exclude.
#### Returns
*(Array)*: Returns the new array of filtered values.
#### Example
```js
_.without([1, 2, 1, 3], 1, 2);
// => [3]
```
* * *
### `_.xor([arrays])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6886 "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.
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to inspect.
#### Returns
*(Array)*: Returns the new array of values.
#### Example
```js
_.xor([2, 1], [4, 2]);
// => [1, 4]
```
* * *
### `_.xorBy([arrays], [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6910 "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]
// The `_.property` iteratee shorthand.
_.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
// => [{ 'x': 2 }]
```
* * *
### `_.xorWith([arrays], [comparator])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6937 "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/4.2.1/lodash.js#L6960 "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
of the given arrays, and so on.
#### Arguments
1. `[arrays]` *(...Array)*: The arrays to process.
#### Returns
*(Array)*: Returns the new array of grouped elements.
#### Example
```js
_.zip(['fred', 'barney'], [30, 40], [true, false]);
// => [['fred', 30, true], ['barney', 40, false]]
```
* * *
### `_.zipObject([props=[]], [values=[]])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6977 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobject "See the npm package")
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.
2. `[values=[]]` *(Array)*: The property values.
#### Returns
*(Object)*: Returns the new object.
#### Example
```js
_.zipObject(['a', 'b'], [1, 2]);
// => { 'a': 1, 'b': 2 }
```
* * *
### `_.zipObjectDeep([props=[]], [values=[]])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L6995 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipobjectdeep "See the npm package")
This method is like `_.zipObject` except that it supports property paths.
#### Arguments
1. `[props=[]]` *(Array)*: The property names.
2. `[values=[]]` *(Array)*: The property values.
#### Returns
*(Object)*: Returns the new object.
#### Example
```js
_.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
// => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
```
* * *
### `_.zipWith([arrays], [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7017 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.zipwith "See the npm package")
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=_.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], function(a, b, c) {
return a + b + c;
});
// => [111, 222]
```
* * *
## `“Collection” Methods`
### `_.countBy(collection, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7399 "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 invoked with one argument: (value).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee to transform keys.
#### Returns
*(Object)*: Returns the composed aggregate object.
#### Example
```js
_.countBy([6.1, 4.2, 6.3], Math.floor);
// => { '4': 1, '6': 2 }
_.countBy(['one', 'two', 'three'], 'length');
// => { '3': 2, '5': 1 }
```
* * *
### `_.every(collection, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7437 "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`.
Iteration is stopped once `predicate` returns falsey. The predicate is
invoked with three arguments: (value, index|key, collection).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(boolean)*: Returns `true` if all elements pass the predicate check, else `false`.
#### Example
```js
_.every([true, 1, null, 'yes'], Boolean);
// => false
var users = [
{ 'user': 'barney', 'active': false },
{ 'user': 'fred', 'active': false }
];
// The `_.matches` iteratee shorthand.
_.every(users, { 'user': 'barney', 'active': false });
// => false
// The `_.matchesProperty` iteratee shorthand.
_.every(users, ['active', false]);
// => true
// The `_.property` iteratee shorthand.
_.every(users, 'active');
// => false
```
* * *
### `_.filter(collection, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7478 "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 invoked with three arguments:
(value, index|key, collection).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new filtered array.
#### Example
```js
var users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false }
];
_.filter(users, function(o) { return !o.active; });
// => objects for ['fred']
// The `_.matches` iteratee shorthand.
_.filter(users, { 'age': 36, 'active': true });
// => objects for ['barney']
// The `_.matchesProperty` iteratee shorthand.
_.filter(users, ['active', false]);
// => objects for ['fred']
// The `_.property` iteratee shorthand.
_.filter(users, 'active');
// => objects for ['barney']
```
* * *
### `_.find(collection, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7517 "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 invoked with three arguments:
(value, index|key, collection).
#### Arguments
1. `collection` *(Array|Object)*: The collection to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(*)*: Returns the matched element, else `undefined`.
#### Example
```js
var users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false },
{ 'user': 'pebbles', 'age': 1, 'active': true }
];
_.find(users, function(o) { return o.age < 40; });
// => object for 'barney'
// The `_.matches` iteratee shorthand.
_.find(users, { 'age': 1, 'active': true });
// => object for 'pebbles'
// The `_.matchesProperty` iteratee shorthand.
_.find(users, ['active', false]);
// => object for 'fred'
// The `_.property` iteratee shorthand.
_.find(users, 'active');
// => object for 'barney'
```
* * *
### `_.findLast(collection, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7543 "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)*: The collection to search.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(*)*: Returns the matched element, else `undefined`.
#### Example
```js
_.findLast([1, 2, 3, 4], function(n) {
return n % 2 == 1;
});
// => 3
```
* * *
### `_.flatMap(collection, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7572 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flatmap "See the npm package")
Creates an array of flattened values by running each element in `collection`
through `iteratee` and concating its result to the other mapped values.
The iteratee is invoked with three arguments: (value, index|key, collection).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new flattened array.
#### Example
```js
function duplicate(n) {
return [n, n];
}
_.flatMap([1, 2], duplicate);
// => [1, 1, 2, 2]
```
* * *
### `_.forEach(collection, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7604 "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 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 use `_.forIn` or `_.forOwn`
for object iteration.
#### Aliases
*_.each*
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array|Object)*: Returns `collection`.
#### Example
```js
_([1, 2]).forEach(function(value) {
console.log(value);
});
// => logs `1` then `2`
_.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
console.log(key);
});
// => logs 'a' then 'b' (iteration order is not guaranteed)
```
* * *
### `_.forEachRight(collection, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7628 "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.
#### Aliases
*_.eachRight*
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
#### Returns
*(Array|Object)*: Returns `collection`.
#### Example
```js
_.forEachRight([1, 2], function(value) {
console.log(value);
});
// => logs `2` then `1`
```
* * *
### `_.groupBy(collection, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7655 "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 elements responsible for generating the key.
The iteratee is invoked with one argument: (value).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee to transform keys.
#### Returns
*(Object)*: Returns the composed aggregate object.
#### Example
```js
_.groupBy([6.1, 4.2, 6.3], Math.floor);
// => { '4': [4.2], '6': [6.1, 6.3] }
// The `_.property` iteratee shorthand.
_.groupBy(['one', 'two', 'three'], 'length');
// => { '3': ['one', 'two'], '5': ['three'] }
```
* * *
### `_.includes(collection, value, [fromIndex=0])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7691 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.includes "See the npm package")
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. `value` *(*)*: The value to search for.
3. `[fromIndex=0]` *(number)*: The index to search from.
#### Returns
*(boolean)*: Returns `true` if `value` is found, else `false`.
#### Example
```js
_.includes([1, 2, 3], 1);
// => true
_.includes([1, 2, 3], 1, 2);
// => false
_.includes({ 'user': 'fred', 'age': 40 }, 'fred');
// => true
_.includes('pebbles', 'eb');
// => true
```
* * *
### `_.invokeMap(collection, path, [args])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7726 "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.2.1/lodash.js#L7766 "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 is invoked with one argument: (value).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The iteratee to transform keys.
#### Returns
*(Object)*: Returns the composed aggregate object.
#### Example
```js
var array = [
{ 'dir': 'left', 'code': 97 },
{ 'dir': 'right', 'code': 100 }
];
_.keyBy(array, function(o) {
return String.fromCharCode(o.code);
});
// => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
_.keyBy(array, 'dir');
// => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
```
* * *
### `_.map(collection, [iteratee=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7811 "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 invoked with three arguments:
(value, index|key, collection).
Many lodash methods are guarded to work as iteratees for methods like
`_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
The guarded methods are:
`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)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new mapped array.
#### Example
```js
function square(n) {
return n * n;
}
_.map([4, 8], square);
// => [16, 64]
_.map({ 'a': 4, 'b': 8 }, square);
// => [16, 64] (iteration order is not guaranteed)
var users = [
{ 'user': 'barney' },
{ 'user': 'fred' }
];
// The `_.property` iteratee shorthand.
_.map(users, 'user');
// => ['barney', 'fred']
```
* * *
### `_.orderBy(collection, [iteratees=[_.identity]], [orders])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7843 "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.2.1/lodash.js#L7892 "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, the second of which
contains elements `predicate` returns falsey for. The predicate is
invoked with one argument: (value).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the array of grouped elements.
#### Example
```js
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true },
{ 'user': 'pebbles', 'age': 1, 'active': false }
];
_.partition(users, function(o) { return o.active; });
// => objects for [['fred'], ['barney', 'pebbles']]
// The `_.matches` iteratee shorthand.
_.partition(users, { 'age': 1, 'active': false });
// => objects for [['pebbles'], ['barney', 'fred']]
// The `_.matchesProperty` iteratee shorthand.
_.partition(users, ['active', false]);
// => objects for [['barney', 'pebbles'], ['fred']]
// The `_.property` iteratee shorthand.
_.partition(users, 'active');
// => objects for [['fred'], ['barney', 'pebbles']]
```
* * *
### `_.reduce(collection, [iteratee=_.identity], [accumulator])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7931 "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 invoked with four arguments:
(accumulator, value, index|key, collection).
Many lodash methods are guarded to work as iteratees for methods like
`_.reduce`, `_.reduceRight`, and `_.transform`.
The guarded methods are:
`assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
and `sortBy`
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
3. `[accumulator]` *(*)*: The initial value.
#### Returns
*(*)*: Returns the accumulated value.
#### Example
```js
_.reduce([1, 2], function(sum, n) {
return sum + n;
}, 0);
// => 3
_.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
(result[value] || (result[value] = [])).push(key);
return result;
}, {});
// => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
```
* * *
### `_.reduceRight(collection, [iteratee=_.identity], [accumulator])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7958 "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.
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[iteratee=_.identity]` *(Function)*: The function invoked per iteration.
3. `[accumulator]` *(*)*: The initial value.
#### Returns
*(*)*: Returns the accumulated value.
#### Example
```js
var array = [[0, 1], [2, 3], [4, 5]];
_.reduceRight(array, function(flattened, other) {
return flattened.concat(other);
}, []);
// => [4, 5, 2, 3, 0, 1]
```
* * *
### `_.reject(collection, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L7997 "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)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(Array)*: Returns the new filtered array.
#### Example
```js
var users = [
{ 'user': 'barney', 'age': 36, 'active': false },
{ 'user': 'fred', 'age': 40, 'active': true }
];
_.reject(users, function(o) { return !o.active; });
// => objects for ['fred']
// The `_.matches` iteratee shorthand.
_.reject(users, { 'age': 40, 'active': true });
// => objects for ['barney']
// The `_.matchesProperty` iteratee shorthand.
_.reject(users, ['active', false]);
// => objects for ['fred']
// The `_.property` iteratee shorthand.
_.reject(users, 'active');
// => objects for ['barney']
```
* * *
### `_.sample(collection)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8018 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.sample "See the npm package")
Gets a random element from `collection`.
#### Arguments
1. `collection` *(Array|Object)*: The collection to sample.
#### Returns
*(*)*: Returns the random element.
#### Example
```js
_.sample([1, 2, 3, 4]);
// => 2
```
* * *
### `_.sampleSize(collection, [n=0])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8043 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.samplesize "See the npm package")
Gets `n` random elements at unique keys from `collection` up to the
size of `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], 2);
// => [3, 1]
_.sampleSize([1, 2, 3], 4);
// => [2, 3, 1]
```
* * *
### `_.shuffle(collection)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8075 "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)*: The collection to shuffle.
#### Returns
*(Array)*: Returns the new shuffled array.
#### Example
```js
_.shuffle([1, 2, 3, 4]);
// => [4, 1, 3, 2]
```
* * *
### `_.size(collection)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8099 "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)*: The collection to inspect.
#### Returns
*(number)*: Returns the collection size.
#### Example
```js
_.size([1, 2, 3]);
// => 3
_.size({ 'a': 1, 'b': 2 });
// => 2
_.size('pebbles');
// => 7
```
* * *
### `_.some(collection, [predicate=_.identity])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8144 "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`.
Iteration is stopped once `predicate` returns truthy. The predicate is
invoked with three arguments: (value, index|key, collection).
#### Arguments
1. `collection` *(Array|Object)*: The collection to iterate over.
2. `[predicate=_.identity]` *(Function|Object|string)*: The function invoked per iteration.
#### Returns
*(boolean)*: Returns `true` if any element passes the predicate check, else `false`.
#### Example
```js
_.some([null, 0, 'yes', false], Boolean);
// => true
var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false }
];
// The `_.matches` iteratee shorthand.
_.some(users, { 'user': 'barney', 'active': false });
// => false
// The `_.matchesProperty` iteratee shorthand.
_.some(users, ['active', false]);
// => true
// The `_.property` iteratee shorthand.
_.some(users, 'active');
// => true
```
* * *
### `_.sortBy(collection, [iteratees=[_.identity]])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8185 "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 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)*: 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.
#### Example
```js
var users = [
{ 'user': 'fred', 'age': 48 },
{ 'user': 'barney', 'age': 36 },
{ 'user': 'fred', 'age': 42 },
{ 'user': 'barney', 'age': 34 }
];
_.sortBy(users, function(o) { return o.user; });
// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
_.sortBy(users, ['user', 'age']);
// => objects for [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
_.sortBy(users, 'user', function(o) {
return Math.floor(o.age / 10);
});
// => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
```
* * *
## `“Date” Methods`
### `_.now()`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8216 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.now "See the npm package")
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
_.defer(function(stamp) {
console.log(_.now() - stamp);
}, _.now());
// => logs the number of milliseconds it took for the deferred function to be invoked
```
* * *
## `“Function” Methods`
### `_.after(n, func)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8243 "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.
#### Arguments
1. `n` *(number)*: The number of calls before `func` is invoked.
2. `func` *(Function)*: The function to restrict.
#### Returns
*(Function)*: Returns the new restricted function.
#### Example
```js
var saves = ['profile', 'settings'];
var done = _.after(saves.length, function() {
console.log('done saving!');
});
_.forEach(saves, function(type) {
asyncSave({ 'type': type, 'complete': done });
});
// => logs 'done saving!' after the two async saves have completed
```
* * *
### `_.ary(func, [n=func.length])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8271 "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
additional arguments.
#### Arguments
1. `func` *(Function)*: The function to cap arguments for.
2. `[n=func.length]` *(number)*: The arity cap.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
_.map(['6', '8', '10'], _.ary(parseInt, 1));
// => [6, 8, 10]
```
* * *
### `_.before(n, func)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8293 "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
calls to the created function return the result of the last `func` invocation.
#### Arguments
1. `n` *(number)*: The number of calls at which `func` is no longer invoked.
2. `func` *(Function)*: The function to restrict.
#### Returns
*(Function)*: Returns the new restricted function.
#### Example
```js
jQuery(element).on('click', _.before(5, addContactToList));
// => allows adding up to 4 contacts to the list
```
* * *
### `_.bind(func, thisArg, [partials])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8345 "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
bound function.
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 doesn't set the "length"
property of bound functions.
#### Arguments
1. `func` *(Function)*: The function to bind.
2. `thisArg` *(*)*: The `this` binding of `func`.
3. `[partials]` *(...*)*: The arguments to be partially applied.
#### Returns
*(Function)*: Returns the new bound function.
#### Example
```js
var greet = function(greeting, punctuation) {
return greeting + ' ' + this.user + punctuation;
};
var object = { 'user': 'fred' };
var bound = _.bind(greet, object, 'hi');
bound('!');
// => 'hi fred!'
// Bound with placeholders.
var bound = _.bind(greet, object, _, '!');
bound('hi');
// => 'hi fred!'
```
* * *
### `_.bindKey(object, key, [partials])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8400 "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.
This method differs from `_.bind` by allowing bound functions to reference
methods that may be redefined or don't yet exist.
See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
for more details.
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 to invoke the method on.
2. `key` *(string)*: The key of the method.
3. `[partials]` *(...*)*: The arguments to be partially applied.
#### Returns
*(Function)*: Returns the new bound function.
#### Example
```js
var object = {
'user': 'fred',
'greet': function(greeting, punctuation) {
return greeting + ' ' + this.user + punctuation;
}
};
var bound = _.bindKey(object, 'greet', 'hi');
bound('!');
// => 'hi fred!'
object.greet = function(greeting, punctuation) {
return greeting + 'ya ' + this.user + punctuation;
};
bound('!');
// => 'hiya fred!'
// Bound with placeholders.
var bound = _.bindKey(object, 'greet', _, '!');
bound('hi');
// => 'hiya fred!'
```
* * *
### `_.curry(func, [arity=func.length])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8451 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.curry "See the npm package")
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 doesn't set the "length" property of curried functions.
#### Arguments
1. `func` *(Function)*: The function to curry.
2. `[arity=func.length]` *(number)*: The arity of `func`.
#### Returns
*(Function)*: Returns the new curried function.
#### Example
```js
var abc = function(a, b, c) {
return [a, b, c];
};
var curried = _.curry(abc);
curried(1)(2)(3);
// => [1, 2, 3]
curried(1, 2)(3);
// => [1, 2, 3]
curried(1, 2, 3);
// => [1, 2, 3]
// Curried with placeholders.
curried(1)(_, 3)(2);
// => [1, 2, 3]
```
* * *
### `_.curryRight(func, [arity=func.length])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8495 "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`.
The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
builds, may be used as a placeholder for provided arguments.
**Note:** This method doesn't set the "length" property of curried functions.
#### Arguments
1. `func` *(Function)*: The function to curry.
2. `[arity=func.length]` *(number)*: The arity of `func`.
#### Returns
*(Function)*: Returns the new curried function.
#### Example
```js
var abc = function(a, b, c) {
return [a, b, c];
};
var curried = _.curryRight(abc);
curried(3)(2)(1);
// => [1, 2, 3]
curried(2, 3)(1);
// => [1, 2, 3]
curried(1, 2, 3);
// => [1, 2, 3]
// Curried with placeholders.
curried(3)(1, _)(2);
// => [1, 2, 3]
```
* * *
### `_.debounce(func, [wait=0], [options])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8551 "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 `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
on the trailing edge of the timeout only if the debounced function is
invoked more than once during the `wait` timeout.
See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
for details over the differences between `_.debounce` and `_.throttle`.
#### Arguments
1. `func` *(Function)*: The function to debounce.
2. `[wait=0]` *(number)*: The number of milliseconds to delay.
3. `[options]` *(Object)*: The options object.
4. `[options.leading=false]` *(boolean)*: Specify invoking on the leading edge of the timeout.
5. `[options.maxWait]` *(number)*: The maximum time `func` is allowed to be delayed before it's invoked.
6. `[options.trailing=true]` *(boolean)*: Specify invoking on the trailing edge of the timeout.
#### Returns
*(Function)*: Returns the new debounced function.
#### Example
```js
// Avoid costly calculations while the window size is in flux.
jQuery(window).on('resize', _.debounce(calculateLayout, 150));
// 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', debounced);
// Cancel the trailing debounced invocation.
jQuery(window).on('popstate', debounced.cancel);
```
* * *
### `_.defer(func, [args])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8683 "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 `func` with.
#### Returns
*(number)*: Returns the timer id.
#### Example
```js
_.defer(function(text) {
console.log(text);
}, 'deferred');
// => logs 'deferred' after one or more milliseconds
```
* * *
### `_.delay(func, wait, [args])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8705 "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.
#### Arguments
1. `func` *(Function)*: The function to delay.
2. `wait` *(number)*: The number of milliseconds to delay invocation.
3. `[args]` *(...*)*: The arguments to invoke `func` with.
#### Returns
*(number)*: Returns the timer id.
#### Example
```js
_.delay(function(text) {
console.log(text);
}, 1000, 'later');
// => logs 'later' after one second
```
* * *
### `_.flip(func)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8726 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.flip "See the npm package")
Creates a function that invokes `func` with arguments reversed.
#### Arguments
1. `func` *(Function)*: The function to flip arguments for.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
var flipped = _.flip(function() {
return _.toArray(arguments);
});
flipped('a', 'b', 'c', 'd');
// => ['d', 'c', 'b', 'a']
```
* * *
### `_.memoize(func, [resolver])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8772 "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 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 `delete`, `get`, `has`, and `set`.
#### Arguments
1. `func` *(Function)*: The function to have its output memoized.
2. `[resolver]` *(Function)*: The function to resolve the cache key.
#### Returns
*(Function)*: Returns the new memoizing function.
#### Example
```js
var object = { 'a': 1, 'b': 2 };
var other = { 'c': 3, 'd': 4 };
var values = _.memoize(_.values);
values(object);
// => [1, 2]
values(other);
// => [3, 4]
object.a = 2;
values(object);
// => [1, 2]
// Modify the result cache.
values.cache.set(object, ['a', 'b']);
values(object);
// => ['a', 'b']
// Replace `_.memoize.Cache`.
_.memoize.Cache = WeakMap;
```
* * *
### `_.negate(predicate)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8811 "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
created function.
#### Arguments
1. `predicate` *(Function)*: The predicate to negate.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
function isEven(n) {
return n % 2 == 0;
}
_.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
// => [1, 3, 5]
```
* * *
### `_.once(func)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8837 "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 invocation. The `func` is
invoked with the `this` binding and arguments of the created function.
#### Arguments
1. `func` *(Function)*: The function to restrict.
#### Returns
*(Function)*: Returns the new restricted function.
#### Example
```js
var initialize = _.once(createApplication);
initialize();
initialize();
// `initialize` invokes `createApplication` once
```
* * *
### `_.overArgs(func, [transforms])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8872 "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/4.2.1/lodash.js#L8919 "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
it does **not** alter the `this` binding.
The `_.partial.placeholder` value, which defaults to `_` in monolithic
builds, may be used as a placeholder for partially applied arguments.
**Note:** This method doesn't set the "length" property of partially
applied functions.
#### Arguments
1. `func` *(Function)*: The function to partially apply arguments to.
2. `[partials]` *(...*)*: The arguments to be partially applied.
#### Returns
*(Function)*: Returns the new partially applied function.
#### Example
```js
var greet = function(greeting, name) {
return greeting + ' ' + name;
};
var sayHelloTo = _.partial(greet, 'hello');
sayHelloTo('fred');
// => 'hello fred'
// Partially applied with placeholders.
var greetFred = _.partial(greet, _, 'fred');
greetFred('hi');
// => 'hi fred'
```
* * *
### `_.partialRight(func, [partials])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8957 "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.
The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
builds, may be used as a placeholder for partially applied arguments.
**Note:** This method doesn't set the "length" property of partially
applied functions.
#### Arguments
1. `func` *(Function)*: The function to partially apply arguments to.
2. `[partials]` *(...*)*: The arguments to be partially applied.
#### Returns
*(Function)*: Returns the new partially applied function.
#### Example
```js
var greet = function(greeting, name) {
return greeting + ' ' + name;
};
var greetFred = _.partialRight(greet, 'fred');
greetFred('hi');
// => 'hi fred'
// Partially applied with placeholders.
var sayHelloTo = _.partialRight(greet, 'hello', _);
sayHelloTo('fred');
// => 'hello fred'
```
* * *
### `_.rearg(func, indexes)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L8986 "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
provided as the first argument, the argument value at the second index is
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 individually or in arrays.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
var rearged = _.rearg(function(a, b, c) {
return [a, b, c];
}, 2, 0, 1);
rearged('b', 'c', 'a')
// => ['a', 'b', 'c']
```
* * *
### `_.rest(func, [start=func.length-1])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L9012 "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://mdn.io/rest_parameters).
#### Arguments
1. `func` *(Function)*: The function to apply a rest parameter to.
2. `[start=func.length-1]` *(number)*: The start position of the rest parameter.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
var say = _.rest(function(what, names) {
return what + ' ' + _.initial(names).join(', ') +
(_.size(names) > 1 ? ', & ' : '') + _.last(names);
});
say('hello', 'fred', 'barney', 'pebbles');
// => 'hello fred, barney, & pebbles'
```
* * *
### `_.spread(func, [start=0])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L9072 "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://mdn.io/spread_operator).
#### Arguments
1. `func` *(Function)*: The function to spread arguments over.
2. `[start=0]` *(number)*: The start position of the spread.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
var say = _.spread(function(who, what) {
return who + ' says ' + what;
});
say(['fred', 'hello']);
// => 'fred says hello'
var numbers = Promise.all([
Promise.resolve(40),
Promise.resolve(36)
]);
numbers.then(_.spread(function(x, y) {
return x + y;
}));
// => a Promise of 76
```
* * *
### `_.throttle(func, [wait=0], [options])`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L9128 "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 `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
on the trailing edge of the timeout only if the throttled function is
invoked more than once during the `wait` timeout.
See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
for details over the differences between `_.throttle` and `_.debounce`.
#### Arguments
1. `func` *(Function)*: The function to throttle.
2. `[wait=0]` *(number)*: The number of milliseconds to throttle invocations to.
3. `[options]` *(Object)*: The options object.
4. `[options.leading=true]` *(boolean)*: Specify invoking on the leading edge of the timeout.
5. `[options.trailing=true]` *(boolean)*: Specify invoking on the trailing edge of the timeout.
#### Returns
*(Function)*: Returns the new throttled function.
#### Example
```js
// Avoid excessively updating the position while scrolling.
jQuery(window).on('scroll', _.throttle(updatePosition, 100));
// Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
jQuery(element).on('click', throttled);
// Cancel the trailing throttled invocation.
jQuery(window).on('popstate', throttled.cancel);
```
* * *
### `_.unary(func)`
# [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L9156 "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/4.2.1/lodash.js#L9181 "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
appended to those provided to the wrapper function. The wrapper is invoked
with the `this` binding of the created function.
#### Arguments
1. `value` *(*)*: The value to wrap.
2. `wrapper` *(Function)*: The wrapper function.
#### Returns
*(Function)*: Returns the new function.
#### Example
```js
var p = _.wrap(_.escape, function(func, text) {
return '
' + func(text) + '
'; }); p('fred, barney, & pebbles'); // => 'fred, barney, & pebbles
' ``` * * * ## `“Lang” Methods` ### `_.clone(value)` # [Ⓢ](https://github.com/lodash/lodash/blob/4.2.1/lodash.js#L9212 "View in source") [Ⓣ][1] [Ⓝ](https://www.npmjs.com/package/lodash.clone "See the npm package") Creates a shallow clone of `value`.