@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
12 lines (11 loc) • 362 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.asyncFilter = void 0;
/**
* Allows you to filter an array asynchronously
*/
async function asyncFilter(array, callback) {
const results = await Promise.all(array.map(callback));
return array.filter((_v, index) => results[index]);
}
exports.asyncFilter = asyncFilter;