MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / titleFromPath

Function titleFromPath

apps/desktop/src/main/databases.ts:49–54  ·  view source on GitHub ↗

Database title: its `.base` folder name (legacy: the `.csv` basename).

(rel: string)

Source from the content-addressed store, hash-verified

47
48/** Database title: its `.base` folder name (legacy: the `.csv` basename). */
49function titleFromPath(rel: string): string {
50 const posix = toPosix(rel)
51 if (formDirFromCsvPath(posix)) return formTitleFromCsvPath(posix)
52 const base = posix.split('/').filter(Boolean).pop() ?? rel
53 return base.replace(/\.csv$/i, '')
54}
55
56// Record-page paths are stored RELATIVE to the database folder (e.g. `pages/X.md`)
57// so a folder rename/move never rewrites them; on read they're resolved to full

Callers 2

hydrateFunction · 0.70
walkFunction · 0.70

Calls 3

formDirFromCsvPathFunction · 0.90
formTitleFromCsvPathFunction · 0.90
toPosixFunction · 0.70

Tested by

no test coverage detected