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

Function normalizeDailyNoteLegacyPatterns

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

Source from the content-addressed store, hash-verified

817}
818
819function 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
839function normalizeWeeklyNoteLegacyPatterns(value: unknown): VaultSettings['weeklyNotes']['legacyPatterns'] {
840 if (!Array.isArray(value)) return []

Callers 1

normalizeVaultSettingsFunction · 0.70

Calls 3

normalizeDailyNoteLocaleFunction · 0.70

Tested by

no test coverage detected