CyrToLatTranslitJS
Ultra-lightweight JavaScript library for converting Cyrillic symbols to Translit and vice versa
Install
npm install --save cyrToLatTranslit
Simple to use
import CyrillicToTranslit from 'CyrToLatTranslit.js';
const cyrillicToTranslit = new CyrToLatTranslit();
cyrillicToTranslit.transform('Салом Ахмад', '_');
Constructor
-
{ preset: tj }
or empty - transliteration preset for Tajik language. -
{ preset: ru }
- transliteration preset for Russian language.
transform()
Convert Cyrillic symbols to Translit
cyrillicToTranslit().transform(input, spaceReplacement);
-
input
- string which should be transformed -
spaceReplacement
- symbol for space replacement
reverse()
Convert Translit symbols to Cyrillic
cyrillicToTranslit().reverse(input, spaceReplacement);
-
input
- string which should be transformed -
spaceReplacement
- symbol for space replacement
Examples
- transform()
cyrillicToTranslit().transform('Азию Плюс');
> Aziya Plyus
- reverse()
cyrillicToTranslit().reverse("Aziya Plyus")
> Азию Плюс
Typescript
Typescript supports starting form v2.0.0. See definitions here
License
MIT © Zohid Saidov