UNPKG

1.71 kBMarkdownView Raw
1<span class="badge-npmversion"><a href="https://npmjs.org/package/@to-da-moon/thai-bath-lib" title="View this project on NPM"><img src="https://img.shields.io/npm/v/@to-da-moon/thai-baht-lib.svg" alt="NPM version" /></a></span> <!-- <span class="badge-npmdownloads"><a href="https://npmjs.org/package/@to-da-moon/thai-bath-lib" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/@to-da-moon/thai-bath-lib.svg" alt="NPM downloads" /></a></span> --> [![install size](https://packagephobia.com/badge?p=%40to-da-moon%2Fthai-baht-lib)](https://packagephobia.com/result?p=%40to-da-moon%2Fthai-baht-lib)
2
3
4## Acknowledgements
5
6Support both js and ts
7
8This library is free software. We just make it easier for us to get the thai baht.
9
10Improve version from bath.js
11
12## Improvement
131. Completely change original code to be from bathjs as it has better performance
142. Fix string 01 showing เอ็ด problem
153. Round satang to be 2 decimal place not just always rounddown
164. When satang reach 999 round it to the decimal place
175. Improve speed from bathjs
18
19## Benchmark
20MacBook Pro (15-inch, 2016)
21bahtLatest (x100000): 1886ms
22thaiBahtLib (x100000): 1755ms
23
24
25
26## Getting Started
27
28Send in the number to get thai baht result in string format
29
30## Installation
31
32using yarn
33```
34yarn add @to-da-moon/thai-baht-lib
35```
36using npm
37```
38npm i @to-da-moon/thai-baht-lib
39```
40
41## Example Usage
42
43```
44bahtText(1)
45// return thai baht text format
46// e.g. 1 -> หนึ่งบาทถ้วน
47```
48
49```
50bahtText(100)
51// return thai baht text format
52// e.g. 100 -> หนึ่งร้อยบาทถ้วน
53```
54
55## Plan
56- [ ] Let me know what to upgrade, just create issue for us, we will do it.