Home

function: pickBy


pickBy(object: Object, predicate: function): Object

Creates an object composed of the `object` properties `predicate` returns truthy for. The predicate is invoked with two arguments: (value, key).

Example(s):

const object = { 'a': 1, 'b': '2', 'c': 3 }

pickBy(object, isNumber)
// => { 'a': 1, 'c': 3 }

Params:

Name Type Attribute Description
object The source object.
predicate The function invoked per property.

Returns:

Object

  {
    "comment": "/**\r\n * Creates an object composed of the `object` properties `predicate` returns\r\n * truthy for. The predicate is invoked with two arguments: (value, key).\r\n *\r\n * @since 4.0.0\r\n * @category Object\r\n * @param {Object} object The source object.\r\n * @param {Function} predicate The function invoked per property.\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 * pickBy(object, isNumber)\r\n * // => { 'a': 1, 'c': 3 }\r\n */",
    "meta": {
        "range": [
            649,
            879
        ],
        "filename": "pickBy.js",
        "lineno": 21,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100007006",
            "name": "pickBy",
            "type": "FunctionDeclaration",
            "paramnames": [
                "object",
                "predicate"
            ]
        },
        "vars": {
            "props": "pickBy~props",
            "": null
        }
    },
    "description": "Creates an object composed of the `object` properties `predicate` returns\rtruthy for. The predicate is invoked with two arguments: (value, key).",
    "since": "4.0.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Object",
            "value": "Object"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Object"
                ]
            },
            "description": "The source object.",
            "name": "object"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function invoked per property.",
            "name": "predicate"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "Object"
                ]
            },
            "description": "Returns the new object."
        }
    ],
    "examples": [
        "const object = { 'a': 1, 'b': '2', 'c': 3 }\r\rpickBy(object, isNumber)\r// => { 'a': 1, 'c': 3 }"
    ],
    "name": "pickBy",
    "longname": "pickBy",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000646",
    "___s": true,
    "filepath": "pickBy.js"
}