Home

function: some


some(collection: Array, Object, predicate: function): boolean

Checks if `predicate` returns truthy for **any** element of `collection`. Iteration is stopped once `predicate` returns truthy. The predicate is invoked with three arguments: (value, index|key, collection).

Example(s):

some([null, 0, 'yes', false], Boolean)
// => true

Params:

Name Type Attribute Description
collection The collection to iterate over.
predicate The function invoked per iteration.

Returns:

boolean

  {
    "comment": "/**\r\n * Checks if `predicate` returns truthy for **any** element of `collection`.\r\n * Iteration is stopped once `predicate` returns truthy. The predicate is\r\n * invoked with three 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 iterate over.\r\n * @param {Function} predicate The function invoked per iteration.\r\n * @returns {boolean} Returns `true` if any element passes the predicate check,\r\n *  else `false`.\r\n * @example\r\n *\r\n * some([null, 0, 'yes', false], Boolean)\r\n * // => true\r\n */",
    "meta": {
        "range": [
            687,
            831
        ],
        "filename": "some.js",
        "lineno": 20,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100008400",
            "name": "some",
            "type": "FunctionDeclaration",
            "paramnames": [
                "collection",
                "predicate"
            ]
        },
        "vars": {
            "func": "some~func"
        }
    },
    "description": "Checks if `predicate` returns truthy for **any** element of `collection`.\rIteration is stopped once `predicate` returns truthy. The predicate is\rinvoked with three arguments: (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 iterate over.",
            "name": "collection"
        },
        {
            "type": {
                "names": [
                    "function"
                ]
            },
            "description": "The function invoked per iteration.",
            "name": "predicate"
        }
    ],
    "returns": [
        {
            "type": {
                "names": [
                    "boolean"
                ]
            },
            "description": "Returns `true` if any element passes the predicate check,\r else `false`."
        }
    ],
    "examples": [
        "some([null, 0, 'yes', false], Boolean)\r// => true"
    ],
    "name": "some",
    "longname": "some",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000769",
    "___s": true,
    "filepath": "some.js"
}