lodash
Every lodash function available as _ inside expressions: arrays, collections, objects, strings and more, in the exact version Sommatic AI runs.
Call any function through _ inside {{ }}. Use them to group, filter, pick and reshape the data of earlier nodes:
{{ _.groupBy($json.items, 'status') }}Array
_.chunk(array, [size=1])
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.
-
arrayArray The array to process. -
sizenumber Optional Default1The length of each chunk
→ Array
_.compact(array)
Creates an array with all falsey values removed. The values false, null,
0, -0, 0n, "", undefined, and NaN are falsy.
-
arrayArray The array to compact.
→ Array
_.concat(array, [values])
Creates a new array concatenating array with any additional arrays
and/or values.
-
arrayArray The array to concatenate. -
values...* Optional The values to concatenate.
→ Array
_.difference(array, [values])
Creates an array of array values not included in the other given arrays
using SameValueZero
for equality comparisons. The order and references of result values are
determined by the first array.
Note: Unlike _.pullAll, this method returns a new array.
-
arrayArray The array to inspect. -
values...Array Optional The values to exclude.
→ Array
_.differenceBy(array, [values], [iteratee=_.identity])
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 they're compared. The order and references of result values are
determined by the first array. The iteratee is invoked with one argument:
(value).
Note: Unlike _.pullAllBy, this method returns a new array.
-
arrayArray The array to inspect. -
values...Array Optional The values to exclude. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ Array
_.differenceWith(array, [values], [comparator])
This method is like _.difference except that it accepts comparator
which is invoked to compare elements of array to values. The order and
references of result values are determined by the first array. The comparator
is invoked with two arguments: (arrVal, othVal).
Note: Unlike _.pullAllWith, this method returns a new array.
-
arrayArray The array to inspect. -
values...Array Optional The values to exclude. -
comparatorFunction Optional The comparator invoked per element.
→ Array
_.drop(array, [n=1])
Creates a slice of array with n elements dropped from the beginning.
-
arrayArray The array to query. -
nnumber Optional Default1The number of elements to drop.
→ Array
_.dropRight(array, [n=1])
Creates a slice of array with n elements dropped from the end.
-
arrayArray The array to query. -
nnumber Optional Default1The number of elements to drop.
→ Array
_.dropRightWhile(array, [predicate=_.identity])
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).
-
arrayArray The array to query. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.dropWhile(array, [predicate=_.identity])
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).
-
arrayArray The array to query. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.fill(array, value, [start=0], [end=array.length])
Fills elements of array with value from start up to, but not
including, end.
Note: This method mutates array.
-
arrayArray The array to fill. -
value* The value to fill `array` with. -
startnumber Optional Default0The start position. -
endnumber Optional Defaultarray.lengthThe end position.
→ Array
_.findIndex(array, [predicate=_.identity], [fromIndex=0])
This method is like _.find except that it returns the index of the first
element predicate returns truthy for instead of the element itself.
-
arrayArray The array to inspect. -
predicateFunction Optional Default_.identityThe function invoked per iteration. -
fromIndexnumber Optional Default0The index to search from.
→ number
_.findLastIndex(array, [predicate=_.identity], [fromIndex=array.length-1])
This method is like _.findIndex except that it iterates over elements
of collection from right to left.
-
arrayArray The array to inspect. -
predicateFunction Optional Default_.identityThe function invoked per iteration. -
fromIndexnumber Optional Defaultarray.length-1The index to search from.
→ number
_.flatten(array)
Flattens array a single level deep.
-
arrayArray The array to flatten.
→ Array
_.flattenDeep(array)
Recursively flattens array.
-
arrayArray The array to flatten.
→ Array
_.flattenDepth(array, [depth=1])
Recursively flatten array up to depth times.
-
arrayArray The array to flatten. -
depthnumber Optional Default1The maximum recursion depth.
→ Array
_.fromPairs(pairs)
The inverse of _.toPairs; this method returns an object composed
from key-value pairs.
-
pairsArray The key-value pairs.
→ Object
_.head(array)
Gets the first element of array.
-
arrayArray The array to query.
→ *
_.indexOf(array, value, [fromIndex=0])
Gets the index at which the first occurrence of value is found in array
using SameValueZero
for equality comparisons. If fromIndex is negative, it's used as the
offset from the end of array.
-
arrayArray The array to inspect. -
value* The value to search for. -
fromIndexnumber Optional Default0The index to search from.
→ number
_.initial(array)
Gets all but the last element of array.
-
arrayArray The array to query.
→ Array
_.intersection([arrays])
Creates an array of unique values that are included in all given arrays
using SameValueZero
for equality comparisons. The order and references of result values are
determined by the first array.
-
arrays...Array Optional The arrays to inspect.
→ Array
_.intersectionBy([arrays], [iteratee=_.identity])
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 they're compared. The order and references of result values are
determined by the first array. The iteratee is invoked with one argument:
(value).
-
arrays...Array Optional The arrays to inspect. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ Array
_.intersectionWith([arrays], [comparator])
This method is like _.intersection except that it accepts comparator
which is invoked to compare elements of arrays. The order and references
of result values are determined by the first array. The comparator is
invoked with two arguments: (arrVal, othVal).
-
arrays...Array Optional The arrays to inspect. -
comparatorFunction Optional The comparator invoked per element.
→ Array
_.join(array, [separator=','])
Converts all elements in array into a string separated by separator.
-
arrayArray The array to convert. -
separatorstring Optional Default','The element separator.
→ string
_.last(array)
Gets the last element of array.
-
arrayArray The array to query.
→ *
_.lastIndexOf(array, value, [fromIndex=array.length-1])
This method is like _.indexOf except that it iterates over elements of
array from right to left.
-
arrayArray The array to inspect. -
value* The value to search for. -
fromIndexnumber Optional Defaultarray.length-1The index to search from.
→ number
_.nth(array, [n=0])
Gets the element at index n of array. If n is negative, the nth
element from the end is returned.
-
arrayArray The array to query. -
nnumber Optional Default0The index of the element to return.
→ *
_.pull(array, [values])
Removes all given values from array using
SameValueZero
for equality comparisons.
Note: Unlike _.without, this method mutates array. Use _.remove
to remove elements from an array by predicate.
-
arrayArray The array to modify. -
values...* Optional The values to remove.
→ Array
_.pullAll(array, values)
This method is like _.pull except that it accepts an array of values to remove.
Note: Unlike _.difference, this method mutates array.
-
arrayArray The array to modify. -
valuesArray The values to remove.
→ Array
_.pullAllBy(array, values, [iteratee=_.identity])
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 they're compared. The iteratee is invoked with one argument: (value).
Note: Unlike _.differenceBy, this method mutates array.
-
arrayArray The array to modify. -
valuesArray The values to remove. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ Array
_.pullAllWith(array, values, [comparator])
This method is like _.pullAll except that it accepts comparator which
is invoked to compare elements of array to values. The comparator is
invoked with two arguments: (arrVal, othVal).
Note: Unlike _.differenceWith, this method mutates array.
-
arrayArray The array to modify. -
valuesArray The values to remove. -
comparatorFunction Optional The comparator invoked per element.
→ Array
_.pullAt(array, [indexes])
Removes elements from array corresponding to indexes and returns an
array of removed elements.
Note: Unlike _.at, this method mutates array.
-
arrayArray The array to modify. -
indexes...(number|number[]) Optional The indexes of elements to remove.
→ Array
_.remove(array, [predicate=_.identity])
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. Use _.pull
to pull elements from an array by value.
-
arrayArray The array to modify. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.reverse(array)
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.
-
arrayArray The array to modify.
→ Array
_.slice(array, [start=0], [end=array.length])
Creates a slice of array from start up to, but not including, end.
Note: This method is used instead of
Array#slice to ensure dense arrays are
returned.
-
arrayArray The array to slice. -
startnumber Optional Default0The start position. -
endnumber Optional Defaultarray.lengthThe end position.
→ Array
_.sortedIndex(array, value)
Uses a binary search to determine the lowest index at which value
should be inserted into array in order to maintain its sort order.
-
arrayArray The sorted array to inspect. -
value* The value to evaluate.
→ number
_.sortedIndexBy(array, value, [iteratee=_.identity])
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).
-
arrayArray The sorted array to inspect. -
value* The value to evaluate. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ number
_.sortedIndexOf(array, value)
This method is like _.indexOf except that it performs a binary
search on a sorted array.
-
arrayArray The array to inspect. -
value* The value to search for.
→ number
_.sortedLastIndex(array, value)
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.
-
arrayArray The sorted array to inspect. -
value* The value to evaluate.
→ number
_.sortedLastIndexBy(array, value, [iteratee=_.identity])
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).
-
arrayArray The sorted array to inspect. -
value* The value to evaluate. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ number
_.sortedLastIndexOf(array, value)
This method is like _.lastIndexOf except that it performs a binary
search on a sorted array.
-
arrayArray The array to inspect. -
value* The value to search for.
→ number
_.sortedUniq(array)
This method is like _.uniq except that it's designed and optimized
for sorted arrays.
-
arrayArray The array to inspect.
→ Array
_.sortedUniqBy(array, [iteratee])
This method is like _.uniqBy except that it's designed and optimized
for sorted arrays.
-
arrayArray The array to inspect. -
iterateeFunction Optional The iteratee invoked per element.
→ Array
_.tail(array)
Gets all but the first element of array.
-
arrayArray The array to query.
→ Array
_.take(array, [n=1])
Creates a slice of array with n elements taken from the beginning.
-
arrayArray The array to query. -
nnumber Optional Default1The number of elements to take.
→ Array
_.takeRight(array, [n=1])
Creates a slice of array with n elements taken from the end.
-
arrayArray The array to query. -
nnumber Optional Default1The number of elements to take.
→ Array
_.takeRightWhile(array, [predicate=_.identity])
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).
-
arrayArray The array to query. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.takeWhile(array, [predicate=_.identity])
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).
-
arrayArray The array to query. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.union([arrays])
Creates an array of unique values, in order, from all given arrays using
SameValueZero
for equality comparisons.
-
arrays...Array Optional The arrays to inspect.
→ Array
_.unionBy([arrays], [iteratee=_.identity])
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. Result values are chosen from the first
array in which the value occurs. The iteratee is invoked with one argument:
(value).
-
arrays...Array Optional The arrays to inspect. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ Array
_.unionWith([arrays], [comparator])
This method is like _.union except that it accepts comparator which
is invoked to compare elements of arrays. Result values are chosen from
the first array in which the value occurs. The comparator is invoked
with two arguments: (arrVal, othVal).
-
arrays...Array Optional The arrays to inspect. -
comparatorFunction Optional The comparator invoked per element.
→ Array
_.uniq(array)
Creates a duplicate-free version of an array, using
SameValueZero
for equality comparisons, in which only the first occurrence of each element
is kept. The order of result values is determined by the order they occur
in the array.
-
arrayArray The array to inspect.
→ Array
_.uniqBy(array, [iteratee=_.identity])
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 order of result values is determined by the
order they occur in the array. The iteratee is invoked with one argument:
(value).
-
arrayArray The array to inspect. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ Array
_.uniqWith(array, [comparator])
This method is like _.uniq except that it accepts comparator which
is invoked to compare elements of array. The order of result values is
determined by the order they occur in the array.The comparator is invoked
with two arguments: (arrVal, othVal).
-
arrayArray The array to inspect. -
comparatorFunction Optional The comparator invoked per element.
→ Array
_.unzip(array)
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.
-
arrayArray The array of grouped elements to process.
→ Array
_.unzipWith(array, [iteratee=_.identity])
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).
-
arrayArray The array of grouped elements to process. -
iterateeFunction Optional Default_.identityThe function to combine regrouped values.
→ Array
_.without(array, [values])
Creates an array excluding all given values using
SameValueZero
for equality comparisons.
Note: Unlike _.pull, this method returns a new array.
-
arrayArray The array to inspect. -
values...* Optional The values to exclude.
→ Array
_.xor([arrays])
Creates an array of unique values that is the symmetric difference of the given arrays. The order of result values is determined by the order they occur in the arrays.
-
arrays...Array Optional The arrays to inspect.
→ Array
_.xorBy([arrays], [iteratee=_.identity])
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 by which they're compared. The order of result values is determined
by the order they occur in the arrays. The iteratee is invoked with one
argument: (value).
-
arrays...Array Optional The arrays to inspect. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ Array
_.xorWith([arrays], [comparator])
This method is like _.xor except that it accepts comparator which is
invoked to compare elements of arrays. The order of result values is
determined by the order they occur in the arrays. The comparator is invoked
with two arguments: (arrVal, othVal).
-
arrays...Array Optional The arrays to inspect. -
comparatorFunction Optional The comparator invoked per element.
→ Array
_.zip([arrays])
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.
-
arrays...Array Optional The arrays to process.
→ Array
_.zipObject([props=[], [values=[])
This method is like _.fromPairs except that it accepts two arrays,
one of property identifiers and one of corresponding values.
-
propsArray Optional Default[] The property identifiers. -
valuesArray Optional Default[] The property values.
→ Object
_.zipObjectDeep([props=[], [values=[])
This method is like _.zipObject except that it supports property paths.
-
propsArray Optional Default[] The property identifiers. -
valuesArray Optional Default[] The property values.
→ Object
_.zipWith([arrays], [iteratee=_.identity])
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).
-
arrays...Array Optional The arrays to process. -
iterateeFunction Optional Default_.identityThe function to combine grouped values.
→ Array
Collection
_.countBy(collection, [iteratee=_.identity])
Creates an object composed of keys generated from the results of running
each element of collection thru 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).
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe iteratee to transform keys.
→ Object
_.every(collection, [predicate=_.identity])
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).
Note: This method returns true for
empty collections because
everything is true of
elements of empty collections.
-
collectionArray|Object The collection to iterate over. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ boolean
_.filter(collection, [predicate=_.identity])
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).
Note: Unlike _.remove, this method returns a new array.
-
collectionArray|Object The collection to iterate over. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.find(collection, [predicate=_.identity], [fromIndex=0])
Iterates over elements of collection, returning the first element
predicate returns truthy for. The predicate is invoked with three
arguments: (value, index|key, collection).
-
collectionArray|Object The collection to inspect. -
predicateFunction Optional Default_.identityThe function invoked per iteration. -
fromIndexnumber Optional Default0The index to search from.
→ *
_.findLast(collection, [predicate=_.identity], [fromIndex=collection.length-1])
This method is like _.find except that it iterates over elements of
collection from right to left.
-
collectionArray|Object The collection to inspect. -
predicateFunction Optional Default_.identityThe function invoked per iteration. -
fromIndexnumber Optional Defaultcollection.length-1The index to search from.
→ *
_.flatMap(collection, [iteratee=_.identity])
Creates a flattened array of values by running each element in collection
thru iteratee and flattening the mapped results. The iteratee is invoked
with three arguments: (value, index|key, collection).
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.flatMapDeep(collection, [iteratee=_.identity])
This method is like _.flatMap except that it recursively flattens the
mapped results.
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.flatMapDepth(collection, [iteratee=_.identity], [depth=1])
This method is like _.flatMap except that it recursively flattens the
mapped results up to depth times.
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration. -
depthnumber Optional Default1The maximum recursion depth.
→ Array
_.forEach(collection, [iteratee=_.identity])
Iterates over elements of collection and invokes 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.
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Array|Object
_.forEachRight(collection, [iteratee=_.identity])
This method is like _.forEach except that it iterates over elements of
collection from right to left.
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Array|Object
_.groupBy(collection, [iteratee=_.identity])
Creates an object composed of keys generated from the results of running
each element of collection thru iteratee. The order of grouped values
is determined by the order they occur in collection. The corresponding
value of each key is an array of elements responsible for generating the
key. The iteratee is invoked with one argument: (value).
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe iteratee to transform keys.
→ Object
_.includes(collection, value, [fromIndex=0])
Checks if value is in collection. If collection is a string, it's
checked for a substring of value, otherwise
SameValueZero
is used for equality comparisons. If fromIndex is negative, it's used as
the offset from the end of collection.
-
collectionArray|Object|string The collection to inspect. -
value* The value to search for. -
fromIndexnumber Optional Default0The index to search from.
→ boolean
_.invokeMap(collection, path, [args])
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 path is a function, it's invoked
for, and this bound to, each element in collection.
-
collectionArray|Object The collection to iterate over. -
pathArray|Function|string The path of the method to invoke or the function invoked per iteration. -
args...* Optional The arguments to invoke each method with.
→ Array
_.keyBy(collection, [iteratee=_.identity])
Creates an object composed of keys generated from the results of running
each element of collection thru iteratee. The corresponding value of
each key is the last element responsible for generating the key. The
iteratee is invoked with one argument: (value).
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe iteratee to transform keys.
→ Object
_.map(collection, [iteratee=_.identity])
Creates an array of values by running each element in collection thru
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, chunk, curry, curryRight, drop, dropRight, every,
fill, invert, parseInt, random, range, rangeRight, repeat,
sampleSize, slice, some, sortBy, split, take, takeRight,
template, trim, trimEnd, trimStart, and words
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.orderBy(collection, [iteratees=[_.identity], [orders])
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.
-
collectionArray|Object The collection to iterate over. -
iterateesArray[]|Function[]|Object[]|string[] Optional Default[_.identity] The iteratees to sort by. -
ordersstring[] Optional The sort orders of `iteratees`.
→ Array
_.partition(collection, [predicate=_.identity])
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).
-
collectionArray|Object The collection to iterate over. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.reduce(collection, [iteratee=_.identity], [accumulator])
Reduces collection to a value which is the accumulated result of running
each element in collection thru iteratee, where each successive
invocation is supplied the return value of the previous. If accumulator
is not given, 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
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration. -
accumulator* Optional The initial value.
→ *
_.reduceRight(collection, [iteratee=_.identity], [accumulator])
This method is like _.reduce except that it iterates over elements of
collection from right to left.
-
collectionArray|Object The collection to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration. -
accumulator* Optional The initial value.
→ *
_.reject(collection, [predicate=_.identity])
The opposite of _.filter; this method returns the elements of collection
that predicate does not return truthy for.
-
collectionArray|Object The collection to iterate over. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.sample(collection)
Gets a random element from collection.
-
collectionArray|Object The collection to sample.
→ *
_.sampleSize(collection, [n=1])
Gets n random elements at unique keys from collection up to the
size of collection.
-
collectionArray|Object The collection to sample. -
nnumber Optional Default1The number of elements to sample.
→ Array
_.shuffle(collection)
Creates an array of shuffled values, using a version of the Fisher-Yates shuffle.
-
collectionArray|Object The collection to shuffle.
→ Array
_.size(collection)
Gets the size of collection by returning its length for array-like
values or the number of own enumerable string keyed properties for objects.
-
collectionArray|Object|string The collection to inspect.
→ number
_.some(collection, [predicate=_.identity])
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).
-
collectionArray|Object The collection to iterate over. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ boolean
_.sortBy(collection, [iteratees=[_.identity])
Creates an array of elements, sorted in ascending order by the results of running each element in a collection thru 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).
-
collectionArray|Object The collection to iterate over. -
iteratees...(Function|Function[]) Optional Default[_.identity] The iteratees to sort by.
→ Array
Date
_.now()
Gets the timestamp of the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).
→ number
Function
_.after(n, func)
The opposite of _.before; this method creates a function that invokes
func once it's called n or more times.
-
nnumber The number of calls before `func` is invoked. -
funcFunction The function to restrict.
→ Function
_.ary(func, [n=func.length])
Creates a function that invokes func, with up to n arguments,
ignoring any additional arguments.
-
funcFunction The function to cap arguments for. -
nnumber Optional Defaultfunc.lengthThe arity cap.
→ Function
_.before(n, func)
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.
-
nnumber The number of calls at which `func` is no longer invoked. -
funcFunction The function to restrict.
→ Function
_.bind(func, thisArg, [partials])
Creates a function that invokes func with the this binding of thisArg
and partials prepended to the arguments it receives.
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.
-
funcFunction The function to bind. -
thisArg* The `this` binding of `func`. -
partials...* Optional The arguments to be partially applied.
→ Function
_.bindKey(object, key, [partials])
Creates a function that invokes the method at object[key] with partials
prepended to the arguments it receives.
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
for more details.
The _.bindKey.placeholder value, which defaults to _ in monolithic
builds, may be used as a placeholder for partially applied arguments.
-
objectObject The object to invoke the method on. -
keystring The key of the method. -
partials...* Optional The arguments to be partially applied.
→ Function
_.curry(func, [arity=func.length])
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.
-
funcFunction The function to curry. -
aritynumber Optional Defaultfunc.lengthThe arity of `func`.
→ Function
_.curryRight(func, [arity=func.length])
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.
-
funcFunction The function to curry. -
aritynumber Optional Defaultfunc.lengthThe arity of `func`.
→ Function
_.debounce(func, [wait=0], [options={}], [options.leading=false], [options.maxWait], [options.trailing=true])
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 options 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.
If wait is 0 and leading is false, func invocation is deferred
until to the next tick, similar to setTimeout with a timeout of 0.
See David Corbacho's article
for details over the differences between _.debounce and _.throttle.
-
funcFunction The function to debounce. -
waitnumber Optional Default0The number of milliseconds to delay. -
optionsObject Optional Default{}The options object. -
options.leadingboolean Optional DefaultfalseSpecify invoking on the leading edge of the timeout. -
options.maxWaitnumber Optional The maximum time `func` is allowed to be delayed before it's invoked. -
options.trailingboolean Optional DefaulttrueSpecify invoking on the trailing edge of the timeout.
→ Function
_.defer(func, [args])
Defers invoking the func until the current call stack has cleared. Any
additional arguments are provided to func when it's invoked.
-
funcFunction The function to defer. -
args...* Optional The arguments to invoke `func` with.
→ number
_.delay(func, wait, [args])
Invokes func after wait milliseconds. Any additional arguments are
provided to func when it's invoked.
-
funcFunction The function to delay. -
waitnumber The number of milliseconds to delay invocation. -
args...* Optional The arguments to invoke `func` with.
→ number
_.flip(func)
Creates a function that invokes func with arguments reversed.
-
funcFunction The function to flip arguments for.
→ Function
_.memoize(func, [resolver])
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
method interface of clear, delete, get, has, and set.
-
funcFunction The function to have its output memoized. -
resolverFunction Optional The function to resolve the cache key.
→ Function
_.negate(predicate)
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.
-
predicateFunction The predicate to negate.
→ Function
_.once(func)
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.
-
funcFunction The function to restrict.
→ Function
_.overArgs(func, [transforms=[_.identity])
Creates a function that invokes func with its arguments transformed.
-
funcFunction The function to wrap. -
transforms...(Function|Function[]) Optional Default[_.identity] The argument transforms.
→ Function
_.partial(func, [partials])
Creates a function that invokes func with partials prepended to the
arguments it receives. 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.
-
funcFunction The function to partially apply arguments to. -
partials...* Optional The arguments to be partially applied.
→ Function
_.partialRight(func, [partials])
This method is like _.partial except that partially applied arguments
are appended to the arguments it receives.
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.
-
funcFunction The function to partially apply arguments to. -
partials...* Optional The arguments to be partially applied.
→ Function
_.rearg(func, indexes)
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.
-
funcFunction The function to rearrange arguments for. -
indexes...(number|number[]) The arranged argument indexes.
→ Function
_.rest(func, [start=func.length-1])
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.
-
funcFunction The function to apply a rest parameter to. -
startnumber Optional Defaultfunc.length-1The start position of the rest parameter.
→ Function
_.spread(func, [start=0])
Creates a function that invokes func with the this binding of the
create function and an array of arguments much like
Function#apply.
Note: This method is based on the spread operator.
-
funcFunction The function to spread arguments over. -
startnumber Optional Default0The start position of the spread.
→ Function
_.throttle(func, [wait=0], [options={}], [options.leading=true], [options.trailing=true])
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 options 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.
If wait is 0 and leading is false, func invocation is deferred
until to the next tick, similar to setTimeout with a timeout of 0.
See David Corbacho's article
for details over the differences between _.throttle and _.debounce.
-
funcFunction The function to throttle. -
waitnumber Optional Default0The number of milliseconds to throttle invocations to. -
optionsObject Optional Default{}The options object. -
options.leadingboolean Optional DefaulttrueSpecify invoking on the leading edge of the timeout. -
options.trailingboolean Optional DefaulttrueSpecify invoking on the trailing edge of the timeout.
→ Function
_.unary(func)
Creates a function that accepts up to one argument, ignoring any additional arguments.
-
funcFunction The function to cap arguments for.
→ Function
_.wrap(value, [wrapper=identity])
Creates a function that provides value to wrapper as its first
argument. Any additional arguments provided to the function are appended
to those provided to the wrapper. The wrapper is invoked with the this
binding of the created function.
-
value* The value to wrap. -
wrapperFunction Optional DefaultidentityThe wrapper function.
→ Function
Lang
_.castArray(value)
Casts value as an array if it's not one.
-
value* The value to inspect.
→ Array
_.clone(value)
Creates a shallow clone of value.
Note: This method is loosely based on the
structured clone algorithm
and supports cloning arrays, array buffers, booleans, date objects, maps,
numbers, Object objects, regexes, sets, strings, symbols, and typed
arrays. The own enumerable properties of arguments objects are cloned
as plain objects. An empty object is returned for uncloneable values such
as error objects, functions, DOM nodes, and WeakMaps.
-
value* The value to clone.
→ *
_.cloneDeep(value)
This method is like _.clone except that it recursively clones value.
-
value* The value to recursively clone.
→ *
_.cloneDeepWith(value, [customizer])
This method is like _.cloneWith except that it recursively clones value.
-
value* The value to recursively clone. -
customizerFunction Optional The function to customize cloning.
→ *
_.cloneWith(value, [customizer])
This method is like _.clone except that it accepts customizer which
is invoked to produce the cloned value. If customizer returns undefined,
cloning is handled by the method instead. The customizer is invoked with
up to four arguments; (value [, index|key, object, stack]).
-
value* The value to clone. -
customizerFunction Optional The function to customize cloning.
→ *
_.conformsTo(object, source)
Checks if object conforms to source by invoking the predicate
properties of source with the corresponding property values of object.
Note: This method is equivalent to _.conforms when source is
partially applied.
-
objectObject The object to inspect. -
sourceObject The object of property predicates to conform to.
→ boolean
_.eq(value, other)
Performs a
SameValueZero
comparison between two values to determine if they are equivalent.
-
value* The value to compare. -
other* The other value to compare.
→ boolean
_.gt(value, other)
Checks if value is greater than other.
-
value* The value to compare. -
other* The other value to compare.
→ boolean
_.gte(value, other)
Checks if value is greater than or equal to other.
-
value* The value to compare. -
other* The other value to compare.
→ boolean
_.isArguments(value)
Checks if value is likely an arguments object.
-
value* The value to check.
→ boolean
_.isArray(value)
Checks if value is classified as an Array object.
-
value* The value to check.
→ boolean
_.isArrayBuffer(value)
Checks if value is classified as an ArrayBuffer object.
-
value* The value to check.
→ boolean
_.isArrayLike(value)
Checks if value is array-like. A value is considered array-like if it's
not a function and has a value.length that's an integer greater than or
equal to 0 and less than or equal to Number.MAX_SAFE_INTEGER.
-
value* The value to check.
→ boolean
_.isArrayLikeObject(value)
This method is like _.isArrayLike except that it also checks if value
is an object.
-
value* The value to check.
→ boolean
_.isBoolean(value)
Checks if value is classified as a boolean primitive or object.
-
value* The value to check.
→ boolean
_.isBuffer(value)
Checks if value is a buffer.
-
value* The value to check.
→ boolean
_.isDate(value)
Checks if value is classified as a Date object.
-
value* The value to check.
→ boolean
_.isElement(value)
Checks if value is likely a DOM element.
-
value* The value to check.
→ boolean
_.isEmpty(value)
Checks if value is an empty object, collection, map, or set.
Objects are considered empty if they have no own enumerable string keyed properties.
Array-like values such as arguments objects, arrays, buffers, strings, or
jQuery-like collections are considered empty if they have a length of 0.
Similarly, maps and sets are considered empty if they have a size of 0.
-
value* The value to check.
→ boolean
_.isEqual(value, other)
Performs a deep comparison between two values to determine if they are equivalent.
Note: This method supports comparing arrays, array buffers, booleans,
date objects, error objects, maps, numbers, Object objects, regexes,
sets, strings, symbols, and typed arrays. Object objects are compared
by their own, not inherited, enumerable properties. Functions and DOM
nodes are compared by strict equality, i.e. ===.
-
value* The value to compare. -
other* The other value to compare.
→ boolean
_.isEqualWith(value, other, [customizer])
This method is like _.isEqual except that it accepts customizer which
is invoked to compare values. If customizer returns undefined, comparisons
are handled by the method instead. The customizer is invoked with up to
six arguments: (objValue, othValue [, index|key, object, other, stack]).
-
value* The value to compare. -
other* The other value to compare. -
customizerFunction Optional The function to customize comparisons.
→ boolean
_.isError(value)
Checks if value is an Error, EvalError, RangeError, ReferenceError,
SyntaxError, TypeError, or URIError object.
-
value* The value to check.
→ boolean
_.isFinite(value)
Checks if value is a finite primitive number.
Note: This method is based on
Number.isFinite.
-
value* The value to check.
→ boolean
_.isFunction(value)
Checks if value is classified as a Function object.
-
value* The value to check.
→ boolean
_.isInteger(value)
Checks if value is an integer.
Note: This method is based on
Number.isInteger.
-
value* The value to check.
→ boolean
_.isLength(value)
Checks if value is a valid array-like length.
Note: This method is loosely based on
ToLength.
-
value* The value to check.
→ boolean
_.isMap(value)
Checks if value is classified as a Map object.
-
value* The value to check.
→ boolean
_.isMatch(object, source)
Performs a partial deep comparison between object and source to
determine if object contains equivalent property values.
Note: This method is equivalent to _.matches when source is
partially applied.
Partial comparisons will match empty array and empty object source
values against any array or object value, respectively. See _.isEqual
for a list of supported value comparisons.
-
objectObject The object to inspect. -
sourceObject The object of property values to match.
→ boolean
_.isMatchWith(object, source, [customizer])
This method is like _.isMatch except that it accepts customizer which
is invoked to compare values. If customizer returns undefined, comparisons
are handled by the method instead. The customizer is invoked with five
arguments: (objValue, srcValue, index|key, object, source).
-
objectObject The object to inspect. -
sourceObject The object of property values to match. -
customizerFunction Optional The function to customize comparisons.
→ boolean
_.isNaN(value)
Checks if value is NaN.
Note: This method is based on
Number.isNaN and is not the same as
global isNaN which returns true for
undefined and other non-number values.
-
value* The value to check.
→ boolean
_.isNative(value)
Checks if value is a pristine native function.
Note: This method can't reliably detect native functions in the presence of the core-js package because core-js circumvents this kind of detection. Despite multiple requests, the core-js maintainer has made it clear: any attempt to fix the detection will be obstructed. As a result, we're left with little choice but to throw an error. Unfortunately, this also affects packages, like babel-polyfill, which rely on core-js.
-
value* The value to check.
→ boolean
_.isNil(value)
Checks if value is null or undefined.
-
value* The value to check.
→ boolean
_.isNull(value)
Checks if value is null.
-
value* The value to check.
→ boolean
_.isNumber(value)
Checks if value is classified as a Number primitive or object.
Note: To exclude Infinity, -Infinity, and NaN, which are
classified as numbers, use the _.isFinite method.
-
value* The value to check.
→ boolean
_.isObject(value)
Checks if value is the
language type
of Object. (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
-
value* The value to check.
→ boolean
_.isObjectLike(value)
Checks if value is object-like. A value is object-like if it's not null
and has a typeof result of "object".
-
value* The value to check.
→ boolean
_.isPlainObject(value)
Checks if value is a plain object, that is, an object created by the
Object constructor or one with a [[Prototype]] of null.
-
value* The value to check.
→ boolean
_.isRegExp(value)
Checks if value is classified as a RegExp object.
-
value* The value to check.
→ boolean
_.isSafeInteger(value)
Checks if value is a safe integer. An integer is safe if it's an IEEE-754
double precision number which isn't the result of a rounded unsafe integer.
Note: This method is based on
Number.isSafeInteger.
-
value* The value to check.
→ boolean
_.isSet(value)
Checks if value is classified as a Set object.
-
value* The value to check.
→ boolean
_.isString(value)
Checks if value is classified as a String primitive or object.
-
value* The value to check.
→ boolean
_.isSymbol(value)
Checks if value is classified as a Symbol primitive or object.
-
value* The value to check.
→ boolean
_.isTypedArray(value)
Checks if value is classified as a typed array.
-
value* The value to check.
→ boolean
_.isUndefined(value)
Checks if value is undefined.
-
value* The value to check.
→ boolean
_.isWeakMap(value)
Checks if value is classified as a WeakMap object.
-
value* The value to check.
→ boolean
_.isWeakSet(value)
Checks if value is classified as a WeakSet object.
-
value* The value to check.
→ boolean
_.lt(value, other)
Checks if value is less than other.
-
value* The value to compare. -
other* The other value to compare.
→ boolean
_.lte(value, other)
Checks if value is less than or equal to other.
-
value* The value to compare. -
other* The other value to compare.
→ boolean
_.toArray(value)
Converts value to an array.
-
value* The value to convert.
→ Array
_.toFinite(value)
Converts value to a finite number.
-
value* The value to convert.
→ number
_.toInteger(value)
Converts value to an integer.
Note: This method is loosely based on
ToInteger.
-
value* The value to convert.
→ number
_.toLength(value)
Converts value to an integer suitable for use as the length of an
array-like object.
Note: This method is based on
ToLength.
-
value* The value to convert.
→ number
_.toNumber(value)
Converts value to a number.
-
value* The value to process.
→ number
_.toPlainObject(value)
Converts value to a plain object flattening inherited enumerable string
keyed properties of value to own properties of the plain object.
-
value* The value to convert.
→ Object
_.toSafeInteger(value)
Converts value to a safe integer. A safe integer can be compared and
represented correctly.
-
value* The value to convert.
→ number
_.toString(value)
Converts value to a string. An empty string is returned for null
and undefined values. The sign of -0 is preserved.
-
value* The value to convert.
→ string
Math
_.add(augend, addend)
Adds two numbers.
-
augendnumber The first number in an addition. -
addendnumber The second number in an addition.
→ number
_.ceil(number, [precision=0])
Computes number rounded up to precision.
-
numbernumber The number to round up. -
precisionnumber Optional Default0The precision to round up to.
→ number
_.divide(dividend, divisor)
Divide two numbers.
-
dividendnumber The first number in a division. -
divisornumber The second number in a division.
→ number
_.floor(number, [precision=0])
Computes number rounded down to precision.
-
numbernumber The number to round down. -
precisionnumber Optional Default0The precision to round down to.
→ number
_.max(array)
Computes the maximum value of array. If array is empty or falsey,
undefined is returned.
-
arrayArray The array to iterate over.
→ *
_.maxBy(array, [iteratee=_.identity])
This method is like _.max except that it accepts iteratee which is
invoked for each element in array to generate the criterion by which
the value is ranked. The iteratee is invoked with one argument: (value).
-
arrayArray The array to iterate over. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ *
_.mean(array)
Computes the mean of the values in array.
-
arrayArray The array to iterate over.
→ number
_.meanBy(array, [iteratee=_.identity])
This method is like _.mean except that it accepts iteratee which is
invoked for each element in array to generate the value to be averaged.
The iteratee is invoked with one argument: (value).
-
arrayArray The array to iterate over. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ number
_.min(array)
Computes the minimum value of array. If array is empty or falsey,
undefined is returned.
-
arrayArray The array to iterate over.
→ *
_.minBy(array, [iteratee=_.identity])
This method is like _.min except that it accepts iteratee which is
invoked for each element in array to generate the criterion by which
the value is ranked. The iteratee is invoked with one argument: (value).
-
arrayArray The array to iterate over. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ *
_.multiply(multiplier, multiplicand)
Multiply two numbers.
-
multipliernumber The first number in a multiplication. -
multiplicandnumber The second number in a multiplication.
→ number
_.round(number, [precision=0])
Computes number rounded to precision.
-
numbernumber The number to round. -
precisionnumber Optional Default0The precision to round to.
→ number
_.subtract(minuend, subtrahend)
Subtract two numbers.
-
minuendnumber The first number in a subtraction. -
subtrahendnumber The second number in a subtraction.
→ number
_.sum(array)
Computes the sum of the values in array.
-
arrayArray The array to iterate over.
→ number
_.sumBy(array, [iteratee=_.identity])
This method is like _.sum except that it accepts iteratee which is
invoked for each element in array to generate the value to be summed.
The iteratee is invoked with one argument: (value).
-
arrayArray The array to iterate over. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ number
Number
_.clamp(number, [lower], upper)
Clamps number within the inclusive lower and upper bounds.
-
numbernumber The number to clamp. -
lowernumber Optional The lower bound. -
uppernumber The upper bound.
→ number
_.inRange(number, [start=0], end)
Checks if n is between start and up to, but not including, end. If
end is not specified, it's set to start with start then set to 0.
If start is greater than end the params are swapped to support
negative ranges.
-
numbernumber The number to check. -
startnumber Optional Default0The start of the range. -
endnumber The end of the range.
→ boolean
_.random([lower=0], [upper=1], [floating])
Produces a random number between the inclusive lower and upper bounds.
If only one argument is provided a number between 0 and the given number
is returned. If floating is true, or either lower or upper are
floats, a floating-point number is returned instead of an integer.
Note: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.
Note: If lower is greater than upper, the values are swapped.
-
lowernumber Optional Default0The lower bound. -
uppernumber Optional Default1The upper bound. -
floatingboolean Optional Specify returning a floating-point number.
→ number
Object
_.assign(object, [sources])
Assigns own enumerable string keyed properties of source objects to the destination object. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.
Note: This method mutates object and is loosely based on
Object.assign.
-
objectObject The destination object. -
sources...Object Optional The source objects.
→ Object
_.assignIn(object, [sources])
This method is like _.assign except that it iterates over own and
inherited source properties.
Note: This method mutates object.
-
objectObject The destination object. -
sources...Object Optional The source objects.
→ Object
_.assignInWith(object, sources, [customizer])
This method is like _.assignIn except that it accepts customizer
which is invoked to produce the assigned values. If customizer returns
undefined, assignment is handled by the method instead. The customizer
is invoked with five arguments: (objValue, srcValue, key, object, source).
Note: This method mutates object.
-
objectObject The destination object. -
sources...Object The source objects. -
customizerFunction Optional The function to customize assigned values.
→ Object
_.assignWith(object, sources, [customizer])
This method is like _.assign except that it accepts customizer
which is invoked to produce the assigned values. If customizer returns
undefined, assignment is handled by the method instead. The customizer
is invoked with five arguments: (objValue, srcValue, key, object, source).
Note: This method mutates object.
-
objectObject The destination object. -
sources...Object The source objects. -
customizerFunction Optional The function to customize assigned values.
→ Object
_.at(object, [paths])
Creates an array of values corresponding to paths of object.
-
objectObject The object to iterate over. -
paths...(string|string[]) Optional The property paths to pick.
→ Array
_.create(prototype, [properties])
Creates an object that inherits from the prototype object. If a
properties object is given, its own enumerable string keyed properties
are assigned to the created object.
-
prototypeObject The object to inherit from. -
propertiesObject Optional The properties to assign to the object.
→ Object
_.defaults(object, [sources])
Assigns own and inherited enumerable string keyed properties of source
objects to the destination object for all destination properties that
resolve to undefined. Source objects are applied from left to right.
Once a property is set, additional values of the same property are ignored.
Note: This method mutates object.
-
objectObject The destination object. -
sources...Object Optional The source objects.
→ Object
_.defaultsDeep(object, [sources])
This method is like _.defaults except that it recursively assigns
default properties.
Note: This method mutates object.
-
objectObject The destination object. -
sources...Object Optional The source objects.
→ Object
_.findKey(object, [predicate=_.identity])
This method is like _.find except that it returns the key of the first
element predicate returns truthy for instead of the element itself.
-
objectObject The object to inspect. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ string|undefined
_.findLastKey(object, [predicate=_.identity])
This method is like _.findKey except that it iterates over elements of
a collection in the opposite order.
-
objectObject The object to inspect. -
predicateFunction Optional Default_.identityThe function invoked per iteration.
→ string|undefined
_.forIn(object, [iteratee=_.identity])
Iterates over own and inherited enumerable string keyed properties of an
object and invokes iteratee for each property. The iteratee is invoked
with three arguments: (value, key, object). Iteratee functions may exit
iteration early by explicitly returning false.
-
objectObject The object to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Object
_.forInRight(object, [iteratee=_.identity])
This method is like _.forIn except that it iterates over properties of
object in the opposite order.
-
objectObject The object to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Object
_.forOwn(object, [iteratee=_.identity])
Iterates over own enumerable string keyed properties of an object and
invokes iteratee for each property. The iteratee is invoked with three
arguments: (value, key, object). Iteratee functions may exit iteration
early by explicitly returning false.
-
objectObject The object to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Object
_.forOwnRight(object, [iteratee=_.identity])
This method is like _.forOwn except that it iterates over properties of
object in the opposite order.
-
objectObject The object to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Object
_.functions(object)
Creates an array of function property names from own enumerable properties
of object.
-
objectObject The object to inspect.
→ Array
_.functionsIn(object)
Creates an array of function property names from own and inherited
enumerable properties of object.
-
objectObject The object to inspect.
→ Array
_.get(object, path, [defaultValue])
Gets the value at path of object. If the resolved value is
undefined, the defaultValue is returned in its place.
-
objectObject The object to query. -
pathArray|string The path of the property to get. -
defaultValue* Optional The value returned for `undefined` resolved values.
→ *
_.has(object, path)
Checks if path is a direct property of object.
-
objectObject The object to query. -
pathArray|string The path to check.
→ boolean
_.hasIn(object, path)
Checks if path is a direct or inherited property of object.
-
objectObject The object to query. -
pathArray|string The path to check.
→ boolean
_.invert(object)
Creates an object composed of the inverted keys and values of object.
If object contains duplicate values, subsequent values overwrite
property assignments of previous values.
-
objectObject The object to invert.
→ Object
_.invertBy(object, [iteratee=_.identity])
This method is like _.invert except that the inverted object is generated
from the results of running each element of object thru iteratee. The
corresponding inverted value of each inverted key is an array of keys
responsible for generating the inverted value. The iteratee is invoked
with one argument: (value).
-
objectObject The object to invert. -
iterateeFunction Optional Default_.identityThe iteratee invoked per element.
→ Object
_.invoke(object, path, [args])
Invokes the method at path of object.
-
objectObject The object to query. -
pathArray|string The path of the method to invoke. -
args...* Optional The arguments to invoke the method with.
→ *
_.keys(object)
Creates an array of the own enumerable property names of object.
Note: Non-object values are coerced to objects. See the ES spec for more details.
-
objectObject The object to query.
→ Array
_.keysIn(object)
Creates an array of the own and inherited enumerable property names of object.
Note: Non-object values are coerced to objects.
-
objectObject The object to query.
→ Array
_.mapKeys(object, [iteratee=_.identity])
The opposite of _.mapValues; this method creates an object with the
same values as object and keys generated by running each own enumerable
string keyed property of object thru iteratee. The iteratee is invoked
with three arguments: (value, key, object).
-
objectObject The object to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Object
_.mapValues(object, [iteratee=_.identity])
Creates an object with the same keys as object and values generated
by running each own enumerable string keyed property of object thru
iteratee. The iteratee is invoked with three arguments:
(value, key, object).
-
objectObject The object to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Object
_.merge(object, [sources])
This method is like _.assign except that it recursively merges own and
inherited enumerable string keyed properties of source objects into the
destination object. Source properties that resolve to undefined are
skipped if a destination value exists. Array and plain object properties
are merged recursively. Other objects and value types are overridden by
assignment. Source objects are applied from left to right. Subsequent
sources overwrite property assignments of previous sources.
Note: This method mutates object.
-
objectObject The destination object. -
sources...Object Optional The source objects.
→ Object
_.mergeWith(object, sources, customizer)
This method is like _.merge except that it accepts customizer which
is invoked to produce the merged values of the destination and source
properties. If customizer returns undefined, merging is handled by the
method instead. The customizer is invoked with six arguments:
(objValue, srcValue, key, object, source, stack).
Note: This method mutates object.
-
objectObject The destination object. -
sources...Object The source objects. -
customizerFunction The function to customize assigned values.
→ Object
_.omit(object, [paths])
The opposite of _.pick; this method creates an object composed of the
own and inherited enumerable property paths of object that are not omitted.
Note: This method is considerably slower than _.pick.
-
objectObject The source object. -
paths...(string|string[]) Optional The property paths to omit.
→ Object
_.omitBy(object, [predicate=_.identity])
The opposite of _.pickBy; this method creates an object composed of
the own and inherited enumerable string keyed properties of object that
predicate doesn't return truthy for. The predicate is invoked with two
arguments: (value, key).
-
objectObject The source object. -
predicateFunction Optional Default_.identityThe function invoked per property.
→ Object
_.pick(object, [paths])
Creates an object composed of the picked object properties.
-
objectObject The source object. -
paths...(string|string[]) Optional The property paths to pick.
→ Object
_.pickBy(object, [predicate=_.identity])
Creates an object composed of the object properties predicate returns
truthy for. The predicate is invoked with two arguments: (value, key).
-
objectObject The source object. -
predicateFunction Optional Default_.identityThe function invoked per property.
→ Object
_.result(object, path, [defaultValue])
This method is like _.get except that if the resolved value is a
function it's invoked with the this binding of its parent object and
its result is returned.
-
objectObject The object to query. -
pathArray|string The path of the property to resolve. -
defaultValue* Optional The value returned for `undefined` resolved values.
→ *
_.set(object, path, value)
Sets the value at path of object. If a portion of path doesn't exist,
it's created. Arrays are created for missing index properties while objects
are created for all other missing properties. Use _.setWith to customize
path creation.
Note: This method mutates object.
-
objectObject The object to modify. -
pathArray|string The path of the property to set. -
value* The value to set.
→ Object
_.setWith(object, path, value, [customizer])
This method is like _.set except that it accepts customizer which is
invoked to produce the objects of path. If customizer returns undefined
path creation is handled by the method instead. The customizer is invoked
with three arguments: (nsValue, key, nsObject).
Note: This method mutates object.
-
objectObject The object to modify. -
pathArray|string The path of the property to set. -
value* The value to set. -
customizerFunction Optional The function to customize assigned values.
→ Object
_.toPairs(object)
Creates an array of own enumerable string keyed-value pairs for object
which can be consumed by _.fromPairs. If object is a map or set, its
entries are returned.
-
objectObject The object to query.
→ Array
_.toPairsIn(object)
Creates an array of own and inherited enumerable string keyed-value pairs
for object which can be consumed by _.fromPairs. If object is a map
or set, its entries are returned.
-
objectObject The object to query.
→ Array
_.transform(object, [iteratee=_.identity], [accumulator])
An alternative to _.reduce; this method transforms object to a new
accumulator object which is the result of running each of its own
enumerable string keyed properties thru iteratee, with each invocation
potentially mutating the accumulator object. If accumulator is not
provided, a new object with the same [[Prototype]] will be used. The
iteratee is invoked with four arguments: (accumulator, value, key, object).
Iteratee functions may exit iteration early by explicitly returning false.
-
objectObject The object to iterate over. -
iterateeFunction Optional Default_.identityThe function invoked per iteration. -
accumulator* Optional The custom accumulator value.
→ *
_.unset(object, path)
Removes the property at path of object.
Note: This method mutates object.
-
objectObject The object to modify. -
pathArray|string The path of the property to unset.
→ boolean
_.update(object, path, updater)
This method is like _.set except that accepts updater to produce the
value to set. Use _.updateWith to customize path creation. The updater
is invoked with one argument: (value).
Note: This method mutates object.
-
objectObject The object to modify. -
pathArray|string The path of the property to set. -
updaterFunction The function to produce the updated value.
→ Object
_.updateWith(object, path, updater, [customizer])
This method is like _.update except that it accepts customizer which is
invoked to produce the objects of path. If customizer returns undefined
path creation is handled by the method instead. The customizer is invoked
with three arguments: (nsValue, key, nsObject).
Note: This method mutates object.
-
objectObject The object to modify. -
pathArray|string The path of the property to set. -
updaterFunction The function to produce the updated value. -
customizerFunction Optional The function to customize assigned values.
→ Object
_.values(object)
Creates an array of the own enumerable string keyed property values of object.
Note: Non-object values are coerced to objects.
-
objectObject The object to query.
→ Array
_.valuesIn(object)
Creates an array of the own and inherited enumerable string keyed property
values of object.
Note: Non-object values are coerced to objects.
-
objectObject The object to query.
→ Array
Seq
_.chain(value)
Creates a lodash wrapper instance that wraps value with explicit method
chain sequences enabled. The result of such sequences must be unwrapped
with _#value.
-
value* The value to wrap.
→ Object
_.tap(value, interceptor)
This method invokes interceptor and returns value. The interceptor
is invoked with one argument; (value). The purpose of this method is to
"tap into" a method chain sequence in order to modify intermediate results.
-
value* The value to provide to `interceptor`. -
interceptorFunction The function to invoke.
→ *
_.thru(value, interceptor)
This method is like _.tap except that it returns the result of interceptor.
The purpose of this method is to "pass thru" values replacing intermediate
results in a method chain sequence.
-
value* The value to provide to `interceptor`. -
interceptorFunction The function to invoke.
→ *
String
_.camelCase([string=''])
Converts string to camel case.
-
stringstring Optional Default''The string to convert.
→ string
_.capitalize([string=''])
Converts the first character of string to upper case and the remaining
to lower case.
-
stringstring Optional Default''The string to capitalize.
→ string
_.deburr([string=''])
Deburrs string by converting
Latin-1 Supplement
and Latin Extended-A
letters to basic Latin letters and removing
combining diacritical marks.
-
stringstring Optional Default''The string to deburr.
→ string
_.endsWith([string=''], [target], [position=string.length])
Checks if string ends with the given target string.
-
stringstring Optional Default''The string to inspect. -
targetstring Optional The string to search for. -
positionnumber Optional Defaultstring.lengthThe position to search up to.
→ boolean
_.escape([string=''])
Converts the characters "&", "<", ">", '"', and "'" in string to their
corresponding HTML entities.
Note: No other characters are escaped. To escape additional characters use a third-party library like he.
Though the ">" character is escaped for symmetry, characters like ">" and "/" don't need escaping in HTML and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens's article (under "semi-related fun fact") for more details.
When working with HTML you should always quote attribute values to reduce XSS vectors.
-
stringstring Optional Default''The string to escape.
→ string
_.escapeRegExp([string=''])
Escapes the RegExp special characters "^", "$", "", ".", "*", "+",
"?", "(", ")", "[", "]", "{", "}", and "|" in string.
-
stringstring Optional Default''The string to escape.
→ string
_.kebabCase([string=''])
Converts string to
kebab case.
-
stringstring Optional Default''The string to convert.
→ string
_.lowerCase([string=''])
Converts string, as space separated words, to lower case.
-
stringstring Optional Default''The string to convert.
→ string
_.lowerFirst([string=''])
Converts the first character of string to lower case.
-
stringstring Optional Default''The string to convert.
→ string
_.pad([string=''], [length=0], [chars=' '])
Pads string on the left and right sides if it's shorter than length.
Padding characters are truncated if they can't be evenly divided by length.
-
stringstring Optional Default''The string to pad. -
lengthnumber Optional Default0The padding length. -
charsstring Optional Default' 'The string used as padding.
→ string
_.padEnd([string=''], [length=0], [chars=' '])
Pads string on the right side if it's shorter than length. Padding
characters are truncated if they exceed length.
-
stringstring Optional Default''The string to pad. -
lengthnumber Optional Default0The padding length. -
charsstring Optional Default' 'The string used as padding.
→ string
_.padStart([string=''], [length=0], [chars=' '])
Pads string on the left side if it's shorter than length. Padding
characters are truncated if they exceed length.
-
stringstring Optional Default''The string to pad. -
lengthnumber Optional Default0The padding length. -
charsstring Optional Default' 'The string used as padding.
→ string
_.parseInt(string, [radix=10])
Converts string to an integer of the specified radix. If radix is
undefined or 0, a radix of 10 is used unless value is a
hexadecimal, in which case a radix of 16 is used.
Note: This method aligns with the
ES5 implementation of parseInt.
-
stringstring The string to convert. -
radixnumber Optional Default10The radix to interpret `value` by.
→ number
_.repeat([string=''], [n=1])
Repeats the given string n times.
-
stringstring Optional Default''The string to repeat. -
nnumber Optional Default1The number of times to repeat the string.
→ string
_.replace([string=''], pattern, replacement)
Replaces matches for pattern in string with replacement.
Note: This method is based on
String#replace.
-
stringstring Optional Default''The string to modify. -
patternRegExp|string The pattern to replace. -
replacementFunction|string The match replacement.
→ string
_.snakeCase([string=''])
Converts string to
snake case.
-
stringstring Optional Default''The string to convert.
→ string
_.split([string=''], separator, [limit])
Splits string by separator.
Note: This method is based on
String#split.
-
stringstring Optional Default''The string to split. -
separatorRegExp|string The separator pattern to split by. -
limitnumber Optional The length to truncate results to.
→ Array
_.startCase([string=''])
Converts string to
start case.
-
stringstring Optional Default''The string to convert.
→ string
_.startsWith([string=''], [target], [position=0])
Checks if string starts with the given target string.
-
stringstring Optional Default''The string to inspect. -
targetstring Optional The string to search for. -
positionnumber Optional Default0The position to search from.
→ boolean
_.template([string=''], [options={}], [options.escape=_.templateSettings.escape], [options.evaluate=_.templateSettings.evaluate], [options.imports=_.templateSettings.imports], [options.interpolate=_.templateSettings.interpolate], [options.sourceURL='templateSources[n], [options.variable='obj'])
Creates a compiled template function that can interpolate data properties
in "interpolate" delimiters, HTML-escape interpolated data properties in
"escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
properties may be accessed as free variables in the template. If a setting
object is given, it takes precedence over _.templateSettings values.
Security: _.template is insecure and should not be used. It will be
removed in Lodash v5. Avoid untrusted input. See
threat model.
Note: In the development build _.template utilizes
sourceURLs
for easier debugging.
For more information on precompiling templates see lodash's custom builds documentation.
For more information on Chrome extension sandboxes see Chrome's extensions documentation.
-
stringstring Optional Default''The template string. -
optionsObject Optional Default{}The options object. -
options.escapeRegExp Optional Default_.templateSettings.escapeThe HTML "escape" delimiter. -
options.evaluateRegExp Optional Default_.templateSettings.evaluateThe "evaluate" delimiter. -
options.importsObject Optional Default_.templateSettings.importsAn object to import into the template as free variables. -
options.interpolateRegExp Optional Default_.templateSettings.interpolateThe "interpolate" delimiter. -
options.sourceURLstring Optional Default'templateSources[n'] The sourceURL of the compiled template. -
options.variablestring Optional Default'obj'The data object variable name.
→ Function
_.toLower([string=''])
Converts string, as a whole, to lower case just like
String#toLowerCase.
-
stringstring Optional Default''The string to convert.
→ string
_.toUpper([string=''])
Converts string, as a whole, to upper case just like
String#toUpperCase.
-
stringstring Optional Default''The string to convert.
→ string
_.trim([string=''], [chars=whitespace])
Removes leading and trailing whitespace or specified characters from string.
-
stringstring Optional Default''The string to trim. -
charsstring Optional DefaultwhitespaceThe characters to trim.
→ string
_.trimEnd([string=''], [chars=whitespace])
Removes trailing whitespace or specified characters from string.
-
stringstring Optional Default''The string to trim. -
charsstring Optional DefaultwhitespaceThe characters to trim.
→ string
_.trimStart([string=''], [chars=whitespace])
Removes leading whitespace or specified characters from string.
-
stringstring Optional Default''The string to trim. -
charsstring Optional DefaultwhitespaceThe characters to trim.
→ string
_.truncate([string=''], [options={}], [options.length=30], [options.omission='...'], [options.separator])
Truncates string if it's longer than the given maximum string length.
The last characters of the truncated string are replaced with the omission
string which defaults to "...".
-
stringstring Optional Default''The string to truncate. -
optionsObject Optional Default{}The options object. -
options.lengthnumber Optional Default30The maximum string length. -
options.omissionstring Optional Default'...'The string to indicate text is omitted. -
options.separatorRegExp|string Optional The separator pattern to truncate to.
→ string
_.unescape([string=''])
The inverse of _.escape; this method converts the HTML entities
&, <, >, ", and ' in string to
their corresponding characters.
Note: No other HTML entities are unescaped. To unescape additional HTML entities use a third-party library like he.
-
stringstring Optional Default''The string to unescape.
→ string
_.upperCase([string=''])
Converts string, as space separated words, to upper case.
-
stringstring Optional Default''The string to convert.
→ string
_.upperFirst([string=''])
Converts the first character of string to upper case.
-
stringstring Optional Default''The string to convert.
→ string
_.words([string=''], [pattern])
Splits string into an array of its words.
-
stringstring Optional Default''The string to inspect. -
patternRegExp|string Optional The pattern to match words.
→ Array
Util
_.attempt(func, [args])
Attempts to invoke func, returning either the result or the caught error
object. Any additional arguments are provided to func when it's invoked.
-
funcFunction The function to attempt. -
args...* Optional The arguments to invoke `func` with.
→ *
_.bindAll(object, methodNames)
Binds methods of an object to the object itself, overwriting the existing method.
Note: This method doesn't set the "length" property of bound functions.
-
objectObject The object to bind and assign the bound methods to. -
methodNames...(string|string[]) The object method names to bind.
→ Object
_.cond(pairs)
Creates a function that iterates over pairs and invokes the corresponding
function of the first predicate to return truthy. The predicate-function
pairs are invoked with the this binding and arguments of the created
function.
-
pairsArray The predicate-function pairs.
→ Function
_.conforms(source)
Creates a function that invokes the predicate properties of source with
the corresponding property values of a given object, returning true if
all predicates return truthy, else false.
Note: The created function is equivalent to _.conformsTo with
source partially applied.
-
sourceObject The object of property predicates to conform to.
→ Function
_.constant(value)
Creates a function that returns value.
-
value* The value to return from the new function.
→ Function
_.defaultTo(value, defaultValue)
Checks value to determine whether a default value should be returned in
its place. The defaultValue is returned if value is NaN, null,
or undefined.
-
value* The value to check. -
defaultValue* The default value.
→ *
_.flow([funcs])
Creates a function that returns the result of invoking the given functions
with the this binding of the created function, where each successive
invocation is supplied the return value of the previous.
-
funcs...(Function|Function[]) Optional The functions to invoke.
→ Function
_.flowRight([funcs])
This method is like _.flow except that it creates a function that
invokes the given functions from right to left.
-
funcs...(Function|Function[]) Optional The functions to invoke.
→ Function
_.identity(value)
This method returns the first argument it receives.
-
value* Any value.
→ *
_.iteratee([func=_.identity])
Creates a function that invokes func with the arguments of the created
function. If func is a property name, the created function returns the
property value for a given element. If func is an array or object, the
created function returns true for elements that contain the equivalent
source properties, otherwise it returns false.
-
func* Optional Default_.identityThe value to convert to a callback.
→ Function
_.matches(source)
Creates a function that performs a partial deep comparison between a given
object and source, returning true if the given object has equivalent
property values, else false.
Note: The created function is equivalent to _.isMatch with source
partially applied.
Partial comparisons will match empty array and empty object source
values against any array or object value, respectively. See _.isEqual
for a list of supported value comparisons.
Note: Multiple values can be checked by combining several matchers
using _.overSome
-
sourceObject The object of property values to match.
→ Function
_.matchesProperty(path, srcValue)
Creates a function that performs a partial deep comparison between the
value at path of a given object to srcValue, returning true if the
object value is equivalent, else false.
Note: Partial comparisons will match empty array and empty object
srcValue values against any array or object value, respectively. See
_.isEqual for a list of supported value comparisons.
Note: Multiple values can be checked by combining several matchers
using _.overSome
-
pathArray|string The path of the property to get. -
srcValue* The value to match.
→ Function
_.method(path, [args])
Creates a function that invokes the method at path of a given object.
Any additional arguments are provided to the invoked method.
-
pathArray|string The path of the method to invoke. -
args...* Optional The arguments to invoke the method with.
→ Function
_.methodOf(object, [args])
The opposite of _.method; this method creates a function that invokes
the method at a given path of object. Any additional arguments are
provided to the invoked method.
-
objectObject The object to query. -
args...* Optional The arguments to invoke the method with.
→ Function
_.noop()
This method returns undefined.
_.nthArg([n=0])
Creates a function that gets the argument at index n. If n is negative,
the nth argument from the end is returned.
-
nnumber Optional Default0The index of the argument to return.
→ Function
_.over([iteratees=[_.identity])
Creates a function that invokes iteratees with the arguments it receives
and returns their results.
-
iteratees...(Function|Function[]) Optional Default[_.identity] The iteratees to invoke.
→ Function
_.overEvery([predicates=[_.identity])
Creates a function that checks if all of the predicates return
truthy when invoked with the arguments it receives.
Following shorthands are possible for providing predicates.
Pass an Object and it will be used as an parameter for _.matches to create the predicate.
Pass an Array of parameters for _.matchesProperty and the predicate will be created using them.
-
predicates...(Function|Function[]) Optional Default[_.identity] The predicates to check.
→ Function
_.overSome([predicates=[_.identity])
Creates a function that checks if any of the predicates return
truthy when invoked with the arguments it receives.
Following shorthands are possible for providing predicates.
Pass an Object and it will be used as an parameter for _.matches to create the predicate.
Pass an Array of parameters for _.matchesProperty and the predicate will be created using them.
-
predicates...(Function|Function[]) Optional Default[_.identity] The predicates to check.
→ Function
_.property(path)
Creates a function that returns the value at path of a given object.
-
pathArray|string The path of the property to get.
→ Function
_.propertyOf(object)
The opposite of _.property; this method creates a function that returns
the value at a given path of object.
-
objectObject The object to query.
→ Function
_.range([start=0], end, [step=1])
Creates an array of numbers (positive and/or negative) progressing from
start up to, but not including, end. A step of -1 is used if a negative
start is specified without an end or step. If end is not specified,
it's set to start with start then set to 0.
Note: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.
-
startnumber Optional Default0The start of the range. -
endnumber The end of the range. -
stepnumber Optional Default1The value to increment or decrement by.
→ Array
_.rangeRight([start=0], end, [step=1])
This method is like _.range except that it populates values in
descending order.
-
startnumber Optional Default0The start of the range. -
endnumber The end of the range. -
stepnumber Optional Default1The value to increment or decrement by.
→ Array
_.stubArray()
This method returns a new empty array.
→ Array
_.stubFalse()
This method returns false.
→ boolean
_.stubObject()
This method returns a new empty object.
→ Object
_.stubString()
This method returns an empty string.
→ string
_.stubTrue()
This method returns true.
→ boolean
_.times(n, [iteratee=_.identity])
Invokes the iteratee n times, returning an array of the results of
each invocation. The iteratee is invoked with one argument; (index).
-
nnumber The number of times to invoke `iteratee`. -
iterateeFunction Optional Default_.identityThe function invoked per iteration.
→ Array
_.toPath(value)
Converts value to a property path array.
-
value* The value to convert.
→ Array
_.uniqueId([prefix=''])
Generates a unique ID. If prefix is given, the ID is appended to it.
-
prefixstring Optional Default''The value to prefix the ID with.
→ string
Aliases
_.each → _.forEach _.eachRight → _.forEachRight _.entries → _.toPairs _.entriesIn → _.toPairsIn _.extend → _.assignIn _.extendWith → _.assignInWith _.first → _.head