You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
397 B
22 lines
397 B
export function parsePath (path) {
|
|
let hash = ''
|
|
let query = ''
|
|
|
|
const hashIndex = path.indexOf('#')
|
|
if (hashIndex >= 0) {
|
|
hash = path.slice(hashIndex)
|
|
path = path.slice(0, hashIndex)
|
|
}
|
|
|
|
const queryIndex = path.indexOf('?')
|
|
if (queryIndex >= 0) {
|
|
query = path.slice(queryIndex + 1)
|
|
path = path.slice(0, queryIndex)
|
|
}
|
|
|
|
return {
|
|
path,
|
|
query,
|
|
hash
|
|
}
|
|
}
|
|
|