(input: string | undefined, base: string, home: string)
| 13 | } |
| 14 | |
| 15 | function formatPath(input: string | undefined, base: string, home: string) { |
| 16 | if (typeof input !== "string" || !input) return "" |
| 17 | |
| 18 | const absolute = path.isAbsolute(input) ? input : path.resolve(base, input) |
| 19 | const relative = path.relative(base, absolute) |
| 20 | |
| 21 | if (!relative) return "." |
| 22 | if (relative !== ".." && !relative.startsWith(".." + path.sep)) return relative |
| 23 | return abbreviateHome(absolute, home) |
| 24 | } |
no test coverage detected