(input: string)
| 1 | export function extractUrlDomain(input: string): string | null { |
| 2 | try { |
| 3 | const normalizedInput = input.startsWith('http') ? input : `https://${input}`; |
| 4 | const url = new URL(normalizedInput); |
| 5 | return `${url.protocol}//${url.hostname}${url.port ? ':' + url.port : ''}`; // Inclut le protocole et le domaine |
| 6 | } catch { |
| 7 | return null; // Not a valid URL |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | export function extractUrlPath(input: string): string | null { |
| 12 | try { |
no outgoing calls
no test coverage detected