Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cyrillic-to-translit-js

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cyrillic-to-translit-js

Simple javascript function for converting Cyrillic symbols to Translit

  • 3.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
increased by5.99%
Maintainers
4
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 05 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc