export function createMap<K, V>(items: V[], selector: (x: V) => K): Map<K, V> { const map = new Map<K, V>(); for (const item of items) { const key = selector(item); map.set(key, item); } return map; } const transportersById = createMap(transporters, x => x.Id); const transporter = transportersById.get(transporterId);
575900cookie-checkTypescript: Create Map (Hashmap)