fix: preserve intentional OS name casing (macOS, iOS, webOS)

Skip capitalize() for names with mixed casing to prevent
macOS→MacOS, iOS→IOS, webOS→WebOS, ChromeOS→Chromeos etc.
This commit is contained in:
Usman Baig
2026-03-19 11:32:36 +01:00
parent 1696e428ab
commit 6b1e6876c6

View File

@@ -30,6 +30,8 @@ type Tab = 'browsers' | 'os' | 'devices' | 'screens'
function capitalize(s: string): string {
if (!s) return s
// Preserve intentional casing (e.g. macOS, iOS, webOS, ChromeOS, FreeBSD)
if (s !== s.toLowerCase() && s !== s.toUpperCase()) return s
return s.charAt(0).toUpperCase() + s.slice(1)
}