HH\Lib\Dict\pull_with_key

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

This function is available as Dict\pull_with_key() in Facebook's www repository.

Returns a new dict where:

  • values are the result of calling $value_func on the original value/key
  • keys are the result of calling $key_func on the original value/key

Description

namespace HH\Lib\Dict;

function pull_with_key<Tk1, Tk2 as arraykey, Tv1, Tv2>(
  KeyedTraversable<Tk1, Tv1> $traversable,
  (function(Tk1,Tv1):Tv2) $value_func,
  (function(Tk1,Tv1):Tk2) $key_func,
): dict<Tk2, Tv2>;

In the case of duplicate keys, later values will overwrite the previous ones.

Parameters