This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
scoresaber-reloadedv3/projects/common/src/utils/region-utils.ts
Liam 383f41f9ca
All checks were successful
Deploy Backend / deploy (push) Successful in 4m23s
Deploy Website / deploy (push) Successful in 7m25s
surely this works
2024-10-14 11:29:00 +01:00

16 lines
344 B
TypeScript

let regionNames = new Intl.DisplayNames(["en"], { type: "region" });
/**
* Returns the normalized region name
*
* @param region the region to normalize
* @returns the normalized region name
*/
export function normalizedRegionName(region: string) {
try {
return regionNames.of(region) || region;
} catch {
return region;
}
}