Home

function: every


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

Checks if `predicate` returns truthy for **all** elements of `collection`. Iteration is stopped once `predicate` returns falsey. The predicate is invoked with three arguments: (value, index|key, collection). **Note:** This method returns `true` for [empty collections](https://en.wikipedia.org/wiki/Empty_set) because [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of elements of empty collections.

Example(s):

every([true, 1, null, 'yes'], Boolean)
// => false

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 **all** elements of `collection`.\r\n * Iteration is stopped once `predicate` returns falsey. The predicate is\r\n * invoked with three arguments: (value, index|key, collection).\r\n *\r\n * **Note:** This method returns `true` for\r\n * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because\r\n * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\r\n * elements of empty collections.\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 all elements pass the predicate check,\r\n *  else `false`.\r\n * @example\r\n *\r\n * every([true, 1, null, 'yes'], Boolean)\r\n * // => false\r\n */",
    "meta": {
        "range": [
            922,
            1069
        ],
        "filename": "every.js",
        "lineno": 25,
        "path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
        "code": {
            "id": "astnode100002304",
            "name": "every",
            "type": "FunctionDeclaration",
            "paramnames": [
                "collection",
                "predicate"
            ]
        },
        "vars": {
            "func": "every~func"
        }
    },
    "description": "Checks if `predicate` returns truthy for **all** elements of `collection`.\rIteration is stopped once `predicate` returns falsey. The predicate is\rinvoked with three arguments: (value, index|key, collection).\r\r**Note:** This method returns `true` for\r[empty collections](https://en.wikipedia.org/wiki/Empty_set) because\r[everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of\relements of empty collections.",
    "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 all elements pass the predicate check,\r else `false`."
        }
    ],
    "examples": [
        "every([true, 1, null, 'yes'], Boolean)\r// => false"
    ],
    "name": "every",
    "longname": "every",
    "kind": "function",
    "scope": "global",
    "___id": "T000002R000254",
    "___s": true,
    "filepath": "every.js"
}