Files
prowler/ui/lib/categories.ts
T
Alan Buscaglia d2886a5e10 refactor(ui): simplify categories.ts to only use dynamic label formatting
Remove hardcoded CATEGORY_IDS and CATEGORY_LABELS constants.
Categories now come from the API and are formatted dynamically.
2025-12-15 19:16:06 +01:00

16 lines
412 B
TypeScript

/**
* Converts a category ID to a human-readable label.
* Capitalizes each word and replaces hyphens with spaces.
*
* Examples:
* - "internet-exposed" -> "Internet Exposed"
* - "iam" -> "Iam"
* - "forensics-ready" -> "Forensics Ready"
*/
export function getCategoryLabel(id: string): string {
return id
.split("-")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(" ");
}