serbian-cyrillic-latin-conversion
v1.0.8
Published
Serbian Cyrillic to Latin and Latin to Cyrillic conversion library
Readme
Serbian Transliteration
A fast, Rust-powered WASM library for Serbian Latin to Cyrillic (and vice versa) transliteration.
Features
- Convert Serbian Latin text to Cyrillic
- Convert Serbian Cyrillic text to Latin
- Fast performance (powered by Rust and WebAssembly)
- Works in both browser and Node.js environments
- TypeScript support
Installation
Setup
For Vite Projects
If you're using Vite, you'll need to install and configure vite-plugin-wasm:
npm install -D vite-plugin-wasm
Then add this to your vite.config.js or vite.config.ts:
import { defineConfig } from "vite";
import wasm from "vite-plugin-wasm";
export default defineConfig({
plugins: [wasm()],
});For Webpack Projects
If you're using webpack, add this to your webpack.config.js:
module.exports = {
// ... other config
experiments: {
asyncWebAssembly: true,
},
};Usage
import { toCyrillic, toLatin } from "serbian-transliteration";
// Convert Latin to Cyrillic
console.log(toCyrillic("njegov čaj")); // његов чај
console.log(toCyrillic("život i priključenja")); // живот и прикључења
console.log(toCyrillic("ljulja se ljuljaška")); // љуља се љуљашка
// Convert Cyrillic to Latin
console.log(toLatin("његов чај")); // njegov čaj
console.log(toLatin("живот и прикључења")); // život i priključenja
console.log(toLatin("љуља се љуљашка")); // ljulja se ljuljaška