Getting started
Install
Section titled “Install”import into a project with your package manager of choice:
npm install taraskevizer# oryarn add taraskevizer# orbun add taraskevizerimport { init, tarask, alphabetic, TaraskConfig, htmlConfigOptions,} from "taraskevizer";
await init(); // skip under Node.js: the `node` export initializes automatically
tarask("планета");// "плянэта"
const cfg = new TaraskConfig({ abc: "cyrillic", j: "always", variations: "first", wrappers: "ansi", g: true,});tarask("планета і Гродна", cfg);// "пл\x1b[32mя\x1b[0mн\x1b[32mэ\x1b[0mта \x1b[32mй\x1b[0m \x1b[35mГорадня\x1b[0m"
const htmlCfg = htmlConfigOptions();htmlCfg.abc = "latin";tarask("энергія планеты", htmlCfg);// "e<tarF>ne</tarF>r<tarF>g</tarF>ija p<tarF>l</tarF>a<tarF>ne</tarF>ty"
alphabetic("яна і іншыя", new TaraskConfig({ abc: "latinJi" }));// "jana j jinšyja"See the API reference for every export, option, and type.
The two moving parts: pipelines and config
Section titled “The two moving parts: pipelines and config”Every conversion is a call to a pipeline (what to do) with an optional
TaraskConfig (how to do it).
- A pipeline is an exported conversion function such as
tarask,alphabetic, orphonetic. See Builtin pipelines. - A config tunes the alphabet, letter replacements, variations, and how
changed parts are wrapped. It can be a
TaraskConfiginstance or a plain option object (tarask("планета", { abc: "latin" })). See Configuration.
If you omit the config, the defaults are used, which convert into the Belarusian classical orthography (тарашкевіца) using the Cyrillic alphabet.
Using a <script> tag
Section titled “Using a <script> tag”The package ships a browser bundle. After loading it, everything is exposed
on the global taraskevizer object. The bundle is fully synchronous — no
initialization call is needed.
<head> <script src="https://cdn.jsdelivr.net/npm/taraskevizer@latest/dist/bundle.js"></script> <script> document.write(taraskevizer.tarask("планета")); // "плянэта" </script></head>The global mirrors the module exports, so taraskevizer.tarask(...)
works exactly like the imported tarask(...).