Creates an object composed of the picked `object` properties.
const object = { 'a': 1, 'b': '2', 'c': 3 }
pick(object, ['a', 'c'])
// => { 'a': 1, 'c': 3 }
| Name | Type | Attribute | Description |
|---|---|---|---|
| object | The source object. | ||
| paths | The property paths to pick. |
{
"comment": "/**\r\n * Creates an object composed of the picked `object` properties.\r\n *\r\n * @since 0.1.0\r\n * @category Object\r\n * @param {Object} object The source object.\r\n * @param {...(string|string[])} [paths] The property paths to pick.\r\n * @returns {Object} Returns the new object.\r\n * @example\r\n *\r\n * const object = { 'a': 1, 'b': '2', 'c': 3 }\r\n *\r\n * pick(object, ['a', 'c'])\r\n * // => { 'a': 1, 'c': 3 }\r\n */",
"meta": {
"range": [
457,
549
],
"filename": "pick.js",
"lineno": 18,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100006975",
"name": "pick",
"type": "FunctionDeclaration",
"paramnames": [
"object",
"paths"
]
}
},
"description": "Creates an object composed of the picked `object` properties.",
"since": "0.1.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Object",
"value": "Object"
}
],
"params": [
{
"type": {
"names": [
"Object"
]
},
"description": "The source object.",
"name": "object"
},
{
"type": {
"names": [
"string",
"Array."
]
},
"optional": true,
"variable": true,
"description": "The property paths to pick.",
"name": "paths"
}
],
"returns": [
{
"type": {
"names": [
"Object"
]
},
"description": "Returns the new object."
}
],
"examples": [
"const object = { 'a': 1, 'b': '2', 'c': 3 }\r\rpick(object, ['a', 'c'])\r// => { 'a': 1, 'c': 3 }"
],
"name": "pick",
"longname": "pick",
"kind": "function",
"scope": "global",
"___id": "T000002R000644",
"___s": true,
"filepath": "pick.js"
}