(path, config)
| 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) { |
no outgoing calls
no test coverage detected
searching dependent graphs…