(urlOrPath)
| 33 | } |
| 34 | |
| 35 | export function withBase(urlOrPath) { |
| 36 | const base = getBasePath(); |
| 37 | const s = String(urlOrPath || ''); |
| 38 | if (!base) return s; |
| 39 | if (!s.startsWith('/')) return s; |
| 40 | if (s === base || s.startsWith(base + '/')) return s; |
| 41 | return base + s; |
| 42 | } |
| 43 | |
| 44 | export function stripBase(pathname) { |
| 45 | const base = getBasePath(); |
no test coverage detected