Normalize accented chars in team name mapping
This commit is contained in:
@@ -62,6 +62,14 @@ export const TEAM_NAME_MAP: Record<string, string> = {
|
||||
'panama': 'PAN', 'panamá': 'PAN',
|
||||
}
|
||||
|
||||
export function resolveTeam(name: string): string | null {
|
||||
return TEAM_NAME_MAP[name.trim().toLowerCase()] ?? null
|
||||
function normalize(name: string): string {
|
||||
return name.trim().toLowerCase()
|
||||
.normalize('NFD')
|
||||
.replace(/\p{Diacritic}/gu, '')
|
||||
}
|
||||
|
||||
export function resolveTeam(name: string): string | null {
|
||||
const key = name.trim().toLowerCase()
|
||||
const keyNorm = normalize(name)
|
||||
return TEAM_NAME_MAP[key] ?? TEAM_NAME_MAP[keyNorm] ?? null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user