bangla-kit
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Gecti
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Accurate Bangla numbers, taka, digits, text and dates for JavaScript, plus an MCP server for AI assistants.
bangla-kit
Accurate Bangla numbers, taka, digits, text and dates for JavaScript, plus an MCP server so AI assistants stop getting Bangla numbers wrong.
| Package | What it is |
|---|---|
bangla-kit |
Zero-dependency, fully typed core library (ESM and CJS) |
bangla-kit-mcp |
MCP server exposing every function as a tool |
Install
npm install bangla-kit
Examples
import { toWords, toTaka, formatLakh, toBanglaDate } from "bangla-kit";
toWords(1250000); // "বারো লক্ষ পঞ্চাশ হাজার"
toTaka(1250.5); // "এক হাজার দুই শত পঞ্চাশ টাকা পঞ্চাশ পয়সা মাত্র"
formatLakh(123456789, { digits: "bn" }); // "১২,৩৪,৫৬,৭৮৯"
toBanglaDate("2026-11-07").formatted; // "২২ কার্তিক ১৪৩৩"
Use it from Claude, Cursor or any MCP client
{
"mcpServers": {
"bangla-kit": { "command": "npx", "args": ["-y", "bangla-kit-mcp"] }
}
}
Then ask: "Write ৳12,50,000.75 on a cheque in Bangla." The assistant calls to_taka and getsবারো লক্ষ পঞ্চাশ হাজার টাকা পঁচাত্তর পয়সা মাত্র, exactly.
API (v0.1)
| Function | Does |
|---|---|
toWords(n, opts?) |
Number to Bangla words. Handles 0, negatives, decimals, bigint, Bangla-digit strings. Options: hundred: "formal" | "colloquial", lakh: "লক্ষ" | "লাখ", negativeWord, pointWord |
toTaka(n, opts?) |
Cheque-style taka and poisha with মাত্র. Poisha round half up |
formatLakh(n, opts?) |
12,34,56,789 grouping, digits: "bn", fractionDigits |
toBanglaDigits(s) / toEnglishDigits(s) / convertDigits(s, "bn" | "en") |
Digit conversion |
cleanText(s, opts?) |
NFC, invisible characters removed (ZWJ and ZWNJ kept), spaces collapsed, dari (।) fixed |
toBanglaDate(date?, opts?) |
Bangladesh national calendar (Bangabda, 2019 revision): year, month, day, month name, season, weekday, formatted |
Invalid input throws a TypeError or RangeError; it never returns a wrong word silently.
Accuracy
Bangla number words from 1 to 99 are irregular, so each is a hand-written entry, kept in a
golden fixture that native speakers sign off before each release.
Spelling follows the Bangla Academy list (for example ২৮ আটাশ, ৫২ বাহান্ন, ৮৮ আটাশি). Common alternative spellings
are accepted when reading words back with fromWords, but never produced. Found a word you disagree with?
Open an issue with a source.
Every integer from 0 to 20,000, and thousands of random values up to 10^20, are checked by a round tripfromWords(toWords(n)) === n, in both the formal (এক শত, লক্ষ) and colloquial (একশো, লাখ) styles.
The calendar follows the 2019 revision used in Bangladesh: ১ বৈশাখ is 14 April, ২১ ফেব্রুয়ারি is ৮ ফাল্গুন,
১৬ ডিসেম্বর is ১ পৌষ. The West Bengal calendar differs and is planned as an option.
Tests
pnpm install
pnpm test
pnpm coverage # 100% lines
pnpm build
Roadmap
- West Bengal calendar option
- Bangla to Gregorian date conversion
Contributing
See CONTRIBUTING.md. Issues get a reply within 24 hours.
License
MIT, by Nasir Khan.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi