Optional
iterator: Iteratee<V, boolean, TypeOfCollection<V, never>>Optional
context: anysome
Optional
iterator: Iteratee<V, boolean, TypeOfCollection<V, never>>Optional
context: anymap
Optional
context: anyfind
Optional
iteratee: Iteratee<V, boolean, TypeOfCollection<V, never>>Optional
context: anyreduce
Optional
context: anyreduce
reduceRight
Optional
context: anyreduceRight
each
Optional
context: anyfirst
first
contains
Optional
fromIndex: numbercontains
Optional
fromIndex: numberreduce
Optional
context: anyreduce
filter
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>Optional
context: anyfirst
first
Wrapped type List
uniq
Optional
isSorted: booleanOptional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>Optional
context: anyWrapped type List
uniq
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>Optional
context: anyChunks the wrapped list into multiple arrays, each containing
length
or fewer items.
A chain wrapper around the contents of the wrapped list in
chunks no greater than length
in size.
The maximum size of the chunks.
Returns a copy of the wrapped list with all falsy values removed. In JavaScript, false, null, 0, "", undefined and NaN are all falsy.
A chain wrapper around an array containing the elements of the wrapped list without falsy values.
Returns a new array comprised of the array on which it is called joined with the array(s) and/or value(s) provided as arguments.
A new array comprised of the array on which it is called
Rest
...arr: T[][]Arrays and/or values to concatenate into a new array. See the discussion below for details.
Returns true if the value is present in the wrapped collection. Uses
indexOf internally, if the wrapped collection is a List. Use
fromIndex
to start your search at a given index.
A chain wrapper around true if value
is present in the
wrapped collection after fromIndex
, otherwise around false.
The value to check the wrapped collection for.
Optional
fromIndex: numberThe index to start searching from, optional, default = 0, only used when the wrapped collection is a List.
Sorts the wrapped collection into groups and returns a count for the
number of objects in each group. Similar to groupBy
, but instead
of returning a list of values, returns a count for the number of
values in that group.
A chain wrapper around a dictionary with the group names
provided by iteratee
as properties where each property contains
the count of the grouped elements from the wrapped collection.
Optional
iterator: Iteratee<V, string | number, TypeOfCollection<V, never>>Optional
context: anythis
object in iteratee
, optional.
Similar to without, but returns the values from the wrapped list
that are not present in others
.
A chain wrapper around the contents of the wrapped list
without the values in others
.
Rest
...others: List<T>[]The lists of values to exclude from the wrapped list.
Iterates over the wrapped collection of elements, yielding each in
turn to an iteratee
. The iteratee
is bound to the context
object, if one is passed.
A chain wrapper around the originally wrapped collection.
The iteratee to call for each element in the wrapped collection.
Optional
context: any'this' object in iteratee
, optional.
Returns true if all of the values in the wrapped collection pass the
iteratee
truth test. Short-circuits and stops traversing the
wrapped collection if a false element is found.
A chain wrapper around true if all elements pass the truth test, otherwise around false.
Optional
iterator: Iteratee<V, boolean, TypeOfCollection<V, never>>Optional
context: anythis
object in iteratee
, optional.
Looks through each value in the wrapped collection, returning an
array of all the values that pass a truth test (iteratee
).
A chain wrapper around the set of values that pass the truth test.
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>The truth test to apply.
Optional
context: anythis
object in iteratee
, optional.
Looks through each value in the wrapped collection, returning the
first one that passes a truth test (iteratee
), or undefined if no
value passes the test. The function returns as soon as it finds an
acceptable element, and doesn't traverse the entire collection.
A chain wrapper around the first element in the wrapped collection that passes the truth test or undefined if no elements pass.
Optional
iteratee: Iteratee<V, boolean, TypeOfCollection<V, never>>The truth test to apply.
Optional
context: anythis
object in iteratee
, optional.
Returns the first index of an element in the wrapped list where the
iteratee
truth test passes, otherwise returns -1.
A chain wrapper around the index of the first element in the wrapped list where the truth test passes or -1 if no elements pass.
Optional
iteratee: Iteratee<V, boolean, TypeOfCollection<V, never>>The truth test to apply.
Optional
context: anythis
object in iteratee
, optional.
Similar to findIndex
but for keys in objects. Returns the key
where the iteratee
truth test passes or undefined.
The first element in the wrapped object that passes the truth test or undefined if no elements pass.
Optional
iteratee: Iteratee<V, boolean, TypeOfCollection<V, any>>The truth test to apply.
Optional
context: anythis
object in iteratee
, optional.
Returns the last index of an element in the wrapped list where the
iteratee
truth test passes, otherwise returns -1.
A chain wrapper around the index of the last element in the wrapped list where the truth test passes or -1 if no elements pass.
Optional
iteratee: Iteratee<V, boolean, TypeOfCollection<V, never>>The truth test to apply.
Optional
context: anythis
object in iteratee
, optional.
Looks through the wrapped collection and returns the first value
that matches all of the key-value pairs listed in properties
. If
no match is found, or if list is empty, undefined will be returned.
A chain wrapper around the first element in the wrapped
collection that matches properties
or undefined if no match is
found.
The properties to check for on the elements within the wrapped collection.
Returns the first element of the wrapped list. Passing n
will
return the first n
elements of the wrapped list.
A chain wrapper around the first n
elements of the
wrapped list or around the first element if n
is omitted.
Flattens a nested list (the nesting can be to any depth). If you pass true or 1 as the depth, the list will only be flattened a single level. Passing a greater number will cause the flattening to descend deeper into the nesting hierarchy. Omitting the depth argument, or passing false or Infinity, flattens the list all the way to the deepest nesting level.
A chain wrapper around the flattened list.
True to only flatten one level, optional, default = false.
Optional
depth: number | falseWrapped type any
.
_.get
Optional
defaultValue: USplits the warpped collection into sets that are grouped by the
result of running each value through iteratee
.
A chain wrapper around a dictionary with the group names
provided by iteratee
as properties where each property contains
the grouped elements from the wrapped collection.
Optional
iteratee: Iteratee<V, string | number, TypeOfCollection<V, never>>An iteratee that provides the value to group by for each item in the wrapped collection.
Optional
context: anythis
object in iteratee
, optional.
Given the warpped collection and an iteratee
function that returns
a key for each element in collection
, returns an object that acts
as an index of each item. Just like groupBy
, but for when you
know your keys are unique.
A chain wrapper around a dictionary where each item in the
wrapped collection is assigned to the property designated by
iteratee
.
Optional
iteratee: Iteratee<V, string | number, TypeOfCollection<V, never>>An iteratee that provides the value to index by for each item in the wrapped collection.
Optional
context: anythis
object in iteratee
, optional.
Returns the index at which value
can be found in the wrapped list,
or -1 if value
is not present. If you're working with a large list
and you know that the list is already sorted, pass true for
isSortedOrFromIndex
to use a faster binary search...or, pass a
number in order to look for the first matching value in the list
after the given index.
A chain wrapper around the index of the first occurrence of
value
within the wrapped list or -1 if value
is not found.
The value to search for within the wrapped list.
Optional
isSortedOrFromIndex: number | booleanTrue if the wrapped list is already sorted OR the starting index for the search, optional.
Returns everything but the last entry of the wrapped list.
Especially useful on the arguments object. Pass n
to exclude the
last n
elements from the result.
A chain wrapper around the elements of the wrapped list
with the last n
items omitted.
Optional
n: numberThe number of elements from the end of the wrapped list to omit, optional, default = 1.
Computes the list of values that are the intersection of the wrapped
list and the passed-in lists
. Each value in the result is present
in each of the lists.
A chain wrapper around the intersection of elements within
the the wrapped list and lists
.
Rest
...lists: List<T>[]The lists (along with the wrapped list) to compute the intersection of.
Calls the method named by methodName
on each value in the wrapped
collection. Any extra arguments passed to invoke will be forwarded
on to the method invocation.
A chain wrapper around an array containing the result of the method call for each item in the wrapped collection.
The name of the method to call on each element in the wrapped collection.
Rest
...args: any[]Additional arguments to pass to method methodName
.
Returns true if the wrapped object is an Arguments object.
True if the wrapped object is an Arguments object, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is an Array.
True if the wrapped object is an Array, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is an ArrayBuffer.
True if the wrapped object is an ArrayBuffer, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a Boolean.
True if the wrapped object is a Boolean, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a DataView.
True if the wrapped object is a DataView, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a Date.
True if the wrapped object is a Date, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a DOM element.
True if the wrapped object is a DOM element, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped collection contains no values. For strings and array-like objects checks if the length property is 0.
True if the wrapped collection has no elements. The result will be wrapped in a chain wrapper.
Performs an optimized deep comparison between the wrapped object
and other
to determine if they should be considered equal.
True if the wrapped object should be considered equal to
other
.
The result will be wrapped in a chain wrapper.
Compare to the wrapped object.
Returns true if the wrapped object is a Error.
True if the wrapped object is a Error, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a finite Number.
True if the wrapped object is a finite Number. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a Function.
True if the wrapped object is a Function, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the keys and values in properties
are contained in
the wrapped object.
True if all keys and values in properties
are also in the
wrapped object.
The result will be wrapped in a chain wrapper.
The properties to check for in the wrapped object.
Returns true if the wrapped object is NaN. Note: this is not the same as the native isNaN function, which will also return true if the variable is undefined.
True if the wrapped object is NaN, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is null.
True if the wrapped object is null, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a Number (including NaN).
True if the wrapped object is a Number, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is an Object. Note that JavaScript arrays and functions are objects, while (normal) strings and numbers are not.
True if the wrapped object is an Object, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a RegExp.
True if the wrapped object is a RegExp, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a String.
True if the wrapped object is a String, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a Symbol.
True if the wrapped object is a Symbol, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is a TypedArray.
True if the wrapped object is a TypedArray, otherwise false. The result will be wrapped in a chain wrapper.
Returns true if the wrapped object is undefined.
True if the wrapped object is undefined, otherwise false. The result will be wrapped in a chain wrapper.
Join all elements of an array into a string.
The string conversions of all array elements joined into one string.
Optional
separator: anyOptional. Specifies a string to separate each element of the array. The separator is converted to a string if necessary. If omitted, the array elements are separated with a comma.
Returns the last element of the wrapped list. Passing n
will
return the last n
elements of the wrapped list.
A chain wrapper around the last n
elements of the wrapped
list or around the last element if n
is omitted.
Returns the index of the last occurrence of value
in the wrapped
list, or -1 if value
is not present. Pass fromIndex
to start
your search at a given index.
A chain wrapper around the index of the last occurrence of
value
within the wrapped list or -1 if value
is not found.
The value to search for within the wrapped list.
Optional
fromIndex: numberThe starting index for the search, optional.
Produces a new array of values by mapping each value in the wrapped
collection through a transformation iteratee
.
A chain wrapper around the mapped result.
The iteratee to use to transform each item in the wrapped collection.
Optional
context: anythis
object in iteratee
, optional.
Like map, but for objects. Transform the value of each property in turn.
A chain wrapper around a new object with all of the wrapped
object's property values transformed through iteratee
.
The iteratee to use to transform property values.
Optional
context: anythis
object in iteratee
, optional.
Returns the maximum value in the wrapped collection. If an
iteratee
is provided, it will be used on each element to generate
the criterion by which the element is ranked. -Infinity is returned
if list is empty. Non-numerical values returned by iteratee
will
be ignored.
A chain wrapper around the maximum element within the wrapped collection or around -Infinity if the wrapped collection is empty.
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>The iteratee that provides the criterion by which each element is ranked, optional if evaluating a collection of numbers.
Optional
context: anythis
object in iteratee
, optional.
Returns the minimum value in the wrapped collection. If an
iteratee
is provided, it will be used on each element to generate
the criterion by which the element is ranked. Infinity is returned
if list is empty. Non-numerical values returned by iteratee
will
be ignored.
A chain wrapper around the minimum element within the wrapped collection or around Infinity if the wrapped collection is empty.
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>The iteratee that provides the criterion by which each element is ranked, optional if evaluating a collection of numbers.
Optional
context: anythis
object in iteratee
, optional.
Converts lists into objects. Call on either a wrapped list of
[key, value] pairs, or a wrapped list of keys and a list of
values
. Passing by pairs is the reverse of pairs. If duplicate
keys exist, the last value wins.
A chain wrapper around an object comprised of the provided keys and values.
If the wrapped list is a list of keys, a list of values corresponding to those keys.
Return a copy of the wrapped object that is filtered to omit the disallowed keys (or array of keys).
A chain wrapper around a copy of the wrapped object without
the keys
properties.
Rest
...keys: (K | K[])[]The keys to omit from the wrapped object.
Return a copy of the wrapped object that is filtered to not have values for the keys selected by a truth test.
A chain wrapper around a copy of the wrapped object without
the keys selected by iterator
.
A truth test that selects the keys to omit from the wrapped object.
Convert the wrapped object into a list of [key, value] pairs. The
opposite of the single-argument signature of _.object
.
A chain wrapper around the list of [key, value] pairs from the wrapped object.
Splits the wrapped collection into two arrays: one whose elements
all satisfy iteratee
and one whose elements all do not satisfy
iteratee
.
A chain wrapper around an array composed of two elements, where the first element contains the elements in the wrapped collection that satisfied the predicate and the second element contains the elements that did not.
Optional
iteratee: Iteratee<V, boolean, TypeOfCollection<V, never>>The iteratee that defines the partitioning scheme for each element in the wrapped collection.
Optional
context: anythis
object in iteratee
, optional.
Return a copy of the wrapped object that is filtered to only have values for the allowed keys (or array of keys).
A chain wrapper around a copy of the wrapped object with
only the keys
properties.
Rest
...keys: (K | K[])[]The keys to keep on the wrapped object.
Return a copy of the wrapped object that is filtered to only have values for the keys selected by a truth test.
A chain wrapper around a copy of the wrapped object with
only the keys selected by iterator
.
A truth test that selects the keys to keep on the wrapped object.
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
A chain wrapper around The set of values for the specified
propertyName
for each item in the wrapped collection.
The name of a specific property to retrieve from all items in the wrapped collection.
Removes the last element from an array and returns that element.
Returns the popped element.
A function to create flexibly-numbered lists of integers, handy for
each
and map
loops. Returns a list of integers from
the wrapped value (inclusive) to stop
(exclusive), incremented
(or decremented) by step
. Note that ranges that stop
before they
start
are considered to be zero-length instead of negative - if
you'd like a negative range, use a negative step
.
If stop
is not specified, the wrapped value will be the number to
stop at and the default start of 0 will be used.
A chain wrapper around an array of numbers from start to
stop
with increments of step
.
Optional
stop: numberThe number to stop at.
Optional
step: numberThe number to count up by each iteration, optional, default = 1.
Also known as inject and foldl, reduce boils down the wrapped
collection of values into a single value. memo
is the initial
state of the reduction, and each successive step of it should be
returned by iteratee
.
If no memo is passed to the initial invocation of reduce, iteratee
is not invoked on the first element of the wrapped collection. The
first element is instead passed as the memo in the invocation of
iteratee
on the next element in the wrapped collection.
A chain wrapper around the reduced result.
The function to call on each iteration to reduce the collection.
The initial reduce state or undefined to use the first
item in collection
as initial state.
Optional
context: anythis
object in iteratee
, optional.
The right-associative version of reduce.
This is not as useful in JavaScript as it would be in a language with lazy evaluation.
A chain wrapper around the reduced result.
The function to call on each iteration to reduce the collection.
The initial reduce state or undefined to use the first
item in collection
as the initial state.
Optional
context: anythis
object in iteratee
, optional.
Returns the values in the wrapped collection without the elements
that pass a truth test (iteratee
).
The opposite of filter.
A chain wrapper around the set of values that fail the truth test.
Optional
iteratee: Iteratee<V, boolean, TypeOfCollection<V, never>>The truth test to apply.
Optional
context: anythis
object in iteratee
, optional.
Returns the rest of the elements in the wrapped list. Pass an
index
to return the values of the list from that index onward.
A chain wrapper around the elements of the wrapped list
from index
to the end of the list.
Optional
n: numberProduce a random sample from the wrapped collection. Pass a number
to return n
random elements from the wrapped collection. Otherwise
a single random item will be returned.
A chain wrapper around a random sample of n
elements from
the wrapped collection or a single element if n
is not specified.
The number of elements to sample from the wrapped collection.
Removes the first element from an array and returns that element. This method changes the length of the array.
The shifted element.
Determines the number of values in the wrapped collection.
A chain wrapper around the number of values in the wrapped collection.
Returns a shallow copy of a portion of an array into a new array object.
A shallow copy of a portion of an array into a new array object.
Zero-based index at which to begin extraction.
Optional
end: numberOptional. Zero-based index at which to end extraction. slice extracts up to but not including end.
Returns true if any of the values in the wrapped collection pass the
iteratee
truth test. Short-circuits and stops traversing the
wrapped collection if a true element is found.
A chain wrapper around true if any element passed the truth test, otherwise around false.
Optional
iterator: Iteratee<V, boolean, TypeOfCollection<V, never>>Optional
context: anythis
object in iteratee
, optional.
Sorts the elements of an array in place and returns the array. The sort is not necessarily stable. The default sort order is according to string Unicode code points.
The sorted array.
Optional
compareFn: ((a: T, b: T) => boolean)Optional. Specifies a function that defines the sort order. If omitted, the array is sorted according to each character's Unicode code point value, according to the string conversion of each element.
Returns a (stably) sorted copy of the wrapped collection, ranked in
ascending order by the results of running each value through
iteratee
.
A chain wrapper around a sorted copy of the wrapped collection.
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>An iteratee that provides the value to sort by for each item in the wrapped collection.
Optional
context: anythis
object in iteratee
, optional.
Uses a binary search to determine the lowest index at which the value should be inserted into the wrapped list in order to maintain the wrapped list's sorted order. If an iteratee is provided, it will be used to compute the sort ranking of each value, including the value you pass.
A chain wrapper around the index where value
should be
inserted into the wrapped list.
The value to determine an insert index for to mainain the sorting in the wrapped list.
Optional
iteratee: Iteratee<undefined | V, any, TypeOfCollection<V, never>>Iteratee to compute the sort ranking of each element
including value
, optional.
Optional
context: anythis
object in iteratee
, optional.
Changes the content of an array by removing existing elements and/or adding new elements.
An array containing the deleted elements. If only one element is removed, an array of one element is returned. If no elements are removed, an empty array is returned.
Index at which to start changing the array. If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end.
An integer indicating the number of old array elements to remove. If deleteCount is 0, no elements are removed. In this case, you should specify at least one new element. If deleteCount is greater than the number of elements left in the array starting at index, then all of the elements through the end of the array will be deleted.
Rest
...items: T[]The element to add to the array. If you don't specify any elements, splice will only remove elements from the array.
Wrapped type string
.
_.template
Optional
settings: TemplateSettingsWrapped type Function
.
_.throttle
Optional
options: ThrottleSettingsA string representing the specified array and its elements.
A string representing the specified array and its elements.
Computes the union of the wrapped list and the passed-in lists
:
the list of unique items, examined in order from first list to last
list, that are present in one or more of the lists.
A chain wrapper around the union of elements within the
wrapped list and lists
.
Rest
...lists: List<T>[]The lists (along with the wrapped list) to compute the union of.
Produces a duplicate-free version of the wrapped list, using === to test object equality. If you know in advance that the wrapped list is sorted, passing true for isSorted will run a much faster algorithm. If you want to compute unique items based on a transformation, pass an iteratee function.
A chain wrapper around an array containing only the unique elements in the wrapped list.
Optional
isSorted: booleanTrue if the wrapped list is already sorted, optional, default = false.
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>Transform the elements of the wrapped list before comparisons for uniqueness.
Optional
context: any'this' object in iteratee
, optional.
Optional
iteratee: Iteratee<V, any, TypeOfCollection<V, never>>Optional
context: anyThe opposite of zip. Given the wrapped list of lists, returns a series of new arrays, the first of which contains all of the first elements in the wrapped lists, the second of which contains all of the second elements, and so on. (alias: transpose)
A chain wrapper around the unzipped version of the wrapped lists.
Looks through each value in the wrapped collection, returning an
array of all the elements that match the key-value pairs listed in
properties
.
A chain wrapper around the elements in the wrapped
collection that match properties
.
The properties to check for on the elements within the wrapped collection.
Returns a copy of the wrapped list with all instances of values
removed.
A chain wrapper around an array that contains all elements
of the wrapped list except for values
.
Rest
...values: T[]The values to exclude from the wrapped list.
Merges together the values of each of the lists
(including the
wrapped list) with the values at the corresponding position. Useful
when you have separate data sources that are coordinated through
matching list indexes.
A chain wrapper around the zipped version of the wrapped
list and lists
.
Rest
...arrays: List<any>[]
See
every