The at
function from Lodash allows you to get values of an array or object at certain indices or paths. Here is an example of how to use it with an array:
index.tsx185 chars9 lines
In this example, at
takes two arguments: the array we want to manipulate (array
) and the indices we want to retrieve the values from (indices
). The function then returns a new array with the requested values.
You can also use at
with objects to retrieve values at specific paths. Here is an example:
index.tsx193 chars9 lines
In this example, at
takes the object
we want to manipulate and an array of paths
as arguments. The function returns an array with the requested values at the specified paths.
It's important to note that at
returns an array, even if you only request the value at one index or path.
gistlibby LogSnag