HH\Lib\Vec\filter

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

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

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

Description

namespace HH\Lib\Vec;

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

The default predicate is casting the value to boolean.

To remove null values in a typechecker-visible way, see Vec\filter_nulls(). To use an async predicate, see Vec\filter_async().

Parameters