@bemoje/arr-any
Check whether a condition is true for any element of an array. The condition check is in the form of a callback.
Version
Travis CI
Dependencies
Stats
Donate
Installation
npm install @bemoje/arr-any
npm install --save @bemoje/arr-any
npm install --save-dev @bemoje/arr-any
Usage
import arrAny from '@bemoje/arr-any'
const arr = ['hi', 'there']
arrAny(arr, (element) => {
return element === 'there'
})
arrAny(arr, (element) => {
return element.length === 5
})
arrAny(arr, (element) => {
return element.length > 5
})
Tests
Uses Jest to test module functionality. Run tests to get coverage details.
npm run test
API
arrAny
Check whether a condition is true for any element of an array. The condition check is in the form of a callback.
Parameters
-
arr
Array The array to iterate
-
callback
callback callback(element, index, array): boolean
Returns
boolean
callback
Type: Function
Parameters
Returns
boolean