SPB Git

Repository Public

text.ts 446 B 14 lines typescript

1/** Text normalisation shared by quiz grading and search. */2const COMBINING = /[̀-ͯ]/g;34/** Lowercase, no accents, ligatures expanded, typographic apostrophes and spaces unified. */5export function fold(text: string): string {6  return text7    .replace(/[œŒ]/g, "oe").replace(/[æÆ]/g, "ae")8    .normalize("NFD").replace(COMBINING, "")9    .toLowerCase()10    .replace(/[’‘ʼ`]/g, "'")11    .replace(/[  \s]+/g, " ")12    .trim();13}14
Files main
Menu

Theme