HH\Lib\Keyset\filter

This API is part of the Hack Standard Library, not HHVM itself.
Facebook Engineer?

This function is available as Keyset\filter() in Facebook's www repository.

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

Description

namespace HH\Lib\Keyset;

function filter<Tv as arraykey>(
  Traversable<Tv> $traversable,
  ?(function(Tv):bool) $value_predicate = null,
): keyset<Tv>;

The default predicate is casting the value to boolean.

To remove null values in a typechecker-visible way, see Keyset\filter_nulls().

Parameters