(input: string)
| 9 | } |
| 10 | |
| 11 | export function extractUrlPath(input: string): string | null { |
| 12 | try { |
| 13 | const normalizedInput = input.startsWith('http') ? input : `https://${input}`; |
| 14 | const url = new URL(normalizedInput); |
| 15 | return url.pathname.replace(/^\/|\/$/g, ''); // Remove leading and trailing slashes |
| 16 | } catch { |
| 17 | return null; // Not a valid URL |
| 18 | } |
| 19 | } |
no outgoing calls
no test coverage detected