// https://advancedweb.hu/how-to-use-async-functions-with-array-filter-in-javascript/ export async function AsyncFilter(arr: unknown[], predicate: (value: unknown, index: number, array: unknown[]) => Promise) { return Promise.all(arr.map(predicate)).then((results) => arr.filter((_v, index) => results[index])); }