(inputUrl)
| 255 | * @returns |
| 256 | */ |
| 257 | const parseUrl = (inputUrl) => { |
| 258 | // Ensure the input URL does not end with a slash |
| 259 | const sanitizedUrl = inputUrl.replace(/\/$/, '') |
| 260 | |
| 261 | try { |
| 262 | // Create a new URL object |
| 263 | const url = new URL(sanitizedUrl) |
| 264 | return url |
| 265 | } catch (error) { |
| 266 | // Handle any errors that might occur during URL parsing |
| 267 | console.error('Invalid URL:', error.message) |
| 268 | return null |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * Parse repository URL |
no test coverage detected
searching dependent graphs…