(value: unknown)
| 837 | } |
| 838 | |
| 839 | function normalizeWeeklyNoteLegacyPatterns(value: unknown): VaultSettings['weeklyNotes']['legacyPatterns'] { |
| 840 | if (!Array.isArray(value)) return [] |
| 841 | const out: NonNullable<VaultSettings['weeklyNotes']['legacyPatterns']> = [] |
| 842 | const seen = new Set<string>() |
| 843 | for (const item of value) { |
| 844 | if (!item || typeof item !== 'object') continue |
| 845 | const pattern = item as { directory?: unknown; titlePattern?: unknown; locale?: unknown } |
| 846 | const next = { |
| 847 | directory: normalizeWeeklyNotesDirectory(pattern.directory), |
| 848 | titlePattern: normalizeWeeklyNoteTitlePattern(pattern.titlePattern), |
| 849 | locale: normalizeWeeklyNoteLocale(pattern.locale) |
| 850 | } |
| 851 | const key = `${next.directory}\0${next.titlePattern}\0${next.locale}` |
| 852 | if (seen.has(key)) continue |
| 853 | seen.add(key) |
| 854 | out.push(next) |
| 855 | } |
| 856 | return out |
| 857 | } |
| 858 | |
| 859 | function normalizePrimaryNotesLocation(value: unknown): PrimaryNotesLocation { |
| 860 | return value === 'root' ? 'root' : 'inbox' |
no test coverage detected