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) 412 B
/** * Allows you to run [Array#every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) asynchronously */ export 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; }