Removes the accents from a string, converting them to their corresponding non-accented ASCII characters.
npm install remove-accents
An easy to use solution for converting all accented characters to their corresponding non-accented ASCII characters.
import removeAccents from 'remove-accents';
removeAccents(inputString)
Alternatively, you could use the CommonJS syntax to import it:
const removeAccents = require('remove-accents');
The string that you wish to remove accents from.
Call removeAccents()
by passing the string you wish to remove accents from, and you will get the non-accented string as result.
const input = 'ÀÁÂÃÄÅ';
const output = removeAccents(input);
console.log(output); // AAAAAA
The exported function also has helper methods.
Determine if a string has any accented characters.
import removeAccents from 'remove-accents';
console.log(removeAccents.has('ÀÁÂÃÄÅ')); // true
console.log(removeAccents.has('ABC')); // false
Alias of removeAccents
.
import removeAccents from 'remove-accents';
console.log(removeAccents.remove('ÀÁÂÃÄÅ')); // AAAAAA
MIT