HH\Lib\Dict\flatten

Requires the Hack Standard Library to be installed.
Facebook Engineer?

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

Returns a new dict formed by merging the KeyedTraversable elements of the given Traversable

namespace HH\Lib\Dict;

function flatten<Tk as arraykey, Tv>(
  Traversable<KeyedContainer<Tk, Tv>> $traversables,
): dict<Tk, Tv>;

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

For a fixed number of KeyedTraversables, see Dict\merge().

Time complexity: O(n), where n is the combined size of all the $traversables Space complexity: O(n), where n is the combined size of all the $traversables

Parameters

Returns

  • dict<Tk, Tv>