refactor: monorepo+pnpm (removed husky)
This commit is contained in:
15
packages/hoppscotch-app/helpers/utils/uri.js
Normal file
15
packages/hoppscotch-app/helpers/utils/uri.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export function parseUrlAndPath(value) {
|
||||
const result = {}
|
||||
try {
|
||||
const url = new URL(value)
|
||||
result.url = url.origin
|
||||
result.path = url.pathname
|
||||
} catch (e) {
|
||||
const uriRegex = value.match(
|
||||
/^((http[s]?:\/\/)?(<<[^/]+>>)?[^/]*|)(\/?.*)$/
|
||||
)
|
||||
result.url = uriRegex[1]
|
||||
result.path = uriRegex[4]
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user