This is a helper that convert a number to a string like the way a real Vietnamese read it.
Warning
This package is no longer maintained, please migrate to the new package: https://jsr.io/@hckhanh/vn-number/doc/~/readVnNumber
# npm
npm i read-vn-number
# yarn
yarn add read-vn-number
# pnpm
yarn add read-vn-number
# jsr
npx jsr add @hckhanh/read-vn-number
yarn dlx jsr add @hckhanh/read-vn-number
pnpm dlx jsr add @hckhanh/read-vn-number
https://github.com/hckhanh/read-vn-number/packages
Import and use in ES6+:
import readNumber from 'read-vn-number'
// import readNumber from '@hckhanh/read-vn-number' // (if you are using jsr)
readNumber('19990000') // or readNumber(19990000)
// output: mười chín triệu chín trăm chín mươi nghìn
or commonjs way:
const readNumber = require('read-vn-number')
readNumber('100000000')
// output: một trăm triệu
MIT © Khanh Hoang