| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | var baseEach = require('./_baseEach'); |
| 2 | |
| 3 | /** |
| 4 | * The base implementation of `_.some` without support for iteratee shorthands. |
| 5 | * |
| 6 | * @private |
| 7 | * @param {Array|Object} collection The collection to iterate over. |
| 8 | * @param {Function} predicate The function invoked per iteration. |
| 9 | * @returns {boolean} Returns `true` if any element passes the predicate check, |
| 10 | * else `false`. |
| 11 | */ |
| 12 | function baseSome(collection, predicate) { |
| 13 | var result; |
| 14 | |
| 15 | baseEach(collection, function(value, index, collection) { |
| 16 | result = predicate(value, index, collection); |
| 17 | return !result; |
| 18 | }); |
| 19 | return !!result; |
| 20 | } |
| 21 | |
| 22 | module.exports = baseSome; |