n2words 1.23.0 → 1.24.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 (317) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +182 -53
  3. package/dist/languages/ar.js +2 -0
  4. package/dist/languages/ar.js.map +1 -0
  5. package/dist/languages/az.js +2 -0
  6. package/dist/languages/az.js.map +1 -0
  7. package/dist/languages/bn.js +2 -0
  8. package/dist/languages/bn.js.map +1 -0
  9. package/dist/languages/cs.js +2 -0
  10. package/dist/languages/cs.js.map +1 -0
  11. package/dist/languages/da.js +2 -0
  12. package/dist/languages/da.js.map +1 -0
  13. package/dist/languages/de.js +2 -0
  14. package/dist/languages/de.js.map +1 -0
  15. package/dist/languages/el.js +2 -0
  16. package/dist/languages/el.js.map +1 -0
  17. package/dist/languages/en.js +2 -0
  18. package/dist/languages/en.js.map +1 -0
  19. package/dist/languages/es.js +2 -0
  20. package/dist/languages/es.js.map +1 -0
  21. package/dist/languages/fa.js +2 -0
  22. package/dist/languages/fa.js.map +1 -0
  23. package/dist/languages/fil.js +2 -0
  24. package/dist/languages/fil.js.map +1 -0
  25. package/dist/languages/fr-BE.js +2 -0
  26. package/dist/languages/fr-BE.js.map +1 -0
  27. package/dist/languages/fr.js +2 -0
  28. package/dist/languages/fr.js.map +1 -0
  29. package/dist/languages/gu.js +2 -0
  30. package/dist/languages/gu.js.map +1 -0
  31. package/dist/languages/he.js +2 -0
  32. package/dist/languages/he.js.map +1 -0
  33. package/dist/languages/hi.js +2 -0
  34. package/dist/languages/hi.js.map +1 -0
  35. package/dist/languages/hr.js +2 -0
  36. package/dist/languages/hr.js.map +1 -0
  37. package/dist/languages/hu.js +2 -0
  38. package/dist/languages/hu.js.map +1 -0
  39. package/dist/languages/id.js +2 -0
  40. package/dist/languages/id.js.map +1 -0
  41. package/dist/languages/it.js +2 -0
  42. package/dist/languages/it.js.map +1 -0
  43. package/dist/languages/ja.js +2 -0
  44. package/dist/languages/ja.js.map +1 -0
  45. package/dist/languages/kn.js +2 -0
  46. package/dist/languages/kn.js.map +1 -0
  47. package/dist/languages/ko.js +2 -0
  48. package/dist/languages/ko.js.map +1 -0
  49. package/dist/languages/lt.js +2 -0
  50. package/dist/languages/lt.js.map +1 -0
  51. package/dist/languages/lv.js +2 -0
  52. package/dist/languages/lv.js.map +1 -0
  53. package/dist/languages/mr.js +2 -0
  54. package/dist/languages/mr.js.map +1 -0
  55. package/dist/languages/ms.js +2 -0
  56. package/dist/languages/ms.js.map +1 -0
  57. package/dist/languages/nb.js +2 -0
  58. package/dist/languages/nb.js.map +1 -0
  59. package/dist/languages/nl.js +2 -0
  60. package/dist/languages/nl.js.map +1 -0
  61. package/dist/languages/pa-Guru.js +2 -0
  62. package/dist/languages/pa-Guru.js.map +1 -0
  63. package/dist/languages/pl.js +2 -0
  64. package/dist/languages/pl.js.map +1 -0
  65. package/dist/languages/pt.js +2 -0
  66. package/dist/languages/pt.js.map +1 -0
  67. package/dist/languages/ro.js +2 -0
  68. package/dist/languages/ro.js.map +1 -0
  69. package/dist/languages/ru.js +2 -0
  70. package/dist/languages/ru.js.map +1 -0
  71. package/dist/languages/sr-Latn.js +2 -0
  72. package/dist/languages/sr-Latn.js.map +1 -0
  73. package/dist/languages/sv.js +2 -0
  74. package/dist/languages/sv.js.map +1 -0
  75. package/dist/languages/sw.js +2 -0
  76. package/dist/languages/sw.js.map +1 -0
  77. package/dist/languages/ta.js +2 -0
  78. package/dist/languages/ta.js.map +1 -0
  79. package/dist/languages/te.js +2 -0
  80. package/dist/languages/te.js.map +1 -0
  81. package/dist/languages/th.js +2 -0
  82. package/dist/languages/th.js.map +1 -0
  83. package/dist/languages/tr.js +2 -0
  84. package/dist/languages/tr.js.map +1 -0
  85. package/dist/languages/uk.js +2 -0
  86. package/dist/languages/uk.js.map +1 -0
  87. package/dist/languages/ur.js +2 -0
  88. package/dist/languages/ur.js.map +1 -0
  89. package/dist/languages/vi.js +2 -0
  90. package/dist/languages/vi.js.map +1 -0
  91. package/dist/languages/zh-Hans.js +2 -0
  92. package/dist/languages/zh-Hans.js.map +1 -0
  93. package/dist/n2words.js +1 -1
  94. package/dist/n2words.js.map +1 -1
  95. package/lib/classes/abstract-language.js +211 -110
  96. package/lib/classes/greedy-scale-language.js +195 -0
  97. package/lib/classes/slavic-language.js +251 -0
  98. package/lib/classes/south-asian-language.js +161 -0
  99. package/lib/classes/turkic-language.js +63 -0
  100. package/lib/languages/ar.js +243 -0
  101. package/lib/languages/az.js +58 -0
  102. package/lib/languages/bn.js +126 -0
  103. package/lib/languages/cs.js +212 -0
  104. package/lib/languages/da.js +167 -0
  105. package/lib/languages/de.js +135 -0
  106. package/lib/languages/el.js +116 -0
  107. package/lib/languages/en.js +123 -0
  108. package/lib/languages/es.js +153 -0
  109. package/lib/languages/fa.js +127 -0
  110. package/lib/languages/fil.js +162 -0
  111. package/lib/languages/fr-BE.js +61 -0
  112. package/lib/languages/fr.js +145 -0
  113. package/lib/languages/gu.js +156 -0
  114. package/lib/languages/he.js +329 -0
  115. package/lib/languages/hi.js +126 -0
  116. package/lib/languages/hr.js +157 -0
  117. package/lib/languages/hu.js +155 -0
  118. package/lib/languages/id.js +174 -0
  119. package/lib/languages/it.js +148 -0
  120. package/lib/languages/ja.js +190 -0
  121. package/lib/languages/kn.js +71 -0
  122. package/lib/languages/ko.js +83 -0
  123. package/lib/languages/lt.js +171 -0
  124. package/lib/languages/lv.js +153 -0
  125. package/lib/languages/mr.js +156 -0
  126. package/lib/languages/ms.js +146 -0
  127. package/lib/languages/nb.js +120 -0
  128. package/lib/languages/nl.js +206 -0
  129. package/lib/languages/pa-Guru.js +126 -0
  130. package/lib/languages/pl.js +189 -0
  131. package/lib/languages/pt.js +147 -0
  132. package/lib/languages/ro.js +380 -0
  133. package/lib/languages/ru.js +116 -0
  134. package/lib/languages/sr-Latn.js +157 -0
  135. package/lib/languages/sv.js +127 -0
  136. package/lib/languages/sw.js +121 -0
  137. package/lib/languages/ta.js +226 -0
  138. package/lib/languages/te.js +229 -0
  139. package/lib/languages/th.js +123 -0
  140. package/lib/languages/tr.js +83 -0
  141. package/lib/{i18n → languages}/uk.js +50 -23
  142. package/lib/languages/ur.js +126 -0
  143. package/lib/languages/vi.js +193 -0
  144. package/lib/languages/zh-Hans.js +165 -0
  145. package/lib/n2words.js +246 -75
  146. package/package.json +80 -72
  147. package/typings/classes/abstract-language.d.ts +144 -0
  148. package/typings/classes/greedy-scale-language.d.ts +148 -0
  149. package/typings/classes/slavic-language.d.ts +145 -0
  150. package/typings/classes/south-asian-language.d.ts +101 -0
  151. package/typings/classes/turkic-language.d.ts +42 -0
  152. package/typings/languages/ar.d.ts +93 -0
  153. package/typings/languages/az.d.ts +25 -0
  154. package/typings/languages/bn.d.ts +1 -0
  155. package/typings/languages/cs.d.ts +120 -0
  156. package/typings/languages/da.d.ts +53 -0
  157. package/typings/languages/de.d.ts +26 -0
  158. package/typings/languages/el.d.ts +11 -0
  159. package/typings/languages/en.d.ts +30 -0
  160. package/typings/languages/es.d.ts +43 -0
  161. package/typings/languages/fa.d.ts +81 -0
  162. package/typings/languages/fil.d.ts +12 -0
  163. package/typings/languages/fr-BE.d.ts +41 -0
  164. package/typings/languages/fr.d.ts +43 -0
  165. package/typings/languages/gu.d.ts +12 -0
  166. package/typings/languages/he.d.ts +197 -0
  167. package/typings/languages/hi.d.ts +1 -0
  168. package/typings/languages/hr.d.ts +110 -0
  169. package/typings/languages/hu.d.ts +37 -0
  170. package/typings/languages/id.d.ts +69 -0
  171. package/typings/languages/it.d.ts +51 -0
  172. package/typings/languages/ja.d.ts +58 -0
  173. package/typings/languages/kn.d.ts +11 -0
  174. package/typings/languages/ko.d.ts +25 -0
  175. package/typings/languages/lt.d.ts +110 -0
  176. package/typings/languages/lv.d.ts +99 -0
  177. package/typings/languages/mr.d.ts +12 -0
  178. package/typings/languages/ms.d.ts +37 -0
  179. package/typings/languages/nb.d.ts +27 -0
  180. package/typings/languages/nl.d.ts +65 -0
  181. package/typings/languages/pa-Guru.d.ts +1 -0
  182. package/typings/languages/pl.d.ts +116 -0
  183. package/typings/languages/pt.d.ts +39 -0
  184. package/typings/languages/ro.d.ts +229 -0
  185. package/typings/languages/ru.d.ts +108 -0
  186. package/typings/languages/sr-Latn.d.ts +98 -0
  187. package/typings/languages/sv.d.ts +30 -0
  188. package/typings/languages/sw.d.ts +1 -0
  189. package/typings/languages/ta.d.ts +1 -0
  190. package/typings/languages/te.d.ts +1 -0
  191. package/typings/languages/th.d.ts +1 -0
  192. package/typings/languages/tr.d.ts +46 -0
  193. package/typings/languages/uk.d.ts +117 -0
  194. package/typings/languages/ur.d.ts +1 -0
  195. package/typings/languages/vi.d.ts +116 -0
  196. package/typings/languages/zh-Hans.d.ts +57 -0
  197. package/typings/n2words.d.ts +177 -0
  198. package/dist/ar.js +0 -2
  199. package/dist/ar.js.map +0 -1
  200. package/dist/az.js +0 -2
  201. package/dist/az.js.map +0 -1
  202. package/dist/cz.js +0 -2
  203. package/dist/cz.js.map +0 -1
  204. package/dist/de.js +0 -2
  205. package/dist/de.js.map +0 -1
  206. package/dist/dk.js +0 -2
  207. package/dist/dk.js.map +0 -1
  208. package/dist/en.js +0 -2
  209. package/dist/en.js.map +0 -1
  210. package/dist/es.js +0 -2
  211. package/dist/es.js.map +0 -1
  212. package/dist/fa.js +0 -2
  213. package/dist/fa.js.map +0 -1
  214. package/dist/fr-BE.js +0 -2
  215. package/dist/fr-BE.js.map +0 -1
  216. package/dist/fr.js +0 -2
  217. package/dist/fr.js.map +0 -1
  218. package/dist/he.js +0 -2
  219. package/dist/he.js.map +0 -1
  220. package/dist/hr.js +0 -2
  221. package/dist/hr.js.map +0 -1
  222. package/dist/hu.js +0 -2
  223. package/dist/hu.js.map +0 -1
  224. package/dist/id.js +0 -2
  225. package/dist/id.js.map +0 -1
  226. package/dist/it.js +0 -2
  227. package/dist/it.js.map +0 -1
  228. package/dist/ko.js +0 -2
  229. package/dist/ko.js.map +0 -1
  230. package/dist/lt.js +0 -2
  231. package/dist/lt.js.map +0 -1
  232. package/dist/lv.js +0 -2
  233. package/dist/lv.js.map +0 -1
  234. package/dist/n2words.d.ts +0 -2
  235. package/dist/nl.js +0 -2
  236. package/dist/nl.js.map +0 -1
  237. package/dist/no.js +0 -2
  238. package/dist/no.js.map +0 -1
  239. package/dist/pl.js +0 -2
  240. package/dist/pl.js.map +0 -1
  241. package/dist/pt.js +0 -2
  242. package/dist/pt.js.map +0 -1
  243. package/dist/ro.js +0 -2
  244. package/dist/ro.js.map +0 -1
  245. package/dist/ru.js +0 -2
  246. package/dist/ru.js.map +0 -1
  247. package/dist/sr.js +0 -2
  248. package/dist/sr.js.map +0 -1
  249. package/dist/tr.js +0 -2
  250. package/dist/tr.js.map +0 -1
  251. package/dist/uk.js +0 -2
  252. package/dist/uk.js.map +0 -1
  253. package/dist/vi.js +0 -2
  254. package/dist/vi.js.map +0 -1
  255. package/dist/zh.js +0 -2
  256. package/dist/zh.js.map +0 -1
  257. package/lib/classes/abstract-language.d.ts +0 -54
  258. package/lib/classes/base-language.d.ts +0 -58
  259. package/lib/classes/base-language.js +0 -172
  260. package/lib/i18n/ar.d.ts +0 -41
  261. package/lib/i18n/ar.js +0 -209
  262. package/lib/i18n/az.d.ts +0 -15
  263. package/lib/i18n/az.js +0 -66
  264. package/lib/i18n/cz.d.ts +0 -68
  265. package/lib/i18n/cz.js +0 -135
  266. package/lib/i18n/de.d.ts +0 -17
  267. package/lib/i18n/de.js +0 -103
  268. package/lib/i18n/dk.d.ts +0 -14
  269. package/lib/i18n/dk.js +0 -110
  270. package/lib/i18n/en.d.ts +0 -22
  271. package/lib/i18n/en.js +0 -86
  272. package/lib/i18n/es.d.ts +0 -16
  273. package/lib/i18n/es.js +0 -110
  274. package/lib/i18n/fa.d.ts +0 -54
  275. package/lib/i18n/fa.js +0 -106
  276. package/lib/i18n/fr-BE.d.ts +0 -11
  277. package/lib/i18n/fr-BE.js +0 -20
  278. package/lib/i18n/fr.d.ts +0 -15
  279. package/lib/i18n/fr.js +0 -99
  280. package/lib/i18n/he.d.ts +0 -61
  281. package/lib/i18n/he.js +0 -132
  282. package/lib/i18n/hr.d.ts +0 -68
  283. package/lib/i18n/hr.js +0 -129
  284. package/lib/i18n/hu.d.ts +0 -17
  285. package/lib/i18n/hu.js +0 -135
  286. package/lib/i18n/id.d.ts +0 -43
  287. package/lib/i18n/id.js +0 -156
  288. package/lib/i18n/it.d.ts +0 -29
  289. package/lib/i18n/it.js +0 -137
  290. package/lib/i18n/ko.d.ts +0 -15
  291. package/lib/i18n/ko.js +0 -56
  292. package/lib/i18n/lt.d.ts +0 -68
  293. package/lib/i18n/lt.js +0 -138
  294. package/lib/i18n/lv.d.ts +0 -57
  295. package/lib/i18n/lv.js +0 -120
  296. package/lib/i18n/nl.d.ts +0 -20
  297. package/lib/i18n/nl.js +0 -125
  298. package/lib/i18n/no.d.ts +0 -15
  299. package/lib/i18n/no.js +0 -77
  300. package/lib/i18n/pl.d.ts +0 -67
  301. package/lib/i18n/pl.js +0 -126
  302. package/lib/i18n/pt.d.ts +0 -26
  303. package/lib/i18n/pt.js +0 -118
  304. package/lib/i18n/ro.d.ts +0 -109
  305. package/lib/i18n/ro.js +0 -360
  306. package/lib/i18n/ru.d.ts +0 -30
  307. package/lib/i18n/ru.js +0 -198
  308. package/lib/i18n/sr.d.ts +0 -56
  309. package/lib/i18n/sr.js +0 -127
  310. package/lib/i18n/tr.d.ts +0 -15
  311. package/lib/i18n/tr.js +0 -64
  312. package/lib/i18n/uk.d.ts +0 -78
  313. package/lib/i18n/vi.d.ts +0 -70
  314. package/lib/i18n/vi.js +0 -151
  315. package/lib/i18n/zh.d.ts +0 -18
  316. package/lib/i18n/zh.js +0 -78
  317. package/lib/n2words.d.ts +0 -9
