Skip to content

Latest commit

 

History

History
15 lines (15 loc) · 569 Bytes

some.md

File metadata and controls

15 lines (15 loc) · 569 Bytes

someAsync

someAsync<T>(iterable: AsyncIterable<T>, predicate: AsyncPredicate<Awaited<T>>): Promise<boolean>  

Checks if predicate (array, Promise of array or array of Promises) returns truthy for any element of collection.
Sequential iteration is stopped once predicate returns truthy. Resolves a boolean.

await someAsync(Promise.resolve([0, 1, 2, 3, 4, 5, 6]), (item) => {  
    return item > 3  
}); // => true  
await someAsync(Promise.resolve([0, 1, 2, 3, 4, 5, 6]), (item) => {  
    return item > 7  
}); // => false