|
1 | | -# vn-number |
| 1 | +# vn-number 🇻🇳 |
2 | 2 |
|
3 | | -A bunch of utility functions that work with number in Vietnamese language |
| 3 | +🛠 A bunch of utility functions that work with number in 🇻🇳 Vietnamese language |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -- [Zero dependency](https://jsr.io/@hckhanh/vn-number/dependencies) |
8 | | -- Edge runtime built-in support [](https://github.com/hckhanh/vn-number/actions/workflows/publish.yml) |
| 7 | +- [Zero dependencies](https://jsr.io/@hckhanh/vn-number/dependencies) |
| 8 | +- Built-in support for Edge runtime |
| 9 | +- Typesafe with TypeScript |
| 10 | +- Fully documented |
9 | 11 |
|
10 | 12 | ## Functions |
11 | 13 |
|
12 | | -- Read Vietnamese number (một triệu hai trăm năm mươi nghìn) |
13 | | -- Format number in Vietnamese format (1.250.000) |
14 | | -- Format VN currency (VND) (1.250.000 ₫) |
15 | | -- Format percentage in Vietnamese format (99,1%) |
| 14 | +### Read Vietnamese number (một triệu hai trăm năm mươi nghìn) |
| 15 | + |
| 16 | +```ts |
| 17 | +import { readVnNumber } from '@hckhanh/vn-number' |
| 18 | + |
| 19 | +const result = readVnNumber(1250000) |
| 20 | +console.log(result) // một triệu hai trăm năm mươi nghìn |
| 21 | +``` |
| 22 | + |
| 23 | +### Format number in Vietnamese format (1.250.000) |
| 24 | + |
| 25 | +```ts |
| 26 | +import { formatVnNumber } from '@hckhanh/vn-number' |
| 27 | + |
| 28 | +const result = formatVnNumber(1250000) |
| 29 | +console.log(result) // 1.250.000 |
| 30 | +``` |
| 31 | + |
| 32 | +### Format VN currency (VND) (1.250.000 ₫) |
| 33 | + |
| 34 | +```ts |
| 35 | +import { formatVnCurrency } from '@hckhanh/vn-number' |
| 36 | + |
| 37 | +const result = formatVnCurrency(1250000) |
| 38 | +console.log(result) // 1.250.000 ₫ |
| 39 | +``` |
| 40 | + |
| 41 | +### Format percentage in Vietnamese format (99,1%) |
| 42 | + |
| 43 | +```ts |
| 44 | +import { formatVnPercent } from '@hckhanh/vn-number' |
| 45 | + |
| 46 | +const result = formatVnPercent(0.991) |
| 47 | +console.log(result) // 99,1% |
| 48 | +``` |
16 | 49 |
|
17 | 50 | ## Release Notes |
18 | 51 |
|
|
0 commit comments