@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
16 lines (15 loc) • 535 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.asyncSome = void 0;
/**
* Allows you to run [Array#some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) asynchronously
*/
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;
}
exports.asyncSome = asyncSome;