cyrillic-to-translit

Simple javascript function for converting Cyrillic(Tj,Ru) symbols to Latin


Keywords
cyrToLatTranslit, cyrillic, translit, cyrillict to latin, cyrToLat
License
MIT
Install
npm install cyrillic-to-translit@1.0.1

Documentation

CyrToLatTranslitJS

Ultra-lightweight JavaScript library for converting Cyrillic symbols to Translit and vice versa

Demo page

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