(path: string)
| 182 | |
| 183 | /** JSDoc */ |
| 184 | export function dirname(path: string): string { |
| 185 | const result = splitPath(path); |
| 186 | const root = result[0] || ''; |
| 187 | let dir = result[1]; |
| 188 | |
| 189 | if (!root && !dir) { |
| 190 | // No dirname whatsoever |
| 191 | return '.'; |
| 192 | } |
| 193 | |
| 194 | if (dir) { |
| 195 | // It has a dirname, strip trailing slash |
| 196 | dir = dir.slice(0, dir.length - 1); |
| 197 | } |
| 198 | |
| 199 | return root + dir; |
| 200 | } |
| 201 | |
| 202 | /** JSDoc */ |
| 203 | export function basename(path: string, ext?: string): string { |