(key: string, token: CachedToken)
| 176 | } |
| 177 | |
| 178 | function rememberToken(key: string, token: CachedToken): void { |
| 179 | if (TOKEN_CACHE.has(key)) TOKEN_CACHE.delete(key) |
| 180 | TOKEN_CACHE.set(key, token) |
| 181 | while (TOKEN_CACHE.size > TOKEN_CACHE_MAX_ENTRIES) { |
| 182 | const oldestKey = TOKEN_CACHE.keys().next().value |
| 183 | if (oldestKey === undefined) break |
| 184 | TOKEN_CACHE.delete(oldestKey) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | function normalizeGeolocation(raw: string | undefined, fallback: string): string { |
| 189 | if (!raw) return `https://${fallback}` |
no test coverage detected