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

nums2words-bg

v1.4.5

Published

Converts numbers to words in Bulgarian

Downloads

69

Readme

nums2wordsBG 🇧🇬

Преобразува числата в думи (converts numbers to words in Bulgarian).

Install

npm i nums2words-bg

Usage

import nums2wordsBG from "nums2words-bg";

nums2wordsBG("201401"); // двеста и една хиляди, четиристотин и едно

// currencies
nums2wordsBG.currency("1024.81"); // хиляда двадесет и четири лева и осемдесет и една стотинки
nums2wordsBG.currency("10122.1", {separator: ", "}); // десет хиляди, сто двадесет и два лева, десет стотинки
nums2wordsBG.currency("21001.01", { labelBig: "лв.", labelSmall: "ст." }); // двадесет и една хиляди и един лв. и една ст.
nums2wordsBG.currency("11", {displaySmall: false}); // единадесет лева
nums2wordsBG.currency("0.11", {displayBig: false}); // единадесет стотинки

nums2wordsBG.currency(".00000001", {currency: "btc"}); // нула биткойна и едно сатоши
nums2wordsBG.currency("2.01", {currency: "btc"}); // два биткойна и един милион сатоши
nums2wordsBG.currency(".208000", {currency: "btc"}); // нула биткойна и двадесет милиона и осемстотин хиляди сатоши

nums2wordsBG.currency("1.01", { currency: "cny" }); // един юан и един фен
nums2wordsBG.currency("21001.59", { currency: "cny" }); // двадесет и една хиляди и един юана и петдесет и девет фена

nums2wordsBG.currency("01.01", {currency: "rub"}); // една рубла и една копейка
nums2wordsBG.currency("21015.01", {currency: "rub"}); // двадесет и една хиляди и петнадесет рубли и една копейка

nums2wordsBG.currency("00.00", { currency: "usd" }); // нула долара и нула цента
nums2wordsBG.currency("1.99", { currency: "usd" }); // един долар и деветдесет и девет цента

// time
nums2wordsBG.time("00:01:01"); // "нула часа, една минута и една секунда"
nums2wordsBG.time("10:59:03"); // десет часа, петдесет и девет минути и три секунди
nums2wordsBG.time("1:30:4", { displayMinute: false, labelHour: "часа" }); // един часа и четири секунди

// date
nums2wordsBG.date("2 8 301", { format: "a,y,d", separator: ", " }); // два века, осем години, триста и един дена
nums2wordsBG.date("2 6", { format: "w,d" }); // две седмици и шест дена
nums2wordsBG.date("1.1.1.1", { format: "a/y/d/m", separator: ", " })); // "един век, една година, един ден, един месец"

// various units
nums2wordsBG("1", { gender: "f" }) + " вилица"; // една вилица
nums2wordsBG("1001", { gender: "m" }) + " километра"; // хиляда и един километра
nums2wordsBG("102", { gender: "m" }) + " километра"; // сто и два километра

Добавяне на валута:

// define function which returns such structure:
const myCurrency = function () {
    return {
        xyz: {
            labelBig: "xyz_лева",
            labelSmall: "xyz_стотинки",
            singular: { lv: "xyz_лев", st: "xyz_стотинка" },
            decimals: 100,
            def: { lv: "m", st: "f" },
            gender: {
                1: { m: "един", f: "една" },
                2: { m: "два", f: "две" },
            },
        },
    };
};

// invoke `currency`, using the third argument (defined above)
nums2wordsBG.currency("11.01", { currency: "xyz" }, myCurrency) // единадесет xyz_лева и една xyz_стотинка

The library is written in vanilla JS. Онлайн пример. Повече примери в тестовете.