@@ -0,0 +1,101 @@
1
+ export default SouthAsianLanguage;
2
+ /**
3
+ * Array of scale words for the Indian numbering system, in ascending order.
4
+ * - Index 0: Usually empty/unused (ones place)
5
+ * - Index 1: Thousands (hazaar/হাজার/हजार)
6
+ * - Index 2: Lakhs (lakh/লাখ/लाख)
7
+ * - Index 3: Crores (crore/কোটি/करोड़)
8
+ * - Index 4: Arabs (arab/আরব/अरब)
9
+ * Each index i represents the scale word for groups at position i in the Indian system.
10
+ */
11
+ export type SouthAsianScaleWords = Array<string>;
12
+ /**
13
+ * Array of words for numbers 0-99, indexed directly.
14
+ * belowHundred[0] = word for 0, belowHundred[42] = word for 42, etc.
15
+ */
16
+ export type SouthAsianBelowHundred = Array<string>;
17
+ /**
18
+ * @typedef {Array<string>} SouthAsianScaleWords
19
+ * Array of scale words for the Indian numbering system, in ascending order.
20
+ * - Index 0: Usually empty/unused (ones place)
21
+ * - Index 1: Thousands (hazaar/হাজার/हजार)
22
+ * - Index 2: Lakhs (lakh/লাখ/लाख)
23
+ * - Index 3: Crores (crore/কোটি/करोड़)
24
+ * - Index 4: Arabs (arab/আরব/अरब)
25
+ * Each index i represents the scale word for groups at position i in the Indian system.
26
+ */
27
+ /**
28
+ * @typedef {Array<string>} SouthAsianBelowHundred
29
+ * Array of words for numbers 0-99, indexed directly.
30
+ * belowHundred[0] = word for 0, belowHundred[42] = word for 42, etc.
31
+ */
32
+ /**
33
+ * Base class for South Asian languages with shared grouping patterns.
34
+ *
35
+ * This class provides a reusable implementation for South Asian languages that share:
36
+ * - Indian-style number grouping: last 3 digits, then 2-2 (1,23,45,67,89)
37
+ * - Lakh (100,000), Crore (10,000,000), Arab (1,000,000,000) scale words
38
+ * - Standard negative and decimal handling (inherits AbstractLanguage decimal logic,
39
+ * including `convertDecimalsPerDigit` support when set by subclasses)
40
+ *
41
+ * Used by: Hindi (hi), Bengali (bn), Urdu (ur), Punjabi (pa), Marathi (mr), Gujarati (gu), Kannada (kn)
42
+ *
43
+ * Subclasses MUST define language-specific vocabulary via class properties:
44
+ * - `belowHundred` array with digit and teen words (0-99)
45
+ * - `hundredWord` string used inside `convertBelowThousand`
46
+ * - `scaleWords` array with grouping words (hazaar, lakh, crore, etc.) indexed by grouping level
47
+ * - `negativeWord`, `decimalSeparatorWord`, `zeroWord`, `wordSeparator`
48
+ *
49
+ * @abstract
50
+ * @extends AbstractLanguage
51
+ */
52
+ declare class SouthAsianLanguage extends AbstractLanguage {
53
+ /**
54
+ * Array of words for numbers 0-99 (digits and teens).
55
+ * Index directly: belowHundred[0] through belowHundred[99].
56
+ * @type {Array<string>}
57
+ */
58
+ belowHundred: Array<string>;
59
+ /**
60
+ * Word for "hundred" in the language (e.g., 'सौ' in Hindi, 'শত' in Bengali).
61
+ * Used to construct hundreds (e.g., "1 hundred", "2 hundred").
62
+ * @type {string}
63
+ */
64
+ hundredWord: string;
65
+ /**
66
+ * Array of scale words for Indian-style grouping (hazaar, lakh, crore, arab, etc.).
67
+ * Index 0 is typically unused (ones place, no scale word).
68
+ * Index 1 is for thousands, Index 2 for lakhs, Index 3 for crores, etc.
69
+ * @type {Array<string>}
70
+ */
71
+ scaleWords: Array<string>;
72
+ /**
73
+ * Split a number into Indian numbering system groups.
74
+ *
75
+ * The Indian system groups differently than Western (3-3-3) systems:
76
+ * - First group (rightmost): Up to 3 digits (ones, tens, hundreds)
77
+ * - Subsequent groups: Exactly 2 digits each (thousands, lakhs, crores, etc.)
78
+ *
79
+ * This creates the familiar Indian comma pattern: 1,23,45,67,890
80
+ *
81
+ * @protected
82
+ * @param {bigint} number The number to split into groups
83
+ * @returns {Array<number>} Array of groups from most significant to least significant
84
+ *
85
+ * @example
86
+ * // splitToGroups(1234567n) → [12, 34, 567]
87
+ * // Reads as: 12 lakhs, 34 thousands, 567 units
88
+ * // splitToGroups(98765432n) → [9, 87, 65, 432]
89
+ * // Reads as: 9 crores, 87 lakhs, 65 thousands, 432 units
90
+ */
91
+ protected splitToGroups(number: bigint): Array<number>;
92
+ /**
93
+ * Convert a number below 1000 to words (0-999).
94
+ *
95
+ * @protected
96
+ * @param {number} number Value between 0 and 999
97
+ * @returns {string} Language-specific word representation
98
+ */
99
+ protected convertBelowThousand(number: number): string;
100
+ }
101
+ import AbstractLanguage from './abstract-language.js';
@@ -0,0 +1,42 @@
1
+ export default TurkicLanguage;
2
+ export type TurkicWordPair = {
3
+ /**
4
+ * - The Turkic word or phrase
5
+ */
6
+ word: string;
7
+ /**
8
+ * - The numeric value represented by the word
9
+ */
10
+ value: bigint;
11
+ };
12
+ /**
13
+ * @typedef {Object} TurkicWordPair
14
+ * @property {string} word - The Turkic word or phrase
15
+ * @property {bigint} value - The numeric value represented by the word
16
+ */
17
+ /**
18
+ * Base class for Turkic languages with shared grammar patterns.
19
+ *
20
+ * This class provides a reusable implementation for Turkic languages that share:
21
+ * - Space-separated number combinations
22
+ * - Implicit 'bir' (one) before hundreds and thousands
23
+ * - Simple multiplication/addition logic
24
+ * - Consistent magnitude handling
25
+ * - Inherits decimal handling from AbstractLanguage via GreedyScaleLanguage
26
+ * (supports both grouped and per-digit modes via the `convertDecimalsPerDigit` class property).
27
+ *
28
+ * Used by: Turkish (TR), Azerbaijani (AZ)
29
+ *
30
+ * Subclasses MUST define (from GreedyScaleLanguage requirements):
31
+ * - `scaleWordPairs` array of [value, word] pairs as a class property (ordered descending by value).
32
+ * Optionally, language-specific class properties (e.g., `negativeWord`, `zeroWord`, `decimalSeparatorWord`, `wordSeparator`).
33
+ *
34
+ * TurkicLanguage provides a default `mergeScales()` implementation; subclasses may override
35
+ * if specialized merge logic is needed (unlikely for Turkic languages).
36
+ *
37
+ * @abstract
38
+ * @extends GreedyScaleLanguage
39
+ */
40
+ declare class TurkicLanguage extends GreedyScaleLanguage {
41
+ }
42
+ import GreedyScaleLanguage from './greedy-scale-language.js';
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Converts a number to Arabic cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {ArabicOptions} [options={}] Configuration options.
6
+ * @returns {string} The number expressed in Arabic words.
7
+ * @throws {TypeError} If value is NaN or invalid type.
8
+ * @throws {Error} If value is an invalid number string.
9
+ */
10
+ export default function convertToWords(value: number | string | bigint, options?: ArabicOptions): string;
11
+ /**
12
+ * @typedef {Object} ArabicOptions
13
+ * @property {string} [negativeWord='ناقص'] Word for negative numbers (minus).
14
+ * @property {boolean} [feminine=false] Use feminine forms for numbers.
15
+ */
16
+ /**
17
+ * Arabic language converter.
18
+ *
19
+ * Converts numbers to Arabic words with full grammatical support:
20
+ * - Gender agreement (masculine/feminine forms)
21
+ * - Complex pluralization rules (singular, dual, plural forms)
22
+ * - Special handling for hundreds, thousands, millions, etc.
23
+ * - Right-to-left text orientation
24
+ * - Traditional Arabic number naming conventions
25
+ *
26
+ * Key Features:
27
+ * - Gender-aware number forms (واحد masculine vs واحدة feminine)
28
+ * - Dual forms: اثنان/اثنتان (two masculine/feminine)
29
+ * - Complex rule system for numbers 3-10 (requiring feminine when referring to countables)
30
+ * - Group-based algorithm: splits number by powers of 1000 (ones, thousands, millions, billions)
31
+ * - Tanween (nunation) for indefinite numbers
32
+ * - Sophisticated pluralization with singular, dual, and plural forms
33
+ *
34
+ * Algorithm:
35
+ * 1. Break number into groups of 3 digits (right to left)
36
+ * 2. For each non-zero group, convert to words using gender and plural rules
37
+ * 3. Append the appropriate magnitude word (ألف/مليون/مليار) with proper plural form
38
+ * 4. Join all groups with spaces
39
+ *
40
+ * Features:
41
+ * - Support for gender-aware number forms
42
+ * - Proper handling of Arabic dual forms (اثنان/اثنتان)
43
+ * - Complex group processing for large numbers
44
+ * - Right-to-left text orientation
45
+ * - Traditional Arabic number naming conventions
46
+ */
47
+ export class Arabic extends AbstractLanguage {
48
+ /**
49
+ * Initializes the Arabic converter with language-specific options.
50
+ *
51
+ * @param {ArabicOptions} [options={}] Configuration options.
52
+ */
53
+ constructor({ negativeWord, feminine }?: ArabicOptions);
54
+ arabicTens: string[];
55
+ arabicHundreds: string[];
56
+ arabicAppendedTwos: string[];
57
+ arabicTwos: string[];
58
+ arabicGroup: string[];
59
+ arabicAppendedGroup: string[];
60
+ arabicPluralGroups: string[];
61
+ ones: {
62
+ masculine: string[];
63
+ feminine: string[];
64
+ };
65
+ feminine: boolean;
66
+ selectedOnes: string[];
67
+ /**
68
+ * Returns the feminine status of a given digit (1-9).
69
+ *
70
+ * @param {number} digit - The digit to check (1-9).
71
+ * @returns {string} The word form of the digit based on feminine status.
72
+ */
73
+ digitFeminineStatus(digit: number): string;
74
+ /**
75
+ * Processes the Arabic group number and returns the corresponding Arabic representation.
76
+ * @param {number} groupNumber - The number to process. (Range: 1-999)
77
+ * @param {number} groupLevel - Group level to process. (See example)
78
+ * @returns {string} The Arabic representation of the group number.
79
+ * @example 12345678 is processed in blocks of 3: '678' (group 0), '345' (group 1), '12' (group 2).
80
+ */
81
+ processArabicGroup(groupNumber: number, groupLevel: number, fullNumber: any): string;
82
+ }
83
+ export type ArabicOptions = {
84
+ /**
85
+ * Word for negative numbers (minus).
86
+ */
87
+ negativeWord?: string;
88
+ /**
89
+ * Use feminine forms for numbers.
90
+ */
91
+ feminine?: boolean;
92
+ };
93
+ import AbstractLanguage from '../classes/abstract-language.js';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Converts a number to Azerbaijani cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see AZ class).
6
+ * @returns {string} The number expressed in Azerbaijani words.
7
+ * @throws {TypeError} If value is NaN or invalid type.
8
+ * @throws {Error} If value is an invalid number string.
9
+ *
10
+ * @example
11
+ * convertToWords(42, { lang: 'az' }); // 'qırx iki'
12
+ * convertToWords(1000, { lang: 'az' }); // 'min'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * Azerbaijani language converter.
17
+ *
18
+ * Inherits from TurkicLanguage shared patterns:
19
+ * - Space-separated number combinations
20
+ * - Omits '1' before hundreds and thousands
21
+ * - Supports flexible word spacing configuration
22
+ */
23
+ export class Azerbaijani extends TurkicLanguage {
24
+ }
25
+ import TurkicLanguage from '../classes/turkic-language.js';
@@ -0,0 +1 @@
1
+ export default function convertToWords(value: any, options?: {}): string;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Converts a number to Czech cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {SlavicOptions} [options={}] Configuration options.
6
+ * @returns {string} The number expressed in Czech words.
7
+ * @throws {TypeError} If value is NaN or invalid type.
8
+ * @throws {Error} If value is an invalid number string.
9
+ */
10
+ export default function convertToWords(value: number | string | bigint, options?: SlavicOptions): string;
11
+ /**
12
+ * @typedef {Object} SlavicOptions
13
+ * @property {boolean} [feminine=false] Use feminine forms for numbers.
14
+ */
15
+ /**
16
+ * Czech language converter.
17
+ *
18
+ * Implements Czech number words using the Slavic language pattern:
19
+ * - Czech number words (jedna, dva, tři, čtyři, pět...)
20
+ * - Slavic three-form pluralization (tisíc/tisíce/tisíc)
21
+ * - Gender agreement for numbers 1-2
22
+ * - Czech-specific number word endings
23
+ *
24
+ * Key Features:
25
+ * - Three-form pluralization system shared across Slavic languages
26
+ * * Form 1 (singular): 1 (e.g., "tisíc")
27
+ * * Form 2 (few): 2-4, 22-24, 32-34... excluding teens (e.g., "tisíce")
28
+ * * Form 3 (many): all other numbers (e.g., "tisíc")
29
+ * - Chunk-based decomposition (splits into groups of 3 digits: ones, thousands, millions, etc.)
30
+ * - Large number handling via thousands[] array with indexed [singular, few, many] forms
31
+ *
32
+ * Inherits from SlavicLanguage:
33
+ * - Complex pluralization rules (one/few/many forms)
34
+ * - Group-based large number handling (chunk decomposition via splitByX())
35
+ * - Proper declension patterns via pluralize() method
36
+ */
37
+ export class Czech extends SlavicLanguage {
38
+ ones: {
39
+ 1: string;
40
+ 2: string;
41
+ 3: string;
42
+ 4: string;
43
+ 5: string;
44
+ 6: string;
45
+ 7: string;
46
+ 8: string;
47
+ 9: string;
48
+ };
49
+ tens: {
50
+ 0: string;
51
+ 1: string;
52
+ 2: string;
53
+ 3: string;
54
+ 4: string;
55
+ 5: string;
56
+ 6: string;
57
+ 7: string;
58
+ 8: string;
59
+ 9: string;
60
+ };
61
+ twenties: {
62
+ 2: string;
63
+ 3: string;
64
+ 4: string;
65
+ 5: string;
66
+ 6: string;
67
+ 7: string;
68
+ 8: string;
69
+ 9: string;
70
+ };
71
+ hundreds: {
72
+ 1: string;
73
+ 2: string;
74
+ 3: string;
75
+ 4: string;
76
+ 5: string;
77
+ 6: string;
78
+ 7: string;
79
+ 8: string;
80
+ 9: string;
81
+ };
82
+ thousands: {
83
+ 1: string[];
84
+ 2: string[];
85
+ 3: string[];
86
+ 4: string[];
87
+ 5: string[];
88
+ 6: string[];
89
+ 7: string[];
90
+ 8: string[];
91
+ 9: string[];
92
+ 10: string[];
93
+ };
94
+ /**
95
+ * Returns the Czech word for the decimal separator based on the whole number.
96
+ *
97
+ * @returns {string} The Czech word for the decimal separator.
98
+ */
99
+ get decimalSeparatorWord(): string;
100
+ /**
101
+ * Implements Czech-specific three-form pluralization rules.
102
+ *
103
+ * Czech three-form system:
104
+ * - Form 1 (singular): exactly n=1 (e.g., "tisíc")
105
+ * - Form 2 (few): n ends in 2-4, excluding teens (22-24, 32-34...) (e.g., "tisíce")
106
+ * - Form 3 (many): all other numbers (e.g., "tisíc" for 0, 5+)
107
+ *
108
+ * @param {bigint} n The number to classify.
109
+ * @param {Array<string>} forms Array of [singular, few, many] word forms.
110
+ * @returns {string} The appropriate form for the number n.
111
+ */
112
+ pluralize(n: bigint, forms: Array<string>): string;
113
+ }
114
+ export type SlavicOptions = {
115
+ /**
116
+ * Use feminine forms for numbers.
117
+ */
118
+ feminine?: boolean;
119
+ };
120
+ import SlavicLanguage from '../classes/slavic-language.js';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Converts a number to Danish cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see Danish class options).
6
+ * @param {boolean} [options.ordFlag=false] Enable ordinal number conversion.
7
+ * @returns {string} The number expressed in Danish words.
8
+ * @throws {TypeError} If value is NaN or invalid type.
9
+ * @throws {Error} If value is an invalid number string.
10
+ *
11
+ * @example
12
+ * convertToWords(25); // 'femogtyve' (five-and-twenty)
13
+ * convertToWords(50); // 'halvtreds' (half-third-times-twenty)
14
+ */
15
+ export default function convertToWords(value: number | string | bigint, options?: {
16
+ ordFlag?: boolean;
17
+ }): string;
18
+ /**
19
+ * @typedef {Object} DanishOptions
20
+ * @property {boolean} [ordFlag=false] Enable ordinal number conversion.
21
+ */
22
+ /**
23
+ * Danish language converter.
24
+ *
25
+ * GreedyScaleLanguage with Danish-specific extensions:
26
+ * - Unique vigesimal (base-20) number system for 50-90
27
+ * - Special composition rules ("og" for "and" between units and tens)
28
+ * - Reverse digit order (e.g., "fem-og-tyve" = five-and-twenty = 25)
29
+ * - Support for ordinal numbers via ordFlag option
30
+ *
31
+ * Key Features:
32
+ * - Vigesimal tens: halvtreds (50), treds (60), halvfjerds (70), firs (80), halvfems (90)
33
+ * - Units-before-tens pattern (e.g., "tre-og-tyve" = 23)
34
+ * - "et" prefix for hundreds/thousands (not "en")
35
+ * - Optional ordinal number conversion via ordFlag option
36
+ * - Inline merge logic tailored for Danish ordering
37
+ */
38
+ export class Danish extends GreedyScaleLanguage {
39
+ /**
40
+ * Initializes the Danish converter with language-specific options.
41
+ *
42
+ * @param {DanishOptions} [options={}] Configuration options.
43
+ */
44
+ constructor({ ordFlag }?: DanishOptions);
45
+ ordFlag: boolean;
46
+ }
47
+ export type DanishOptions = {
48
+ /**
49
+ * Enable ordinal number conversion.
50
+ */
51
+ ordFlag?: boolean;
52
+ };
53
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Converts a number to German cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see German class options).
6
+ * @returns {string} The number expressed in German words.
7
+ * @throws {TypeError} If value is NaN or invalid type.
8
+ * @throws {Error} If value is an invalid number string.
9
+ *
10
+ * @example
11
+ * convertToWords(42); // 'zweiundvierzig'
12
+ * convertToWords('1.5'); // 'eins komma fünf'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * German language converter.
17
+ *
18
+ * Handles German grammatical features:
19
+ * - "eins" vs "ein" and "eine" forms for 1
20
+ * - Compound words without separators (e.g., "einundzwanzig" = 21)
21
+ * - Million/Billion pluralization
22
+ * - Special characters (e.g., "ü", "ö", "ß")
23
+ */
24
+ export class German extends GreedyScaleLanguage {
25
+ }
26
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Converts a number to its word representation in Greek.
3
+ * @param {number|string|bigint} value - The number to convert
4
+ * @param {Object} [options={}] - Conversion options
5
+ * @returns {string} The word representation of the number
6
+ * @example
7
+ * convertToWords(42) // 'σαράντα δύο'
8
+ * convertToWords(1000) // 'χίλια'
9
+ * convertToWords(2000) // 'δύο χίλια'
10
+ */
11
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Converts a number to English cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see English class options).
6
+ * @returns {string} The number expressed in English words.
7
+ * @throws {TypeError} If value is NaN or invalid type.
8
+ * @throws {Error} If value is an invalid number string.
9
+ *
10
+ * @example
11
+ * convertToWords(42); // 'forty-two'
12
+ * convertToWords('1.5'); // 'one point five'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * English language converter.
17
+ *
18
+ * Converts numbers to English words, supporting:
19
+ * - Negative numbers (prepended with "minus")
20
+ * - Decimal numbers (word "point" between whole and fractional parts)
21
+ * - Numbers up to octillions
22
+ *
23
+ * Merge rules:
24
+ * - Hyphenated for compound tens (e.g., "twenty-three")
25
+ * - "and" after hundreds (e.g., "one hundred and one")
26
+ * - Space-separated for larger composites (e.g., "one thousand twenty-three")
27
+ */
28
+ export class English extends GreedyScaleLanguage {
29
+ }
30
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Converts a number to Spanish cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see ES class).
6
+ * @returns {string} The number expressed in Spanish words.
7
+ * @throws {TypeError} If value is NaN or invalid type.
8
+ * @throws {Error} If value is an invalid number string.
9
+ *
10
+ * @example
11
+ * convertToWords(42, { lang: 'es' }); // 'cuarenta y dos'
12
+ * convertToWords(100, { lang: 'es' }); // 'cien'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * @typedef {Object} SpanishOptions
17
+ * @property {string} [genderStem='o'] Masculine 'o' or feminine 'a' ending.
18
+ */
19
+ /**
20
+ * Spanish language converter.
21
+ *
22
+ * Handles Spanish grammatical features:
23
+ * - Gender agreement for numbers (masculine by default, feminine via `genderStem`)
24
+ * - "y" (and) between tens and units (e.g., "veinte y uno")
25
+ * - Special forms for hundreds (e.g., "cien", "ciento", "doscientos")
26
+ * - Million pluralization
27
+ */
28
+ export class Spanish extends GreedyScaleLanguage {
29
+ /**
30
+ * Initializes the Spanish converter.
31
+ *
32
+ * @param {SpanishOptions} [options={}] Configuration options.
33
+ */
34
+ constructor({ genderStem }?: SpanishOptions);
35
+ genderStem: string;
36
+ }
37
+ export type SpanishOptions = {
38
+ /**
39
+ * Masculine 'o' or feminine 'a' ending.
40
+ */
41
+ genderStem?: string;
42
+ };
43
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Converts a number to Persian cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options={}] Configuration options.
6
+ * @returns {string} The number expressed in Persian words.
7
+ * @throws {TypeError} If value is NaN or invalid type.
8
+ * @throws {Error} If value is an invalid number string.
9
+ */
10
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
11
+ /**
12
+ * Persian (Farsi) language converter.
13
+ *
14
+ * Converts numbers to Persian words using Persian-Arabic numerals:
15
+ * - Right-to-left script orientation
16
+ * - Base-10 decimal system with Persian number words
17
+ * - Conjunction "و" (va/and) for compound numbers
18
+ * - Traditional Persian number naming conventions
19
+ *
20
+ * Key Features:
21
+ * - Named number lookup table (namedNumbers) for direct mapping 0-999
22
+ * - Group-based algorithm for numbers >= 1000:
23
+ * 1. Split into groups of 3 digits
24
+ * 2. Convert each group to words using named table or recursion
25
+ * 3. Append magnitude word (هزار/میلیون/میلیارد)
26
+ * 4. Join with "و" (and) conjunction
27
+ * - Special compound forms (دویست for 200, سیصد for 300)
28
+ * - Proper Persian grammatical structure
29
+ * - Support for large numbers (thousands, millions, billions, trillions)
30
+ *
31
+ * Features:
32
+ * - Native Persian digits and words
33
+ * - Special compound forms (e.g., دویست for 200, سیصد for 300)
34
+ * - Support for large numbers (thousands, millions)
35
+ * - Proper Persian grammatical structure
36
+ */
37
+ export class Farsi extends AbstractLanguage {
38
+ namedNumbers: {
39
+ 0: string;
40
+ 1: string;
41
+ 2: string;
42
+ 3: string;
43
+ 4: string;
44
+ 5: string;
45
+ 6: string;
46
+ 7: string;
47
+ 8: string;
48
+ 9: string;
49
+ 10: string;
50
+ 11: string;
51
+ 12: string;
52
+ 13: string;
53
+ 14: string;
54
+ 15: string;
55
+ 16: string;
56
+ 17: string;
57
+ 18: string;
58
+ 19: string;
59
+ 20: string;
60
+ 30: string;
61
+ 40: string;
62
+ 50: string;
63
+ 60: string;
64
+ 70: string;
65
+ 80: string;
66
+ 90: string;
67
+ 100: string;
68
+ 200: string;
69
+ 300: string;
70
+ 400: string;
71
+ 500: string;
72
+ 600: string;
73
+ 700: string;
74
+ 800: string;
75
+ 900: string;
76
+ 1000: string;
77
+ 1000000: string;
78
+ };
79
+ convertWholePart(number: any): any;
80
+ }
81
+ import AbstractLanguage from '../classes/abstract-language.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Convert a number to Filipino words
3
+ *
4
+ * @param {number|string|bigint} value - The number to convert
5
+ * @param {Object} [options={}] - Conversion options
6
+ * @returns {string} The Filipino word representation
7
+ * @example
8
+ * convertToWords(42) // 'apatnapu dalawa'
9
+ * convertToWords(1000) // 'isang libo'
10
+ * convertToWords(123456) // 'isang daang dalawampung tatlong libong apat na daang limampung anim'
11
+ */
12
+ export default function convertToWords(value: number | string | bigint, options?: any): string;