bahttext 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-en.md +18 -10
- package/README.md +17 -10
- package/index.html +5 -5
- package/package.json +14 -4
- package/src/index.js +28 -63
- package/src/index.test.js +37 -150
- package/.editorconfig +0 -8
- package/.github/workflows/continuous-integration.yml +0 -37
- package/.github/workflows/release.yml +0 -27
- package/codecov.yaml +0 -20
- package/example/commonjs.js +0 -3
- package/example/es6.ts +0 -3
- package/example/index.html +0 -19
- package/example/package.json +0 -7
- package/misc/test.json +0 -379
package/README-en.md
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
# bahttext
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/jojoee/bahttext)
|
|
4
3
|
[](https://codecov.io/github/jojoee/bahttext)
|
|
5
4
|
[](https://www.npmjs.com/package/bahttext)
|
|
6
5
|
[](http://opensource.org/licenses/MIT)
|
|
7
6
|
[](https://github.com/semantic-release/semantic-release) [](https://greenkeeper.io/)
|
|
8
7
|
|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
9
13
|
Language: [ไทย](https://github.com/jojoee/bahttext/blob/master/README.md), [English](https://github.com/jojoee/bahttext/blob/master/README-en.md)
|
|
10
14
|
|
|
11
|
-
Change number to Thai pronunciation string, test against [
|
|
15
|
+
Change number to Thai pronunciation string, test against [Google Sheets BAHTTEXT function](https://support.google.com/docs/answer/9982303?hl=en), [Demo page](https://jojoee.github.io/bahttext/)
|
|
12
16
|
|
|
13
17
|
## Installation
|
|
14
18
|
|
|
@@ -38,22 +42,26 @@ bahttext(63147.89)
|
|
|
38
42
|
|
|
39
43
|
## Note
|
|
40
44
|
- [x] Compatible with all browsers
|
|
45
|
+
- [x] Node.js version support: 6-12
|
|
46
|
+
- [x] 0 Dependencies
|
|
41
47
|
- [x] Unit test
|
|
42
48
|
- [ ] Browser compatibility test
|
|
43
|
-
- [
|
|
49
|
+
- [x] Remove duplication between test code and test-case-csv file
|
|
44
50
|
- [x] [Demo page](https://jojoee.github.io/bahttext/)
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
51
|
+
- [x] Support negative number
|
|
52
|
+
- [x] Fix semantic-release
|
|
47
53
|
|
|
48
|
-
##
|
|
54
|
+
## CMD
|
|
49
55
|
|
|
50
56
|
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
brew install curl
|
|
58
|
+
brew install jq
|
|
59
|
+
npm install -g
|
|
60
|
+
curl -L -o ./misc/testcases.csv https://docs.google.com/spreadsheets/d/e/2PACX-1vTb8PIKzgo07rn9UpcjqE0YrdMAmf4fyDbL2plUieLCyrn_5O3vDvece7UfkaArWQLUSsaw92jVpY_z/pub?gid=0&single=true&output=csv
|
|
61
|
+
csvtojson ./misc/testcases.csv | jq > ./misc/testcases.json
|
|
55
62
|
```
|
|
56
63
|
|
|
57
64
|
## Reference
|
|
65
|
+
- [Google Sheets BAHTTEXT function](https://support.google.com/docs/answer/9982303?hl=en)
|
|
58
66
|
- [Microsoft Office's BAHTTEXT function](https://support.office.com/en-us/article/BAHTTEXT-function-5ba4d0b4-abd3-4325-8d22-7a92d59aab9c)
|
|
59
67
|
- Inspired by [earthchie/BAHTTEXT.js](https://github.com/earthchie/BAHTTEXT.js)
|
package/README.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# bahttext
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/jojoee/bahttext)
|
|
4
3
|
[](https://codecov.io/github/jojoee/bahttext)
|
|
5
4
|
[](https://www.npmjs.com/package/bahttext)
|
|
6
5
|
[](http://opensource.org/licenses/MIT)
|
|
7
6
|
[](https://github.com/semantic-release/semantic-release) [](https://greenkeeper.io/)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
8
11
|
|
|
9
12
|
ภาษา: [ไทย](https://github.com/jojoee/bahttext/blob/master/README.md), [English](https://github.com/jojoee/bahttext/blob/master/README-en.md)
|
|
10
13
|
|
|
11
|
-
เปลี่ยนตัวเลข เป็นคำอ่านภาษาไทย, โมดูลตัวนี้ได้ทำการทดสอบกับ [
|
|
14
|
+
เปลี่ยนตัวเลข เป็นคำอ่านภาษาไทย, โมดูลตัวนี้ได้ทำการทดสอบกับ [Google Sheets BAHTTEXT function](https://support.google.com/docs/answer/9982303?hl=en), [Demo page](https://jojoee.github.io/bahttext/) เรียบร้อยแล้ว
|
|
12
15
|
|
|
13
16
|
## ติดตั้ง
|
|
14
17
|
|
|
@@ -38,22 +41,26 @@ bahttext(63147.89)
|
|
|
38
41
|
|
|
39
42
|
## ฟีเจอร์
|
|
40
43
|
- [x] สามารถใช้งานได้ทุก เบราว์เซอร์
|
|
44
|
+
- [x] สามารถใช้งานได้ตั้งแต่ Node.js version 6-12
|
|
45
|
+
- [x] 0 Dependencies
|
|
41
46
|
- [x] ทำการทดสอบแบบ unit test
|
|
42
47
|
- [ ] ทดสอบบนเบราว์เซอร์ ในแต่ละ เวอร์ชั่น
|
|
43
|
-
- [
|
|
48
|
+
- [x] ลดการซ้ำซ้อนของการเขียน ระหว่าง code และ ไฟล์ csv ในการทำการทดสอบ
|
|
44
49
|
- [x] [หน้าตัวอย่างการใช้งาน](https://jojoee.github.io/bahttext/)
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
50
|
+
- [x] สนับสนุนการใช้งานกับตัวเลขติดลบ
|
|
51
|
+
- [x] แก้ไข semantic-release
|
|
47
52
|
|
|
48
|
-
##
|
|
53
|
+
## CMD
|
|
49
54
|
|
|
50
55
|
```
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
brew install curl
|
|
57
|
+
brew install jq
|
|
58
|
+
npm install -g
|
|
59
|
+
curl -L -o ./misc/testcases.csv https://docs.google.com/spreadsheets/d/e/2PACX-1vTb8PIKzgo07rn9UpcjqE0YrdMAmf4fyDbL2plUieLCyrn_5O3vDvece7UfkaArWQLUSsaw92jVpY_z/pub?gid=0&single=true&output=csv
|
|
60
|
+
csvtojson ./misc/testcases.csv | jq > ./misc/testcases.json
|
|
55
61
|
```
|
|
56
62
|
|
|
57
63
|
## อ้างอิง
|
|
64
|
+
- [Google Sheets BAHTTEXT function](https://support.google.com/docs/answer/9982303?hl=en)
|
|
58
65
|
- [Microsoft Office's BAHTTEXT function](https://support.office.com/en-us/article/BAHTTEXT-function-5ba4d0b4-abd3-4325-8d22-7a92d59aab9c)
|
|
59
66
|
- แรงบัลดาลใจจาก [earthchie/BAHTTEXT.js](https://github.com/earthchie/BAHTTEXT.js)
|
package/index.html
CHANGED
|
@@ -39,7 +39,7 @@ td {
|
|
|
39
39
|
<th>category</th>
|
|
40
40
|
<th>case</th>
|
|
41
41
|
<th>number</th>
|
|
42
|
-
<th>
|
|
42
|
+
<th>text</th>
|
|
43
43
|
</tr>
|
|
44
44
|
</thead>
|
|
45
45
|
<tfoot>
|
|
@@ -47,7 +47,7 @@ td {
|
|
|
47
47
|
<th>category</th>
|
|
48
48
|
<th>case</th>
|
|
49
49
|
<th>number</th>
|
|
50
|
-
<th>
|
|
50
|
+
<th>text</th>
|
|
51
51
|
</tr>
|
|
52
52
|
</tfoot>
|
|
53
53
|
</table>
|
|
@@ -88,7 +88,7 @@ $(document).ready(function() {
|
|
|
88
88
|
|
|
89
89
|
// random
|
|
90
90
|
$random.click(function(e) {
|
|
91
|
-
const num = r.real(
|
|
91
|
+
const num = r.real(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER)
|
|
92
92
|
$number.val(num)
|
|
93
93
|
updateResult()
|
|
94
94
|
})
|
|
@@ -99,7 +99,7 @@ $(document).ready(function() {
|
|
|
99
99
|
searching: false,
|
|
100
100
|
ordering: false,
|
|
101
101
|
ajax: {
|
|
102
|
-
url: 'misc/
|
|
102
|
+
url: 'misc/testcases.json',
|
|
103
103
|
dataSrc: ''
|
|
104
104
|
},
|
|
105
105
|
columns: [
|
|
@@ -116,7 +116,7 @@ $(document).ready(function() {
|
|
|
116
116
|
width: '22%'
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
|
-
data: '
|
|
119
|
+
data: 'text'
|
|
120
120
|
}
|
|
121
121
|
]
|
|
122
122
|
})
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bahttext",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Change number to Thai pronunciation string",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
+
"typings": "src/index.js",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"jest": "jest",
|
|
8
|
-
"jest.watch": "
|
|
9
|
+
"jest.watch": "jest --watch",
|
|
9
10
|
"commit": "git-cz",
|
|
10
11
|
"coverage.check": "jest --coverage",
|
|
11
12
|
"semantic-release": "semantic-release",
|
|
12
|
-
"standard": "standard"
|
|
13
|
+
"standard": "standard",
|
|
14
|
+
"validate": "npm run standard && npm run coverage.check"
|
|
13
15
|
},
|
|
14
16
|
"config": {
|
|
15
17
|
"ghooks": {
|
|
@@ -24,8 +26,12 @@
|
|
|
24
26
|
"url": "https://github.com/jojoee/bahttext.git"
|
|
25
27
|
},
|
|
26
28
|
"keywords": [
|
|
29
|
+
"thai",
|
|
27
30
|
"baht",
|
|
28
|
-
"text"
|
|
31
|
+
"text",
|
|
32
|
+
"number",
|
|
33
|
+
"convert",
|
|
34
|
+
"thai baht"
|
|
29
35
|
],
|
|
30
36
|
"author": "Nathachai Thongniran <inid3a@gmail.com>",
|
|
31
37
|
"license": "MIT",
|
|
@@ -39,10 +45,14 @@
|
|
|
39
45
|
"cz-conventional-changelog": "3.3.0",
|
|
40
46
|
"ghooks": "2.0.4",
|
|
41
47
|
"jest": "^26.6.1",
|
|
48
|
+
"jest-expect-message": "^1.0.2",
|
|
42
49
|
"semantic-release": "^17.2.1",
|
|
43
50
|
"standard": "^15.0.0"
|
|
44
51
|
},
|
|
45
52
|
"jest": {
|
|
53
|
+
"setupFilesAfterEnv": [
|
|
54
|
+
"jest-expect-message"
|
|
55
|
+
],
|
|
46
56
|
"verbose": true,
|
|
47
57
|
"testMatch": [
|
|
48
58
|
"**/*.test.js"
|
package/src/index.js
CHANGED
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
/*
|
|
2
|
-
step:
|
|
3
|
-
1. validate
|
|
4
|
-
2. sanitize
|
|
5
|
-
3. split
|
|
6
|
-
4. proceed
|
|
7
|
-
5. grammar
|
|
8
|
-
6. combine
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
1
|
const defaultResult = 'ศูนย์บาทถ้วน'
|
|
12
|
-
const singleUnitStrs = [
|
|
13
|
-
|
|
14
|
-
'หนึ่ง',
|
|
15
|
-
'สอง',
|
|
16
|
-
'สาม',
|
|
17
|
-
'สี่',
|
|
18
|
-
'ห้า',
|
|
19
|
-
'หก',
|
|
20
|
-
'เจ็ด',
|
|
21
|
-
'แปด',
|
|
22
|
-
'เก้า'
|
|
23
|
-
]
|
|
24
|
-
const placeNameStrs = [
|
|
25
|
-
'',
|
|
26
|
-
'สิบ',
|
|
27
|
-
'ร้อย',
|
|
28
|
-
'พัน',
|
|
29
|
-
'หมื่น',
|
|
30
|
-
'แสน',
|
|
31
|
-
'ล้าน'
|
|
32
|
-
]
|
|
2
|
+
const singleUnitStrs = ['', 'หนึ่ง', 'สอง', 'สาม', 'สี่', 'ห้า', 'หก', 'เจ็ด', 'แปด', 'เก้า']
|
|
3
|
+
const placeNameStrs = ['', 'สิบ', 'ร้อย', 'พัน', 'หมื่น', 'แสน', 'ล้าน']
|
|
33
4
|
|
|
34
5
|
/**
|
|
35
6
|
* @param {number[]} nums
|
|
@@ -59,22 +30,16 @@ function num2Word (nums) {
|
|
|
59
30
|
}
|
|
60
31
|
|
|
61
32
|
/**
|
|
33
|
+
* @todo improve performance
|
|
62
34
|
* @param {string} str
|
|
63
35
|
* @returns {string}
|
|
64
36
|
*/
|
|
65
37
|
function grammarFix (str) {
|
|
66
38
|
let result = str
|
|
67
39
|
|
|
68
|
-
|
|
69
|
-
result = result.replace(
|
|
70
|
-
|
|
71
|
-
result = result.replace('สองสิบ', 'ยี่สิบ')
|
|
72
|
-
// "เอ็ด"
|
|
73
|
-
const neungLen = 5
|
|
74
|
-
if (result.length > neungLen &&
|
|
75
|
-
result.length - result.lastIndexOf('หนึ่ง') === neungLen) {
|
|
76
|
-
result = result.substr(0, result.length - neungLen) + 'เอ็ด'
|
|
77
|
-
}
|
|
40
|
+
result = result.replace(/หนึ่งสิบ/g, 'สิบ')
|
|
41
|
+
result = result.replace(/สองสิบ/g, 'ยี่สิบ')
|
|
42
|
+
result = result.replace(/สิบหนึ่ง/g, 'สิบเอ็ด')
|
|
78
43
|
|
|
79
44
|
return result
|
|
80
45
|
}
|
|
@@ -110,42 +75,42 @@ function combine (baht, satang) {
|
|
|
110
75
|
* @returns {string}
|
|
111
76
|
*/
|
|
112
77
|
function bahttext (num) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
//
|
|
116
|
-
if (
|
|
117
|
-
//
|
|
118
|
-
if (num
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
78
|
+
// no null
|
|
79
|
+
if (!num) return defaultResult
|
|
80
|
+
// no boolean
|
|
81
|
+
if (typeof num === 'boolean') return defaultResult
|
|
82
|
+
// must be number only
|
|
83
|
+
if (isNaN(Number(num))) return defaultResult
|
|
84
|
+
// not less than Number.MIN_SAFE_INTEGER
|
|
85
|
+
if (num < Number.MIN_SAFE_INTEGER) return defaultResult
|
|
86
|
+
// no more than Number.MAX_SAFE_INTEGER
|
|
87
|
+
if (num > Number.MAX_SAFE_INTEGER) return defaultResult
|
|
88
|
+
|
|
89
|
+
// set
|
|
90
|
+
const positiveNum = Math.abs(num)
|
|
91
|
+
|
|
92
|
+
// split baht and satang e.g. 432.214567 >> 432, 21
|
|
93
|
+
const bahtStr = Math.floor(positiveNum).toString()
|
|
127
94
|
/** @type {string} */
|
|
128
|
-
const satangStr =
|
|
95
|
+
const satangStr = (positiveNum % 1 * 100).toFixed(2).split('.')[0]
|
|
129
96
|
|
|
130
|
-
// 3. split: convert number array
|
|
131
|
-
// @todo optimize it
|
|
132
97
|
/** @type {number[]} */
|
|
133
98
|
const bahtArr = Array.from(bahtStr).map(Number)
|
|
134
99
|
/** @type {number[]} */
|
|
135
100
|
const satangArr = Array.from(satangStr).map(Number)
|
|
136
101
|
|
|
137
|
-
//
|
|
102
|
+
// proceed
|
|
138
103
|
let baht = num2Word(bahtArr)
|
|
139
104
|
let satang = num2Word(satangArr)
|
|
140
105
|
|
|
141
|
-
//
|
|
106
|
+
// grammar
|
|
142
107
|
baht = grammarFix(baht)
|
|
143
108
|
satang = grammarFix(satang)
|
|
144
109
|
|
|
145
|
-
//
|
|
146
|
-
result = combine(baht, satang)
|
|
110
|
+
// combine
|
|
111
|
+
const result = combine(baht, satang)
|
|
147
112
|
|
|
148
|
-
return result
|
|
113
|
+
return num >= 0 ? result : 'ลบ' + result
|
|
149
114
|
}
|
|
150
115
|
|
|
151
116
|
if (typeof module !== 'undefined' &&
|
package/src/index.test.js
CHANGED
|
@@ -1,159 +1,46 @@
|
|
|
1
1
|
const { bahttext } = require('./index')
|
|
2
2
|
const defaultResult = 'ศูนย์บาทถ้วน'
|
|
3
|
+
const testCases = require('../misc/testcases.json')
|
|
3
4
|
jest.autoMockOff()
|
|
4
5
|
|
|
5
|
-
describe('
|
|
6
|
-
test('
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
expect(bahttext(
|
|
12
|
-
expect(bahttext(
|
|
13
|
-
expect(bahttext(3)).toBe(
|
|
14
|
-
expect(bahttext(
|
|
15
|
-
expect(bahttext(
|
|
16
|
-
expect(bahttext(
|
|
17
|
-
expect(bahttext(
|
|
18
|
-
expect(bahttext(
|
|
19
|
-
expect(bahttext(
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
test('
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
test('5', () => {
|
|
36
|
-
expect(bahttext(44444)).toBe('สี่หมื่นสี่พันสี่ร้อยสี่สิบสี่บาทถ้วน')
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
test('6', () => {
|
|
40
|
-
expect(bahttext(555555)).toBe('ห้าแสนห้าหมื่นห้าพันห้าร้อยห้าสิบห้าบาทถ้วน')
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
test('7', () => {
|
|
44
|
-
expect(bahttext(6666666)).toBe('หกล้านหกแสนหกหมื่นหกพันหกร้อยหกสิบหกบาทถ้วน')
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
test('8', () => {
|
|
48
|
-
expect(bahttext(77777777)).toBe('เจ็ดสิบเจ็ดล้านเจ็ดแสนเจ็ดหมื่นเจ็ดพันเจ็ดร้อยเจ็ดสิบเจ็ดบาทถ้วน')
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
test('9', () => {
|
|
52
|
-
expect(bahttext(888888888)).toBe('แปดร้อยแปดสิบแปดล้านแปดแสนแปดหมื่นแปดพันแปดร้อยแปดสิบแปดบาทถ้วน')
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
test('10', () => {
|
|
56
|
-
expect(bahttext(9999999999)).toBe('เก้าพันเก้าร้อยเก้าสิบเก้าล้านเก้าแสนเก้าหมื่นเก้าพันเก้าร้อยเก้าสิบเก้าบาทถ้วน')
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
test('11', () => {
|
|
60
|
-
expect(bahttext(12345678901)).toBe('หนึ่งหมื่นสองพันสามร้อยสี่สิบห้าล้านหกแสนเจ็ดหมื่นแปดพันเก้าร้อยเอ็ดบาทถ้วน')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
test('12', () => {
|
|
64
|
-
expect(bahttext(123456789012)).toBe('หนึ่งแสนสองหมื่นสามพันสี่ร้อยห้าสิบหกล้านเจ็ดแสนแปดหมื่นเก้าพันสิบสองบาทถ้วน')
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
test('13', () => {
|
|
68
|
-
expect(bahttext(1234567890133)).toBe('หนึ่งล้านสองแสนสามหมื่นสี่พันห้าร้อยหกสิบเจ็ดล้านแปดแสนเก้าหมื่นหนึ่งร้อยสามสิบสามบาทถ้วน')
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
test('14', () => {
|
|
72
|
-
expect(bahttext(12345678901234)).toBe('สิบสองล้านสามแสนสี่หมื่นห้าพันหกร้อยเจ็ดสิบแปดล้านเก้าแสนหนึ่งพันสองร้อยสามสิบสี่บาทถ้วน')
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
test('15', () => {
|
|
76
|
-
expect(bahttext(123456789012345)).toBe('หนึ่งร้อยยี่สิบสามล้านสี่แสนห้าหมื่นหกพันเจ็ดร้อยแปดสิบเก้าล้านหนึ่งหมื่นสองพันสามร้อยสี่สิบห้าบาทถ้วน')
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
test('16 digits, not more than Number.MAX_SAFE_INTEGER', () => {
|
|
80
|
-
// Number.MAX_SAFE_INTEGER
|
|
81
|
-
// 9007199254740991
|
|
82
|
-
expect(bahttext(1234567890123450)).toBe('หนึ่งพันสองร้อยสามสิบสี่ล้านห้าแสนหกหมื่นเจ็ดพันแปดร้อยเก้าสิบล้านหนึ่งแสนสองหมื่นสามพันสี่ร้อยห้าสิบบาทถ้วน')
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
test('16 digits, more than Number.MAX_SAFE_INTEGER', () => {
|
|
86
|
-
// eslint-disable-next-line
|
|
87
|
-
expect(bahttext(9007199254750991)).toBe(defaultResult)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
test('more than 16', () => {
|
|
91
|
-
expect(bahttext(12345678901234500)).toBe(defaultResult)
|
|
92
|
-
expect(bahttext(123456789012345000)).toBe(defaultResult)
|
|
93
|
-
expect(bahttext(1234567890123450000)).toBe(defaultResult)
|
|
94
|
-
expect(bahttext(123456789012345000000)).toBe(defaultResult)
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
describe('grammar', () => {
|
|
99
|
-
test('end with 1 (more than 10)', () => {
|
|
100
|
-
expect(bahttext(11)).toBe('สิบเอ็ดบาทถ้วน')
|
|
101
|
-
expect(bahttext(201)).toBe('สองร้อยเอ็ดบาทถ้วน')
|
|
102
|
-
|
|
103
|
-
expect(bahttext(3061.21)).toBe('สามพันหกสิบเอ็ดบาทยี่สิบเอ็ดสตางค์')
|
|
104
|
-
expect(bahttext(456011.71)).toBe('สี่แสนห้าหมื่นหกพันสิบเอ็ดบาทเจ็ดสิบเอ็ดสตางค์')
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
test('end with 1x', () => {
|
|
108
|
-
expect(bahttext(14)).toBe('สิบสี่บาทถ้วน')
|
|
109
|
-
expect(bahttext(40019)).toBe('สี่หมื่นสิบเก้าบาทถ้วน')
|
|
110
|
-
|
|
111
|
-
expect(bahttext(317.10)).toBe('สามร้อยสิบเจ็ดบาทสิบสตางค์')
|
|
112
|
-
expect(bahttext(40019.17)).toBe('สี่หมื่นสิบเก้าบาทสิบเจ็ดสตางค์')
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
test('end with 2x', () => {
|
|
116
|
-
expect(bahttext(22)).toBe('ยี่สิบสองบาทถ้วน')
|
|
117
|
-
expect(bahttext(5723)).toBe('ห้าพันเจ็ดร้อยยี่สิบสามบาทถ้วน')
|
|
118
|
-
|
|
119
|
-
expect(bahttext(57.23)).toBe('ห้าสิบเจ็ดบาทยี่สิบสามสตางค์')
|
|
120
|
-
expect(bahttext(422.26)).toBe('สี่ร้อยยี่สิบสองบาทยี่สิบหกสตางค์')
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
describe('decimals', () => {
|
|
125
|
-
test('general', () => {
|
|
126
|
-
expect(bahttext(1.01)).toBe('หนึ่งบาทหนึ่งสตางค์')
|
|
127
|
-
expect(bahttext(1.02)).toBe('หนึ่งบาทสองสตางค์')
|
|
128
|
-
expect(bahttext(1.03)).toBe('หนึ่งบาทสามสตางค์')
|
|
129
|
-
expect(bahttext(1.04)).toBe('หนึ่งบาทสี่สตางค์')
|
|
130
|
-
expect(bahttext(1.05)).toBe('หนึ่งบาทห้าสตางค์')
|
|
131
|
-
expect(bahttext(1.06)).toBe('หนึ่งบาทหกสตางค์')
|
|
132
|
-
expect(bahttext(1.07)).toBe('หนึ่งบาทเจ็ดสตางค์')
|
|
133
|
-
expect(bahttext(1.08)).toBe('หนึ่งบาทแปดสตางค์')
|
|
134
|
-
expect(bahttext(1.09)).toBe('หนึ่งบาทเก้าสตางค์')
|
|
135
|
-
|
|
136
|
-
expect(bahttext(32.23)).toBe('สามสิบสองบาทยี่สิบสามสตางค์')
|
|
137
|
-
expect(bahttext(474.45)).toBe('สี่ร้อยเจ็ดสิบสี่บาทสี่สิบห้าสตางค์')
|
|
138
|
-
expect(bahttext(5789.67)).toBe('ห้าพันเจ็ดร้อยแปดสิบเก้าบาทหกสิบเจ็ดสตางค์')
|
|
139
|
-
expect(bahttext(63147.89)).toBe('หกหมื่นสามพันหนึ่งร้อยสี่สิบเจ็ดบาทแปดสิบเก้าสตางค์')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
test('more than 2 decimals, using 2 decimals', () => {
|
|
143
|
-
expect(bahttext(25.1230)).toBe('ยี่สิบห้าบาทสิบสองสตางค์')
|
|
144
|
-
expect(bahttext(345.2345)).toBe('สามร้อยสี่สิบห้าบาทยี่สิบสามสตางค์')
|
|
145
|
-
expect(bahttext(5678.4567)).toBe('ห้าพันหกร้อยเจ็ดสิบแปดบาทสี่สิบหกสตางค์')
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
test('not more than 1', () => {
|
|
149
|
-
expect(bahttext(0.25)).toBe('ยี่สิบห้าสตางค์')
|
|
150
|
-
expect(bahttext(0.36)).toBe('สามสิบหกสตางค์')
|
|
151
|
-
expect(bahttext(0.69)).toBe('หกสิบเก้าสตางค์')
|
|
6
|
+
describe('misc', () => {
|
|
7
|
+
test('invalid number', () => {
|
|
8
|
+
const zeroText = 'ศูนย์บาทถ้วน'
|
|
9
|
+
|
|
10
|
+
expect(bahttext(null)).toBe(zeroText)
|
|
11
|
+
expect(bahttext(true)).toBe(zeroText)
|
|
12
|
+
expect(bahttext(false)).toBe(zeroText)
|
|
13
|
+
expect(bahttext([])).toBe(zeroText)
|
|
14
|
+
expect(bahttext([1, 2, 3])).toBe(zeroText)
|
|
15
|
+
expect(bahttext({})).toBe(zeroText)
|
|
16
|
+
expect(bahttext('')).toBe(zeroText)
|
|
17
|
+
expect(bahttext()).toBe(zeroText)
|
|
18
|
+
expect(bahttext(undefined)).toBe(zeroText)
|
|
19
|
+
expect(bahttext('this-is-not-number')).toBe(zeroText)
|
|
20
|
+
expect(bahttext('it-must-be-number-only')).toBe(zeroText)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('less than Number.MIN_SAFE_INTEGER', () => {
|
|
24
|
+
const items = [1, 20, 9451, 5656549]
|
|
25
|
+
for (let i = 0; i < items.length; i++) {
|
|
26
|
+
expect(bahttext(Number.MIN_SAFE_INTEGER - items[i])).toBe(defaultResult)
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('more than Number.MAX_SAFE_INTEGER', () => {
|
|
31
|
+
const items = [1, 20, 9451, 5656549]
|
|
32
|
+
for (let i = 0; i < items.length; i++) {
|
|
33
|
+
expect(bahttext(Number.MAX_SAFE_INTEGER + items[i])).toBe(defaultResult)
|
|
34
|
+
}
|
|
152
35
|
})
|
|
153
36
|
})
|
|
154
37
|
|
|
155
|
-
describe('
|
|
156
|
-
test('
|
|
157
|
-
|
|
38
|
+
describe('number', () => {
|
|
39
|
+
test('imported from Google Sheet', () => {
|
|
40
|
+
for (let i = 0; i < testCases.length; i++) {
|
|
41
|
+
const customMessage = JSON.stringify(testCases[i])
|
|
42
|
+
const number = Number(testCases[i].number)
|
|
43
|
+
expect(bahttext(number), customMessage).toBe(testCases[i].text)
|
|
44
|
+
}
|
|
158
45
|
})
|
|
159
46
|
})
|
package/.editorconfig
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
name: continuous integration
|
|
2
|
-
on: [push]
|
|
3
|
-
|
|
4
|
-
jobs:
|
|
5
|
-
build:
|
|
6
|
-
runs-on: ubuntu-latest
|
|
7
|
-
strategy:
|
|
8
|
-
matrix:
|
|
9
|
-
node-version: [10.x, 12.x, 14.x]
|
|
10
|
-
|
|
11
|
-
steps:
|
|
12
|
-
- name: Checkout
|
|
13
|
-
uses: actions/checkout@v2
|
|
14
|
-
|
|
15
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
16
|
-
uses: actions/setup-node@v1
|
|
17
|
-
with:
|
|
18
|
-
node-version: ${{ matrix.node-version }}
|
|
19
|
-
|
|
20
|
-
- name: Cache dependencies
|
|
21
|
-
uses: actions/cache@v2
|
|
22
|
-
with:
|
|
23
|
-
path: |
|
|
24
|
-
**/node_modules
|
|
25
|
-
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
|
26
|
-
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: npm install
|
|
29
|
-
|
|
30
|
-
- name: Linting with Standard.js
|
|
31
|
-
run: npm run standard
|
|
32
|
-
|
|
33
|
-
- name: Test and test coverage
|
|
34
|
-
run: npm run coverage.check
|
|
35
|
-
|
|
36
|
-
- name: Upload coverage to Codecov
|
|
37
|
-
uses: codecov/codecov-action@v1
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_run:
|
|
5
|
-
workflows: ["continuous integration"]
|
|
6
|
-
branches: [master]
|
|
7
|
-
types:
|
|
8
|
-
- completed
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
release:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
strategy:
|
|
14
|
-
matrix:
|
|
15
|
-
node-version: [12.x]
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- name: Checkout
|
|
19
|
-
uses: actions/checkout@v2
|
|
20
|
-
with:
|
|
21
|
-
fetch-depth: 0
|
|
22
|
-
|
|
23
|
-
- name: Semantic Release
|
|
24
|
-
uses: cycjimmy/semantic-release-action@v2
|
|
25
|
-
env:
|
|
26
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
27
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/codecov.yaml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
codecov:
|
|
2
|
-
require_ci_to_pass: yes
|
|
3
|
-
|
|
4
|
-
coverage:
|
|
5
|
-
precision: 2
|
|
6
|
-
round: down
|
|
7
|
-
range: "70...100"
|
|
8
|
-
|
|
9
|
-
parsers:
|
|
10
|
-
gcov:
|
|
11
|
-
branch_detection:
|
|
12
|
-
conditional: yes
|
|
13
|
-
loop: yes
|
|
14
|
-
method: no
|
|
15
|
-
macro: no
|
|
16
|
-
|
|
17
|
-
comment:
|
|
18
|
-
layout: "reach,diff,flags,files,footer"
|
|
19
|
-
behavior: default
|
|
20
|
-
require_changes: no
|
package/example/commonjs.js
DELETED
package/example/es6.ts
DELETED
package/example/index.html
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>Example of Bahttext</title>
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
Example of Bahttext
|
|
12
|
-
|
|
13
|
-
<script src="https://raw.githack.com/jojoee/bahttext/master/src/index.js"></script>
|
|
14
|
-
<script>
|
|
15
|
-
console.log(bahttext(63147.89))
|
|
16
|
-
</script>
|
|
17
|
-
</body>
|
|
18
|
-
|
|
19
|
-
</html>
|
package/example/package.json
DELETED
package/misc/test.json
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
[{
|
|
2
|
-
"category": "digit",
|
|
3
|
-
"case": "1, zero",
|
|
4
|
-
"number": "0",
|
|
5
|
-
"thai": "ศูนย์บาทถ้วน"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"category": "digit",
|
|
9
|
-
"case": "1",
|
|
10
|
-
"number": "1",
|
|
11
|
-
"thai": "หนึ่งบาทถ้วน"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"category": "digit",
|
|
15
|
-
"case": "1",
|
|
16
|
-
"number": "2",
|
|
17
|
-
"thai": "สองบาทถ้วน"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"category": "digit",
|
|
21
|
-
"case": "1",
|
|
22
|
-
"number": "3",
|
|
23
|
-
"thai": "สามบาทถ้วน"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"category": "digit",
|
|
27
|
-
"case": "1",
|
|
28
|
-
"number": "4",
|
|
29
|
-
"thai": "สี่บาทถ้วน"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"category": "digit",
|
|
33
|
-
"case": "1",
|
|
34
|
-
"number": "5",
|
|
35
|
-
"thai": "ห้าบาทถ้วน"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"category": "digit",
|
|
39
|
-
"case": "1",
|
|
40
|
-
"number": "6",
|
|
41
|
-
"thai": "หกบาทถ้วน"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"category": "digit",
|
|
45
|
-
"case": "1",
|
|
46
|
-
"number": "7",
|
|
47
|
-
"thai": "เจ็ดบาทถ้วน"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"category": "digit",
|
|
51
|
-
"case": "1",
|
|
52
|
-
"number": "8",
|
|
53
|
-
"thai": "แปดบาทถ้วน"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"category": "digit",
|
|
57
|
-
"case": "1",
|
|
58
|
-
"number": "9",
|
|
59
|
-
"thai": "เก้าบาทถ้วน"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"category": "digit",
|
|
63
|
-
"case": "2",
|
|
64
|
-
"number": "37",
|
|
65
|
-
"thai": "สามสิบเจ็ดบาทถ้วน"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"category": "digit",
|
|
69
|
-
"case": "2",
|
|
70
|
-
"number": "48",
|
|
71
|
-
"thai": "สี่สิบแปดบาทถ้วน"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"category": "digit",
|
|
75
|
-
"case": "3",
|
|
76
|
-
"number": "232",
|
|
77
|
-
"thai": "สองร้อยสามสิบสองบาทถ้วน"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"category": "digit",
|
|
81
|
-
"case": "4",
|
|
82
|
-
"number": "3333",
|
|
83
|
-
"thai": "สามพันสามร้อยสามสิบสามบาทถ้วน"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"category": "digit",
|
|
87
|
-
"case": "5",
|
|
88
|
-
"number": "44444",
|
|
89
|
-
"thai": "สี่หมื่นสี่พันสี่ร้อยสี่สิบสี่บาทถ้วน"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"category": "digit",
|
|
93
|
-
"case": "6",
|
|
94
|
-
"number": "555555",
|
|
95
|
-
"thai": "ห้าแสนห้าหมื่นห้าพันห้าร้อยห้าสิบห้าบาทถ้วน"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"category": "digit",
|
|
99
|
-
"case": "7",
|
|
100
|
-
"number": "6666666",
|
|
101
|
-
"thai": "หกล้านหกแสนหกหมื่นหกพันหกร้อยหกสิบหกบาทถ้วน"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"category": "digit",
|
|
105
|
-
"case": "8",
|
|
106
|
-
"number": "77777777",
|
|
107
|
-
"thai": "เจ็ดสิบเจ็ดล้านเจ็ดแสนเจ็ดหมื่นเจ็ดพันเจ็ดร้อยเจ็ดสิบเจ็ดบาทถ้วน"
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"category": "digit",
|
|
111
|
-
"case": "9",
|
|
112
|
-
"number": "888888888",
|
|
113
|
-
"thai": "แปดร้อยแปดสิบแปดล้านแปดแสนแปดหมื่นแปดพันแปดร้อยแปดสิบแปดบาทถ้วน"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"category": "digit",
|
|
117
|
-
"case": "10",
|
|
118
|
-
"number": "9999999999",
|
|
119
|
-
"thai": "เก้าพันเก้าร้อยเก้าสิบเก้าล้านเก้าแสนเก้าหมื่นเก้าพันเก้าร้อยเก้าสิบเก้าบาทถ้วน"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"category": "digit",
|
|
123
|
-
"case": "11",
|
|
124
|
-
"number": "12345678901",
|
|
125
|
-
"thai": "หนึ่งหมื่นสองพันสามร้อยสี่สิบห้าล้านหกแสนเจ็ดหมื่นแปดพันเก้าร้อยเอ็ดบาทถ้วน"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"category": "digit",
|
|
129
|
-
"case": "12",
|
|
130
|
-
"number": "123456789012",
|
|
131
|
-
"thai": "หนึ่งแสนสองหมื่นสามพันสี่ร้อยห้าสิบหกล้านเจ็ดแสนแปดหมื่นเก้าพันสิบสองบาทถ้วน"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"category": "digit",
|
|
135
|
-
"case": "13",
|
|
136
|
-
"number": "1234567890123",
|
|
137
|
-
"thai": "หนึ่งล้านสองแสนสามหมื่นสี่พันห้าร้อยหกสิบเจ็ดล้านแปดแสนเก้าหมื่นหนึ่งร้อยยี่สิบสามบาทถ้วน"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"category": "digit",
|
|
141
|
-
"case": "14",
|
|
142
|
-
"number": "12345678901234",
|
|
143
|
-
"thai": "สิบสองล้านสามแสนสี่หมื่นห้าพันหกร้อยเจ็ดสิบแปดล้านเก้าแสนหนึ่งพันสองร้อยสามสิบสี่บาทถ้วน"
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
"category": "digit",
|
|
147
|
-
"case": "15",
|
|
148
|
-
"number": "123456789012345",
|
|
149
|
-
"thai": "หนึ่งร้อยยี่สิบสามล้านสี่แสนห้าหมื่นหกพันเจ็ดร้อยแปดสิบเก้าล้านหนึ่งหมื่นสองพันสามร้อยสี่สิบห้าบาทถ้วน"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"category": "digit",
|
|
153
|
-
"case": "16, not more than Number.MAX_SAFE_INTEGER",
|
|
154
|
-
"number": "1234567890123450",
|
|
155
|
-
"thai": "หนึ่งพันสองร้อยสามสิบสี่ล้านห้าแสนหกหมื่นเจ็ดพันแปดร้อยเก้าสิบล้านหนึ่งแสนสองหมื่นสามพันสี่ร้อยห้าสิบบาทถ้วน"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"category": "digit",
|
|
159
|
-
"case": "16, more than Number.MAX_SAFE_INTEGER",
|
|
160
|
-
"number": "9007199254750990",
|
|
161
|
-
"thai": "ศูนย์บาทถ้วน"
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"category": "digit",
|
|
165
|
-
"case": "more than 16",
|
|
166
|
-
"number": "12345678901234500",
|
|
167
|
-
"thai": "ศูนย์บาทถ้วน"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"category": "digit",
|
|
171
|
-
"case": "more than 16",
|
|
172
|
-
"number": "123456789012345000",
|
|
173
|
-
"thai": "ศูนย์บาทถ้วน"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"category": "digit",
|
|
177
|
-
"case": "more than 16",
|
|
178
|
-
"number": "1234567890123450000",
|
|
179
|
-
"thai": "ศูนย์บาทถ้วน"
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"category": "digit",
|
|
183
|
-
"case": "more than 16",
|
|
184
|
-
"number": "123456789012345000000",
|
|
185
|
-
"thai": "ศูนย์บาทถ้วน"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"category": "grammar",
|
|
189
|
-
"case": "end with 1 (more than 10)",
|
|
190
|
-
"number": "11",
|
|
191
|
-
"thai": "สิบเอ็ดบาทถ้วน"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"category": "grammar",
|
|
195
|
-
"case": "end with 1 (more than 10)",
|
|
196
|
-
"number": "201",
|
|
197
|
-
"thai": "สองร้อยเอ็ดบาทถ้วน"
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
"category": "grammar",
|
|
201
|
-
"case": "end with 1 (more than 10)",
|
|
202
|
-
"number": "3061.21",
|
|
203
|
-
"thai": "สามพันหกสิบเอ็ดบาทยี่สิบเอ็ดสตางค์"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"category": "grammar",
|
|
207
|
-
"case": "end with 1 (more than 10)",
|
|
208
|
-
"number": "456011.71",
|
|
209
|
-
"thai": "สี่แสนห้าหมื่นหกพันสิบเอ็ดบาทเจ็ดสิบเอ็ดสตางค์"
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"category": "grammar",
|
|
213
|
-
"case": "end with 1x",
|
|
214
|
-
"number": "14",
|
|
215
|
-
"thai": "สิบสี่บาทถ้วน"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"category": "grammar",
|
|
219
|
-
"case": "end with 1x",
|
|
220
|
-
"number": "40019",
|
|
221
|
-
"thai": "สี่หมื่นสิบเก้าบาทถ้วน"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
"category": "grammar",
|
|
225
|
-
"case": "end with 1x",
|
|
226
|
-
"number": "317.10",
|
|
227
|
-
"thai": "สามร้อยสิบเจ็ดบาทสิบสตางค์"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"category": "grammar",
|
|
231
|
-
"case": "end with 1x",
|
|
232
|
-
"number": "40019.17",
|
|
233
|
-
"thai": "สี่หมื่นสิบเก้าบาทสิบเจ็ดสตางค์"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"category": "grammar",
|
|
237
|
-
"case": "end with 2x",
|
|
238
|
-
"number": "22",
|
|
239
|
-
"thai": "ยี่สิบสองบาทถ้วน"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
"category": "grammar",
|
|
243
|
-
"case": "end with 2x",
|
|
244
|
-
"number": "5723",
|
|
245
|
-
"thai": "ห้าพันเจ็ดร้อยยี่สิบสามบาทถ้วน"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
"category": "grammar",
|
|
249
|
-
"case": "end with 2x",
|
|
250
|
-
"number": "57.23",
|
|
251
|
-
"thai": "ห้าสิบเจ็ดบาทยี่สิบสามสตางค์"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"category": "grammar",
|
|
255
|
-
"case": "end with 2x",
|
|
256
|
-
"number": "422.26",
|
|
257
|
-
"thai": "สี่ร้อยยี่สิบสองบาทยี่สิบหกสตางค์"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
"category": "decimals",
|
|
261
|
-
"case": "general",
|
|
262
|
-
"number": "1.01",
|
|
263
|
-
"thai": "หนึ่งบาทหนึ่งสตางค์"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
"category": "decimals",
|
|
267
|
-
"case": "general",
|
|
268
|
-
"number": "1.02",
|
|
269
|
-
"thai": "หนึ่งบาทสองสตางค์"
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
"category": "decimals",
|
|
273
|
-
"case": "general",
|
|
274
|
-
"number": "1.03",
|
|
275
|
-
"thai": "หนึ่งบาทสามสตางค์"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"category": "decimals",
|
|
279
|
-
"case": "general",
|
|
280
|
-
"number": "1.04",
|
|
281
|
-
"thai": "หนึ่งบาทสี่สตางค์"
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"category": "decimals",
|
|
285
|
-
"case": "general",
|
|
286
|
-
"number": "1.05",
|
|
287
|
-
"thai": "หนึ่งบาทห้าสตางค์"
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"category": "decimals",
|
|
291
|
-
"case": "general",
|
|
292
|
-
"number": "1.06",
|
|
293
|
-
"thai": "หนึ่งบาทหกสตางค์"
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"category": "decimals",
|
|
297
|
-
"case": "general",
|
|
298
|
-
"number": "1.07",
|
|
299
|
-
"thai": "หนึ่งบาทเจ็ดสตางค์"
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"category": "decimals",
|
|
303
|
-
"case": "general",
|
|
304
|
-
"number": "1.08",
|
|
305
|
-
"thai": "หนึ่งบาทแปดสตางค์"
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"category": "decimals",
|
|
309
|
-
"case": "general",
|
|
310
|
-
"number": "1.09",
|
|
311
|
-
"thai": "หนึ่งบาทเก้าสตางค์"
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"category": "decimals",
|
|
315
|
-
"case": "general",
|
|
316
|
-
"number": "32.23",
|
|
317
|
-
"thai": "สามสิบสองบาทยี่สิบสามสตางค์"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
"category": "decimals",
|
|
321
|
-
"case": "general",
|
|
322
|
-
"number": "474.45",
|
|
323
|
-
"thai": "สี่ร้อยเจ็ดสิบสี่บาทสี่สิบห้าสตางค์"
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"category": "decimals",
|
|
327
|
-
"case": "general",
|
|
328
|
-
"number": "5789.67",
|
|
329
|
-
"thai": "ห้าพันเจ็ดร้อยแปดสิบเก้าบาทหกสิบเจ็ดสตางค์"
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
"category": "decimals",
|
|
333
|
-
"case": "general",
|
|
334
|
-
"number": "63147.89",
|
|
335
|
-
"thai": "หกหมื่นสามพันหนึ่งร้อยสี่สิบเจ็ดบาทแปดสิบเก้าสตางค์"
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
"category": "decimals",
|
|
339
|
-
"case": "more than 2 decimals, using 2 digits",
|
|
340
|
-
"number": "25.1230",
|
|
341
|
-
"thai": "ยี่สิบห้าบาทสิบสองสตางค์"
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
"category": "decimals",
|
|
345
|
-
"case": "more than 2 decimals, using 2 digits",
|
|
346
|
-
"number": "345.2345",
|
|
347
|
-
"thai": "สามร้อยสี่สิบห้าบาทยี่สิบสามสตางค์"
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
"category": "decimals",
|
|
351
|
-
"case": "more than 2 decimals, using 2 digits",
|
|
352
|
-
"number": "5678.4567",
|
|
353
|
-
"thai": "ห้าพันหกร้อยเจ็ดสิบแปดบาทสี่สิบหกสตางค์"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
"category": "decimals",
|
|
357
|
-
"case": "not more than 1",
|
|
358
|
-
"number": "0.25",
|
|
359
|
-
"thai": "ยี่สิบห้าสตางค์"
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
"category": "decimals",
|
|
363
|
-
"case": "not more than 1",
|
|
364
|
-
"number": "0.36",
|
|
365
|
-
"thai": "สามสิบหกสตางค์"
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
"category": "decimals",
|
|
369
|
-
"case": "not more than 1",
|
|
370
|
-
"number": "0.69",
|
|
371
|
-
"thai": "หกสิบเก้าสตางค์"
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
"category": "misc",
|
|
375
|
-
"case": "invalid number",
|
|
376
|
-
"number": "invalid number",
|
|
377
|
-
"thai": "ศูนย์บาทถ้วน"
|
|
378
|
-
}
|
|
379
|
-
]
|