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

bang-utils

v1.0.1

Published

Useful utility functions for various bengali language related conversions

Downloads

26

Readme

bang-utils

Description

bang-utils is a lightweight utility library for converting English numerals and dates to Bengali in TypeScript/ JavaScript. It provides functions to convert numbers, dates, and months from English to Bengali script.

Features -

  1. Full TypeScript Support
  2. English Number to Bangla Number(21.21 -> ২১.২১)
  3. English Date to Bangla Date(2-5-2024 -> ৫ ফেব্রুয়ারি, ২০২৪)
  4. English Time to Bangla Time (15:48 -> দুপুর ৩ টা ৪৮ মিনিট)
  5. English Number to Bangla In Words(50.25 -> পঞ্চাশ দশমিক দুই পাঁচ)
  6. Currency Number to Bangla Currency(125.58 -> ১২৫ টাকা ৫৮ পয়সা)

Installation

You can install bang-utils via npm or yarn:

npm install bang-utils

or

yarn add bang-utils

Usage

Importing

You can import the functions from bang-utils using ES6 import syntax:

import {
  numBang,
  dateBang,
  monthBang,
  numToBanglaWords,
  dayBang,
  currencyToBang,
  timeBang,
} from "bang-utils";

Converting English Numerals to Bengali

console.log("number: ", numBang(21)); // Output: number: ২১
console.log("decimal number: ", numBang(21.21)); // Output: decimal number: ২১.২১

Converting Dates to Bengali

console.log("month: ", monthBang("2024-05-02")); // Output: month: মে
console.log("day: ", dayBang("2024-02-26")); //day: সোমবার
console.log("date: ", dateBang("2-5-2024", ",", "D M, YYYY")); // Output: date: ৫ ফেব্রুয়ারি, ২০২৪

Converting Numbers to Bengali Words

console.log("to Bangla words: ", numToBanglaWords(50.25)); // Output: to Bangla words: পঞ্চাশ দশমিক দুই পাঁচ

Converting Currency Numbers to Bengali Currency

console.log("currency: ", currencyToBang(50)); //currency: ৫০ টাকা
console.log("currency: ", currencyToBang(125.58)); //currency: ১২৫ টাকা ৫৮ পয়সা

Converting Date Time to Bengali Time

console.log("detailed time: ", timeBang(new Date())); //দুপুর ৩ টা ৪৮ মিনিট
console.log("normal time: ", timeBang(new Date(), "normal")); // দুপুর ৩.৫০ মিনিট
console.log("short time: ", timeBang(new Date(), "short")); //৩.৫০ মিনিট

Inspirations & Credits

The numToBanglaWords() was based on a open source project by MAHMUDUL HASSAN named number-to-bengali-words

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.

License

This project is licensed under the GPL License - see the LICENSE file for details.