export function getMapFromList( list: T[], name: string = 'name' ): Record { const acc: Record = {}; for (const t of list) { const key = t[name] as string | undefined; if (key === undefined) { continue; } acc[key] = t; } return acc; } export function getListFromMap(map: Record): T[] { return Object.keys(map).map((n) => map[n]); }