Checks whether an element in a collection passes a test.
Checks whether an element in a collection passes a test.
Checks whether an element in a collection passes a test.
Checks whether an element in a collection passes a test.
Tests whether a collection contains at least n
elements which pass a test implemented by a predicate function.
The predicate function is provided three arguments:
value
: collection valueindex
: collection indexcollection
: the input collectionThe function immediately returns upon finding n
successful elements.
If provided an empty collection, the function returns false
.
input collection
number of elements
test function
execution context
boolean indicating whether a collection contains at least n
elements which pass a test
function isNegative( v ) {
return ( v < 0 );
}
var arr = [ 1, 2, -3, 4, -1 ];
var bool = someBy( arr, 2, isNegative );
// returns true
Checks whether an element in a collection passes a test.
collection value
collection index
boolean indicating whether an element in a collection passes a test