(value: unknown)
| 817 | } |
| 818 | |
| 819 | function normalizeDailyNoteLegacyPatterns(value: unknown): VaultSettings['dailyNotes']['legacyPatterns'] { |
| 820 | if (!Array.isArray(value)) return [] |
| 821 | const out: NonNullable<VaultSettings['dailyNotes']['legacyPatterns']> = [] |
| 822 | const seen = new Set<string>() |
| 823 | for (const item of value) { |
| 824 | if (!item || typeof item !== 'object') continue |
| 825 | const pattern = item as { directory?: unknown; titlePattern?: unknown; locale?: unknown } |
| 826 | const next = { |
| 827 | directory: normalizeDailyNotesDirectory(pattern.directory), |
| 828 | titlePattern: normalizeDailyNoteTitlePattern(pattern.titlePattern), |
| 829 | locale: normalizeDailyNoteLocale(pattern.locale) |
| 830 | } |
| 831 | const key = `${next.directory}\0${next.titlePattern}\0${next.locale}` |
| 832 | if (seen.has(key)) continue |
| 833 | seen.add(key) |
| 834 | out.push(next) |
| 835 | } |
| 836 | return out |
| 837 | } |
| 838 | |
| 839 | function normalizeWeeklyNoteLegacyPatterns(value: unknown): VaultSettings['weeklyNotes']['legacyPatterns'] { |
| 840 | if (!Array.isArray(value)) return [] |
no test coverage detected