const accentsMap = { a: 'á|à|ã|â|À|Á|Ã|Â', e: 'é|è|ê|É|È|Ê', i: 'í|ì|î|Í|Ì|Î', o: 'ó|ò|ô|õ|Ó|Ò|Ô|Õ', u: 'ú|ù|û|ü|Ú|Ù|Û|Ü', c: 'ç|Ç', n: 'ñ|Ñ', }; export const removeAccents = (text: string): string => Object.keys(accentsMap).reduce( (acc, cur) => acc.replace(new RegExp(accentsMap[cur], 'g'), cur), text, );