(url: string | undefined)
| 3 | import referrers from './referrers'; |
| 4 | |
| 5 | function getHostname(url: string | undefined) { |
| 6 | if (!url) { |
| 7 | return ''; |
| 8 | } |
| 9 | |
| 10 | try { |
| 11 | return new URL(url).hostname; |
| 12 | } catch (e) { |
| 13 | return ''; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | export function parseReferrer(url: string | undefined) { |
| 18 | const hostname = getHostname(url); |