n2words 1.24.0 → 2.0.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.
Files changed (349) hide show
  1. package/README.md +285 -156
  2. package/dist/ArabicConverter.js +3 -0
  3. package/dist/ArabicConverter.js.map +1 -0
  4. package/dist/AzerbaijaniConverter.js +3 -0
  5. package/dist/AzerbaijaniConverter.js.map +1 -0
  6. package/dist/BanglaConverter.js +3 -0
  7. package/dist/BanglaConverter.js.map +1 -0
  8. package/dist/BiblicalHebrewConverter.js +3 -0
  9. package/dist/BiblicalHebrewConverter.js.map +1 -0
  10. package/dist/CroatianConverter.js +3 -0
  11. package/dist/CroatianConverter.js.map +1 -0
  12. package/dist/CzechConverter.js +3 -0
  13. package/dist/CzechConverter.js.map +1 -0
  14. package/dist/DanishConverter.js +3 -0
  15. package/dist/DanishConverter.js.map +1 -0
  16. package/dist/DutchConverter.js +3 -0
  17. package/dist/DutchConverter.js.map +1 -0
  18. package/dist/EnglishConverter.js +3 -0
  19. package/dist/EnglishConverter.js.map +1 -0
  20. package/dist/FilipinoConverter.js +3 -0
  21. package/dist/FilipinoConverter.js.map +1 -0
  22. package/dist/FrenchBelgiumConverter.js +3 -0
  23. package/dist/FrenchBelgiumConverter.js.map +1 -0
  24. package/dist/FrenchConverter.js +3 -0
  25. package/dist/FrenchConverter.js.map +1 -0
  26. package/dist/GermanConverter.js +3 -0
  27. package/dist/GermanConverter.js.map +1 -0
  28. package/dist/GreekConverter.js +3 -0
  29. package/dist/GreekConverter.js.map +1 -0
  30. package/dist/GujaratiConverter.js +3 -0
  31. package/dist/GujaratiConverter.js.map +1 -0
  32. package/dist/HebrewConverter.js +3 -0
  33. package/dist/HebrewConverter.js.map +1 -0
  34. package/dist/HindiConverter.js +3 -0
  35. package/dist/HindiConverter.js.map +1 -0
  36. package/dist/HungarianConverter.js +3 -0
  37. package/dist/HungarianConverter.js.map +1 -0
  38. package/dist/IndonesianConverter.js +3 -0
  39. package/dist/IndonesianConverter.js.map +1 -0
  40. package/dist/ItalianConverter.js +3 -0
  41. package/dist/ItalianConverter.js.map +1 -0
  42. package/dist/JapaneseConverter.js +3 -0
  43. package/dist/JapaneseConverter.js.map +1 -0
  44. package/dist/KannadaConverter.js +3 -0
  45. package/dist/KannadaConverter.js.map +1 -0
  46. package/dist/KoreanConverter.js +3 -0
  47. package/dist/KoreanConverter.js.map +1 -0
  48. package/dist/LatvianConverter.js +3 -0
  49. package/dist/LatvianConverter.js.map +1 -0
  50. package/dist/LithuanianConverter.js +3 -0
  51. package/dist/LithuanianConverter.js.map +1 -0
  52. package/dist/MalayConverter.js +3 -0
  53. package/dist/MalayConverter.js.map +1 -0
  54. package/dist/MarathiConverter.js +3 -0
  55. package/dist/MarathiConverter.js.map +1 -0
  56. package/dist/NorwegianBokmalConverter.js +3 -0
  57. package/dist/NorwegianBokmalConverter.js.map +1 -0
  58. package/dist/PersianConverter.js +3 -0
  59. package/dist/PersianConverter.js.map +1 -0
  60. package/dist/PolishConverter.js +3 -0
  61. package/dist/PolishConverter.js.map +1 -0
  62. package/dist/PortugueseConverter.js +3 -0
  63. package/dist/PortugueseConverter.js.map +1 -0
  64. package/dist/PunjabiConverter.js +3 -0
  65. package/dist/PunjabiConverter.js.map +1 -0
  66. package/dist/RomanianConverter.js +3 -0
  67. package/dist/RomanianConverter.js.map +1 -0
  68. package/dist/RussianConverter.js +3 -0
  69. package/dist/RussianConverter.js.map +1 -0
  70. package/dist/SerbianCyrillicConverter.js +3 -0
  71. package/dist/SerbianCyrillicConverter.js.map +1 -0
  72. package/dist/SerbianLatinConverter.js +3 -0
  73. package/dist/SerbianLatinConverter.js.map +1 -0
  74. package/dist/SimplifiedChineseConverter.js +3 -0
  75. package/dist/SimplifiedChineseConverter.js.map +1 -0
  76. package/dist/SpanishConverter.js +3 -0
  77. package/dist/SpanishConverter.js.map +1 -0
  78. package/dist/SwahiliConverter.js +3 -0
  79. package/dist/SwahiliConverter.js.map +1 -0
  80. package/dist/SwedishConverter.js +3 -0
  81. package/dist/SwedishConverter.js.map +1 -0
  82. package/dist/TamilConverter.js +3 -0
  83. package/dist/TamilConverter.js.map +1 -0
  84. package/dist/TeluguConverter.js +3 -0
  85. package/dist/TeluguConverter.js.map +1 -0
  86. package/dist/ThaiConverter.js +3 -0
  87. package/dist/ThaiConverter.js.map +1 -0
  88. package/dist/TraditionalChineseConverter.js +3 -0
  89. package/dist/TraditionalChineseConverter.js.map +1 -0
  90. package/dist/TurkishConverter.js +3 -0
  91. package/dist/TurkishConverter.js.map +1 -0
  92. package/dist/UkrainianConverter.js +3 -0
  93. package/dist/UkrainianConverter.js.map +1 -0
  94. package/dist/UrduConverter.js +3 -0
  95. package/dist/UrduConverter.js.map +1 -0
  96. package/dist/VietnameseConverter.js +3 -0
  97. package/dist/VietnameseConverter.js.map +1 -0
  98. package/dist/n2words.js +3 -2
  99. package/dist/n2words.js.map +1 -1
  100. package/lib/classes/abstract-language.d.ts +178 -0
  101. package/lib/classes/abstract-language.js +192 -185
  102. package/lib/classes/greedy-scale-language.d.ts +109 -0
  103. package/lib/classes/greedy-scale-language.js +96 -90
  104. package/lib/classes/slavic-language.d.ts +148 -0
  105. package/lib/classes/slavic-language.js +136 -106
  106. package/lib/classes/south-asian-language.d.ts +70 -0
  107. package/lib/classes/south-asian-language.js +58 -65
  108. package/lib/classes/turkic-language.d.ts +26 -0
  109. package/lib/classes/turkic-language.js +22 -26
  110. package/lib/languages/ar.d.ts +30 -0
  111. package/lib/languages/ar.js +49 -133
  112. package/lib/languages/az.d.ts +12 -0
  113. package/lib/languages/az.js +7 -23
  114. package/lib/languages/bn.d.ts +11 -0
  115. package/lib/languages/bn.js +12 -7
  116. package/lib/languages/cs.d.ts +88 -0
  117. package/lib/languages/cs.js +44 -113
  118. package/lib/languages/da.d.ts +15 -0
  119. package/lib/languages/da.js +40 -87
  120. package/lib/languages/de.d.ts +14 -0
  121. package/lib/languages/de.js +34 -68
  122. package/lib/languages/el.d.ts +14 -0
  123. package/lib/languages/el.js +22 -48
  124. package/lib/languages/en.d.ts +16 -0
  125. package/lib/languages/en.js +22 -59
  126. package/lib/languages/es.d.ts +15 -0
  127. package/lib/languages/es.js +49 -81
  128. package/lib/languages/fa.d.ts +47 -0
  129. package/lib/languages/fa.js +90 -73
  130. package/lib/languages/fil.d.ts +16 -0
  131. package/lib/languages/fil.js +35 -76
  132. package/lib/languages/fr-BE.d.ts +11 -0
  133. package/lib/languages/fr-BE.js +15 -51
  134. package/lib/languages/fr.d.ts +15 -0
  135. package/lib/languages/fr.js +33 -72
  136. package/lib/languages/gu.d.ts +11 -0
  137. package/lib/languages/gu.js +10 -34
  138. package/lib/languages/hbo.d.ts +113 -0
  139. package/lib/languages/hbo.js +251 -0
  140. package/lib/languages/he.d.ts +80 -0
  141. package/lib/languages/he.js +41 -164
  142. package/lib/languages/hi.d.ts +11 -0
  143. package/lib/languages/hi.js +12 -7
  144. package/lib/languages/hr.d.ts +80 -0
  145. package/lib/languages/hr.js +51 -95
  146. package/lib/languages/hu.d.ts +22 -0
  147. package/lib/languages/hu.js +35 -53
  148. package/lib/languages/id.d.ts +37 -0
  149. package/lib/languages/id.js +29 -44
  150. package/lib/languages/it.d.ts +37 -0
  151. package/lib/languages/it.js +36 -52
  152. package/lib/languages/ja.d.ts +17 -0
  153. package/lib/languages/ja.js +22 -75
  154. package/lib/languages/kn.d.ts +11 -0
  155. package/lib/languages/kn.js +10 -39
  156. package/lib/languages/ko.d.ts +14 -0
  157. package/lib/languages/ko.js +17 -45
  158. package/lib/languages/lt.d.ts +70 -0
  159. package/lib/languages/lt.js +28 -63
  160. package/lib/languages/lv.d.ts +70 -0
  161. package/lib/languages/lv.js +35 -58
  162. package/lib/languages/mr.d.ts +11 -0
  163. package/lib/languages/mr.js +10 -34
  164. package/lib/languages/ms.d.ts +31 -0
  165. package/lib/languages/ms.js +24 -20
  166. package/lib/languages/nb.d.ts +12 -0
  167. package/lib/languages/nb.js +36 -56
  168. package/lib/languages/nl.d.ts +16 -0
  169. package/lib/languages/nl.js +58 -109
  170. package/lib/languages/pa.d.ts +11 -0
  171. package/lib/languages/{pa-Guru.js → pa.js} +12 -7
  172. package/lib/languages/pl.d.ts +80 -0
  173. package/lib/languages/pl.js +26 -105
  174. package/lib/languages/pt.d.ts +29 -0
  175. package/lib/languages/pt.js +29 -64
  176. package/lib/languages/ro.d.ts +158 -0
  177. package/lib/languages/ro.js +60 -167
  178. package/lib/languages/ru.d.ts +85 -0
  179. package/lib/languages/ru.js +17 -37
  180. package/lib/languages/sr-Cyrl.d.ts +80 -0
  181. package/lib/languages/sr-Cyrl.js +113 -0
  182. package/lib/languages/sr-Latn.d.ts +80 -0
  183. package/lib/languages/sr-Latn.js +54 -98
  184. package/lib/languages/sv.d.ts +14 -0
  185. package/lib/languages/sv.js +26 -63
  186. package/lib/languages/sw.d.ts +39 -0
  187. package/lib/languages/sw.js +26 -21
  188. package/lib/languages/ta.d.ts +20 -0
  189. package/lib/languages/ta.js +26 -26
  190. package/lib/languages/te.d.ts +22 -0
  191. package/lib/languages/te.js +28 -38
  192. package/lib/languages/th.d.ts +17 -0
  193. package/lib/languages/th.js +25 -31
  194. package/lib/languages/tr.d.ts +12 -0
  195. package/lib/languages/tr.js +11 -38
  196. package/lib/languages/uk.d.ts +85 -0
  197. package/lib/languages/uk.js +18 -44
  198. package/lib/languages/ur.d.ts +11 -0
  199. package/lib/languages/ur.js +12 -7
  200. package/lib/languages/vi.d.ts +72 -0
  201. package/lib/languages/vi.js +25 -71
  202. package/lib/languages/zh-Hans.d.ts +21 -0
  203. package/lib/languages/zh-Hans.js +33 -87
  204. package/lib/languages/zh-Hant.d.ts +21 -0
  205. package/lib/languages/zh-Hant.js +111 -0
  206. package/lib/n2words.d.ts +209 -0
  207. package/lib/n2words.js +474 -191
  208. package/package.json +106 -67
  209. package/dist/languages/ar.js +0 -2
  210. package/dist/languages/ar.js.map +0 -1
  211. package/dist/languages/az.js +0 -2
  212. package/dist/languages/az.js.map +0 -1
  213. package/dist/languages/bn.js +0 -2
  214. package/dist/languages/bn.js.map +0 -1
  215. package/dist/languages/cs.js +0 -2
  216. package/dist/languages/cs.js.map +0 -1
  217. package/dist/languages/da.js +0 -2
  218. package/dist/languages/da.js.map +0 -1
  219. package/dist/languages/de.js +0 -2
  220. package/dist/languages/de.js.map +0 -1
  221. package/dist/languages/el.js +0 -2
  222. package/dist/languages/el.js.map +0 -1
  223. package/dist/languages/en.js +0 -2
  224. package/dist/languages/en.js.map +0 -1
  225. package/dist/languages/es.js +0 -2
  226. package/dist/languages/es.js.map +0 -1
  227. package/dist/languages/fa.js +0 -2
  228. package/dist/languages/fa.js.map +0 -1
  229. package/dist/languages/fil.js +0 -2
  230. package/dist/languages/fil.js.map +0 -1
  231. package/dist/languages/fr-BE.js +0 -2
  232. package/dist/languages/fr-BE.js.map +0 -1
  233. package/dist/languages/fr.js +0 -2
  234. package/dist/languages/fr.js.map +0 -1
  235. package/dist/languages/gu.js +0 -2
  236. package/dist/languages/gu.js.map +0 -1
  237. package/dist/languages/he.js +0 -2
  238. package/dist/languages/he.js.map +0 -1
  239. package/dist/languages/hi.js +0 -2
  240. package/dist/languages/hi.js.map +0 -1
  241. package/dist/languages/hr.js +0 -2
  242. package/dist/languages/hr.js.map +0 -1
  243. package/dist/languages/hu.js +0 -2
  244. package/dist/languages/hu.js.map +0 -1
  245. package/dist/languages/id.js +0 -2
  246. package/dist/languages/id.js.map +0 -1
  247. package/dist/languages/it.js +0 -2
  248. package/dist/languages/it.js.map +0 -1
  249. package/dist/languages/ja.js +0 -2
  250. package/dist/languages/ja.js.map +0 -1
  251. package/dist/languages/kn.js +0 -2
  252. package/dist/languages/kn.js.map +0 -1
  253. package/dist/languages/ko.js +0 -2
  254. package/dist/languages/ko.js.map +0 -1
  255. package/dist/languages/lt.js +0 -2
  256. package/dist/languages/lt.js.map +0 -1
  257. package/dist/languages/lv.js +0 -2
  258. package/dist/languages/lv.js.map +0 -1
  259. package/dist/languages/mr.js +0 -2
  260. package/dist/languages/mr.js.map +0 -1
  261. package/dist/languages/ms.js +0 -2
  262. package/dist/languages/ms.js.map +0 -1
  263. package/dist/languages/nb.js +0 -2
  264. package/dist/languages/nb.js.map +0 -1
  265. package/dist/languages/nl.js +0 -2
  266. package/dist/languages/nl.js.map +0 -1
  267. package/dist/languages/pa-Guru.js +0 -2
  268. package/dist/languages/pa-Guru.js.map +0 -1
  269. package/dist/languages/pl.js +0 -2
  270. package/dist/languages/pl.js.map +0 -1
  271. package/dist/languages/pt.js +0 -2
  272. package/dist/languages/pt.js.map +0 -1
  273. package/dist/languages/ro.js +0 -2
  274. package/dist/languages/ro.js.map +0 -1
  275. package/dist/languages/ru.js +0 -2
  276. package/dist/languages/ru.js.map +0 -1
  277. package/dist/languages/sr-Latn.js +0 -2
  278. package/dist/languages/sr-Latn.js.map +0 -1
  279. package/dist/languages/sv.js +0 -2
  280. package/dist/languages/sv.js.map +0 -1
  281. package/dist/languages/sw.js +0 -2
  282. package/dist/languages/sw.js.map +0 -1
  283. package/dist/languages/ta.js +0 -2
  284. package/dist/languages/ta.js.map +0 -1
  285. package/dist/languages/te.js +0 -2
  286. package/dist/languages/te.js.map +0 -1
  287. package/dist/languages/th.js +0 -2
  288. package/dist/languages/th.js.map +0 -1
  289. package/dist/languages/tr.js +0 -2
  290. package/dist/languages/tr.js.map +0 -1
  291. package/dist/languages/uk.js +0 -2
  292. package/dist/languages/uk.js.map +0 -1
  293. package/dist/languages/ur.js +0 -2
  294. package/dist/languages/ur.js.map +0 -1
  295. package/dist/languages/vi.js +0 -2
  296. package/dist/languages/vi.js.map +0 -1
  297. package/dist/languages/zh-Hans.js +0 -2
  298. package/dist/languages/zh-Hans.js.map +0 -1
  299. package/typings/classes/abstract-language.d.ts +0 -144
  300. package/typings/classes/greedy-scale-language.d.ts +0 -148
  301. package/typings/classes/slavic-language.d.ts +0 -145
  302. package/typings/classes/south-asian-language.d.ts +0 -101
  303. package/typings/classes/turkic-language.d.ts +0 -42
  304. package/typings/languages/ar.d.ts +0 -93
  305. package/typings/languages/az.d.ts +0 -25
  306. package/typings/languages/bn.d.ts +0 -1
  307. package/typings/languages/cs.d.ts +0 -120
  308. package/typings/languages/da.d.ts +0 -53
  309. package/typings/languages/de.d.ts +0 -26
  310. package/typings/languages/el.d.ts +0 -11
  311. package/typings/languages/en.d.ts +0 -30
  312. package/typings/languages/es.d.ts +0 -43
  313. package/typings/languages/fa.d.ts +0 -81
  314. package/typings/languages/fil.d.ts +0 -12
  315. package/typings/languages/fr-BE.d.ts +0 -41
  316. package/typings/languages/fr.d.ts +0 -43
  317. package/typings/languages/gu.d.ts +0 -12
  318. package/typings/languages/he.d.ts +0 -197
  319. package/typings/languages/hi.d.ts +0 -1
  320. package/typings/languages/hr.d.ts +0 -110
  321. package/typings/languages/hu.d.ts +0 -37
  322. package/typings/languages/id.d.ts +0 -69
  323. package/typings/languages/it.d.ts +0 -51
  324. package/typings/languages/ja.d.ts +0 -58
  325. package/typings/languages/kn.d.ts +0 -11
  326. package/typings/languages/ko.d.ts +0 -25
  327. package/typings/languages/lt.d.ts +0 -110
  328. package/typings/languages/lv.d.ts +0 -99
  329. package/typings/languages/mr.d.ts +0 -12
  330. package/typings/languages/ms.d.ts +0 -37
  331. package/typings/languages/nb.d.ts +0 -27
  332. package/typings/languages/nl.d.ts +0 -65
  333. package/typings/languages/pa-Guru.d.ts +0 -1
  334. package/typings/languages/pl.d.ts +0 -116
  335. package/typings/languages/pt.d.ts +0 -39
  336. package/typings/languages/ro.d.ts +0 -229
  337. package/typings/languages/ru.d.ts +0 -108
  338. package/typings/languages/sr-Latn.d.ts +0 -98
  339. package/typings/languages/sv.d.ts +0 -30
  340. package/typings/languages/sw.d.ts +0 -1
  341. package/typings/languages/ta.d.ts +0 -1
  342. package/typings/languages/te.d.ts +0 -1
  343. package/typings/languages/th.d.ts +0 -1
  344. package/typings/languages/tr.d.ts +0 -46
  345. package/typings/languages/uk.d.ts +0 -117
  346. package/typings/languages/ur.d.ts +0 -1
  347. package/typings/languages/vi.d.ts +0 -116
  348. package/typings/languages/zh-Hans.d.ts +0 -57
  349. package/typings/n2words.d.ts +0 -177
