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

Function rewriteNoteJumpHistory

packages/app-core/src/store.ts:1345–1358  ·  view source on GitHub ↗
(
  history: NoteJumpLocation[],
  rewrite: (path: string) => string
)

Source from the content-addressed store, hash-verified

1343}
1344
1345function rewriteNoteJumpHistory(
1346 history: NoteJumpLocation[],
1347 rewrite: (path: string) => string
1348): NoteJumpLocation[] {
1349 const next: NoteJumpLocation[] = []
1350 for (const entry of history) {
1351 const mapped = { ...entry, path: rewrite(entry.path) }
1352 if (sameNoteJumpLocation(next[next.length - 1] ?? null, mapped)) continue
1353 next.push(mapped)
1354 }
1355 return next.length > MAX_NOTE_JUMP_HISTORY
1356 ? next.slice(next.length - MAX_NOTE_JUMP_HISTORY)
1357 : next
1358}
1359
1360/**
1361 * Rewrite every occurrence of `#oldTag` across all non-trash notes.

Callers 2

renameNoteStateFunction · 0.85
store.tsFile · 0.85

Calls 2

sameNoteJumpLocationFunction · 0.85
rewriteFunction · 0.70

Tested by

no test coverage detected