Acknowledgements
Support both js and ts
This library is free software. We just make it easier for us to get the thai baht.
Improve version from bath.js
Improvement
- Completely change original code to be from bathjs as it has better performance
- Fix string 01 showing เà¸à¹‡à¸” problem
- Round satang to be 2 decimal place not just always rounddown
- When satang reach 999 round it to the decimal place
- Improve speed from bathjs
Benchmark
MacBook Pro (15-inch, 2016) bahtLatest (x100000): 1886ms thaiBahtLib (x100000): 1755ms
Getting Started
Send in the number to get thai baht result in string format
Installation
using yarn
yarn add @to-da-moon/thai-baht-lib
using npm
npm i @to-da-moon/thai-baht-lib
Example Usage
bahtText(1)
// return thai baht text format
// e.g. 1 -> หนึ่งบาทถ้วน
bahtText(100)
// return thai baht text format
// e.g. 100 -> หนึ่งร้à¸à¸¢à¸šà¸²à¸—ถ้วน
Plan
- Let me know what to upgrade, just create issue for us, we will do it.