The opposite of `method` this method creates a function that invokes the method at a given path of `object`. Any additional arguments are provided to the invoked method.
const array = times(3, constant)
const object = { 'a': array, 'b': array, 'c': array }
map(['a[2]', 'c[0]'], methodOf(object))
// => [2, 0]
map([['a', '2'], ['c', '0']], methodOf(object))
// => [2, 0]
Name | Type | Attribute | Description |
---|---|---|---|
object | The object to query. | ||
args | The arguments to invoke the method with. |
{ "comment": "/**\r\n * The opposite of `method` this method creates a function that invokes\r\n * the method at a given path of `object`. Any additional arguments are\r\n * provided to the invoked method.\r\n *\r\n * @since 3.7.0\r\n * @category Util\r\n * @param {Object} object The object to query.\r\n * @param {Array} [args] The arguments to invoke the method with.\r\n * @returns {Function} Returns the new invoker function.\r\n * @example\r\n *\r\n * const array = times(3, constant)\r\n * const object = { 'a': array, 'b': array, 'c': array }\r\n *\r\n * map(['a[2]', 'c[0]'], methodOf(object))\r\n * // => [2, 0]\r\n *\r\n * map([['a', '2'], ['c', '0']], methodOf(object))\r\n * // => [2, 0]\r\n */", "meta": { "range": [ 691, 774 ], "filename": "methodOf.js", "lineno": 24, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100006293", "name": "methodOf", "type": "FunctionDeclaration", "paramnames": [ "object", "args" ] }, "vars": { "": null } }, "description": "The opposite of `method` this method creates a function that invokes\rthe method at a given path of `object`. Any additional arguments are\rprovided to the invoked method.", "since": "3.7.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Util", "value": "Util" } ], "params": [ { "type": { "names": [ "Object" ] }, "description": "The object to query.", "name": "object" }, { "type": { "names": [ "Array" ] }, "optional": true, "description": "The arguments to invoke the method with.", "name": "args" } ], "returns": [ { "type": { "names": [ "function" ] }, "description": "Returns the new invoker function." } ], "examples": [ "const array = times(3, constant)\rconst object = { 'a': array, 'b': array, 'c': array }\r\rmap(['a[2]', 'c[0]'], methodOf(object))\r// => [2, 0]\r\rmap([['a', '2'], ['c', '0']], methodOf(object))\r// => [2, 0]" ], "name": "methodOf", "longname": "methodOf", "kind": "function", "scope": "global", "___id": "T000002R000586", "___s": true, "filepath": "methodOf.js" }