The opposite of `property`s method creates a function that returns the value at a given path of `object`.
const array = [0, 1, 2]
const object = { 'a': array, 'b': array, 'c': array }
map(['a[2]', 'c[0]'], propertyOf(object))
// => [2, 0]
map([['a', '2'], ['c', '0']], propertyOf(object))
// => [2, 0]
Name | Type | Attribute | Description |
---|---|---|---|
object | The object to query. |
{ "comment": "/**\r\n * The opposite of `property`s method creates a function that returns\r\n * the value at a given path of `object`.\r\n *\r\n * @since 3.0.0\r\n * @category Util\r\n * @param {Object} object The object to query.\r\n * @returns {Function} Returns the new accessor function.\r\n * @example\r\n *\r\n * const array = [0, 1, 2]\r\n * const object = { 'a': array, 'b': array, 'c': array }\r\n *\r\n * map(['a[2]', 'c[0]'], propertyOf(object))\r\n * // => [2, 0]\r\n *\r\n * map([['a', '2'], ['c', '0']], propertyOf(object))\r\n * // => [2, 0]\r\n */", "meta": { "range": [ 564, 667 ], "filename": "propertyOf.js", "lineno": 22, "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo", "code": { "id": "astnode100007087", "name": "propertyOf", "type": "FunctionDeclaration", "paramnames": [ "object" ] }, "vars": { "": null } }, "description": "The opposite of `property`s method creates a function that returns\rthe value at a given path of `object`.", "since": "3.0.0", "tags": [ { "originalTitle": "category", "title": "category", "text": "Util", "value": "Util" } ], "params": [ { "type": { "names": [ "Object" ] }, "description": "The object to query.", "name": "object" } ], "returns": [ { "type": { "names": [ "function" ] }, "description": "Returns the new accessor function." } ], "examples": [ "const array = [0, 1, 2]\rconst object = { 'a': array, 'b': array, 'c': array }\r\rmap(['a[2]', 'c[0]'], propertyOf(object))\r// => [2, 0]\r\rmap([['a', '2'], ['c', '0']], propertyOf(object))\r// => [2, 0]" ], "name": "propertyOf", "longname": "propertyOf", "kind": "function", "scope": "global", "___id": "T000002R000651", "___s": true, "filepath": "propertyOf.js" }