Skip to main content

invoke

_.invoke(path, object) # Ⓢ [Ⓣ][1] Ⓝ

Invokes the method at path of object.

Since​

4.0.0

Arguments​

  1. path (Array|string): The path of the method to invoke.
  2. object (Object): The object to query.

Returns​

(*): Returns the result of the invoked method.

Example​

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

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