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

Function normalizeWeeklyNoteLegacyPatterns

apps/desktop/src/main/vault.ts:839–857  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

837}
838
839function 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
859function normalizePrimaryNotesLocation(value: unknown): PrimaryNotesLocation {
860 return value === 'root' ? 'root' : 'inbox'

Callers 1

normalizeVaultSettingsFunction · 0.70

Tested by

no test coverage detected