(path: string | null | undefined)
| 249 | } |
| 250 | |
| 251 | export function databaseTitleFromTab(path: string | null | undefined): string { |
| 252 | const csv = csvPathFromDatabaseTab(path) |
| 253 | if (!csv) return 'Database' |
| 254 | // A database's title is its `<Name>.base` folder name, not the `data.csv` basename. |
| 255 | if (formDirFromCsvPath(csv)) return formTitleFromCsvPath(csv) |
| 256 | const base = csv.split('/').filter(Boolean).pop() ?? csv |
| 257 | return base.replace(/\.csv$/i, '') |
| 258 | } |
| 259 | |
| 260 | /** True for the sidecar file path (`*.csv.base.json`). */ |
| 261 | export function isDatabaseSidecarPath(relPath: string): boolean { |
no test coverage detected