Requires the Hack Standard Library to be installed.
Facebook Engineer?

This function is available as Vec\gen_filter() in Facebook's www repository.

Returns a new vec containing only the values for which the given async predicate returns true

namespace HH\Lib\Vec;

function filter_async<Tv>(
  Container<Tv> $container,
  (function(Tv): Awaitable<bool>) $value_predicate,
): Awaitable<vec<Tv>>;

For non-async predicates, see Vec\filter().

Time complexity: O(n * p), where p is the complexity of $value_predicate Space complexity: O(n)