export const toObject = (map: Map): Record => { return Object.fromEntries(map.entries()); }; export const toArray = (map: Map): [string, T][] => { return Array.from(map.entries()); }; export const init = (map: Map, records: Record) => { map.clear(); const entries = Object.entries(records); for (const [key, value] of entries) { map.set(key, value); } };