@naverpay/hidash
Version:
improved lodash
18 lines (15 loc) • 1.16 kB
TypeScript
import { ListIterateeCustom, ObjectIterateeCustom } from './internal/baseIteratee.type.js';
import { List } from './internal/types.js';
/**
* @description
* Checks if the `predicate` function returns a truthy value for all elements in the `collection`.
* The iteration stops as soon as an element is found for which the `predicate` returns a falsy value.
* For objects, this function iterates over the object's own enumerable property values.
*
* @param {Array|Object|null|undefined} collection The collection to iterate over.
* @param {Function} [predicate=Boolean] The function invoked per iteration. It receives three arguments: `(value, index|key, collection)`. If omitted, it defaults to the `Boolean` constructor to check for the truthiness of each element.
* @returns {boolean} Returns `true` if all elements pass the predicate check, otherwise `false`.
*/
declare function every<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): boolean;
declare function every<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): boolean;
export { every as default, every };