HH\Lib\Dict\select_keys
Requires the Hack Standard Library to be installed.
Facebook Engineer?
This function is available as Dict\select_keys()
in Facebook's www repository.
Returns a new dict containing only the keys found in both the input container and the given Traversable
namespace HH\Lib\Dict;
function select_keys<Tk as arraykey, Tv>(
KeyedContainer<Tk, Tv> $container,
Traversable<Tk> $keys,
): dict<Tk, Tv>;
The dict will have the same ordering as the
$keys
Traversable.
Time complexity: O(k), where k is the size of $keys
.
Space complexity: O(k), where k is the size of $keys
.
Parameters
Returns
dict<Tk, Tv>