some source npm

_.some(collection, [predicate=_.identity])

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).

Arguments

  1. collection (Array|Object)

    The collection to iterate over.

  2. [predicate=_.identity] (Function|Object|string)

    The function invoked per iteration.

Returns (boolean)

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 }
];

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

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

// using the `_.property` callback shorthand
_.some(users, 'active');
// => true