mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
5 lines
232 B
TypeScript
5 lines
232 B
TypeScript
|
export const asyncFilter = async <T>(arr: T[], predicate: (value: T, index: number, arr: T[]) => Promise<boolean>) => {
|
||
|
const results = await Promise.all(arr.map(predicate));
|
||
|
return arr.filter((_v, index) => results[index]);
|
||
|
};
|