( history: readonly DateNotePatternSettings[] | undefined, previous: DateNotePatternSettings, current: DateNotePatternSettings )
| 2759 | } |
| 2760 | |
| 2761 | function 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 | |
| 2778 | function withDateNotePatternHistory( |
| 2779 | previousSettings: VaultSettings, |
no test coverage detected