UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

37 lines (36 loc) 1.13 kB
/** * 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). * * @since 5.2.0 * @category Collection * @param collection The collection to iterate over. * @param predicate The function invoked per iteration. * @param guard Enables use as an iteratee for methods like `map`. * @returns Returns `true` if any element passes the predicate check, * else `false`. * @example * * some([null, 0, 'yes', false], Boolean); * // => true * * var users = [ * { 'user': 'barney', 'active': true }, * { 'user': 'fred', 'active': false } * ]; * * // The `matches` iteratee shorthand. * some(users, { 'user': 'barney', 'active': false }); * // => false * * // The `matchesProperty` iteratee shorthand. * some(users, ['active', false]); * // => true * * // The `property` iteratee shorthand. * some(users, 'active'); * // => true */ export declare function some<T>(collection: ArrayLike<T>, predicate?: any, guard?: any): boolean; export default some;