(raw: string | undefined)
| 215 | |
| 216 | /** Strip a trailing slash and any leading `./`, so `src/` and `src` are one root. */ |
| 217 | export function normalizeRoot(raw: string | undefined): string { |
| 218 | let root = (raw ?? '').trim().replace(/\\/g, '/'); |
| 219 | while (root.startsWith('./')) root = root.slice(2); |
| 220 | while (root.endsWith('/')) root = root.slice(0, -1); |
| 221 | if (root === '.' || root === '/') return ''; |
| 222 | return root; |
| 223 | } |
| 224 | |
| 225 | function stemOf(basename: string): string { |
| 226 | const dot = basename.indexOf('.'); |
no outgoing calls
no test coverage detected