# nepali-number

> Conversion and transliteration of English to Nepali numbers and vice versa

Latest version **1.0.3** (published 2019-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install nepali-number
pnpm add nepali-number
yarn add nepali-number
bun add nepali-number
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-08-25 |
| First published | 2019-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 33.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Puncoz Nepal |
| Maintainers | puncoz |
| Keywords | nepali, english, number, digit, conversion |

## Links

- npm: https://www.npmjs.com/package/nepali-number
- Repository: https://github.com/puncoz-official/nepali-number-js
- Issues: https://github.com/puncoz-official/nepali-number-js/issues
- npm.io page: https://npm.io/package/nepali-number

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2019-08-25
- 1.0.2 — 2019-08-24
- 1.0.1 — 2019-08-24

## README

# Nepali Number

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

[![Version](https://img.shields.io/npm/v/nepali-number?logo=npm)](https://www.npmjs.com/package/nepali-number)
[![Twitter Follow](https://img.shields.io/twitter/follow/PuncozNepal?label=Follow&style=social)](https://twitter.com/PuncozNepal)

## 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") // "१२३,४५६,७८९.०१५"
```

---
_Source: https://npm.io/package/nepali-number · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
