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

currency-formatter-bd

v1.0.0

Published

A comprehensive utility for formatting and converting Bangladeshi currency and numbers.

Downloads

17

Readme

currency-formatter-bd

Version License Downloads Size

A lightweight, robust, and type-safe TypeScript utility for handling Bangladeshi Currency (Taka) and Number Formats.

| English | বাংলা | | :---: | :---: |

English Documentation

🇧🇩 Made for Bangladesh: Includes specific formatting rules (3,2,2 grouping) and number-to-words conversion in both Bangla and English.

🌐 Find out more at reactbd.com

✨ Features

  • 🇧🇩 Comma Formatting: Formats numbers using the South Asian/Bangladeshi numbering system (e.g., 1,23,45,678).
  • 🔤 Number to Words:
    • English: Converts to standard English words (e.g., "One Hundred Taka").
    • Bangla: Converts to accurate Bangla words (e.g., "এক শত টাকা").
    • Large Numbers: Supports massive numbers (Trillions, Kotis) with precision (handles strict string inputs).
  • ৳ Currency Formatting:
    • Fully customizable currency strings.
    • Supports symbols (, Tk), positioning (left, right), and decimals.
  • 🚀 Modern Stack: Built with TypeScript, zero dependencies, ESM/CJS support.

📦 Installation

npm install currency-formatter-bd
# or
yarn add currency-formatter-bd
# or
pnpm add currency-formatter-bd
# or
bun add currency-formatter-bd

🛠️ Usage Examples

1. Bangladeshi Comma Formatting

Properly places commas for easy readability in the local context.

import { formatWithCommas } from 'currency-formatter-bd';

console.log(formatWithCommas(12345678)); 
// Output: "1,23,45,678"

console.log(formatWithCommas('100000000050')); 
// Output: "1,00,00,00,00,050" (Handles huge strings!)

2. Number to Words

English (International Style)

import { toWords } from 'currency-formatter-bd';

console.log(toWords(1050)); 
// Output: "One Thousand Fifty"

console.log(toWords('1098989389384384398434834893')); 
// Output: "One Octillion ..." (Handles very large numbers!)

Bangla (Local Style)

import { toWordsBangla } from 'currency-formatter-bd';

console.log(toWordsBangla(150)); 
// Output: "এক শত পঞ্চাশ"

console.log(toWordsBangla(1234567)); 
// Output: "বারো লক্ষ চৌত্রিশ হাজার পাঁচ শত সাতষট্টি"

// Large numbers (e.g., 100 Crore)
console.log(toWordsBangla('1000000000'));
// Output: "এক শত কোটি"

// Recursive Koti Support (e.g., 1 Crore Crore)
console.log(toWordsBangla('100000000000000'));
// Output: "এক কোটি কোটি"

3. Currency Formatting

Format prices exactly how you want them.

import { formatCurrency } from 'currency-formatter-bd';

// Default
console.log(formatCurrency(1500)); 
// Output: "৳ 1,500.00"

// Custom Symbol & Position
console.log(formatCurrency(5000, { symbol: 'Tk', position: 'right', spaced: true })); 
// Output: "5,000.00 Tk"

// No Decimals
console.log(formatCurrency(199.99, { decimals: 0 })); 
// Output: "৳ 200"

⚙️ API Reference

  • formatWithCommas(num: number | string): string
  • toWords(num: number | string): string
  • toWordsBangla(num: number | string): string
  • formatCurrency(amount: number | string, options?: CurrencyOptions): string

বাংলা ডকুমেন্টেশন

🇧🇩 বাংলাদেশের জন্য তৈরি: এতে রয়েছে নির্দিষ্ট কমা বিন্যাস নিয়ম (৩-২-২ গ্রুপিং) এবং বাংলা ও ইংরেজি উভয় ভাষায় সংখ্যা-থেকে-শব্দ রূপান্তর।

🌐 আরও জানুন reactbd.com এ।

