@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
16 lines (15 loc) • 544 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.asyncEvery = void 0;
/**
* Allows you to run [Array#every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) asynchronously
*/
async function asyncEvery(array, predicate) {
for (let index = 0, arrayLength = array.length; index < arrayLength; index++) {
if (!(await predicate(array[index], index, array))) {
return false;
}
}
return true;
}
exports.asyncEvery = asyncEvery;