( userAgent: string | undefined )
| 17 | * @returns The detected OS or 'OTHER' if not recognized |
| 18 | */ |
| 19 | export const detectOsInUserAgent = ( |
| 20 | userAgent: string | undefined |
| 21 | ): OperatingSystem => { |
| 22 | const osMatch = userAgent?.match(OS_PATTERNS); |
| 23 | return osMatch ? (osMatch[1].toUpperCase() as OperatingSystem) : 'OTHER'; |
| 24 | }; |
| 25 | |
| 26 | /** |
| 27 | * Detects operating system using navigator.userAgent |
no outgoing calls
no test coverage detected