macedonian-transliteration
Version:
Transliteration Plugin for the Macedonian Cyrillic Alphabet
3 lines (2 loc) • 1.85 kB
JavaScript
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self)["macedonian-transliteration"]={})}(this,(function(t){"use strict";t.cyrillic_to_latin=function(t){const n={"а":"a","б":"b","в":"v","г":"g","д":"d","ѓ":"gj","е":"e","ж":"zh","з":"z","ѕ":"dz","и":"i","ј":"j","к":"k","л":"l","љ":"lj","м":"m","н":"n","њ":"nj","о":"o","п":"p","р":"r","с":"s","т":"t","ќ":"kj","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","џ":"dzh","ш":"sh","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Ѓ":"Gj","Е":"E","Ж":"Zh","З":"Z","Ѕ":"Dz","И":"I","Ј":"J","К":"K","Л":"L","Љ":"Lj","М":"M","Н":"N","Њ":"Nj","О":"O","П":"P","Р":"R","С":"S","Т":"T","Ќ":"Kj","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Џ":"Dzh","Ш":"Sh"};let e="";for(let o=0;o<t.length;o++){const h=t[o];e+=n[h]?n[h]:h}return e},t.latin_to_cyrillic=function(t){const n={a:"а",b:"б",c:"ц",d:"д",e:"е",f:"ф",g:"г",h:"х",i:"и",j:"ј",k:"к",l:"л",m:"м",n:"н",o:"о",p:"п",q:"ќ",r:"р",s:"с",t:"т",u:"у",v:"в",w:"в",x:"џ",y:"ѕ",z:"з",A:"А",B:"Б",C:"Ц",D:"Д",E:"Е",F:"Ф",G:"Г",H:"Х",I:"И",J:"Ј",K:"К",L:"Л",M:"М",N:"Н",O:"О",P:"П",Q:"Ќ",R:"Р",S:"С",T:"Т",U:"У",V:"В",W:"В",X:"Џ",Y:"Ѕ",Z:"З",sh:"ш",Sh:"Ш",SH:"Ш",sH:"Ш",ch:"ч",Ch:"Ч",CH:"Ч",cH:"Ч",dzh:"џ",Dzh:"Џ",DZH:"Џ",dZH:"Џ",DzH:"Џ",nj:"њ",Nj:"Њ",Lj:"Љ",LJ:"Љ",lj:"љ",Kj:"Ќ",KJ:"Ќ",kj:"ќ",Gj:"Ѓ",GJ:"Ѓ",gj:"ѓ",Zh:"Ж",ZH:"Ж",zh:"ж",Dz:"S",DZ:"S",dz:"ѕ"};let e="",o=0;for(;o<t.length;){let h=t[o],i=t.substr(o,2),s=t.substr(o,3);n.hasOwnProperty(s)?(e+=n[s],o+=3):n.hasOwnProperty(i)?(e+=n[i],o+=2):n.hasOwnProperty(h)?(e+=n[h],o++):(e+=h,o++)}return e}}));
//# sourceMappingURL=index.umd.js.map