COLLECTED BY
Organization:
Internet Archive
Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
The Wayback Machine - https://web.archive.org/web/20201220222316/https://github.com/lodash/lodash/blob/master/some.js
Permalink
Cannot retrieve contributors at this time
29 lines (27 sloc)
781 Bytes
/**
* Checks if `predicate` returns truthy for **any** element of `array`.
* Iteration is stopped once `predicate` returns truthy. The predicate is
* invoked with three arguments: (value, index, array).
*
* @since 5.0.0
* @category Array
* @param {Array } array The array to iterate over.
* @param {Function } predicate 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
*/
function some ( array , predicate ) {
let index = - 1
const length = array == null ? 0 : array . length
while ( ++ index < length ) {
if ( predicate ( array [ index ] , index , array ) ) {
return true
}
}
return false
}
export default some
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.