Skip to content

Instantly share code, notes, and snippets.

/tr-otele.js Secret

Created November 14, 2015 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/70aab933384573b4bef9 to your computer and use it in GitHub Desktop.
Save anonymous/70aab933384573b4bef9 to your computer and use it in GitHub Desktop.
var charmap = {
"Ş": "s",
"İ": "i",
"ı": "i",
"Ğ": "g",
"ğ": "g",
"Ü": "u",
"ü": "u",
"ç": "c",
"Ç": "c",
"ö": "o",
"Ö": "o",
"ş": "s",
"â": "a",
"ê": "e",
"î": "i",
"û": "u",
"Â": "a",
"Ê": "e",
"Î": "i",
"Û": "u"
};
var re = new RegExp("[" + Object.keys(charmap).join('') +"]", "g");
function Asciify(str){
return str.replace(re, function (m, p, a){return charmap[m];}).toLowerCase();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment