• Stars
    star
    142
  • Rank 258,495 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

cyrillic-to-translit-js

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

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

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

More Repositories

1

awesome-IT-films

📺 A curated list of awesome films about IT & geek people.
JavaScript
844
star
2

cordova-plugin-proguard

🔳 Cordova Plugin for ProGuard
Shell
51
star
3

MarkdownCheatsheet

📓 This is a handy chrome extension for markdown markup
HTML
20
star
4

github-extension-my-repo-news

Chrome extension which helps you not to miss important changes in your news thread related to your repo
JavaScript
16
star
5

MSEdgeSearchClicker

Microsoft Edge browser search clicker with random words
TypeScript
11
star
6

DynDNSviaYandexAPI

🏠 Automatic tool for changing A-record of your website, which delegated on DNS Yandex.
C#
10
star
7

remark-helpers

Helper methods for remark
JavaScript
7
star
8

generator-tslint

A Yeoman generator to help with TSLint development
JavaScript
5
star
9

generator-badges

Yeoman generator for adding badges to your README.md
JavaScript
4
star
10

md-tags

Extract tags from your markdown article
JavaScript
3
star
11

brandifyjs

🌀 Text transformer/replacer with SVG icons for popular brands
JavaScript
3
star
12

generator-prepare-git-repo

Yeoman generator for quick start prepare template git project repository.
JavaScript
3
star
13

towers_game2d

JavaScript
3
star
14

md-article

Extract data from markdown article
JavaScript
2
star
15

md-content

get content from markdown article
JavaScript
2
star
16

Password.js

Javascript library for generate random passwords
JavaScript
1
star
17

md-date

JavaScript
1
star
18

md-title

JavaScript
1
star
19

YPhoto

Javascript wrapper for fotki.yandex.ru
JavaScript
1
star
20

backTopUserJS

chrome extension back top button
JavaScript
1
star
21

stack-data

Simple stack imlementation on ES6
JavaScript
1
star
22

greybax-temp.github.io

HTML
1
star