A path's last segment up to its first dot — `./pages/Team` → 'Team', `a/b.dart` → 'b' — or '' when that is only dots.
(path: string)
| 107 | |
| 108 | /** A path's last segment up to its first dot — `./pages/Team` → 'Team', `a/b.dart` → 'b' — or '' when that is only dots. */ |
| 109 | function pathStem(path: string): string { |
| 110 | const trimmed = path.replace(/\/+$/, ''); |
| 111 | const stem = fileNameStem(trimmed.slice(trimmed.lastIndexOf('/') + 1)); |
| 112 | // `..` and `.` name a folder only through the referring file's location. |
| 113 | return /^\.*$/.test(stem) ? '' : stem; |
| 114 | } |
| 115 | |
| 116 | /** A file or folder name up to its first dot: 'b.dart' → 'b', 'types.d.ts' → 'types', '.eslintrc.js' → '.eslintrc'. */ |
| 117 | function fileNameStem(name: string): string { |
no test coverage detected