(fullPath: string)
| 95 | |
| 96 | /** Last path segment (file or folder name). Handles mixed `/` and `\\`. */ |
| 97 | export function basenamePath(fullPath: string): string { |
| 98 | if (!fullPath || typeof fullPath !== 'string') return ''; |
| 99 | const i = Math.max(fullPath.lastIndexOf('/'), fullPath.lastIndexOf('\\')); |
| 100 | if (i < 0) return fullPath; |
| 101 | return fullPath.slice(i + 1); |
| 102 | } |
| 103 | |
| 104 | /** Parent directory; supports mixed separators and Unix root (`/` parent of `/foo`). */ |
| 105 | export function dirnameAbsolutePath(fullPath: string): string { |
no test coverage detected