Skip to content

Instantly share code, notes, and snippets.

@shadeglare
Created May 15, 2020 14:37
Show Gist options
  • Save shadeglare/63096eeeb516954e5f49fa663abb3e30 to your computer and use it in GitHub Desktop.
Save shadeglare/63096eeeb516954e5f49fa663abb3e30 to your computer and use it in GitHub Desktop.
const table = {
"а": "a", "А": "A",
"б": "b", "Б": "B",
"в": "v", "В": "V",
"г": "g", "Г": "G",
"д": "d", "Д": "D",
"е": "e", "Е": "E",
"ё": "e", "Ё": "Е",
"ж": "zh", "Ж": "Zh",
"з": "z", "З": "Z",
"и": "i", "И": "I",
"й": "i", "Й": "I",
"к": "k", "К": "K",
"л": "l", "Л": "L",
"м": "m", "М": "M",
"н": "n", "Н": "N",
"о": "o", "О": "O",
"п": "p", "П": "P",
"р": "r", "Р": "R",
"с": "s", "С": "S",
"т": "t", "Т": "T",
"у": "u", "У": "U",
"ф": "f", "Ф": "F",
"х": "kh", "Х": "Kh",
"ц": "ts", "Ц": "Ts",
"ч": "ch", "Ч": "Ch",
"ш": "sh", "Ш": "Sh",
"щ": "shch", "Щ": "Shch",
"ъ": "ie", "Ъ": "Ie",
"ы": "y", "Ы": "Y",
"ь": "", "Ь": "",
"э": "e", "Э": "E",
"ю": "iu", "Ю": "Iu",
"я": "ia", "Я": "Ia"
};
function romanify(value) {
let result = "";
for (let letter of value) {
result += table[letter] || letter;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment