DEV Community

Ivan Bliskavka
Ivan Bliskavka

Posted on

Async Array Filter

private asyncFilter = (arr, predicate) => {
  return Promise.all(arr.map(predicate))
    .then((results) => arr.filter((_v, index) => results[index]));
}
Enter fullscreen mode Exit fullscreen mode

Discussion (0)