github
352 of 426 branches covered (82.63%)
Branch coverage included in aggregate %.
305 of 421 new or added lines in 4 files covered. (72.45%)
16 existing lines in 2 files now uncovered.2786 of 3264 relevant lines covered (85.36%)
867.2 hits per line
UNCOV
1
|
/**
|
|
UNCOV
2
|
* filterAsync filters an array using an asynchronous predicate function. |
× |
UNCOV
3
|
* @param arr |
× |
UNCOV
4
|
* @param predicate function |
× |
UNCOV
5
|
* @returns filtered array |
× |
UNCOV
6
|
*/ |
× |
UNCOV
7
|
export async function filterAsync<T>(
|
× |
UNCOV
8
|
arr: T[], |
× |
UNCOV
9
|
predicate: (item: T) => Promise<boolean> |
× |
UNCOV
10
|
): Promise<T[]> { |
× |
UNCOV
11
|
const promises = arr.map(predicate);
|
× |
UNCOV
12
|
const results = await Promise.all(promises);
|
× |
UNCOV
13
|
return arr.filter((_, index) => results[index]);
|
× |
UNCOV
14
|
} |
× |