Converts the source to a map.
Type of items in the source.
Type of the key.
Type of the value.
Key selector function.
Value selector function.
Collector that converts the source to a map.
const result = toMap<number, string, number>((x) => x.toString(), (x) => x * 2)([1, 2, 3]);console.log(result);// Map {// '1' => 2,// '2' => 4,// '3' => 6,// } Copy
const result = toMap<number, string, number>((x) => x.toString(), (x) => x * 2)([1, 2, 3]);console.log(result);// Map {// '1' => 2,// '2' => 4,// '3' => 6,// }
Converts the source to a map.