2.0.1 • Published 1 year ago

@skip405/bel-lat v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

belLat

Convert cyrillic Belarusian characters to Latin characters using transliteration. Can transliterate in accordance with the "Instruction on transliteration of geographical names" (2000 and 2023) or in accordance with the rules of the Belarusian Latin alphabet (Łacinka).

Installation

npm i @skip405/bel-lat

Usage

By default, the package transliterates in accordance with the Łacinka rules.

import belLat from '@skip405/bel-lat';

belLat('Лацінка'); // Łacinka

which is equivalent to:

import belLat from '@skip405/bel-lat';

belLat('Лацінка', { style: 'lacinka' }); // Łacinka

Instruction for geographical names

You can specify conversion in accordance with the instructions for geographical names (2000 and 2023), e.g.

import belLat from '@skip405/bel-lat';

belLat('Шчучыншчына', { style: 'geo-2000' }); // Ščučynščyna
belLat('Шчучыншчына', { style: 'geo-2023' }); // Shchuchynshchyna

Basic replacements

The package allows to specify own replacement symbols.

import belLat from '@skip405/bel-lat';

belLat("№", {
  customReplacements: [ ['№', ['#']] ]
}); // #

N.B. if you need more complex conversions please prepare the string beforehand using other means.

Basic omissions

If you'd like to omit any characters from conversion you can specify _omitted as a value for a custom replacement.

import belLat from '@skip405/bel-lat';

belLat("абв", {
  customReplacements: [ ['б', '_omitted'] ]
}); // av

N.B. conversion is done on a per-character basis, it is not possible to omit multiple characters in a single call.

Testing

npm test

License

The MIT License (MIT). Please see License File for more information.