HH\Lib\Vec\map_with_key
Requires the Hack Standard Library to be installed.
Facebook Engineer?
This function is available as Vec\map_with_key()
in Facebook's www repository.
Returns a new vec where each value is the result of calling the given function on the original key and value
namespace HH\Lib\Vec;
function map_with_key<Tk, Tv1, Tv2>(
KeyedTraversable<Tk, Tv1> $traversable,
(function(Tk, Tv1): Tv2) $value_func,
): vec<Tv2>;
Time complexity: O(n) Space complexity: O(n)
Parameters
KeyedTraversable<Tk, Tv1> $traversable
(function(Tk, Tv1): Tv2) $value_func
Returns
vec<Tv2>