Function
replaceNoteMeta
(notes: NoteMeta[], oldPath: string, next: NoteMeta)
Source from the content-addressed store, hash-verified
| 984 | } |
| 985 | |
| 986 | function replaceNoteMeta(notes: NoteMeta[], oldPath: string, next: NoteMeta): NoteMeta[] { |
| 987 | const idx = notes.findIndex((n) => n.path === oldPath) |
| 988 | if (idx === -1) return notes |
| 989 | const copy = notes.slice() |
| 990 | copy[idx] = next |
| 991 | return copy |
| 992 | } |
| 993 | |
| 994 | function mergeNotesPreservingOrder(prev: NoteMeta[], next: NoteMeta[]): NoteMeta[] { |
| 995 | const nextByPath = new Map(next.map((n) => [n.path, n] as const)) |
Tested by
no test coverage detected