npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pionir/preslovljivac

v3.0.6

Published

A simple transliteration library for Serbian language, written in Javascript and using ES Modules.

Downloads

4

Readme

preslovljivac-js

A simple transliteration library for Serbian language, written in Javascript and using ES Modules.

Donate via PayPal Donate via OpenCollective

Usage

import preslovi from '@pionir/preslovljivac'; //loading the package  
console.log(preslovi("text",'','n')); /*using it to write "text" to console in cyrillic, the output will be "текст" */  
console.log(preslovi("текст",'','Cyrl')); //output will be "text"  

You can also give it a second parameter, in case you want something to remain unchanged.
For example, I want 'Microsoft' and 'Google' to remain the same:

import preslovi from '@pionir/preslovljivac';
console.log(preslovi("neki tekst, Google Microsoft", "Google, Microsoft",'a'));  
//the expected output is "неки текст, Google Microsoft"  

Do note though that you need to write it as a string, with each entry divided by commas (,).

You can also pass a third parameter.
If the third parameter is a 'falsy' value, it will use the auto-detector that i built: https://www.npmjs.com/package/@pionir/detektor-js.
It only counts through the first 512 characters, so if you have some massive strings it won't count through the entire string, so it may not be 100% accurate if both are abundant throughout the text. It will convert every character no matter the length of the string, though.
If you want to avoid this, you can give it a parameter 'Cyrl' for cyrillic, a non-empty string for latin.
For example:

import preslovi from '@pionir/preslovljivac';
console.log(preslovi("text in latin",'','t')); //i passed t as the third parameter so that it isn't a 'falsy' value  
//expected output is "текст ин латин"  
console.log(preslovi("текст на ћирилици",'','Cyrl')); /*i passed 'Cyrl' as the third parameter, so now it will treat it as cyrillic text and the output will be "tekst na ćirilici"*/  
//alternatively you can just let it use the auto-detect  
console.log(preslovi("text text and more text")); //the output here will be "текст текст анд море текст"  

./tests/main.js is a test file used with ava. Feel free to configure it as you wish.

Note: A few letters that exist in English latin don't exist in Serbian cyrillic, those are:
Q (translated as "ку"),
X (translated as "кс"),
Y (translated as "иј"),
W (translated as "в").

If you have any suggestions, feel free to send them to me. I'm always open for improvement.

Donate

This projects has been developed as part of the Pionir Free School. To help sustain the school we ask for your donation or sponsorship if you find this project useful. By donating or sponsoring you will be funding continuous development of this and other projects at Pionir.

Donate via PayPal Donate via OpenCollective

Backers and sponsors