Function mapKeys

  • Create a new Map by associating the value of each key with mapper executed for each key in the source map. The opposite of mapMap. In the event two source keys map to the same result key, the second source key's value will overwrite the first, in which case the cardinality of the returned map may be smaller than the source map's.

    Type Parameters

    • K

    • V

    • K2

    Parameters

    • map: ReadonlyMap<K, V>

      source map

    • mapper: ((key, value) => K2)

      function to compute a key in the resulting map for the source key and value

        • (key, value): K2
        • Parameters

          • key: K
          • value: V

          Returns K2

    Returns Map<K2, V>

Generated using TypeDoc