Fix enum value comparison

This commit is contained in:
gpt-engineer-app[bot]
2025-10-17 15:54:58 +00:00
parent f5ee267e66
commit 1e60d6c6b6

View File

@@ -527,7 +527,11 @@ function normalizeForComparison(value: any): any {
// Normalize enum-like strings to lowercase for comparison
// Matches patterns like: "operating", "Operating", "amusement_park", "Amusement_Park", "Amusement Park"
if (typeof value === 'string' && /^[a-zA-Z_\s]+$/.test(value)) {
return value.toLowerCase().trim();
return value
.toLowerCase()
.replace(/_/g, ' ') // Replace underscores with spaces
.replace(/\s+/g, ' ') // Collapse multiple spaces
.trim();
}
// Recursively normalize arrays