Skip to content

Instantly share code, notes, and snippets.

@mytholog
Created October 25, 2016 13:50
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 mytholog/1f3927f37d7be53f223a4c74b8c47faf to your computer and use it in GitHub Desktop.
Save mytholog/1f3927f37d7be53f223a4c74b8c47faf to your computer and use it in GitHub Desktop.
transliterate
a = {"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"","б":"b","ю":"yu"};
transliterate = function(word){
return word.split('').map(function(char){
return typeof a[char] !== 'undefined' ? a[char] : char;
}).join("");
};
module.exports = transliterate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment