MCPcopy Index your code
hub / github.com/serverless/serverless / parseUrl

Function parseUrl

packages/sf-core/src/utils/https/index.js:257–270  ·  view source on GitHub ↗
(inputUrl)

Source from the content-addressed store, hash-verified

255 * @returns
256 */
257const 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

Callers 1

parseRepoURLFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…