bahttext 2.3.1 → 2.3.3

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/.eslintignore ADDED
File without changes
package/.eslintrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "overrides": [
3
+ {
4
+ "files": [
5
+ "**/*.test.js"
6
+ ],
7
+ "env": {
8
+ "jest": true
9
+ }
10
+ }
11
+ ]
12
+ }
package/README-en.md CHANGED
@@ -3,14 +3,15 @@
3
3
  [![Version - npm](https://img.shields.io/npm/v/bahttext.svg)](https://www.npmjs.com/package/bahttext)
4
4
  [![Download - npm](https://img.shields.io/npm/dt/bahttext.svg)](https://www.npmjs.com/package/bahttext)
5
5
  [![License - npm](https://img.shields.io/npm/l/bahttext.svg)](http://opensource.org/licenses/MIT)
6
+ [![install size](https://packagephobia.com/badge?p=bahttext)](https://packagephobia.com/result?p=bahttext)
6
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) [![Greenkeeper badge](https://badges.greenkeeper.io/jojoee/bahttext.svg)](https://greenkeeper.io/)
7
8
  [![Codecov](https://img.shields.io/codecov/c/github/jojoee/bahttext.svg)](https://codecov.io/github/jojoee/bahttext)
8
9
  [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fjojoee%2Fbahttext%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/jojoee/bahttext/master)
9
10
 
10
- [![continuous integration](https://github.com/jojoee/bahttext/workflows/continuous%20integration/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/continuous-integration.yml)
11
- [![release](https://github.com/jojoee/bahttext/workflows/release/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/release.yml)
12
- [![runnable](https://github.com/jojoee/bahttext/workflows/runnable/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/runnable.yml)
13
- [![runnable old node](https://github.com/jojoee/bahttext/workflows/runnable%20old%20node/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/runnable-old-node.yml)
11
+ [![continuous-integration](https://github.com/jojoee/bahttext/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/continuous-integration.yml)
12
+ [![release](https://github.com/jojoee/bahttext/actions/workflows/release.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/release.yml)
13
+ [![runnable](https://github.com/jojoee/bahttext/actions/workflows/runnable.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/runnable.yml)
14
+ [![runnable-old-node](https://github.com/jojoee/bahttext/actions/workflows/runnable-old-node.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/runnable-old-node.yml)
14
15
 
15
16
  Only `TH` and `EN` languages are maintained, the rest is auto-generated by ChatGPT API. Language:
16
17
  [ไทย](https://github.com/jojoee/bahttext/blob/master/README.md),
package/README.md CHANGED
@@ -3,14 +3,15 @@
3
3
  [![Version - npm](https://img.shields.io/npm/v/bahttext.svg)](https://www.npmjs.com/package/bahttext)
4
4
  [![Download - npm](https://img.shields.io/npm/dt/bahttext.svg)](https://www.npmjs.com/package/bahttext)
5
5
  [![License - npm](https://img.shields.io/npm/l/bahttext.svg)](http://opensource.org/licenses/MIT)
6
+ [![install size](https://packagephobia.com/badge?p=bahttext)](https://packagephobia.com/result?p=bahttext)
6
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) [![Greenkeeper badge](https://badges.greenkeeper.io/jojoee/bahttext.svg)](https://greenkeeper.io/)
7
8
  [![Codecov](https://img.shields.io/codecov/c/github/jojoee/bahttext.svg)](https://codecov.io/github/jojoee/bahttext)
8
9
  [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fjojoee%2Fbahttext%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/jojoee/bahttext/master)
9
10
 
10
- [![continuous integration](https://github.com/jojoee/bahttext/workflows/continuous%20integration/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/continuous-integration.yml)
11
- [![release](https://github.com/jojoee/bahttext/workflows/release/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/release.yml)
12
- [![runnable](https://github.com/jojoee/bahttext/workflows/runnable/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/runnable.yml)
13
- [![runnable old node](https://github.com/jojoee/bahttext/workflows/runnable%20old%20node/badge.svg?branch=master)](https://github.com/jojoee/bahttext/actions/workflows/runnable-old-node.yml)
11
+ [![continuous-integration](https://github.com/jojoee/bahttext/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/continuous-integration.yml)
12
+ [![release](https://github.com/jojoee/bahttext/actions/workflows/release.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/release.yml)
13
+ [![runnable](https://github.com/jojoee/bahttext/actions/workflows/runnable.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/runnable.yml)
14
+ [![runnable-old-node](https://github.com/jojoee/bahttext/actions/workflows/runnable-old-node.yml/badge.svg)](https://github.com/jojoee/bahttext/actions/workflows/runnable-old-node.yml)
14
15
 
15
16
  Only `TH` and `EN` languages are maintained, the rest is auto-generated by ChatGPT API. Language:
16
17
  [ไทย](https://github.com/jojoee/bahttext/blob/master/README.md),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bahttext",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Change number to Thai pronunciation string",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -37,14 +37,13 @@
37
37
  "devDependencies": {
38
38
  "@stryker-mutator/core": "^8.7.1",
39
39
  "@stryker-mutator/jest-runner": "^8.7.1",
40
- "@to-da-moon/thai-baht-lib": "^0.0.12",
41
40
  "baht": "^0.7.1",
41
+ "bahttext230": "npm:bahttext@2.3.0",
42
+ "bahttext231": "npm:bahttext@2.3.1",
42
43
  "jest": "^29.7.0",
43
44
  "jest-expect-message": "^1.1.3",
44
45
  "semantic-release": "^24.2.2",
45
46
  "standard": "^17.1.2",
46
- "thai-baht-text": "^2.0.5",
47
- "thai-baht-text-ts": "^1.1.0",
48
47
  "typescript": "*"
49
48
  },
50
49
  "jest": {
package/src/index.d.ts CHANGED
@@ -3,33 +3,43 @@ declare namespace _default {
3
3
  }
4
4
  export default _default;
5
5
  /**
6
- * Change number to Thai pronunciation string
6
+ * Convert number Thai Baht text (supports number or numeric string)
7
+ * Mirrors behaviour of previous implementation but with faster core.
7
8
  *
8
9
  * @public
9
- * @param {number} num
10
+ * @param {number|string} input
10
11
  * @returns {string}
11
12
  */
12
- export function bahttext(num: number): string;
13
+ export function bahttext(input: number | string): string;
13
14
  /**
14
15
  * @private
15
- * @param {number[]} nums
16
- * @returns {string}
16
+ * Handle numeric input and extract baht/satang values
17
+ * @param {number} input - numeric input (positive or negative)
18
+ * @returns {{baht: number, bahtStr: string, satang: number, isNegative: boolean} | false}
17
19
  */
18
- export function bahtxtNum2Word(nums: number[]): string;
20
+ export function handleNumericInput(input: number): {
21
+ baht: number;
22
+ bahtStr: string;
23
+ satang: number;
24
+ isNegative: boolean;
25
+ } | false;
19
26
  /**
20
27
  * @private
21
- * @todo improve performance
22
- * @param {string} str
23
- * @returns {string}
28
+ * Handle string input and extract baht/satang values
29
+ * @param {string} input - string input (numeric string, positive or negative)
30
+ * @returns {{baht: number, bahtStr: string, satang: number, isNegative: boolean} | false}
24
31
  */
25
- export function bahtxtGrammarFix(str: string): string;
32
+ export function handleStringInput(input: string): {
33
+ baht: number;
34
+ bahtStr: string;
35
+ satang: number;
36
+ isNegative: boolean;
37
+ } | false;
26
38
  /**
27
- * bahtxtCombine baht and satang
28
- * and also adding unit
29
- *
30
39
  * @private
31
- * @param {string} baht
32
- * @param {string} satang
33
- * @returns {string}
40
+ * Format satang portion of the output
41
+ * @param {number} baht - baht amount
42
+ * @param {number} satang - satang amount
43
+ * @returns {string} formatted satang string
34
44
  */
35
- export function bahtxtCombine(baht: string, satang: string): string;
45
+ export function formatSatang(baht: number, satang: number): string;
package/src/index.js CHANGED
@@ -1,150 +1,262 @@
1
- const bahtxtConst = {
2
- defaultResult: 'ศูนย์บาทถ้วน',
3
- singleUnitStrs: ['', 'หนึ่ง', 'สอง', 'สาม', 'สี่', 'ห้า', 'หก', 'เจ็ด', 'แปด', 'เก้า'],
4
- placeNameStrs: ['', 'สิบ', 'ร้อย', 'พัน', 'หมื่น', 'แสน', 'ล้าน']
5
- }
1
+ const EMPTY = ''
2
+ const ONE = 'หนึ่ง'
3
+ const TWO = 'สอง'
4
+ const THREE_TO_NINE = ['สาม', 'สี่', 'ห้า', 'หก', 'เจ็ด', 'แปด', 'เก้า']
5
+ const ED = 'เอ็ด'
6
+ const YEE = 'ยี่'
7
+ const LAN = 'ล้าน'
8
+
9
+ // Index 0-5 correspond to units,สิบ,ร้อย,พัน,หมื่น,แสน
10
+ const DIGIT = [EMPTY, 'สิบ', 'ร้อย', 'พัน', 'หมื่น', 'แสน']
6
11
 
7
- const GrammarFixs = [
8
- { pat: /หนึ่งสิบ/g, replace: 'สิบ' },
9
- { pat: /สองสิบ/g, replace: 'ยี่สิบ' },
10
- { pat: /สิบหนึ่ง/g, replace: 'สิบเอ็ด' }
12
+ // Helpers to build word tables quickly
13
+ const ONES = [EMPTY, ED, TWO, ...THREE_TO_NINE]
14
+ const TENS = [
15
+ EMPTY,
16
+ ...[EMPTY, YEE, ...THREE_TO_NINE].map(t => t + DIGIT[1]) // "สิบ" family
11
17
  ]
18
+ // 0-99 lookup (fast satang conversion)
19
+ const SUB_HUNDRED = TENS.reduce(
20
+ (acc, t) => acc.concat(ONES.map(o => t + o)),
21
+ []
22
+ )
23
+
24
+ // Special case: 1 should read "หนึ่ง" not "เอ็ด"
25
+ SUB_HUNDRED[1] = ONE
26
+
27
+ // Single-digit lookup for generic conversion (no suffix)
28
+ const SUB_TEN = [EMPTY, ONE, TWO, ...THREE_TO_NINE]
29
+
30
+ // Pre-compiled constants for frequently used combinations
31
+ const YEE_SIB = YEE + DIGIT[1] // "ยี่สิบ"
32
+ const SIB = DIGIT[1] // "สิบ"
33
+
34
+ // Default fallback text used throughout tests
35
+ const DEFAULT_RESULT = 'ศูนย์บาทถ้วน'
12
36
 
13
37
  /**
14
- * @private
15
- * @param {number[]} nums
38
+ * Convert number → Thai Baht text (supports number or numeric string)
39
+ * Mirrors behaviour of previous implementation but with faster core.
40
+ *
41
+ * @public
42
+ * @param {number|string} input
16
43
  * @returns {string}
17
44
  */
18
- function bahtxtNum2Word (nums) {
19
- /**
20
- * Converts a numeric string (or legacy digit array) into Thai words without unit suffix.
21
- * The new implementation iterates over the input string directly, eliminating
22
- * the intermediate `Array.from(...).map(Number)` allocations previously used.
23
- *
24
- * @param {string|number[]} nums – string of digits ("123") or array \[1,2,3].
25
- * @returns {string}
26
- */
27
- let numStr = ''
28
-
29
- if (typeof nums === 'string') {
30
- numStr = nums
31
- } else if (Array.isArray(nums)) {
32
- numStr = nums.join('')
33
- } else {
34
- return ''
45
+ function bahttext (input) {
46
+ // Early invalidation – keep behaviour expected by test suite
47
+ if (input === null || input === undefined ||
48
+ typeof input === 'boolean' || Array.isArray(input) ||
49
+ (typeof input !== 'number' && typeof input !== 'string')) {
50
+ return DEFAULT_RESULT
35
51
  }
36
52
 
37
- // Trim leading zeros but leave at least one digit so "0" stays "0"
38
- numStr = numStr.replace(/^0+/, '') || '0'
53
+ const converted = convertInternal(input)
54
+ return converted === false ? DEFAULT_RESULT : converted
55
+ }
39
56
 
40
- const len = numStr.length
41
- const maxLen = 7 // handle up to 6-digit group + 1-digit look-ahead for "ล้าน" logic
57
+ /**
58
+ * @private
59
+ * @param {string} numStr – e.g. "123" (no sign, may include leading zeros)
60
+ * @returns {string}
61
+ */
62
+ function numberToWords (numStr) {
63
+ // Short-circuit trivial "0"
64
+ if (numStr === '0') return ''
42
65
 
43
- if (len > maxLen) {
44
- const overflowIndex = len - maxLen + 1
45
- const overflowStr = numStr.slice(0, overflowIndex)
46
- const remainingStr = numStr.slice(overflowIndex)
47
- return bahtxtNum2Word(overflowStr) + 'ล้าน' + bahtxtNum2Word(remainingStr)
48
- }
66
+ let output = EMPTY
67
+ const len = numStr.length
49
68
 
50
- let result = ''
51
69
  for (let i = 0; i < len; i++) {
52
- const digit = numStr.charCodeAt(i) - 48 // faster than parseInt(numStr[i], 10)
53
- if (digit > 0) {
54
- result +=
55
- bahtxtConst.singleUnitStrs[digit] +
56
- bahtxtConst.placeNameStrs[len - i - 1]
70
+ const d = numStr[i]
71
+ const di = len - i - 1 // distance from rightmost digit
72
+ const diMod = di % 6 // position inside a 6-digit group
73
+
74
+ if (d === '0') {
75
+ // skip zero – no wording
76
+ } else if (diMod === 1) {
77
+ // tens column inside group
78
+ if (d === '1') {
79
+ // "สิบ"
80
+ output += SIB
81
+ } else if (d === '2') {
82
+ // "ยี่สิบ"
83
+ output += YEE_SIB
84
+ } else {
85
+ const digitCode = d.charCodeAt(0) - 48
86
+ output += SUB_TEN[digitCode] + DIGIT[diMod]
87
+ }
88
+ } else if (diMod === 0 && d === '1' && i !== 0) {
89
+ // trailing 1 (in ones place, not first digit in overall number) → "เอ็ด"
90
+ // BUT: if it's a stand-alone digit in hundreds place (like 201), use "หนึ่ง"
91
+ const isStandAloneInHundreds = (di === 0 && len > 1 && numStr[i - 1] === '0')
92
+ output += isStandAloneInHundreds ? ONE : ED
93
+ } else {
94
+ const digitCode = d.charCodeAt(0) - 48 // faster than Number(d)
95
+ output += SUB_TEN[digitCode] + DIGIT[diMod]
96
+ }
97
+
98
+ // add "ล้าน" after finishing each 6-digit block (except last group)
99
+ if (diMod === 0 && di) {
100
+ output += LAN
57
101
  }
58
102
  }
59
103
 
60
- return result
104
+ return output
61
105
  }
62
106
 
63
107
  /**
64
108
  * @private
65
- * @todo improve performance
66
- * @param {string} str
67
- * @returns {string}
109
+ * Handle numeric input and extract baht/satang values
110
+ * @param {number} input - numeric input (positive or negative)
111
+ * @returns {{baht: number, bahtStr: string, satang: number, isNegative: boolean} | false}
68
112
  */
69
- function bahtxtGrammarFix (str) {
70
- for (const GrammarFix of GrammarFixs) {
71
- str = str.replace(GrammarFix.pat, GrammarFix.replace)
113
+ function handleNumericInput (input) {
114
+ if (!Number.isFinite(input)) return false
115
+ if (input < Number.MIN_SAFE_INTEGER || input > Number.MAX_SAFE_INTEGER) {
116
+ return false
72
117
  }
73
- return str
118
+
119
+ const isNegative = input < 0
120
+ if (isNegative) {
121
+ input = -input
122
+ }
123
+
124
+ const baht = Math.floor(input)
125
+ const satang = Number.isInteger(input)
126
+ ? 0
127
+ : Math.floor(((input + Number.EPSILON * (baht || 1)) * 100) % 100)
128
+ const bahtStr = baht.toString() // slightly faster than String(baht)
129
+
130
+ return { baht, bahtStr, satang, isNegative }
74
131
  }
75
132
 
76
133
  /**
77
- * bahtxtCombine baht and satang
78
- * and also adding unit
79
- *
80
134
  * @private
81
- * @param {string} baht
82
- * @param {string} satang
83
- * @returns {string}
135
+ * Handle string input and extract baht/satang values
136
+ * @param {string} input - string input (numeric string, positive or negative)
137
+ * @returns {{baht: number, bahtStr: string, satang: number, isNegative: boolean} | false}
84
138
  */
85
- function bahtxtCombine (baht, satang) {
86
- if (!baht && !satang) {
87
- return bahtxtConst.defaultResult
88
- } else if (baht && !satang) {
89
- return baht + 'บาท' + 'ถ้วน'
90
- } else if (!baht && satang) {
91
- return satang + 'สตางค์'
139
+ function handleStringInput (input) {
140
+ let formatted = input.trim()
141
+
142
+ if (formatted.startsWith('-')) {
143
+ formatted = formatted.replace(/^-0+/, '-') // keep sign, drop leading zeros
144
+ if (formatted === '-') formatted = '0' // catch "-" or "-0"
92
145
  } else {
93
- return baht + 'บาท' + satang + 'สตางค์'
146
+ formatted = formatted.replace(/^0+/, '') || '0' // combine with empty check
94
147
  }
148
+
149
+ // Not a valid number?
150
+ if (formatted === '') formatted = '0'
151
+ let inputNum = Number(formatted)
152
+ if (Number.isNaN(inputNum)) return false
153
+
154
+ const isNegative = inputNum < 0
155
+ if (isNegative) {
156
+ inputNum = -inputNum
157
+ // remove sign for string slicing later
158
+ formatted = formatted.slice(1)
159
+ }
160
+
161
+ // Safe-range check after absolute value
162
+ if (inputNum < Number.MIN_SAFE_INTEGER || inputNum > Number.MAX_SAFE_INTEGER) {
163
+ return false
164
+ }
165
+
166
+ let baht, bahtStr, satang, satangStr
167
+
168
+ // Handle decimal part by string slicing to avoid FP errors
169
+ const periodIdx = formatted.lastIndexOf('.')
170
+ if (periodIdx !== -1) {
171
+ bahtStr = formatted.slice(0, periodIdx) || '0'
172
+ baht = Number(bahtStr)
173
+
174
+ satangStr = formatted.slice(periodIdx + 1)
175
+ satang = satangStr
176
+ ? Number(satangStr.slice(0, 2)) * (satangStr.length >= 2 ? 1 : [100, 10][satangStr.length])
177
+ : 0
178
+ } else {
179
+ baht = inputNum
180
+ bahtStr = formatted
181
+ satang = 0
182
+ }
183
+
184
+ return { baht, bahtStr, satang, isNegative }
95
185
  }
96
186
 
97
187
  /**
98
- * Change number to Thai pronunciation string
99
- *
100
- * @public
101
- * @param {number} num
102
- * @returns {string}
188
+ * @private
189
+ * Format satang portion of the output
190
+ * @param {number} baht - baht amount
191
+ * @param {number} satang - satang amount
192
+ * @returns {string} formatted satang string
103
193
  */
104
- function bahttext (num) {
105
- if (num === null || num === undefined || // explicit null/undefined check, allow 0
106
- typeof num === 'boolean' || // no boolean
107
- isNaN(Number(num)) || // must be numeric coercible
108
- num < Number.MIN_SAFE_INTEGER || // outside JS safe integer range
109
- num > Number.MAX_SAFE_INTEGER
110
- ) {
111
- return bahtxtConst.defaultResult
194
+ function formatSatang (baht, satang) {
195
+ if (satang) {
196
+ let output = ''
197
+ if (baht) output += 'บาท'
198
+ output += SUB_HUNDRED[satang] + 'สตางค์'
199
+ return output
200
+ } else {
201
+ return 'บาทถ้วน'
112
202
  }
203
+ }
113
204
 
114
- // normalise sign & prepare parts
115
- const positiveNum = Math.abs(Number(num))
205
+ /**
206
+ * @private
207
+ * Returns false when input cannot be parsed as numeric.
208
+ */
209
+ function convertInternal (input) {
210
+ let baht, bahtStr, satang
211
+ let isNegative = false
116
212
 
117
- const bahtPart = Math.floor(positiveNum)
213
+ if (typeof input === 'number') {
214
+ // Numeric input handling
215
+ const result = handleNumericInput(input)
216
+ if (result === false) return false
118
217
 
119
- const bahtStr = String(bahtPart)
120
- // Keep original rounding behaviour ("toFixed(0)") to avoid output drift
121
- const satangStr = (positiveNum % 1 * 100).toFixed(0)
218
+ baht = result.baht
219
+ bahtStr = result.bahtStr
220
+ satang = result.satang
221
+ isNegative = result.isNegative
222
+ } else if (typeof input === 'string') {
223
+ // String input handling
224
+ const result = handleStringInput(input)
225
+ if (result === false) return false
122
226
 
123
- // Convert directly without creating intermediate digit arrays
124
- let baht = bahtxtNum2Word(bahtStr)
125
- let satang = bahtxtNum2Word(satangStr)
227
+ baht = result.baht
228
+ bahtStr = result.bahtStr
229
+ satang = result.satang
230
+ isNegative = result.isNegative
231
+ } else {
232
+ // unreachable due to early guard, but for safety
233
+ return false
234
+ }
126
235
 
127
- // grammar
128
- baht = bahtxtGrammarFix(baht)
129
- satang = bahtxtGrammarFix(satang)
236
+ // No value at all → zero
237
+ if (!baht && !satang) {
238
+ return DEFAULT_RESULT
239
+ }
130
240
 
131
- // combine
132
- const result = bahtxtCombine(baht, satang)
241
+ // Build output
242
+ let output = isNegative ? 'ลบ' : EMPTY
133
243
 
134
- return num >= 0 ? result : 'ลบ' + result
135
- }
244
+ // Baht part using fast converter
245
+ const bahtWords = numberToWords(bahtStr)
246
+ output += bahtWords
136
247
 
137
- if (typeof module !== 'undefined' &&
138
- module.exports != null) {
139
- module.exports = {
140
- bahttext,
248
+ // Satang
249
+ output += formatSatang(baht, satang)
141
250
 
142
- // export for testing only
143
- bahtxtNum2Word,
144
- bahtxtGrammarFix,
145
- bahtxtCombine
146
- }
147
- exports.default = {
148
- bahttext
149
- }
251
+ return output
150
252
  }
253
+
254
+ module.exports = {
255
+ bahttext,
256
+ // Export private functions for testing
257
+ handleNumericInput,
258
+ handleStringInput,
259
+ formatSatang
260
+ }
261
+
262
+ exports.default = { bahttext }