Like Array.map, but for a Map. Transforms from Map<K,V> to Map<K,R>, returning as a new Map.
Array.map
const mapOfStrings = new Map();mapOfStrings.set(`a`, `10`);mapOfStrings.get(`a`); // Yields `10` (a string)// Convert a map of string->string to string->numberconst mapOfInts = transformMap(mapOfStrings, (value, key) => parseInt(value));mapOfInts.get(`a`); // Yields 10 (a proper number) Copy
const mapOfStrings = new Map();mapOfStrings.set(`a`, `10`);mapOfStrings.get(`a`); // Yields `10` (a string)// Convert a map of string->string to string->numberconst mapOfInts = transformMap(mapOfStrings, (value, key) => parseInt(value));mapOfInts.get(`a`); // Yields 10 (a proper number)
If you want to combine values into a single object, consider instead mapToObjectTransform.
Type of keys (generally a string)
Type of input map values
Type of output map values
Like
Array.map
, but for a Map. Transforms from Map<K,V> to Map<K,R>, returning as a new Map.Example
If you want to combine values into a single object, consider instead mapToObjectTransform.