✨ প্রধান বৈশিষ্ট্যসমূহ

  • 🇧🇩 বাংলাদেশী-স্টাইল কমা ফরম্যাটিং: স্থানীয় প্যাটার্নে অঙ্ক গ্রুপ করে (যেমন ১,২৩,৪৫,৬৭৮)।
  • 🔤 সংখ্যা থেকে শব্দ রূপান্তর:
    • ইংরেজি: সংখ্যাকে পাঠযোগ্য ইংরেজি টেক্সটে রূপান্তর করে (যেমন "One Hundred Taka")।
    • বাংলা: কোটি-লক্ষ সিস্টেম ব্যবহার করে সঠিক বাংলা শব্দ (যেমন "এক শত টাকা")।
    • বিশাল সংখ্যা হ্যান্ডলিং: স্ট্রিং ইনপুটের মাধ্যমে অত্যন্ত বড় মানগুলো কাজ করে।
  • ৳ মুদ্রা ফরম্যাটিং:
    • চিহ্ন (যেমন ৳ বা Tk), প্লেসমেন্ট, স্পেসিং এবং দশমিক নির্ভুলতার জন্য নমনীয় অপশন।
  • 🚀 আধুনিক স্ট্যাক: টাইপস্ক্রিপ্ট দিয়ে তৈরি, কোনো ডিপেন্ডেন্সি নেই।

📦 ইনস্টলেশন

npm install currency-formatter-bd
# অথবা
yarn add currency-formatter-bd

🛠️ ব্যবহারের উদাহরণ

১. বাংলাদেশী কমা ফরম্যাটিং

দক্ষিণ এশীয় কমা গ্রুপিং প্রয়োগ করে (৩-২-২)।

import { formatWithCommas } from 'currency-formatter-bd';

console.log(formatWithCommas(12345678));
// আউটপুট: "1,23,45,678"

console.log(formatWithCommas('100000000050'));
// আউটপুট: "1,00,00,00,00,050"

২. সংখ্যা থেকে শব্দ

ইংরেজি (আন্তর্জাতিক স্টাইল)

import { toWords } from 'currency-formatter-bd';

console.log(toWords(1050));
// আউটপুট: "One Thousand Fifty"

বাংলা (স্থানীয় স্টাইল)

import { toWordsBangla } from 'currency-formatter-bd';

console.log(toWordsBangla(150));
// আউটপুট: "এক শত পঞ্চাশ"

console.log(toWordsBangla(1234567));
// আউটপুট: "বারো লক্ষ চৌত্রিশ হাজার পাঁচ শত সাতষট্টি"

// বিশাল সংখ্যা (যেমন ১০০ কোটি)
console.log(toWordsBangla('1000000000'));
// আউটপুট: "এক শত কোটি"

// ১ কোয়াড্রিলিয়নের জন্য রিকার্সিভ হ্যান্ডলিং
console.log(toWordsBangla('100000000000000'));
// আউটপুট: "এক কোটি কোটি"

৩. মুদ্রা ফরম্যাটিং

টাকার পরিমাণ কীভাবে প্রদর্শন করবেন তা কাস্টমাইজ করুন।

import { formatCurrency } from 'currency-formatter-bd';

// বেসিক
console.log(formatCurrency(1500));
// আউটপুট: "৳ 1,500.00"

// কাস্টম
console.log(formatCurrency(5000, { symbol: 'Tk', position: 'right', spaced: true }));
// আউটপুট: "5,000.00 Tk"

⚙️ এপিআই রেফারেন্স

  • formatWithCommas: বাংলাদেশী কমা যুক্ত স্ট্রিং রিটার্ন করে।
  • toWords: আন্তর্জাতিক পদ্ধতিতে ইংরেজিতে রূপান্তর করে।
  • toWordsBangla: দেশীয় পদ্ধতিতে (কোটি-লক্ষ) বাংলায় রূপান্তর করে।
  • formatCurrency: কাস্টম ফরম্যাটে টাকার অঙ্ক প্রদর্শন করে।

🤝 Contribution / অবদান

We welcome contributions! Please follow these steps:

  1. Clone the repo.
  2. Install dependencies: npm install.
  3. Run tests to ensure everything works: npm test.
  4. Submit a PR.

📄 License

MIT