@@ -1,196 +1,228 @@
1
- import AbstractLanguage from './abstract-language.js'
2
-
3
- /**
4
- * @typedef {string[]} SlavicPluralForms
5
- * Array of three plural forms for Slavic languages:
6
- * - [0]: Singular form (for numbers ending in 1, except 11)
7
- * - [1]: Few form (for numbers ending in 2-4, except 12-14)
8
- * - [2]: Many form (for all other numbers: 0, 5-20, and numbers ending in 0, 5-9, 11-19)
9
- */
10
-
11
- /**
12
- * @typedef {Object.<string, SlavicPluralForms>} SlavicThousandsMap
13
- * Mapping from power indices to their plural forms.
14
- * Example: { '0': ['тысяча', 'тысячи', 'тысяч'], '1': ['миллион', 'миллиона', 'миллионов'] }
15
- */
1
+ import { AbstractLanguage } from './abstract-language.js'
16
2
 
17
3
  /**
18
4
  * Base class for Slavic and related languages with complex pluralization.
19
5
  *
20
6
  * This class provides a reusable implementation for languages that share:
21
7
  * - Three-form pluralization (singular/few/many)
22
- * - Gender-aware number forms (masculine/feminine for 1, 2)
23
- * - Hundreds, tens, ones decomposition
24
- * - Chunk-based large number handling (thousands, millions, etc.)
8
+ * - Gender-aware number forms (masculine/feminine for 1-9)
9
+ * - Hundreds, tens, ones decomposition pattern
10
+ * - Segment-based large number handling (thousands, millions, etc.)
25
11
  * - Inherits decimal handling from AbstractLanguage (supports both grouped and
26
- * per-digit modes via the `convertDecimalsPerDigit` class property).
12
+ * per-digit modes via the `usePerDigitDecimals` class property).
27
13
  *
28
- * Used by: Russian, Czech, Polish, Ukrainian, Serbian, Croatian,
29
- * as well as Baltic (Lithuanian, Latvian) and Hebrew languages.
14
+ * Used by: Russian (ru), Czech (cs), Polish (pl), Ukrainian (uk), Serbian (sr-Latn),
15
+ * Croatian (hr), Lithuanian (lt), Latvian (lv), Hebrew (he), and Biblical Hebrew (hbo).
30
16
  *
31
17
  * Subclasses MUST define these properties with language-specific vocabulary:
32
- * - `ones` - Object mapping 1-9 to masculine forms
33
- * - `onesFeminine` - Object mapping 1-9 to feminine forms
34
- * - `tens` - Object mapping 0-9 to teen numbers (10-19)
35
- * - `twenties` - Object mapping 2-9 to tens (20-90)
36
- * - `hundreds` - Object mapping 1-9 to hundreds (100-900)
37
- * - `thousands` - Object mapping power indices to [singular, few, many] forms
38
- * - `feminine` - Boolean indicating if feminine forms should be used (optional)
18
+ * - `onesWords` - Object mapping 1-9 to masculine forms (or default forms)
19
+ * - `onesFeminineWords` - Object mapping 1-9 to feminine forms (if gender distinction exists)
20
+ * - `teensWords` - Object mapping 0-9 to teen numbers (10-19)
21
+ * - `twentiesWords` - Object mapping 2-9 to tens (20-90)
22
+ * - `hundredsWords` - Object mapping 1-9 to hundreds (100-900) or special hundreds handling
23
+ * - `pluralForms` - Object mapping segment indices to [singular, few, many] plural forms
24
+ *
25
+ * Optional properties:
26
+ * - `scaleGenders` - Object mapping segment indices to boolean (true = feminine scale word)
27
+ * If not defined, defaults to thousands (index 1) being feminine, others masculine.
39
28
  *
40
29
  * @abstract
41
30
  * @extends AbstractLanguage
42
31
  */
43
- class SlavicLanguage extends AbstractLanguage {
32
+ export class SlavicLanguage extends AbstractLanguage {
33
+ // ============================================================================
34
+ // Required Properties (subclasses must define)
35
+ // ============================================================================
36
+
44
37
  /**
45
- * Masculine forms for digits 1-9.
38
+ * Masculine forms for digits 1-9 (or default forms if no gender distinction).
46
39
  *
47
- * @type {object}
40
+ * @type {Object.<number, string>}
48
41
  */
49
- ones = {}
42
+ onesWords = {}
50
43
 
51
44
  /**
52
- * Feminine forms for digits 1-9.
45
+ * Feminine forms for digits 1-9 (if language has gender distinction).
53
46
  *
54
- * @type {object}
47
+ * @type {Object.<number, string>}
55
48
  */
56
- onesFeminine = {}
49
+ onesFeminineWords = {}
57
50
 
58
51
  /**
59
- * Words for tens (10, 20, 30, etc.).
52
+ * Words for teen numbers (10-19).
60
53
  *
61
- * @type {object}
54
+ * @type {Object.<number, string>}
62
55
  */
63
- tens = {}
56
+ teensWords = {}
64
57
 
65
58
  /**
66
- * Special forms for 21-29 in some languages.
59
+ * Words for multiples of ten (20, 30, 40, etc.).
67
60
  *
68
- * @type {object}
61
+ * @type {Object.<number, string>}
69
62
  */
70
- twenties = {}
63
+ twentiesWords = {}
71
64
 
72
65
  /**
73
- * Words for hundreds (100, 200, 300, etc.).
66
+ * Words for hundreds (100, 200, 300, etc.) or special hundreds handling.
74
67
  *
75
- * @type {object}
68
+ * @type {Object.<number, string>}
76
69
  */
77
- hundreds = {}
70
+ hundredsWords = {}
78
71
 
79
72
  /**
80
- * Scale words for thousands, millions, etc.
73
+ * Plural forms for scale words (thousands, millions, billions, etc.).
74
+ * Maps segment indices to [singular, few, many] forms.
81
75
  *
82
- * @type {object}
76
+ * @type {Object.<number, string[]>}
83
77
  */
84
- thousands = {}
78
+ pluralForms = {}
79
+
80
+ // ============================================================================
81
+ // Optional Properties (subclasses may override)
82
+ // ============================================================================
85
83
 
86
84
  /**
87
- * Use feminine forms for numbers (affects 1-9).
85
+ * Gender of each scale word.
86
+ * Maps segment indices to boolean: true = feminine, false = masculine.
87
+ * Default is empty (all masculine). Languages with feminine thousands
88
+ * (Russian, Ukrainian, Serbian, Croatian) should set `{ 1: true }`.
89
+ *
90
+ * @type {Object.<number, boolean>}
91
+ */
92
+ scaleGenders = {}
93
+
94
+ /**
95
+ * Whether to omit "one" before scale words (e.g., "thousand" instead of "one thousand").
96
+ * When true, 1000 becomes "tysiąc" (Polish) instead of "jeden tysiąc".
97
+ * Used by Polish, Czech, and similar languages.
88
98
  *
89
99
  * @type {boolean}
90
100
  */
91
- feminine
101
+ omitOneBeforeScale = false
102
+
103
+ // ============================================================================
104
+ // Constructor
105
+ // ============================================================================
92
106
 
93
107
  /**
94
- * Initializes the Slavic language converter with language-specific options.
108
+ * Constructs a SlavicLanguage instance with optional configuration.
95
109
  *
96
- * @param {Object} [options={}] Configuration options.
97
- * @param {boolean} [options.feminine=false] Use feminine forms for numbers (affects gender agreement).
110
+ * @param {Object} [options] Configuration options.
111
+ * @param {('masculine'|'feminine')} [options.gender='masculine'] Grammatical gender for number forms.
98
112
  */
99
- constructor ({ feminine = false } = {}) {
113
+ constructor (options = {}) {
100
114
  super()
101
115
 
102
- this.feminine = feminine
116
+ this.setOptions({
117
+ gender: 'masculine'
118
+ }, options)
103
119
  }
104
120
 
121
+ // ============================================================================
122
+ // Public Methods
123
+ // ============================================================================
124
+
105
125
  /**
106
- * Converts a whole number to its word representation.
126
+ * Converts an integer to its word representation.
107
127
  *
108
128
  * This method implements the Slavic number construction algorithm:
109
- * 1. Split number into 3-digit chunks (right to left)
110
- * 2. For each chunk: convert hundreds, tens, ones
111
- * 3. Apply gender rules for ones (feminine for thousands, or when feminine=true)
112
- * 4. Add pluralized power word (thousand/million/billion/etc.)
129
+ * 1. Split number into 3-digit segments from right to left (567, 234, 1 for 1,234,567)
130
+ * 2. For each segment (processing left to right): convert hundreds, tens, ones
131
+ * 3. Apply gender rules: feminine forms for thousands segment or when feminine=true
132
+ * 4. Add appropriate pluralized scale word (thousand/million/billion/etc.)
113
133
  * 5. Join all parts with spaces
114
134
  *
115
- * @param {bigint} number The whole number to convert (non-negative).
135
+ * @param {bigint} integerPart The integer to convert (non-negative).
116
136
  * @returns {string} The number in words.
117
137
  */
118
- convertWholePart (number) {
119
- if (number === 0n) {
138
+ integerToWords (integerPart) {
139
+ if (integerPart === 0n) {
120
140
  return this.zeroWord
121
141
  }
122
142
 
123
143
  const words = []
124
- const chunks = this.splitByX(number.toString(), 3)
125
- let chunkIndex = chunks.length
144
+ const segments = this.splitToSegments(integerPart.toString(), 3)
145
+ let segmentIndex = segments.length
126
146
 
127
- for (const chunkValue of chunks) {
128
- chunkIndex = chunkIndex - 1
147
+ for (const segmentValue of segments) {
148
+ segmentIndex = segmentIndex - 1
129
149
 
130
- if (chunkValue === 0n) {
150
+ if (segmentValue === 0n) {
131
151
  continue
132
152
  }
133
153
 
134
- const [onesDigit, tensDigit, hundredsDigit] = this.getDigits(chunkValue)
154
+ const [onesDigit, tensDigit, hundredsDigit] = this.extractDigits(segmentValue)
135
155
 
136
156
  if (hundredsDigit > 0n) {
137
- words.push(this.hundreds[hundredsDigit])
157
+ words.push(this.hundredsWords[hundredsDigit])
138
158
  }
139
159
 
140
160
  if (tensDigit > 1n) {
141
- words.push(this.twenties[tensDigit])
161
+ words.push(this.twentiesWords[tensDigit])
142
162
  }
143
163
 
144
164
  // Handle teens (10-19) or ones (1-9)
145
165
  if (tensDigit === 1n) {
146
- // Teens: use tens array directly
147
- words.push(this.tens[onesDigit])
166
+ // Teens: use teensWords array directly
167
+ words.push(this.teensWords[onesDigit])
148
168
  } else if (onesDigit > 0n) {
149
- // Ones: use feminine form for thousands (chunkIndex 1) or when feminine=true (chunkIndex 0)
150
- const onesArray =
151
- chunkIndex === 1 || (this.feminine && chunkIndex === 0)
152
- ? this.onesFeminine
153
- : this.ones
154
- words.push(onesArray[onesDigit])
169
+ // Skip "one" before scale words if omitOneBeforeScale is set
170
+ // e.g., Polish says "tysiąc" not "jeden tysiąc" for 1000
171
+ const shouldOmitOne = this.omitOneBeforeScale && segmentIndex > 0 && segmentValue === 1n
172
+
173
+ if (!shouldOmitOne) {
174
+ // Determine if feminine forms should be used:
175
+ // 1. Check scaleGenders for this segment index (e.g., thousands = index 1)
176
+ // 2. Also use feminine if user requested gender='feminine' for the ones segment
177
+ const isScaleFeminine = this.scaleGenders[segmentIndex] === true
178
+ const isFeminine = isScaleFeminine || (this.options.gender === 'feminine' && segmentIndex === 0)
179
+ const onesArray = isFeminine ? this.onesFeminineWords : this.onesWords
180
+ words.push(onesArray[onesDigit])
181
+ }
155
182
  }
156
183
 
157
184
  // Add power word (thousand, million, etc.) with proper pluralization
158
- if (chunkIndex > 0) {
159
- words.push(this.pluralize(chunkValue, this.thousands[chunkIndex]))
185
+ if (segmentIndex > 0) {
186
+ words.push(this.pluralize(segmentValue, this.pluralForms[segmentIndex]))
160
187
  }
161
188
  }
162
189
 
163
190
  return words.join(' ')
164
191
  }
165
192
 
193
+ // ============================================================================
194
+ // Protected Methods (subclasses may call or override)
195
+ // ============================================================================
196
+
166
197
  /**
167
- * Splits a number string into chunks of X digits.
198
+ * Splits a number string into segments of specified size from right to left.
168
199
  *
169
- * Example: splitByX('1234567', 3) => [1n, 234n, 567n]
200
+ * Example: splitToSegments('1234567', 3) => [1n, 234n, 567n]
201
+ * This represents: 1 million + 234 thousand + 567 ones
170
202
  *
171
203
  * @param {string} numberString The number as a string.
172
- * @param {number} chunkSize Chunk size (typically 3 for thousands grouping).
173
- * @returns {bigint[]} Array of BigInt chunks.
204
+ * @param {number} segmentSize Segment size (typically 3 for thousands grouping).
205
+ * @returns {bigint[]} Array of BigInt segments from highest to lowest scale.
174
206
  */
175
- splitByX (numberString, chunkSize) {
176
- const chunks = []
207
+ splitToSegments (numberString, segmentSize) {
208
+ const segments = []
177
209
  const stringLength = numberString.length
178
210
 
179
- if (stringLength > chunkSize) {
180
- const remainderLength = stringLength % chunkSize
211
+ if (stringLength > segmentSize) {
212
+ const remainderLength = stringLength % segmentSize
181
213
 
182
214
  if (remainderLength > 0) {
183
- chunks.push(BigInt(numberString.slice(0, remainderLength)))
215
+ segments.push(BigInt(numberString.slice(0, remainderLength)))
184
216
  }
185
217
 
186
- for (let i = remainderLength; i < stringLength; i += chunkSize) {
187
- chunks.push(BigInt(numberString.slice(i, i + chunkSize)))
218
+ for (let i = remainderLength; i < stringLength; i += segmentSize) {
219
+ segments.push(BigInt(numberString.slice(i, i + segmentSize)))
188
220
  }
189
221
  } else {
190
- chunks.push(BigInt(numberString))
222
+ segments.push(BigInt(numberString))
191
223
  }
192
224
 
193
- return chunks
225
+ return segments
194
226
  }
195
227
 
196
228
  /**
@@ -202,7 +234,7 @@ class SlavicLanguage extends AbstractLanguage {
202
234
  * @param {bigint} value The number to extract digits from (0-999).
203
235
  * @returns {bigint[]} Array of [ones, tens, hundreds] as BigInts.
204
236
  */
205
- getDigits (value) {
237
+ extractDigits (value) {
206
238
  // Direct BigInt arithmetic is faster than string manipulation
207
239
  const onesPlace = value % 10n
208
240
  const tensPlace = (value / 10n) % 10n
@@ -213,18 +245,18 @@ class SlavicLanguage extends AbstractLanguage {
213
245
  /**
214
246
  * Selects the correct plural form based on Slavic pluralization rules.
215
247
  *
216
- * Slavic languages use three forms:
217
- * - Form 0 (singular): numbers ending in 1 (but not 11)
218
- * - Form 1 (few): numbers ending in 2-4 (but not 12-14)
219
- * - Form 2 (many): all other numbers (0, 5-20, 25-30, etc.)
248
+ * Slavic languages typically use three forms:
249
+ * - Form 0 (singular): numbers ending in 1, except 11 (1, 21, 31, 101...)
250
+ * - Form 1 (few): numbers ending in 2-4, except 12-14 (2-4, 22-24, 32-34...)
251
+ * - Form 2 (many): all other numbers (0, 5-20, 25-30, 100, 111-119...)
220
252
  *
221
- * Examples (Russian):
222
- * - 1, 21, 31... => тысяча (form 0)
223
- * - 2-4, 22-24, 32-34... => тысячи (form 1)
224
- * - 0, 5-20, 25-30... => тысяч (form 2)
253
+ * Examples using Russian тысяча (thousand):
254
+ * - 1, 21, 31... тысяча (form 0, singular)
255
+ * - 2-4, 22-24, 32-34... тысячи (form 1, few)
256
+ * - 0, 5-20, 25-30, 100... тысяч (form 2, many)
225
257
  *
226
- * @param {bigint} n The number to check.
227
- * @param {string[]} forms Array of [singular, few, many] forms.
258
+ * @param {bigint} number The number to check.
259
+ * @param {string[]} pluralForms Array of [singular, few, many] forms.
228
260
  * @returns {string} The appropriate form for the number.
229
261
  */
230
262
  pluralize (number, pluralForms) {
@@ -247,5 +279,3 @@ class SlavicLanguage extends AbstractLanguage {
247
279
  return pluralForms[2] // Many
248
280
  }
249
281
  }
250
-
251
- export default SlavicLanguage
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Base class for South Asian languages with shared grouping patterns.
3
+ *
4
+ * This class provides a reusable implementation for South Asian languages that share:
5
+ * - Indian-style number grouping: last 3 digits, then 2-2 (1,23,45,67,89)
6
+ * - Lakh (100,000), Crore (10,000,000), Arab (1,000,000,000) scale words
7
+ * - Standard negative and decimal handling (inherits AbstractLanguage decimal logic,
8
+ * including `usePerDigitDecimals` support when set by subclasses)
9
+ *
10
+ * Used by: Hindi (hi), Bengali (bn), Urdu (ur), Punjabi (pa), Marathi (mr), Gujarati (gu), Kannada (kn)
11
+ *
12
+ * Subclasses MUST define language-specific vocabulary via class properties:
13
+ * - `belowHundredWords` array with digit and teen words (0-99)
14
+ * - `hundredWord` string used inside `segmentToWords`
15
+ * - `scaleWords` array with grouping words (hazaar, lakh, crore, etc.) indexed by grouping level
16
+ * - `negativeWord`, `decimalSeparatorWord`, `zeroWord`, `wordSeparator`
17
+ *
18
+ * @abstract
19
+ * @extends AbstractLanguage
20
+ */
21
+ export class SouthAsianLanguage extends AbstractLanguage {
22
+ /**
23
+ * Array of words for numbers 0-99 (digits and teens).
24
+ * Index directly: belowHundredWords[0] through belowHundredWords[99].
25
+ * @type {Array<string>}
26
+ */
27
+ belowHundredWords: Array<string>;
28
+ /**
29
+ * Word for "hundred" in the language (e.g., 'सौ' in Hindi, 'শত' in Bengali).
30
+ * Used to construct hundreds (e.g., "1 hundred", "2 hundred").
31
+ * @type {string}
32
+ */
33
+ hundredWord: string;
34
+ /**
35
+ * Array of scale words for Indian-style grouping (hazaar, lakh, crore, arab, etc.).
36
+ * Index 0 contains empty string (ones place has no scale word).
37
+ * Index 1 is for thousands, Index 2 for lakhs, Index 3 for crores, etc.
38
+ * @type {Array<string>}
39
+ */
40
+ scaleWords: Array<string>;
41
+ /**
42
+ * Splits a number into Indian numbering system segments.
43
+ *
44
+ * The Indian system segments differently than Western (3-3-3) systems:
45
+ * - First segment (rightmost): Up to 3 digits (ones, tens, hundreds)
46
+ * - Subsequent segments: Exactly 2 digits each (thousands, lakhs, crores, etc.)
47
+ *
48
+ * This creates the familiar Indian comma pattern: 1,23,45,67,890
49
+ *
50
+ * @protected
51
+ * @param {bigint} integerPart The integer to split into segments.
52
+ * @returns {Array<number>} Array of segments from most significant to least significant.
53
+ *
54
+ * @example
55
+ * // splitToSegments(1234567n) → [12, 34, 567]
56
+ * // Reads as: 12 lakhs, 34 thousands, 567 units
57
+ * // splitToSegments(98765432n) → [9, 87, 65, 432]
58
+ * // Reads as: 9 crores, 87 lakhs, 65 thousands, 432 units
59
+ */
60
+ protected splitToSegments(integerPart: bigint): Array<number>;
61
+ /**
62
+ * Converts a segment (0-999) to words.
63
+ *
64
+ * @protected
65
+ * @param {number} segmentValue Value between 0 and 999.
66
+ * @returns {string} Language-specific word representation.
67
+ */
68
+ protected segmentToWords(segmentValue: number): string;
69
+ }
70
+ import { AbstractLanguage } from './abstract-language.js';
@@ -1,21 +1,4 @@
1
- import AbstractLanguage from './abstract-language.js'
2
-
3
- /**
4
- * @typedef {Array<string>} SouthAsianScaleWords
5
- * Array of scale words for the Indian numbering system, in ascending order.
6
- * - Index 0: Usually empty/unused (ones place)
7
- * - Index 1: Thousands (hazaar/হাজার/हजार)
8
- * - Index 2: Lakhs (lakh/লাখ/लाख)
9
- * - Index 3: Crores (crore/কোটি/करोड़)
10
- * - Index 4: Arabs (arab/আরব/अरब)
11
- * Each index i represents the scale word for groups at position i in the Indian system.
12
- */
13
-
14
- /**
15
- * @typedef {Array<string>} SouthAsianBelowHundred
16
- * Array of words for numbers 0-99, indexed directly.
17
- * belowHundred[0] = word for 0, belowHundred[42] = word for 42, etc.
18
- */
1
+ import { AbstractLanguage } from './abstract-language.js'
19
2
 
20
3
  /**
21
4
  * Base class for South Asian languages with shared grouping patterns.
@@ -24,26 +7,30 @@ import AbstractLanguage from './abstract-language.js'
24
7
  * - Indian-style number grouping: last 3 digits, then 2-2 (1,23,45,67,89)
25
8
  * - Lakh (100,000), Crore (10,000,000), Arab (1,000,000,000) scale words
26
9
  * - Standard negative and decimal handling (inherits AbstractLanguage decimal logic,
27
- * including `convertDecimalsPerDigit` support when set by subclasses)
10
+ * including `usePerDigitDecimals` support when set by subclasses)
28
11
  *
29
12
  * Used by: Hindi (hi), Bengali (bn), Urdu (ur), Punjabi (pa), Marathi (mr), Gujarati (gu), Kannada (kn)
30
13
  *
31
14
  * Subclasses MUST define language-specific vocabulary via class properties:
32
- * - `belowHundred` array with digit and teen words (0-99)
33
- * - `hundredWord` string used inside `convertBelowThousand`
15
+ * - `belowHundredWords` array with digit and teen words (0-99)
16
+ * - `hundredWord` string used inside `segmentToWords`
34
17
  * - `scaleWords` array with grouping words (hazaar, lakh, crore, etc.) indexed by grouping level
35
18
  * - `negativeWord`, `decimalSeparatorWord`, `zeroWord`, `wordSeparator`
36
19
  *
37
20
  * @abstract
38
21
  * @extends AbstractLanguage
39
22
  */
40
- class SouthAsianLanguage extends AbstractLanguage {
23
+ export class SouthAsianLanguage extends AbstractLanguage {
24
+ // ============================================================================
25
+ // Required Properties (subclasses must define)
26
+ // ============================================================================
27
+
41
28
  /**
42
29
  * Array of words for numbers 0-99 (digits and teens).
43
- * Index directly: belowHundred[0] through belowHundred[99].
30
+ * Index directly: belowHundredWords[0] through belowHundredWords[99].
44
31
  * @type {Array<string>}
45
32
  */
46
- belowHundred
33
+ belowHundredWords
47
34
 
48
35
  /**
49
36
  * Word for "hundred" in the language (e.g., 'सौ' in Hindi, 'শত' in Bengali).
@@ -54,101 +41,109 @@ class SouthAsianLanguage extends AbstractLanguage {
54
41
 
55
42
  /**
56
43
  * Array of scale words for Indian-style grouping (hazaar, lakh, crore, arab, etc.).
57
- * Index 0 is typically unused (ones place, no scale word).
44
+ * Index 0 contains empty string (ones place has no scale word).
58
45
  * Index 1 is for thousands, Index 2 for lakhs, Index 3 for crores, etc.
59
46
  * @type {Array<string>}
60
47
  */
61
48
  scaleWords
62
49
 
50
+ // ============================================================================
51
+ // Protected Methods (subclasses may call or override)
52
+ // ============================================================================
53
+
63
54
  /**
64
- * Split a number into Indian numbering system groups.
55
+ * Splits a number into Indian numbering system segments.
65
56
  *
66
- * The Indian system groups differently than Western (3-3-3) systems:
67
- * - First group (rightmost): Up to 3 digits (ones, tens, hundreds)
68
- * - Subsequent groups: Exactly 2 digits each (thousands, lakhs, crores, etc.)
57
+ * The Indian system segments differently than Western (3-3-3) systems:
58
+ * - First segment (rightmost): Up to 3 digits (ones, tens, hundreds)
59
+ * - Subsequent segments: Exactly 2 digits each (thousands, lakhs, crores, etc.)
69
60
  *
70
61
  * This creates the familiar Indian comma pattern: 1,23,45,67,890
71
62
  *
72
63
  * @protected
73
- * @param {bigint} number The number to split into groups
74
- * @returns {Array<number>} Array of groups from most significant to least significant
64
+ * @param {bigint} integerPart The integer to split into segments.
65
+ * @returns {Array<number>} Array of segments from most significant to least significant.
75
66
  *
76
67
  * @example
77
- * // splitToGroups(1234567n) → [12, 34, 567]
68
+ * // splitToSegments(1234567n) → [12, 34, 567]
78
69
  * // Reads as: 12 lakhs, 34 thousands, 567 units
79
- * // splitToGroups(98765432n) → [9, 87, 65, 432]
70
+ * // splitToSegments(98765432n) → [9, 87, 65, 432]
80
71
  * // Reads as: 9 crores, 87 lakhs, 65 thousands, 432 units
81
72
  */
82
- splitToGroups (number) {
83
- const numStr = number.toString()
73
+ splitToSegments (integerPart) {
74
+ const numStr = integerPart.toString()
84
75
 
85
76
  if (numStr.length <= 3) {
86
77
  return [Number(numStr)]
87
78
  }
88
79
 
89
- const groups = []
80
+ const segments = []
90
81
  const last3 = numStr.slice(-3)
91
- groups.unshift(Number(last3))
82
+ segments.unshift(Number(last3))
92
83
 
93
84
  let remaining = numStr.slice(0, -3)
94
85
  while (remaining.length > 0) {
95
- const group = remaining.slice(-2)
96
- groups.unshift(Number(group))
86
+ const segment = remaining.slice(-2)
87
+ segments.unshift(Number(segment))
97
88
  remaining = remaining.slice(0, -2)
98
89
  }
99
90
 
100
- return groups
91
+ return segments
101
92
  }
102
93
 
103
94
  /**
104
- * Convert a number below 1000 to words (0-999).
95
+ * Converts a segment (0-999) to words.
105
96
  *
106
97
  * @protected
107
- * @param {number} number Value between 0 and 999
108
- * @returns {string} Language-specific word representation
98
+ * @param {number} segmentValue Value between 0 and 999.
99
+ * @returns {string} Language-specific word representation.
109
100
  */
110
- convertBelowThousand (number) {
111
- if (number === 0) return ''
112
- if (number < 100) return this.belowHundred[number]
101
+ segmentToWords (segmentValue) {
102
+ if (segmentValue === 0) return ''
103
+ if (segmentValue < 100) return this.belowHundredWords[segmentValue]
113
104
 
114
- const hundreds = Math.trunc(number / 100)
115
- const remainder = number % 100
105
+ const hundreds = Math.trunc(segmentValue / 100)
106
+ const remainder = segmentValue % 100
116
107
  const parts = []
117
108
 
118
109
  if (hundreds === 1) {
119
- parts.push(this.belowHundred[1] + ' ' + this.hundredWord)
110
+ parts.push(this.belowHundredWords[1] + ' ' + this.hundredWord)
120
111
  } else {
121
- parts.push(this.belowHundred[hundreds] + ' ' + this.hundredWord)
112
+ parts.push(this.belowHundredWords[hundreds] + ' ' + this.hundredWord)
122
113
  }
123
114
 
124
115
  if (remainder > 0) {
125
- parts.push(this.belowHundred[remainder])
116
+ parts.push(this.belowHundredWords[remainder])
126
117
  }
127
118
 
128
119
  return parts.join(' ')
129
120
  }
130
121
 
122
+ // ============================================================================
123
+ // Public Methods
124
+ // ============================================================================
125
+
131
126
  /**
132
- * Convert whole number to cardinal words using South Asian grouping.
127
+ * Converts integer to cardinal words using South Asian grouping.
133
128
  *
134
- * @param {bigint} number Number to convert
135
- * @returns {string} Cardinal representation
129
+ * @param {bigint} integerPart Number to convert.
130
+ * @returns {string} Cardinal representation.
136
131
  */
137
- convertWholePart (number) {
138
- if (number === 0n) {
132
+ integerToWords (integerPart) {
133
+ if (integerPart === 0n) {
139
134
  return this.zeroWord
140
135
  }
141
136
 
142
- const groups = this.splitToGroups(number)
143
- const groupCount = groups.length
137
+ const segments = this.splitToSegments(integerPart)
138
+ const segmentCount = segments.length
144
139
  const words = []
145
140
 
146
- for (let i = 0; i < groupCount; i++) {
147
- const groupValue = groups[i]
148
- if (groupValue === 0) continue
141
+ for (let i = 0; i < segmentCount; i++) {
142
+ const segmentValue = segments[i]
143
+ if (segmentValue === 0) continue
149
144
 
150
- const scaleIndex = groupCount - i - 1
151
- words.push(this.convertBelowThousand(groupValue))
145
+ const scaleIndex = segmentCount - i - 1
146
+ words.push(this.segmentToWords(segmentValue))
152
147
  if (scaleIndex > 0 && this.scaleWords[scaleIndex]) {
153
148
  words.push(this.scaleWords[scaleIndex])
154
149
  }
@@ -157,5 +152,3 @@ class SouthAsianLanguage extends AbstractLanguage {
157
152
  return words.join(' ').trim()
158
153
  }
159
154
  }
160
-
161
- export default SouthAsianLanguage