Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nepali-number

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nepali-number

Conversion and transliteration of English to Nepali numbers and vice versa

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
471
decreased by-14.21%
Maintainers
1
Weekly downloads
 
Created
Source

Nepali Number

Translations and formatting numbers in nepali (Devnagari) and english with unicode supports.

Version Twitter Follow

Installation

Using NPM:

npm i nepali-number

or, using Yarn:

yarn add nepali-number

Usage

Import package

Using ES6 import:

import {
    englishToNepaliNumber,
    nepaliToEnglishNumber,
    
    nepaliNumberFormat,
    englishNumberFormat,
    
    nepaliAmountFormat,
    englishAmountFormat,
} from "nepali-number"

or, using commonJS require

const nepaliNumber = require('nepali-number')

nepaliNumber.englishToNepaliNumber("8848m")
1. English number to nepali (Devnagari) unicode

Syntax: englishToNepaliNumber(numberString: string | number)

englishToNepaliNumber("12,34,56,789.01") // "१२,३४,५६,७८९.०१"
2. Nepali (Devnagari) unicode to english

Syntax: nepaliToEnglishNumber(numberString: string | number)

nepaliToEnglishNumber("१२,३४,५६,७८९.०१") // "12,34,56,789.01"
3. Formatting number to Nepali number system

Syntax: nepaliNumberFormat(numberString: string | number, [locale: string])

  • locale: en for English and ne and Nepali (Devnagari). Default to en
nepaliNumberFormat("१२३४५६७८९") // "12,34,56,789"
nepaliNumberFormat("१२३४५६७८९", "ne") // "१२,३४,५६,७८९"

nepaliNumberFormat("123456789") // "12,34,56,789"
nepaliNumberFormat("123456789", "ne") // "१२,३४,५६,७८९"
4. Formatting number to English number system

Syntax: englishNumberFormat(numberString: string | number, [locale: string])

  • locale: en for English and ne and Nepali (Devnagari). Default to en
englishNumberFormat("१२३४५६७८९") // "123,456,789"
englishNumberFormat("१२३४५६७८९", "ne") // "१२३,४५६,७८९"

englishNumberFormat("123456789") // "123,456,789"
englishNumberFormat("123456789", "ne") // "१२३,४५६,७८९"
5. Formatting amount (number with precision) to Nepali number system

Syntax: nepaliAmountFormat(numberString: string | number, [precision: number], [locale: string])

  • precision: Default to 2
  • locale: en for English and ne and Nepali (Devnagari). Default to en
nepaliAmountFormat("१२३४५६७८९.०१५४") // "12,34,56,789.02"
nepaliAmountFormat("१२३४५६७८९.०१५४", 3, "ne") // "१२,३४,५६,७८९.०१५"

nepaliAmountFormat("123456789.0154") // "12,34,56,789.02"
nepaliAmountFormat("123456789.0154", 3, "ne") // "१२,३४,५६,७८९.०१५"
6. Formatting amount (number with precision) to English number system

Syntax: englishAmountFormat(numberString: string | number, [precision: number], [locale: string])

  • precision: Default to 2
  • locale: en for English and ne and Nepali (Devnagari). Default to en
englishAmountFormat("१२३४५६७८९.०१५४") // "123,456,789.02"
englishAmountFormat("१२३४५६७८९.०१५४", 3, "ne") // "१२३,४५६,७८९.०१५"

englishAmountFormat("123456789.0154") // "123,456,789.02"
englishAmountFormat("123456789.0154", 3, "ne") // "१२३,४५६,७८९.०१५"

Keywords

FAQs

Package last updated on 24 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc