UNPKG

eas-cli

Version:
12 lines (11 loc) 468 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.filterAsync = void 0; /** * asynchronous array filter * @param arr array to filter * @param predicate a predicate function to run asynchronously * @returns a promise resolving to a filtered array */ const filterAsync = async (arr, predicate) => await Promise.all(arr.map(predicate)).then(results => arr.filter((_v, index) => results[index])); exports.filterAsync = filterAsync;