@naverpay/hidash
Version:
improved lodash
19 lines (16 loc) • 981 B
text/typescript
import { ListIterateeCustom, ObjectIterateeCustom } from './internal/baseIteratee.type.mjs';
import { List } from './internal/types.mjs';
/**
* @description
* Checks if **any** element in a collection satisfies a given predicate.
* If no predicate is provided, it checks if the collection is empty.
*
* This function is similar to `Array.prototype.some` but works with various types of collections.
*
* @param {List<T> | object} [collection] The collection to iterate over
* @param {ListIterateeCustom<T, boolean> | ObjectIterateeCustom<T, boolean>} [predicate] The function invoked per iteration
* @returns {boolean} `true` if any element satisfies the predicate, `false` otherwise
*/
declare function some<T>(collection: List<T> | null | undefined, predicate?: ListIterateeCustom<T, boolean>): boolean;
declare function some<T extends object>(collection: T | null | undefined, predicate?: ObjectIterateeCustom<T, boolean>): boolean;
export { some as default, some };