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

Function matchWeeklyPattern

packages/app-core/src/lib/vault-layout.ts:1038–1051  ·  view source on GitHub ↗
(
  subpath: string,
  title: string,
  settings: VaultSettings,
  pattern: DateNotePatternSettings
)

Source from the content-addressed store, hash-verified

1036}
1037
1038function matchWeeklyPattern(
1039 subpath: string,
1040 title: string,
1041 settings: VaultSettings,
1042 pattern: DateNotePatternSettings
1043): Date | null {
1044 const numerics = patternNumerics(pattern, subpath, title, DEFAULT_WEEKLY_NOTE_TITLE_PATTERN)
1045 if (!numerics) return null
1046 for (const candidate of weeklyCandidateMondays(numerics)) {
1047 const expected = weeklyNoteLocationForPattern(candidate, settings, pattern)
1048 if (expected.subpath === subpath && expected.title === title) return candidate
1049 }
1050 return null
1051}
1052
1053/**
1054 * Classify a note as a daily or weekly note, or `null` if it is neither.

Callers 1

classifyDateNoteFunction · 0.85

Calls 3

patternNumericsFunction · 0.85
weeklyCandidateMondaysFunction · 0.85

Tested by

no test coverage detected