_.invoke(object, path, [args])
Invokes the method at path
of object
.
Since
4.0.0
Arguments
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
(*): 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]
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .