Home

constant: find


  {
    "comment": "/**\r\n * Iterates over elements of `collection`, returning the first element\r\n * `predicate` returns truthy for. The predicate is invoked with three\r\n * arguments: (value, index|key, collection).\r\n *\r\n * @since 0.1.0\r\n * @category Collection\r\n * @param {Array|Object} collection The collection to inspect.\r\n * @param {Function} predicate The function invoked per iteration.\r\n * @param {number} [fromIndex=0] The index to search from.\r\n * @returns {*} Returns the matched element, else `undefined`.\r\n * @see findIndex, findKey, findLast, findLastIndex, findLastKey\r\n * @example\r\n *\r\n * const users = [\r\n *   { 'user': 'barney',  'age': 36, 'active': true },\r\n *   { 'user': 'fred',    'age': 40, 'active': false },\r\n *   { 'user': 'pebbles', 'age': 1,  'active': true }\r\n * ]\r\n *\r\n * find(users, ({ age }) => age < 40)\r\n * // => object for 'barney'\r\n */",
    "meta": {
        "range": [
            953,
            981
        ],
        "filename": "find.js",
        "lineno": 27,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100002369",
            "name": "find",
            "type": "CallExpression",
            "value": ""
        }
    },
    "description": "Iterates over elements of `collection`, returning the first element\r`predicate` returns truthy for. The predicate is invoked with three\rarguments: (value, index|key, collection).",
    "since": "0.1.0",
    "tags": [
        {
            "originalTitle": "category",
            "title": "category",
            "text": "Collection",
            "value": "Collection"
        }
    ],
    "params": [
        {
            "type": {
                "names": [
                    "Array",
                    "Object"
                ]
            },
            "description": "The collection to inspect.",
            "name": "collection"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function invoked per iteration.",
            "name": "predicate"
        },
        {
            "type": {
                "names": [
                    "number"
                ]
            },
            "optional": true,
            "defaultvalue": 0,
            "description": "The index to search from.",
            "name": "fromIndex"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "*"
                ]
            },
            "description": "Returns the matched element, else `undefined`."
        }
    ],
    "see": [
        "findIndex, findKey, findLast, findLastIndex, findLastKey"
    ],
    "examples": [
        "const users = [\r  { 'user': 'barney',  'age': 36, 'active': true },\r  { 'user': 'fred',    'age': 40, 'active': false },\r  { 'user': 'pebbles', 'age': 1,  'active': true }\r]\r\rfind(users, ({ age }) => age < 40)\r// => object for 'barney'"
    ],
    "name": "find",
    "longname": "find",
    "kind": "constant",
    "scope": "global",
    "___id": "T000002R000260",
    "___s": true,
    "filepath": "find.js"
}