(ipAddress: string | undefined)
| 118 | } |
| 119 | |
| 120 | function normalizeIpAddress(ipAddress: string | undefined): string | undefined { |
| 121 | const normalized = normalizeOptionalString(ipAddress); |
| 122 | if (!normalized) { |
| 123 | return undefined; |
| 124 | } |
| 125 | |
| 126 | // Node may normalize IPv4 loopback as IPv6-mapped form. |
| 127 | if (normalized === "::ffff:127.0.0.1") { |
| 128 | return "127.0.0.1"; |
| 129 | } |
| 130 | |
| 131 | return normalized; |
| 132 | } |
| 133 | |
| 134 | function detectBrowserFromUserAgent(userAgent: string): string | undefined { |
| 135 | const lowerUserAgent = userAgent.toLowerCase(); |
no test coverage detected