From ce27b005f8a59319fbdcb02aea582cb0ded250bb Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Thu, 6 Apr 2023 22:30:34 -0400 Subject: [PATCH] Add function for getting a list of commands --- src/handbook/src/backend/data.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/handbook/src/backend/data.ts b/src/handbook/src/backend/data.ts index 49de2f7b4..0d4597e53 100644 --- a/src/handbook/src/backend/data.ts +++ b/src/handbook/src/backend/data.ts @@ -6,12 +6,20 @@ import { Quality, ItemType } from "@backend/types"; import type { Command, Avatar, Item } from "@backend/types"; type AvatarDump = { [key: number]: Avatar }; +type CommandDump = { [key: string]: Command }; /** * Fetches and casts all commands in the file. */ -export function getCommands(): { [key: string]: Command } { - return commands as { [key: string]: Command }; +export function getCommands(): CommandDump { + return commands as CommandDump; +} + +/** + * Fetches and lists all the commands in the file. + */ +export function listCommands(): Command[] { + return Object.values(getCommands()); } /**