# cyrillic-to-translit-js

> Simple javascript function for converting Cyrillic symbols to Translit

Latest version **3.2.1** (published 2022-05-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install cyrillic-to-translit-js
pnpm add cyrillic-to-translit-js
yarn add cyrillic-to-translit-js
bun add cyrillic-to-translit-js
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.1 |
| Published | 2022-05-05 |
| First published | 2016-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 207.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 148 |
| Author | Aleksandr Filatov |
| Maintainers | vasergen, nitruxa, greybax, makepost |
| Keywords | cyrillic, translit, transformation |

## Links

- npm: https://www.npmjs.com/package/cyrillic-to-translit-js
- Repository: https://github.com/greybax/CyrillicToTranslitJS
- Homepage: https://github.com/greybax/CyrillicToTranslitJS#readme
- Issues: https://github.com/greybax/CyrillicToTranslitJS/issues
- npm.io page: https://npm.io/package/cyrillic-to-translit-js

## Dependencies (1)

- [lodash.invert](https://npm.io/package/lodash.invert.md) ^4.3.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 3.2.1 (latest) — 2022-05-05
- 3.2.0 — 2022-05-04
- 3.1.0 — 2020-02-20
- 3.0.1 — 2019-10-27
- 3.0.0 — 2019-10-15
- 2.2.0 — 2019-03-29
- 2.1.0 — 2018-04-24
- 2.0.0 — 2017-11-06
- 1.0.6 — 2017-10-20
- 1.0.5 — 2017-09-07
- 1.0.4 — 2017-08-21
- 1.0.3 — 2017-07-28
- 1.0.2 — 2016-04-07
- 1.0.1 — 2016-01-29
- 1.0.0 — 2016-01-29

## README

# cyrillic-to-translit-js
 
[![Codeship Status for greybax/cyrillic-to-translit-js](https://app.codeship.com/projects/9666e180-f1e1-0136-edda-0a4322211bb2/status?branch=master)](https://app.codeship.com/projects/320439)

[![install size](https://packagephobia.com/badge?p=cyrillic-to-translit-js@3.2.1)](https://packagephobia.com/result?p=cyrillic-to-translit-js@3.2.1)
[![NPM version][npm-image]][npm-url]
[![NPM Downloads/month][npm-downloads-image]][npm-downloads-url]
[![Build Status][travis-image]][travis-url]
[![Coveralls Status][coveralls-image]][coveralls-url]

[npm-url]: https://npmjs.org/package/cyrillic-to-translit-js
[npm-image]: https://img.shields.io/npm/v/cyrillic-to-translit-js.svg

[npm-downloads-url]: https://npmjs.org/package/cyrillic-to-translit-js
[npm-downloads-image]: https://img.shields.io/npm/dm/cyrillic-to-translit-js.svg

[travis-url]: https://travis-ci.org/greybax/cyrillic-to-translit-js
[travis-image]: https://travis-ci.org/greybax/cyrillic-to-translit-js.svg

[coveralls-url]: https://coveralls.io/r/greybax/cyrillic-to-translit-js
[coveralls-image]: https://img.shields.io/coveralls/greybax/cyrillic-to-translit-js.svg

<p align="center">
 <a href="https://greybax.github.com/cyrillic-to-translit-js">
   <img src="images/translit-256w.png">
 </a>
</p>

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

[Demo page](https://greybax.github.io/cyrillic-to-translit-js)

## Install

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

## Simple to use

```ts
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](https://github.com/greybax/cyrillic-to-translit-js/pull/27)).
  * [Rules](https://pasport.org.ua/vazhlivo/transliteratsiya)
  * [Apostrophe](https://uk.wikipedia.org/wiki/%D0%90%D0%BF%D0%BE%D1%81%D1%82%D1%80%D0%BE%D1%84#.D0.A2.D0.B5.D1.85.D0.BD.D1.96.D1.87.D0.BD.D1.96_.D0.BE.D1.81.D0.BE.D0.B1.D0.BB.D0.B8.D0.B2.D0.BE.D1.81.D1.82.D1.96)
* `{ preset: 'mn' }` - transliteration preset for Mongolian language (see [PR #142](https://github.com/greybax/cyrillic-to-translit-js/pull/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()**
```js
  cyrillicToTranslit().transform('Привет Мир!');

  >Privet Mir!
```

```js
  cyrillicToTranslit().transform('привет мир!', "_")

  >privet_mir!
```

```js
  cyrillicToTranslit({ preset: "uk" }).transform('привіт світе!', "_")

  >pryvit_svite!
```

* **reverse()**
```js
  cyrillicToTranslit().reverse("ulitsa Soyuza Pechatnikov")

 >улица Союза Печатников
```

```js
  cyrillicToTranslit({ preset: "uk" }).reverse("Rozghon Uliana i Harashchenko Khrystyna")

  >Розгон Уляна і Гаращенко Христина
```

## Typescript

Typescript supports starting form v2.0.0. See definitions [here](./CyrillicToTranslit.d.ts)

## Credits

* [kunashir](https://github.com/kunashir)
* [Vasyl Gendzeliuk](https://github.com/vasergen)
* [Nikita Svesnikov](https://github.com/nitruxa)
* [Igor Deryabin](https://github.com/ideryabin)
* [makepost](https://github.com/makepost)
* [Aleksey Kislov](https://github.com/evenfrost)
* [Igor Kamyshev](https://github.com/igorkamyshev)
* [Sasha Kirillov](https://github.com/sasha-kir)
* [Booglejr](https://github.com/Rootyjr)
* [Пүрэвжаргал](https://github.com/TsPuujee)

## 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](http://alfilatov.com)

---
_Source: https://npm.io/package/cyrillic-to-translit-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
