bd_number
v3.0.2
Published
This package is for bangla number conversion
Downloads
9
Maintainers
Readme
"bd_number"
"bd_number": An Open Source JavaScript Library for Bangla Number Conversion and Phone Number Validator.
In today's world, it's important for websites and applications to be accessible and usable by a global audience. This includes not only the language used in the text, but also the format of numbers and dates. To address this need, an open source JavaScript library, "bd_number," has been developed specifically for converting numbers to Bangla text.
"bd_number" is a small, lightweight library that makes it easy for developers to convert Bangla Number to English Number,English Number to Bangla Number ,English Number to Bangla Word, English Number To BDT Word in English and Bangladeshi Phone Number Validator representation. It is completely open source and can be used in any web project without any restrictions.
Install
$ npm install --save bd_number
Usage | English To Bangla Word
const { enToBnWord } = require("bd_number");
let word = enToBnWord(12433334);
console.log(word); // এক কোটি চব্বিশ লাখ তেত্রিশ হাজার তিনশ চৌত্রিশ
Usage | Bangla To English Number
const { bnToEnNum } = require("bd_number");
let en = bnToEnNum("৮২৬");
console.log(en); // 826
Usage | English To Bangla Number
const { enToBnNum } = require("bd_number");
let bn = enToBnNum("826");
console.log(bn); // ৮২৬
Usage | Bangladeshi Phone Number Validator
const { isValidPhone } = require("bd_number");
// OR
const { isValidPhone } = require("bd_number/lib/phone");
let isOkThisNumber = isValidPhone("01739000000");
console.log(isOkThisNumber); // true
getNumInfo | If phone number is valid
const { getNumInfo } = require("bd_number");
// OR
const { getNumInfo } = require("bd_number/lib/phone");
let numberInfo = getNumInfo("01739000000");
console.log(numberInfo);
// Output | If [isValidPhone: true]
{
inputLength: 11,
isValidPhone: true,
hasOperator: true,
operatorStatus: '(017) Valid Operator',
withCountryCode: '+8801739000000',
status: '+8801739000000'
}
getNumInfo | If phone number is invalid
const { getNumInfo } = require("bd_number");
// OR
const { getNumInfo } = require("bd_number/lib/phone");
let numberInfo = getNumInfo("0173900000000");
console.log(numberInfo);
// Output | If [isValidPhone: false]
{
inputLength: 13,
isValidPhone: false,
hasOperator: true,
operatorStatus: '(017) Valid Operator',
withCountryCode: '+8801739000000',
status: '+8801739000000',
exceed: 2,
hasExceed: true,
originalNumber: '+880173900000000',
exceedDigit: '00',
errorStatus: 'Exceed 2 Digit'
}
Usage | English Number To BDT Word in English
const { numToBDTWord } = require("bd_number");
// OR
const { numToBDTWord } = require("bd_number/lib/numToWord");
let finalAmount = numToBDTWord(128357.66);
console.log(finalAmount);
// Output : One Lakh Twenty Eight Thousand Three Hundred And Fifty Seven Taka And Sixty Six Paisa