HH\Lib\Keyset\filter_async

Meta Engineer?

This is available as Keyset\filter_async in the www repository.

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

namespace HH\Lib\Keyset;

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

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

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

The IO operations for each of the calls to $value_predicate will happen in parallel.

Parameters

  • Container<Tv>$container
  • (function(Tv): Awaitable<bool>) $value_predicate

Returns