anvil/striker-ui/lib/api_converters/toAnvilOverviewHostList.ts

14 lines
358 B
TypeScript

const toAnvilOverviewHostList = (
data: APIAnvilOverviewArray[number]['hosts'],
): APIAnvilOverview['hosts'] =>
data.reduce<APIAnvilOverview['hosts']>(
(previous, { hostName: name, hostType: type, hostUUID: uuid }) => {
previous[uuid] = { name, type, uuid };
return previous;
},
{},
);
export default toAnvilOverviewHostList;