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

Function uniqueTitle

apps/desktop/src/mcp/vault-ops.ts:578–590  ·  view source on GitHub ↗
(dir: string, base: string)

Source from the content-addressed store, hash-verified

576}
577
578async function uniqueTitle(dir: string, base: string): Promise<string> {
579 let candidate = base
580 let n = 1
581 while (true) {
582 try {
583 await fs.access(path.join(dir, `${candidate}.md`))
584 n += 1
585 candidate = `${base} ${n}`
586 } catch {
587 return candidate
588 }
589 }
590}
591
592function sanitizeTitle(raw: string): string {
593 // Filenames must be safe on all 3 OSes. Strip path separators, null,

Callers 4

createNoteFunction · 0.70
moveBetweenFoldersFunction · 0.70
moveNoteFunction · 0.70
duplicateNoteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected