4.17.11
3.10.1
2.4.2
1.3.1

_.invoke(object, path, [args])

Invokes the method at path of object.

Since

4.0.0

Arguments

argument
object
path
[args]
type
Object
(Array|string)
...*
description
The object to query.
The path of the method to invoke.
The arguments to invoke the method with.

Returns

(array)

Example

var object = {
  a: [{ b: { c: [1, 2, 3, 4] } }],
};

_.invoke(
  object,
  "a[0].b.c.slice",
  1,
  3
);
// => [2, 3]
var object = { a: [{ b: { c: [1, 2, 3, 4] } }] };

_.invoke(object, "a[0].b.c.slice", 1, 3);
// => [2, 3]