_.invoke

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

Invokes the method at path of object.

Since

4.0.0

Arguments

  1. object (Object): The object to query.
  2. path (Array|string): The path of the method to invoke.
  3. [args] (...*): The arguments to invoke the method with.

Returns

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

Example

var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
 
_.invoke(object, 'a[0].b.c.slice', 1, 3);
// => [2, 3]
doc_Lodash
2016-11-27 16:37:45
Comments
Leave a Comment

Please login to continue.