# num2chn

> Convert A Number to Chinese.

Latest version **1.0.3** (published 2018-04-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install num2chn
pnpm add num2chn
yarn add num2chn
bun add num2chn
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-04-05 |
| First published | 2018-04-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | cynii |
| Maintainers | cynii |
| Keywords | num2chn, number2chinese, number, word, currency |

## Links

- npm: https://www.npmjs.com/package/num2chn
- npm.io page: https://npm.io/package/num2chn

## 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) — 2018-04-05
- 1.0.2 — 2018-04-03
- 1.0.1 — 2018-04-01
- 1.0.0 — 2018-04-01

## README

Convert Arabic numbers into Chinese.

## How To

1. Require the module, it will return a __function__.

    ```js
    //it returns a function, this function can't be directly put in use.
    var num2chn = require('num2chn')
    ```

2. The returned function accepts one parameter, when set to `true`,  it will convert the number into __capitalized form(大写数字)__.

    ```js
    var num2chnCapt = num2chn(true/*should it be capitalized?*/)

    //'壹仟贰佰叁拾'
    num2chnCapt(1230)
    ```


3. When set to `false`, the returned function will convert the number into __normal form__.

    ```js
    var num2chnNormal = num2chn(false)

    //'八万零四百五十四'
    num2chnNormal(80454)
    ```

4. When set to `'currency'`, the returned function will convert the number into __currency form__.

    ```js
    var num2Currency = num2chn('currency')

    //'壹佰贰拾叁萬元伍角陆分'
    num2Currency(1230000.5645)
    ```

5. Or you can simplly omit the parameter, the number will _also_ be converted into __normal form__.

    ```js
    var num2chn = require('num2chn')()//OK

    //'八万零四百五十四'
    num2chn(80454)
    ```

## Notes
1. Support up to 16-digit number.
2. Decimals **only supported** in the `currency` form, in other forms, the decimal part will be ignored.
3. Do **not** support negative numbers. the negative sign`(-)` will be ignored.

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