MCPcopy
hub / github.com/obsidianmd/obsidian-help / normalize

Function normalize

scripts/migrate-locale.ts:72–79  ·  view source on GitHub ↗
(s: string)

Source from the content-addressed store, hash-verified

70// ─── Fuzzy matching helpers ───────────────────────────────────────────────────
71
72function normalize(s: string): string {
73 return s
74 .normalize("NFD").replace(/[\u0300-\u036f]/g, "") // strip diacritics
75 .toLowerCase()
76 .replace(/[-_']/g, " ")
77 .replace(/[^a-z0-9 ]/g, "")
78 .trim();
79}
80
81function tokenize(s: string): string[] {
82 return normalize(s).split(/\s+/).filter(t => t.length > 1);

Callers 2

tokenizeFunction · 0.70
findMatchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected