( history: NoteJumpLocation[], rewrite: (path: string) => string )
| 1343 | } |
| 1344 | |
| 1345 | function 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. |
no test coverage detected