(value: string)
| 53 | } |
| 54 | |
| 55 | function titleCacheKey(value: string): string { |
| 56 | const url = parseUrl(value) |
| 57 | |
| 58 | if (!url) { |
| 59 | return normalizeExternalUrl(value) |
| 60 | } |
| 61 | |
| 62 | const host = url.hostname.replace(/^www\./i, '').toLowerCase() |
| 63 | const pathname = url.pathname === '/' ? '/' : url.pathname.replace(/\/+$/, '') || '/' |
| 64 | |
| 65 | return `${host}${pathname}${url.search || ''}` |
| 66 | } |
| 67 | |
| 68 | function cacheTitle(key: string, title: string): void { |
| 69 | if (titleCache.size >= TITLE_CACHE_LIMIT) { |
no test coverage detected