(path: Path)
| 93 | * Return the dirname of the path, as a Path. See path.dirname |
| 94 | */ |
| 95 | export function dirname(path: Path): Path { |
| 96 | const index = path.lastIndexOf(NormalizedSep); |
| 97 | if (index === -1) { |
| 98 | return '' as Path; |
| 99 | } |
| 100 | |
| 101 | const endIndex = index === 0 ? 1 : index; // case of file under root: '/file' |
| 102 | |
| 103 | return normalize(path.slice(0, endIndex)); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Join multiple paths together, and normalize the result. Accepts strings that will be |
no test coverage detected