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

Function pagesToFull

apps/desktop/src/main/databases.ts:60–67  ·  view source on GitHub ↗
(csvRel: string, pages: Record<string, string>)

Source from the content-addressed store, hash-verified

58// vault-relative paths (e.g. `Books.base/pages/X.md`). Legacy loose databases
59// have no folder, so paths pass through unchanged.
60function pagesToFull(csvRel: string, pages: Record<string, string>): Record<string, string> {
61 const formDir = formDirFromCsvPath(toPosix(csvRel))
62 if (!formDir) return pages
63 const prefix = `${formDir}/`
64 return Object.fromEntries(
65 Object.entries(pages).map(([id, p]) => [id, p.startsWith(prefix) ? p : `${prefix}${p}`])
66 )
67}
68
69function pagesToRelative(csvRel: string, pages: Record<string, string>): Record<string, string> {
70 const formDir = formDirFromCsvPath(toPosix(csvRel))

Callers 1

readSidecarFunction · 0.85

Calls 2

formDirFromCsvPathFunction · 0.90
toPosixFunction · 0.70

Tested by

no test coverage detected