Last active
April 1, 2019 08:17
-
-
Save ktquez/fc29a6af56b3a9c8c752ac79e2ee4b3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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