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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sashakil12/bdtformat

v0.2.2

Published

Takes a number input and returns a string following bangladeshi monetary amount writing fashion used commonly in writing bank checks across bangladesh. Formats money strings and spells amounts out in words in Bangla or English. Create money string, bangla

Readme

BDT Format

Javascript number to money string and words generator, Bangladeshi format

Formats numbers the way monetary amounts are written across Bangladesh (rightmost three digits, then twos), and spells amounts out in words — in Bangla or English — the way they are written on a bank cheque.

Install

npm i @sashakil12/bdtformat
# or
pnpm add @sashakil12/bdtformat

Formatting

const { bdtFormat } = require('@sashakil12/bdtformat')

bdtFormat(152457899)   // '15,24,57,899'
bdtFormat(655125.4)    // '6,55,125.4'
bdtFormat(-33500)      // '-33,500'

In words

const { bdtWords } = require('@sashakil12/bdtformat')

bdtWords(1234567.89)         // 'বারো লক্ষ চৌত্রিশ হাজার পাঁচ শত সাতষট্টি টাকা ঊননব্বই পয়সা মাত্র'
bdtWords(1234567.89, 'en')   // 'taka twelve lakh thirty-four thousand five hundred sixty-seven and eighty-nine poisha only'

bdtWords(100000)             // 'এক লক্ষ টাকা মাত্র'
bdtWords(10000000, 'en')     // 'taka one crore only'
bdtWords(-500, 'en')         // 'minus taka five hundred only'

Bangla ('bn') is the default. Pass an options object for finer control:

bdtWords(152, { lang: 'en', currency: false })  // 'one hundred fifty-two'
bdtWords(152, { lang: 'en', only: false })      // 'taka one hundred fifty-two'

| option | default | effect | | ---------- | ------- | ------------------------------------------------- | | lang | 'bn' | 'bn' or 'en' | | currency | true | false spells the bare number, no টাকা/পয়সা | | only | true | false drops the trailing মাত্র / only |

Paisa is taken from the first two decimal places and rounded, so .4 reads as forty paisa. A rounding carry is handled properly — bdtWords(5.999, 'en') is 'taka six only', never "one hundred poisha".

Big numbers

Both functions accept number, string, and BigInt. Pass large values as a string or BigInt to keep every digit — a plain number above Number.MAX_SAFE_INTEGER throws rather than silently losing precision.

bdtFormat('15245789963531444785632')   // '15,24,57,89,96,35,31,44,47,85,632'
bdtWords(90000000n, 'en')              // 'taka nine crore only'

Scale names repeat past crore the way the system actually works — 10¹² is one lakh crore, 10¹⁴ is one crore crore — so there is no upper bound where the naming runs out.

Performance

Both functions work on the decimal digit string, never on the numeric value, so they run in O(n) in the number of digits. The obvious alternative — peeling groups off with n % 100n and n / 100n — is O(n²), because each BigInt divmod is itself O(n).

For any real currency amount the cost is flat at roughly 100 ns per digit. (For absurd inputs of thousands of digits, the words output itself grows quadratically because the scale name repeats crore — that is inherent to the naming system, not the algorithm; the generator stays linear in the size of the text it emits.)

Notes

  • Invalid input throws: non-numeric types, NaN, and Infinity.
  • bdtFormat preserves the fractional part as given; bdtWords rounds it to paisa.