HH\Lib\Dict\flatten

Meta Engineer?

This is available as Dict\flatten in the www repository.

Returns a new dict formed by merging the KeyedContainer 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>