(link: HTMLAnchorElement)
| 39 | } |
| 40 | |
| 41 | export function isClientLink(link: HTMLAnchorElement) { |
| 42 | let baseUrl = process.env.LIBRARY |
| 43 | ? getBaseUrl(process.env.LIBRARY as any) |
| 44 | : 'http://localhost:1234'; |
| 45 | |
| 46 | return ( |
| 47 | link && |
| 48 | link instanceof HTMLAnchorElement && |
| 49 | link.href && |
| 50 | (!link.target || link.target === '_self') && |
| 51 | link.origin === location.origin && |
| 52 | !link.hasAttribute('download') && |
| 53 | link.href.startsWith(baseUrl) && |
| 54 | !link.href.includes('v3/') && // links with v3 are from the old website |
| 55 | !link.pathname.endsWith('.html') // links with .html are from the old website |
| 56 | ); |
| 57 | } |
no test coverage detected