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

Method parse

src/core/router/history/hash.js:80–99  ·  view source on GitHub ↗

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

(path = location.href)

Source from the content-addressed store, hash-verified

78 * @return {object} { path, query }
79 */
80 parse(path = location.href) {
81 let query = '';
82
83 const hashIndex = path.indexOf('#');
84 if (hashIndex >= 0) {
85 path = path.slice(hashIndex + 1);
86 }
87
88 const queryIndex = path.indexOf('?');
89 if (queryIndex >= 0) {
90 query = path.slice(queryIndex + 1);
91 path = path.slice(0, queryIndex);
92 }
93
94 return {
95 path,
96 file: this.getFile(path, true),
97 query: parseQuery(query),
98 };
99 }
100
101 toURL(path, params, currentRoute) {
102 return '#' + super.toURL(path, params, currentRoute);

Callers

nothing calls this directly

Calls 2

parseQueryFunction · 0.90
getFileMethod · 0.80

Tested by

no test coverage detected