(input: string, home: string)
| 1 | import path from "path" |
| 2 | |
| 3 | export function abbreviateHome(input: string, home: string) { |
| 4 | if (!home) return input |
| 5 | const relative = path.relative(home, input) |
| 6 | if (relative === "") return "~" |
| 7 | if (relative === ".." || relative.startsWith(".." + path.sep) || path.isAbsolute(relative)) return input |
| 8 | return "~" + path.sep + relative |
| 9 | } |
no outgoing calls
no test coverage detected