invokeMap
_.invokeMap(path, collection)
# Ⓢ [Ⓣ][1] Ⓝ
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.
Since
4.0.0
Arguments
path(Array|Function|string): The path of the method to invoke or
the function invoked per iteration.collection(Array|Object): The collection to iterate over.
Returns
(Array): Returns the array of results.
Example
_.invokeMap("sort", [
[5, 1, 7],
[3, 2, 1],
]);
// => [[1, 5, 7], [1, 2, 3]]