(s: string)
| 70 | // ─── Fuzzy matching helpers ─────────────────────────────────────────────────── |
| 71 | |
| 72 | function 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 | |
| 81 | function tokenize(s: string): string[] { |
| 82 | return normalize(s).split(/\s+/).filter(t => t.length > 1); |