A better Array.prototype.some(). Supports iterables, whitelist testing, and more.
npm install @lamansky/someA better Array.prototype.some(). Supports iterables, whitelist testing, and more.
Requires Node.js 6.0.0 or above.
``bash`
npm i @lamansky/some
The module exports a single function.
1. Bindable: iter (iterable)test
2. Optional: (function, array, or any): If a function is provided, iterated values will be evaluated on whether test returns true when passed the value. If an array is provided, iterated values will be evaluated on whether they are contained in the array. If some other value is provided, iterated values will be evaluated on whether they strictly equal test. If test is omitted, iterated values will be evaluated on whether they are truthy.
Returns true if any one of the iterated values of iter passes test; otherwise returns false.
`javascript
const some = require('@lamansky/some')
const arr = [1, 2, 3]
some(arr, n => n % 2 === 0) // true
some(arr, 1) // true
some(arr, [3, 4]) // true
some(arr, n => n > 3) // false
some(arr, 4) // false
some(arr, [4, 5]) // false
// Supports the bind operator
arr::some(n => n % 2 === 0) // true
``
* every