1.0.2 • Published 1 year ago

nepali-english-number-converter v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Nepali English Number Converter

This package converts number form Nepali to English and English to Nepali.

Installation

Install using npm

npm install nepali-english-number-converter --save

Or if you prefer using yarn

yarn add nepali-english-number-converter --save

Usage

Import package in the Node project

const convert = require("nepali-english-number-converter")

Convert number

Convert function accept two parameters. One is acutal number (number or string) and another is type. Type can be TO-NP or TO-EN. These options are not case sensative. 1. Convert number form English to Nepali

console.log(convert(123, 'TO-NP'));

Output : १२३

console.log(convert(12345.05, "to-np"));

Output : २,३४५.०५
  1. Convert number form Nepali to English
console.log(convert("१२३", "to-EN"));

Output : 123

console.log(convert("१२,३४५.०५", "TO-EN");

Output : 12345.05

API

convert(number, type)

ParamTypeDescription
numberstring or numberInput number to be converted.
typestring : TO-NP or TO-ENType number to be converted.

Example

example.js

const convert = require("nepali-english-number-converter")
console.log(convert(123, 'TO-NP'));

Output : १२३