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

Function pagesToRelative

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

Source from the content-addressed store, hash-verified

67}
68
69function pagesToRelative(csvRel: string, pages: Record<string, string>): Record<string, string> {
70 const formDir = formDirFromCsvPath(toPosix(csvRel))
71 if (!formDir) return pages
72 const prefix = `${formDir}/`
73 return Object.fromEntries(
74 Object.entries(pages).map(([id, p]) => [id, p.startsWith(prefix) ? p.slice(prefix.length) : p])
75 )
76}
77
78function isMissing(err: unknown): boolean {
79 return (err as NodeJS.ErrnoException)?.code === 'ENOENT'

Callers 1

persistSidecarFunction · 0.85

Calls 2

formDirFromCsvPathFunction · 0.90
toPosixFunction · 0.70

Tested by

no test coverage detected