Skip to content

Instantly share code, notes, and snippets.

@ktquez
Last active April 1, 2019 08:17
Show Gist options
  • Save ktquez/fc29a6af56b3a9c8c752ac79e2ee4b3a to your computer and use it in GitHub Desktop.
Save ktquez/fc29a6af56b3a9c8c752ac79e2ee4b3a to your computer and use it in GitHub Desktop.
function removeLetterAccent (value) {
const mapLetters = {
a: /(á|ã|â|à)/g,
e: /(é|ê)/g,
i: /(í)/g,
o: /(ó|ô|õ)/g,
u: /(ú|ü|)/g,
c: /(ç)/g,
n: /(ñ)/g
}
for (let letter in mapLetters) {
let rexp = mapLetters[letter]
value = value.toLowerCase().replace(rexp, letter)
}
return value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment