Invokes the method at `path` of `object`.
const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }
invoke(object, 'a[0].b.c.slice', [1, 3])
// => [2, 3]
Name | Type | Attribute | Description |
---|---|---|---|
object | The object to query. | ||
path | The path of the method to invoke. | ||
args | The arguments to invoke the method with. |
*
{ "comment": "/**\r\n * Invokes the method at `path` of `object`.\r\n *\r\n * @since 4.0.0\r\n * @category Object\r\n * @param {Object} object The object to query.\r\n * @param {Array|string} path The path of the method to invoke.\r\n * @param {Array} [args] The arguments to invoke the method with.\r\n * @returns {*} Returns the result of the invoked method.\r\n * @example\r\n *\r\n * const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }\r\n *\r\n * invoke(object, 'a[0].b.c.slice', [1, 3])\r\n * // => [2, 3]\r\n */", "meta": { "range": [ 647, 883 ], "filename": "invoke.js", "lineno": 22, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100004038", "name": "invoke", "type": "FunctionDeclaration", "paramnames": [ "object", "path", "args" ] }, "vars": { "path": "invoke~path", "object": "invoke~object", "func": "invoke~func" } }, "description": "Invokes the method at `path` of `object`.", "since": "4.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Object", "value": "Object" } ], "params": [ { "type": { "names": [ "Object" ] }, "description": "The object to query.", "name": "object" }, { "type": { "names": [ "Array", "string" ] }, "description": "The path of the method to invoke.", "name": "path" }, { "type": { "names": [ "Array" ] }, "optional": true, "description": "The arguments to invoke the method with.", "name": "args" } ], "returns": [ { "type": { "names": [ "*" ] }, "description": "Returns the result of the invoked method." } ], "examples": [ "const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }\r\rinvoke(object, 'a[0].b.c.slice', [1, 3])\r// => [2, 3]" ], "name": "invoke", "longname": "invoke", "kind": "function", "scope": "global", "___id": "T000002R000408", "___s": true, "filepath": "invoke.js" }