npm accent-folding

Accent-insensitive matching with built-in search highlighting — try typing lo, mu, gar, or bj

Vanilla JS browser

Original name replace(name) highlightMatch(name, query)

React React component

TypeScript types included

Full type declarations ship with the package — no @types/ needed.

import AccentFolding, { type AccentMap } from 'accent-folding';

const af = new AccentFolding();

const replaced:     string = af.replace('café');
const highlighted:  string = af.highlightMatch('López', 'lo');
const withTag:      string = af.highlightMatch('López', 'lo', 'mark');

// Custom accent map with a typed argument
const myMap: AccentMap = { ö: 'oe', ü: 'ue', ñ: 'n' };
const afCustom        = new AccentFolding(myMap);

// Static utility
const entries: Array<[string, string]> = AccentFolding.convertAccentMapToArray(myMap);