Creates a Map of an iterable object mapping each item to the specified key.
The key can be a property name or a function.
If the key is not unique the last item will be used that matches the key.
Type Parameters
T
K extends string | number
I = T
Parameters
iterable: Iterable<T>
iterable items to map
keySelector: keyof T | ((item, index) => undefined | K)
function to get the map by key
OptionalitemSelector: ((item, index) => I)
function to get the the item value; defaults to the items being iterated
Creates a Map of an iterable object mapping each item to the specified key. The key can be a property name or a function. If the key is not unique the last item will be used that matches the key.