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

Function appendDateNotePatternHistory

packages/app-core/src/store.ts:2761–2776  ·  view source on GitHub ↗
(
  history: readonly DateNotePatternSettings[] | undefined,
  previous: DateNotePatternSettings,
  current: DateNotePatternSettings
)

Source from the content-addressed store, hash-verified

2759}
2760
2761function appendDateNotePatternHistory(
2762 history: readonly DateNotePatternSettings[] | undefined,
2763 previous: DateNotePatternSettings,
2764 current: DateNotePatternSettings
2765): DateNotePatternSettings[] {
2766 const out: DateNotePatternSettings[] = []
2767 const seen = new Set([dateNotePatternKey(current)])
2768 for (const pattern of [previous, ...(history ?? [])]) {
2769 const key = dateNotePatternKey(pattern)
2770 if (seen.has(key)) continue
2771 seen.add(key)
2772 out.push(pattern)
2773 if (out.length >= MAX_DATE_NOTE_PATTERN_HISTORY) break
2774 }
2775 return out
2776}
2777
2778function withDateNotePatternHistory(
2779 previousSettings: VaultSettings,

Callers 1

Calls 1

dateNotePatternKeyFunction · 0.70

Tested by

no test coverage detected