From 6112b692ffb51f14aa23e46a4227d2068ffa7b26 Mon Sep 17 00:00:00 2001 From: AnthonyFuller <24512050+AnthonyFuller@users.noreply.github.com> Date: Thu, 31 Oct 2024 20:38:33 +0000 Subject: [PATCH] refactor(ingame options): use a for loop to parse builtInPages --- components/menus/settings.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/components/menus/settings.ts b/components/menus/settings.ts index 263144c2..31a78da5 100644 --- a/components/menus/settings.ts +++ b/components/menus/settings.ts @@ -37,15 +37,18 @@ const commandMap = new Map([ // eslint-disable-next-line @typescript-eslint/no-explicit-any const builtInPages: Record = { - "/pages/peacock-menu/index.json": JSON.parse(PeacockMenuIndex), - "/pages/peacock-menu/options.json": JSON.parse(PeacockMenuOptions), - "/pages/peacock-menu/flags/index.json": JSON.parse(PeacockMenuFlagIndex), - "/pages/peacock-menu/flags/category.json": JSON.parse( - PeacockMenuFlagCategory, - ), - "/pages/peacock-menu/flags/flag.json": JSON.parse(PeacockMenuFlag), + "/pages/peacock-menu/index.json": PeacockMenuIndex, + "/pages/peacock-menu/options.json": PeacockMenuOptions, + "/pages/peacock-menu/flags/index.json": PeacockMenuFlagIndex, + "/pages/peacock-menu/flags/category.json": PeacockMenuFlagCategory, + "/pages/peacock-menu/flags/flag.json": PeacockMenuFlag, } +Object.keys(builtInPages).forEach((page) => { + // Parse the string into an object + builtInPages[page] = JSON.parse(builtInPages[page]) +}) + const pagePrefix = "/pages/peacock-menu/" const jsonExtension = ".json"