@@ -64,26 +64,26 @@ function inferBrowser(userAgent: string | undefined): string | undefined {
6464 if ( ! userAgent ) {
6565 return undefined ;
6666 }
67- const normalized = userAgent ;
68- if ( / E d g \/ / . test ( normalized ) ) return "Edge" ;
69- if ( / O P R \/ / . test ( normalized ) ) return "Opera" ;
70- if ( / F i r e f o x \/ / . test ( normalized ) ) return "Firefox" ;
71- if ( / C h r o m e \/ / . test ( normalized ) || / C r i O S \/ / . test ( normalized ) ) return "Chrome" ;
72- if ( / S a f a r i \/ / . test ( normalized ) && ! / C h r o m e \/ / . test ( normalized ) ) return "Safari" ;
73- if ( / E l e c t r o n \/ / . test ( normalized ) ) return "Electron" ;
67+ const normalized = userAgent . toLowerCase ( ) ;
68+ if ( / e d g \/ / . test ( normalized ) ) return "Edge" ;
69+ if ( / o p r \/ / . test ( normalized ) ) return "Opera" ;
70+ if ( / f i r e f o x \/ / . test ( normalized ) ) return "Firefox" ;
71+ if ( / c h r o m e \/ / . test ( normalized ) || / c r i o s \/ / . test ( normalized ) ) return "Chrome" ;
72+ if ( / s a f a r i \/ / . test ( normalized ) && ! / c h r o m e \/ / . test ( normalized ) ) return "Safari" ;
73+ if ( / e l e c t r o n \/ / . test ( normalized ) ) return "Electron" ;
7474 return undefined ;
7575}
7676
7777function inferOs ( userAgent : string | undefined ) : string | undefined {
7878 if ( ! userAgent ) {
7979 return undefined ;
8080 }
81- const normalized = userAgent ;
82- if ( / i P h o n e | i P a d | i P o d / . test ( normalized ) ) return "iOS" ;
83- if ( / A n d r o i d / . test ( normalized ) ) return "Android" ;
84- if ( / M a c O S X | M a c i n t o s h / . test ( normalized ) ) return "macOS" ;
85- if ( / W i n d o w s N T / . test ( normalized ) ) return "Windows" ;
86- if ( / L i n u x / . test ( normalized ) ) return "Linux" ;
81+ const normalized = userAgent . toLowerCase ( ) ;
82+ if ( / i p h o n e | i p a d | i p o d / . test ( normalized ) ) return "iOS" ;
83+ if ( / a n d r o i d / . test ( normalized ) ) return "Android" ;
84+ if ( / m a c o s x | m a c i n t o s h / . test ( normalized ) ) return "macOS" ;
85+ if ( / w i n d o w s n t / . test ( normalized ) ) return "Windows" ;
86+ if ( / l i n u x / . test ( normalized ) ) return "Linux" ;
8787 return undefined ;
8888}
8989
0 commit comments