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

Function get404Path

src/core/fetch/index.js:38–65  ·  view source on GitHub ↗
(path, config)

Source from the content-addressed store, hash-verified

36 };
37
38 const get404Path = (path, config) => {
39 const { notFoundPage, ext } = config;
40 const defaultPath = '_404' + (ext || '.md');
41 let key;
42 let path404;
43
44 switch (typeof notFoundPage) {
45 case 'boolean':
46 path404 = defaultPath;
47 break;
48 case 'string':
49 path404 = notFoundPage;
50 break;
51
52 case 'object':
53 key = Object.keys(notFoundPage)
54 .sort((a, b) => b.length - a.length)
55 .filter(k => path.match(new RegExp('^' + k)))[0];
56
57 path404 = (key && notFoundPage[key]) || defaultPath;
58 break;
59
60 default:
61 break;
62 }
63
64 return path404;
65 };
66
67 return class Fetch extends Base {
68 _loadSideAndNav(path, qs, loadSidebar, cb) {

Callers 1

_fetch404Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…