MCPcopy
hub / github.com/docsifyjs/docsify / parse

Method parse

src/core/router/history/html5.js:45–66  ·  view source on GitHub ↗

* Parse the url * @param {string} [path=location.href] URL to be parsed * @return {object} { path, query }

(path = location.href)

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 3

getPathFunction · 0.90
parseQueryFunction · 0.90
getFileMethod · 0.80

Tested by

no test coverage detected