Skip to content

Instantly share code, notes, and snippets.

@feruzm
feruzm / detranslit.js
Created February 21, 2017 06:30 — forked from tamr/detranslit.js
detransliterate (latin to cyrillic)
detransliterate = (
function() {
var d = /\t+/g,
rus = "щ щ ш ч ц ю ю я я ё ё ж ъ ъ ы э э а б в г д е з и й й й к л м н о п р с т у ф х х ь ь".split(d),
eng = "shh w sh ch cz yu ju ya q yo jo zh `` '' y e` e' a b v g d e z i j i` i' k l m n o p r s t u f x h ` '".split(d);
return function(str) {
var i,
s = /[^[\]]+(?=])/g, orig = str.match(s),
t = /<(.|\n)*?>/g, tags = str.match(t);