* Parse the url * @param {string} [path=location.href] URL to be parsed * @return {object} { path, query }
(path = location.href)
| 43 | * @return {object} { path, query } |
| 44 | */ |
| 45 | parse(path = location.href) { |
| 46 | let query = ''; |
| 47 | |
| 48 | const queryIndex = path.indexOf('?'); |
| 49 | if (queryIndex >= 0) { |
| 50 | query = path.slice(queryIndex + 1); |
| 51 | path = path.slice(0, queryIndex); |
| 52 | } |
| 53 | |
| 54 | const base = getPath(location.origin); |
| 55 | const baseIndex = path.indexOf(base); |
| 56 | |
| 57 | if (baseIndex > -1) { |
| 58 | path = path.slice(baseIndex + base.length); |
| 59 | } |
| 60 | |
| 61 | return { |
| 62 | path, |
| 63 | file: this.getFile(path), |
| 64 | query: parseQuery(query), |
| 65 | }; |
| 66 | } |
| 67 | } |
nothing calls this directly
no test coverage detected