Standard Array.some logic for the iterable, extended with iteration state + async.
It emits a boolean, indicating whether at least one element passes the predicate test.
boolean
import {pipe, some} from 'iter-ops';const i = pipe( [1, 2, 3], some(a => a % 2 === 0) // checks if even numbers are present);console.log(...i); //=> trueconsole.log(i.first); //=> true Copy
import {pipe, some} from 'iter-ops';const i = pipe( [1, 2, 3], some(a => a % 2 === 0) // checks if even numbers are present);console.log(...i); //=> trueconsole.log(i.first); //=> true
Note that the predicate can only return a Promise inside an asynchronous pipeline, or else the Promise will be treated as a truthy value.
Promise
Standard Array.some logic for the iterable, extended with iteration state + async.
It emits a
boolean
, indicating whether at least one element passes the predicate test.Note that the predicate can only return a
Promise
inside an asynchronous pipeline, or else thePromise
will be treated as a truthy value.