Skip to main content

some

_.some(predicate, collection) # Ⓢ [Ⓣ][1] Ⓝ

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​

0.1.0

Arguments​

  1. predicate (Function): The function invoked per iteration.
  2. collection (Array|Object): The collection to iterate over.

Returns​

(boolean): Returns true if any element passes the predicate check,



else false.

Example​

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

var users = [
{ 'user': 'barney', 'active': true },
{ 'user': 'fred', 'active': false }
];

// The `_.matches` iteratee shorthand.
_.some({ 'user': 'barney', 'active': false }, users);
// => false

// The `_.matchesProperty` iteratee shorthand.
_.some(['active', false], users);
// => true

// The `_.property` iteratee shorthand.
_.some('active', users);
// => true