Neutron Polarization Manipulator

    cyrillic-to-translit-js
    TypeScript icon, indicating that this package has built-in type declarations

    3.2.1 • Public • Published

    cyrillic-to-translit-js

    Codeship Status for greybax/cyrillic-to-translit-js

    install size NPM version NPM Downloads/month Build Status Coveralls Status

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

    Demo page

    Install

    npm install --save cyrillic-to-translit-js

    Simple to use

    import CyrillicToTranslit from 'cyrillic-to-translit-js';
    
    const cyrillicToTranslit = new CyrillicToTranslit();
    
    cyrillicToTranslit.transform('Какая-то строка', '_').toLowerCase();

    Constructor

    • { preset: 'ru' } or empty - transliteration preset for Russian language.
    • { preset: 'uk' } - transliteration preset for Ukranian language (see PR #27).
    • { preset: 'mn' } - transliteration preset for Mongolian language (see PR #142).

    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('Привет Мир!');
    
      >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

    Typescript supports starting form v2.0.0. See definitions here

    Credits

    Why I've done this plugin?

    https://alfilatov.com/posts/cyrillic-to-translit-js-library-for-converting-cyrillic-symbols-to-translit-and-vice-versa/

    License

    MIT © Aleksandr Filatov alfilatov.com

    Install

    npm i cyrillic-to-translit-js

    DownloadsWeekly Downloads

    5,603

    Version

    3.2.1

    License

    MIT

    Unpacked Size

    212 kB

    Total Files

    24

    Last publish

    Collaborators

    • vasergen
    • nitruxa
    • greybax
    • makepost