An open API service indexing awesome lists of open source software.

https://github.com/justforuse/number-to-chinese

Convert number to chinese characters
https://github.com/justforuse/number-to-chinese

npm

Last synced: 21 days ago
JSON representation

Convert number to chinese characters

Awesome Lists containing this project

README

          

# Number To Chinese

This is a js library that help you to transform number to chinese.

## Install

```
npm i @codog/number-to-chinese
```

It provide two useful functions: `numberToChinese` and `getChineseNumberList`

`numberToChinese` is transform single number.

```js
import { numberToChinese } from '@codog/number-to-chinese'

console.log(numberToChinese(1)) // Output: '一'
```

`getChineseNumberList` well provide a list of chinese number so you not need to iterate the `numberToChinese` function.

```js
import { getChineseNumberList } from '@codog/number-to-chinese'

console.log(getChineseNumberList(3)) // Output: ['一', '二', '三']
```