Ultra-lightweight JavaScript library for converting Cyrillic symbols to Translit and vice versa
npm install --save cyrillic-to-translit-js
import CyrillicToTranslit from 'cyrillic-to-translit-js';
const cyrillicToTranslit = new CyrillicToTranslit();
cyrillicToTranslit.transform('Какая-то строка', '_').toLowerCase();
{ preset: ru }
or empty - transliteration preset for Russian language.{ preset: uk }
- transliteration preset for Ukranian language (see PR #27).
Convert Cyrillic symbols to Translit
cyrillicToTranslit().transform(input, spaceReplacement);
input
- string which should be transformedspaceReplacement
- symbol for space replacement
Convert Translit symbols to Cyrillic
cyrillicToTranslit().reverse(input, spaceReplacement);
input
- string which should be transformedspaceReplacement
- symbol for space replacement
- transform()
cyrillicToTranslit().transform('Привет Мир!');
>Privet Mir!
cyrillicToTranslit().transform('привет мир!', "_")
>privet_mir!
cyrillicToTranslit({ preset: "uk" }).transform('привіт світе!', "_")
>pryvit_svite!
- reverse()
cyrillicToTranslit().reverse("ulitsa Soyuza Pechatnikov")
>улица Союза Печатников
cyrillicToTranslit({ preset: "uk" }).reverse("Rozghon Uliana i Harashchenko Khrystyna")
>Розгон Уляна і Гаращенко Христина
Typescript supports starting form v2.0.0. See definitions here
- kunashir
- Vasyl Gendzeliuk
- Nikita Svesnikov
- Igor Deryabin
- makepost
- Aleksey Kislov
- Igor Kamyshev
- Sasha Kirillov
- Booglejr
MIT © Aleksandr Filatov alfilatov.com