Date

“Object” Methods

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

source npm package

Invokes the method at path of object.

引入版本

4.0.0

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

返回值
(*) : Returns the result of the invoked method.

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