basant307/AI_Governance_Project
045
1import arraySome from './_arraySome.js';2import baseIteratee from './_baseIteratee.js';3import baseSome from './_baseSome.js';4import isArray from './isArray.js';5import isIterateeCall from './_isIterateeCall.js';6 7/**8 * Checks if `predicate` returns truthy for **any** element of `collection`.9 * Iteration is stopped once `predicate` returns truthy. The predicate is10 * invoked with three arguments: (value, index|key, collection).11 *12 * @static13 * @memberOf _14 * @since 0.1.015 * @category Collection16 * @param {Array|Object} collection The collection to iterate over.17 * @param {Function} [predicate=_.identity] The function invoked per iteration.18 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.19 * @returns {boolean} Returns `true` if any element passes the predicate check,20 * else `false`.21 * @example22 *23 * _.some([null, 0, 'yes', false], Boolean);24 * // => true25 *26 * var users = [27 * { 'user': 'barney', 'active': true },28 * { 'user': 'fred', 'active': false }29 * ];30 *31 * // The `_.matches` iteratee shorthand.32 * _.some(users, { 'user': 'barney', 'active': false });33 * // => false34 *35 * // The `_.matchesProperty` iteratee shorthand.36 * _.some(users, ['active', false]);37 * // => true38 *39 * // The `_.property` iteratee shorthand.40 * _.some(users, 'active');41 * // => true42 */43function some(collection, predicate, guard) {44 var func = isArray(collection) ? arraySome : baseSome;45 if (guard && isIterateeCall(collection, predicate, guard)) {46 predicate = undefined;47 }48 return func(collection, baseIteratee(predicate, 3));49}50 51export default some;52 