UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

12 lines (11 loc) 406 B
/** * Allows you to run [Array#some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) asynchronously */ export async function asyncSome(array, predicate) { for (let index = 0, arrayLength = array.length; index < arrayLength; index++) { if (await predicate(array[index], index, array)) { return true; } } return false; }