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

Function patternNumerics

packages/app-core/src/lib/vault-layout.ts:960–974  ·  view source on GitHub ↗

* Numerics a note's directory + title expose, used only to bound the set of * candidate dates we round-trip. Tokens we cannot reverse cheaply (localized * month/weekday names) contribute nothing here — the round-trip below verifies * them instead, so the locale never has to be parsed backwards.

(
  pattern: DateNotePatternSettings,
  subpath: string,
  title: string,
  defaultTitlePattern: string
)

Source from the content-addressed store, hash-verified

958 * them instead, so the locale never has to be parsed backwards.
959 */
960function patternNumerics(
961 pattern: DateNotePatternSettings,
962 subpath: string,
963 title: string,
964 defaultTitlePattern: string
965): DateNotePatternMatch | null {
966 const directoryMatch = matchDirectoryPattern(pattern.directory, subpath)
967 const titleMatch = matchDateNotePattern(pattern.titlePattern ?? defaultTitlePattern, title)
968 if (!directoryMatch || !titleMatch) return null
969 const merged: DateNotePatternMatch = {}
970 if (!mergePatternMatch(merged, directoryMatch) || !mergePatternMatch(merged, titleMatch)) {
971 return null
972 }
973 return merged
974}
975
976/**
977 * Every calendar day consistent with the extracted numerics. A day-of-month

Callers 2

matchDailyPatternFunction · 0.85
matchWeeklyPatternFunction · 0.85

Calls 3

matchDirectoryPatternFunction · 0.85
matchDateNotePatternFunction · 0.85
mergePatternMatchFunction · 0.85

Tested by

no test coverage detected