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,41 @@
1
+ /**
2
+ * Converts a number to Belgian French cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options={}] Configuration options.
6
+ * @param {boolean} [options.withHyphenSeparator=false] Use hyphens (true) instead of spaces (false) in compounds.
7
+ * @returns {string} The number expressed in Belgian French words.
8
+ * @throws {TypeError} If value is NaN or invalid type.
9
+ * @throws {Error} If value is an invalid number string.
10
+ */
11
+ export default function convertToWords(value: number | string | bigint, options?: {
12
+ withHyphenSeparator?: boolean;
13
+ }): string;
14
+ /**
15
+ * @typedef {Object} BelgianFrenchOptions
16
+ * @property {boolean} [withHyphenSeparator=false] Use hyphens (true) instead of spaces (false) in compounds.
17
+ */
18
+ /**
19
+ * Belgian French language converter.
20
+ *
21
+ * Extends the French converter with Belgian French regional variant:
22
+ * - Uses "septante" (70) instead of "soixante-dix"
23
+ * - Uses "nonante" (90) instead of "quatre-vingt-dix"
24
+ * - Maintains standard French "quatre-vingts" for 80
25
+ * - More regular and logical number system than standard French
26
+ *
27
+ * Features:
28
+ * - Regional number word variations (septante, nonante)
29
+ * - Simplified tens naming (no complex arithmetic)
30
+ * - Inherits all other French grammar rules from FR class
31
+ * - Same pluralization and hyphenation patterns as standard French
32
+ */
33
+ export class BelgianFrench extends French {
34
+ }
35
+ export type BelgianFrenchOptions = {
36
+ /**
37
+ * Use hyphens (true) instead of spaces (false) in compounds.
38
+ */
39
+ withHyphenSeparator?: boolean;
40
+ };
41
+ import { French } from './fr.js';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Converts a number to French cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see FR class).
6
+ * @returns {string} The number expressed in French 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: 'fr' }); // 'quarante-deux'
12
+ * convertToWords(81, { lang: 'fr' }); // 'quatre-vingt-un'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * @typedef {Object} FrenchOptions
17
+ * @property {boolean} [withHyphenSeparator=false] Use hyphens (true) instead of spaces (false) in compounds.
18
+ */
19
+ /**
20
+ * French language converter.
21
+ *
22
+ * Special handling:
23
+ * - Pluralization of "cent" (hundred) and other words
24
+ * - "et" (and) before odd numbers in tens place
25
+ * - Hyphenation for compound numbers
26
+ * - Regional number word variations
27
+ */
28
+ export class French extends GreedyScaleLanguage {
29
+ /**
30
+ * Initializes the French converter with language-specific options.
31
+ *
32
+ * @param {FrenchOptions} [options={}] Configuration options.
33
+ */
34
+ constructor({ withHyphenSeparator }?: FrenchOptions);
35
+ withHyphenSeparator: boolean;
36
+ }
37
+ export type FrenchOptions = {
38
+ /**
39
+ * Use hyphens (true) instead of spaces (false) in compounds.
40
+ */
41
+ withHyphenSeparator?: boolean;
42
+ };
43
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Convert a number to Gujarati words
3
+ *
4
+ * @param {number|string|bigint} value - The number to convert
5
+ * @param {Object} [options={}] - Conversion options
6
+ * @returns {string} The Gujarati word representation
7
+ * @example
8
+ * convertToWords(42) // 'બેતાળીસ'
9
+ * convertToWords(1000) // 'એક હજાર'
10
+ * convertToWords(100000) // 'એક લાખ'
11
+ */
12
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Converts a number to Hebrew cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {HebrewOptions} [options={}] Configuration options.
6
+ * @returns {string} The number expressed in Hebrew 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?: HebrewOptions): string;
11
+ /**
12
+ * @typedef {Object} HebrewOptions
13
+ * @property {string} [and='ו'] Conjunction character (typically 'ו' for and).
14
+ * @property {boolean} [biblical=false] Use biblical scale words instead of modern ones.
15
+ * @property {boolean} [feminine=false] Use feminine forms for numbers.
16
+ */
17
+ /**
18
+ * Hebrew language converter.
19
+ *
20
+ * Implements Hebrew number words using the Slavic language pattern:
21
+ * - Hebrew alphabet and right-to-left text
22
+ * - Hebrew number words (אחת, שתים, שלוש, ארבע...)
23
+ * - Feminine number forms (default in Hebrew)
24
+ * - Optional "ve" (ו, "and") conjunction between number groups
25
+ *
26
+ * Key Features:
27
+ * - Three-form pluralization system shared across Slavic languages
28
+ * * Form 1 (singular): 1 (e.g., "אלף")
29
+ * * Form 2 (few): 2-4, 22-24, 32-34... excluding teens (e.g., "אלפים")
30
+ * * Form 3 (many): all other numbers (e.g., "אלף")
31
+ * - Chunk-based decomposition (splits into groups of 3 digits: ones, thousands, millions, etc.)
32
+ * - Large number handling via thousands[] array with indexed [singular, few, many] forms
33
+ *
34
+ * Features:
35
+ * - Right-to-left text orientation
36
+ * - Feminine grammatical gender for numbers
37
+ * - Three-form pluralization (similar to Slavic pattern)
38
+ * - Conjunction control via "and" option
39
+ *
40
+ * Inherits from SlavicLanguage for complex pluralization algorithms.
41
+ */
42
+ export class Hebrew extends SlavicLanguage {
43
+ /**
44
+ * Initializes the Hebrew converter with language-specific options.
45
+ *
46
+ * @param {HebrewOptions} [options={}] Configuration options.
47
+ */
48
+ constructor({ and, biblical, feminine }?: HebrewOptions);
49
+ ones: {
50
+ 1: string;
51
+ 2: string;
52
+ 3: string;
53
+ 4: string;
54
+ 5: string;
55
+ 6: string;
56
+ 7: string;
57
+ 8: string;
58
+ 9: string;
59
+ };
60
+ tens: {
61
+ 0: string;
62
+ 1: string;
63
+ 2: string;
64
+ 3: string;
65
+ 4: string;
66
+ 5: string;
67
+ 6: string;
68
+ 7: string;
69
+ 8: string;
70
+ 9: string;
71
+ };
72
+ twenties: {
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
+ hundreds: {
83
+ 1: string;
84
+ 2: string;
85
+ 3: string;
86
+ };
87
+ thousands: {
88
+ 1: string;
89
+ 2: string;
90
+ 3: string;
91
+ 4: string;
92
+ 5: string;
93
+ 6: string;
94
+ 7: string;
95
+ 8: string;
96
+ 9: string;
97
+ };
98
+ scale: {
99
+ 1: string;
100
+ 2: string;
101
+ 3: string;
102
+ 4: string;
103
+ 5: string;
104
+ 6: string;
105
+ };
106
+ scalePlural: {
107
+ 1: string;
108
+ 2: string;
109
+ 3: string;
110
+ 4: string;
111
+ 5: string;
112
+ 6: string;
113
+ };
114
+ biblicalOnes: {
115
+ 1: string;
116
+ 2: string;
117
+ 3: string;
118
+ 4: string;
119
+ 5: string;
120
+ 6: string;
121
+ 7: string;
122
+ 8: string;
123
+ 9: string;
124
+ };
125
+ biblicalTens: {
126
+ 0: string;
127
+ 1: string;
128
+ 2: string;
129
+ 3: string;
130
+ 4: string;
131
+ 5: string;
132
+ 6: string;
133
+ 7: string;
134
+ 8: string;
135
+ 9: string;
136
+ };
137
+ biblicalTwenties: {
138
+ 2: string;
139
+ 3: string;
140
+ 4: string;
141
+ 5: string;
142
+ 6: string;
143
+ 7: string;
144
+ 8: string;
145
+ 9: string;
146
+ };
147
+ biblicalHundreds: {
148
+ 1: string;
149
+ 2: string;
150
+ 3: string;
151
+ };
152
+ biblicalThousands: {
153
+ 1: string;
154
+ 2: string;
155
+ 3: string;
156
+ 4: string;
157
+ 5: string;
158
+ 6: string;
159
+ 7: string;
160
+ 8: string;
161
+ 9: string;
162
+ };
163
+ biblicalScale: {
164
+ 1: string;
165
+ 2: string;
166
+ 3: string;
167
+ 4: string;
168
+ 5: string;
169
+ 6: string;
170
+ };
171
+ biblicalScalePlural: {
172
+ 1: string;
173
+ 2: string;
174
+ 3: string;
175
+ 4: string;
176
+ 5: string;
177
+ 6: string;
178
+ };
179
+ and: string;
180
+ biblical: boolean;
181
+ convertWholePart(number: any): string;
182
+ }
183
+ export type HebrewOptions = {
184
+ /**
185
+ * Conjunction character (typically 'ו' for and).
186
+ */
187
+ and?: string;
188
+ /**
189
+ * Use biblical scale words instead of modern ones.
190
+ */
191
+ biblical?: boolean;
192
+ /**
193
+ * Use feminine forms for numbers.
194
+ */
195
+ feminine?: boolean;
196
+ };
197
+ import SlavicLanguage from '../classes/slavic-language.js';
@@ -0,0 +1 @@
1
+ export default function convertToWords(value: any, options?: {}): string;
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Converts a number to Croatian cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options={}] Configuration options.
6
+ * @param {boolean} [options.feminine=false] Use feminine forms for numbers.
7
+ * @returns {string} The number expressed in Croatian words.
8
+ * @throws {TypeError} If value is NaN or invalid type.
9
+ * @throws {Error} If value is an invalid number string.
10
+ */
11
+ export default function convertToWords(value: number | string | bigint, options?: {
12
+ feminine?: boolean;
13
+ }): string;
14
+ /**
15
+ * @typedef {Object} SlavicOptions
16
+ * @property {boolean} [feminine=false] Use feminine forms for numbers.
17
+ */
18
+ /**
19
+ * Croatian language converter.
20
+ *
21
+ * Implements Croatian number words using the Slavic language pattern:
22
+ * - Croatian number words (jedan/jedna, dva/dvije, tri, četiri...)
23
+ * - Gender-aware forms (masculine/feminine)
24
+ * - Slavic three-form pluralization (tisuća/tisuće/tisuća)
25
+ * - Croatian-specific declension endings
26
+ *
27
+ * Key Features:
28
+ * - Three-form pluralization system shared across Slavic languages
29
+ * * Form 1 (singular): 1 (e.g., "tisuća")
30
+ * * Form 2 (few): 2-4, 22-24, 32-34... excluding teens (e.g., "tisuće")
31
+ * * Form 3 (many): all other numbers (e.g., "tisuća")
32
+ * - Chunk-based decomposition (splits into groups of 3 digits: ones, thousands, millions, etc.)
33
+ * - Large number handling via thousands[] array with indexed [singular, few, many] forms
34
+ * - Gender-specific number forms for 1 and 2 (masculine/feminine dual forms)
35
+ *
36
+ * Features:
37
+ * - Dual gender forms for 1 and 2 (jedan/jedna, dva/dvije)
38
+ * - Latin script orthography
39
+ * - Similar structure to Serbian
40
+ *
41
+ * Inherits from SlavicLanguage for complex pluralization algorithms.
42
+ */
43
+ export class Croatian extends SlavicLanguage {
44
+ ones: {
45
+ 1: string[];
46
+ 2: string[];
47
+ 3: string[];
48
+ 4: string[];
49
+ 5: string[];
50
+ 6: string[];
51
+ 7: string[];
52
+ 8: string[];
53
+ 9: string[];
54
+ };
55
+ tens: {
56
+ 0: string;
57
+ 1: string;
58
+ 2: string;
59
+ 3: string;
60
+ 4: string;
61
+ 5: string;
62
+ 6: string;
63
+ 7: string;
64
+ 8: string;
65
+ 9: string;
66
+ };
67
+ twenties: {
68
+ 2: string;
69
+ 3: string;
70
+ 4: string;
71
+ 5: string;
72
+ 6: string;
73
+ 7: string;
74
+ 8: string;
75
+ 9: string;
76
+ };
77
+ hundreds: {
78
+ 1: string;
79
+ 2: string;
80
+ 3: string;
81
+ 4: string;
82
+ 5: string;
83
+ 6: string;
84
+ 7: string;
85
+ 8: string;
86
+ 9: string;
87
+ };
88
+ SCALE: {
89
+ 0: (string | boolean)[];
90
+ 1: (string | boolean)[];
91
+ 2: (string | boolean)[];
92
+ 3: (string | boolean)[];
93
+ 4: (string | boolean)[];
94
+ 5: (string | boolean)[];
95
+ 6: (string | boolean)[];
96
+ 7: (string | boolean)[];
97
+ 8: (string | boolean)[];
98
+ 9: (string | boolean)[];
99
+ 10: (string | boolean)[];
100
+ };
101
+ pluralize(n: any, forms: any): any;
102
+ convertWholePart(number: any): string;
103
+ }
104
+ export type SlavicOptions = {
105
+ /**
106
+ * Use feminine forms for numbers.
107
+ */
108
+ feminine?: boolean;
109
+ };
110
+ import SlavicLanguage from '../classes/slavic-language.js';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Converts a number to Hungarian cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see Hungarian class options).
6
+ * @returns {string} The number expressed in Hungarian 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); // 'negyvenkettő'
12
+ * convertToWords(21); // 'huszonegy'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * Hungarian language converter.
17
+ *
18
+ * Converts numbers to Hungarian words following Hungarian conventions:
19
+ * - Agglutinative structure for compound numbers
20
+ * - No spaces between tens and units (e.g., "huszonegy" = twenty-one)
21
+ * - Special handling for "egy" (one) - often omitted as multiplier
22
+ * - Vowel harmony in compound words
23
+ *
24
+ * Features:
25
+ * - Compact number representations (húsz, harminc, negyven)
26
+ * - Pre-composed twenties (huszonegy through huszonkilenc)
27
+ * - "egész" as decimal separator (meaning "whole")
28
+ * - Support for very large numbers (up to quadrilliards)
29
+ */
30
+ export class Hungarian extends GreedyScaleLanguage {
31
+ tensToCardinal(number: any): string;
32
+ hundredsToCardinal(number: any): string;
33
+ thousandsToCardinal(number: any): string;
34
+ bigNumberToCardinal(number: any): string;
35
+ convertWholePart(number: any, zeroWord?: string): string;
36
+ }
37
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Converts a number to Indonesian 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 Indonesian 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
+ * Indonesian language converter.
13
+ *
14
+ * Converts numbers to Indonesian words following Indonesian conventions:
15
+ * - Simple base-10 structure
16
+ * - "Se-" prefix for one (e.g., "seratus" = one hundred, "seribu" = one thousand)
17
+ * - Space-separated number components
18
+ * - Straightforward grouping by thousands
19
+ *
20
+ * Key Features:
21
+ * - Base number mapping (base) for single digits 0-9
22
+ * - Magnitude scale (thousands) mapping powers of 10 to Indonesian words
23
+ * - Group-based algorithm:
24
+ * 1. Split number into groups of 3 digits
25
+ * 2. For each group, convert ones/tens/hundreds using base and naming rules
26
+ * 3. Apply "se-" prefix for 1 (seratus, seribu, sejuta)
27
+ * 4. Combine with magnitude words
28
+ * 5. Join all parts with spaces
29
+ * - Regular patterns (puluh for tens, ratus for hundreds, ribu for thousands)
30
+ * - Clear grouping: ribu (10³), juta (10⁶), miliar (10⁹), triliun (10¹²)
31
+ *
32
+ * Features:
33
+ * - "Se-" prefix usage for singular units
34
+ * - Support for very large numbers (up to decillions)
35
+ */
36
+ export class Indonesian extends AbstractLanguage {
37
+ base: {
38
+ 0: any[];
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
+ thousands: {
50
+ 3: string;
51
+ 6: string;
52
+ 9: string;
53
+ 12: string;
54
+ 15: string;
55
+ 18: string;
56
+ 21: string;
57
+ 24: string;
58
+ 27: string;
59
+ 30: string;
60
+ 33: string;
61
+ };
62
+ splitBy3(number: any): any[][];
63
+ spell(blocks: any): any[];
64
+ getHundreds(number: any): any[];
65
+ getTens(number: any): any;
66
+ join(wordBlocks: any): string;
67
+ convertWholePart(number: any): string;
68
+ }
69
+ import AbstractLanguage from '../classes/abstract-language.js';
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Converts a number to Italian 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 Italian 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
+ * Italian language converter.
13
+ *
14
+ * Converts numbers to Italian words following Italian conventions:
15
+ * - Phonetic contractions (removes duplicate vowels: "ventotto" not "ventiotto")
16
+ * - Accentuation rules for "tre" in compounds ("ventitré" not "ventitre")
17
+ * - Special handling for "uno" and vowel agreement
18
+ * - Complex composition patterns for large numbers
19
+ *
20
+ * Architecture Note:
21
+ * Unlike other GreedyScaleLanguage subclasses, Italian uses a custom algorithm
22
+ * rather than the standard highest-matching-scale approach. This is necessary
23
+ * because Italian's word formation rules are irregular and context-dependent.
24
+ * See tensToCardinal(), hundredsToCardinal(), and bigNumberToCardinal().
25
+ *
26
+ * Features:
27
+ * - Vowel elision (e.g., "ventotto" not "ventiotto")
28
+ * - Accentuation of final "tre" (ventitré, trentacinque - note: accent on compound tres)
29
+ * - Exponent-based large number naming (milione, miliardo, trilione)
30
+ * - Custom word construction for hundreds and thousands
31
+ */
32
+ export class Italian extends GreedyScaleLanguage {
33
+ cardinalWords: string[];
34
+ strTens: {
35
+ 2: string;
36
+ 3: string;
37
+ 4: string;
38
+ 6: string;
39
+ };
40
+ exponentPrefixes: string[];
41
+ accentuate(string: any): any;
42
+ omitIfZero(numberToString: any): any;
43
+ phoneticContraction(string: any): any;
44
+ tensToCardinal(number: any): any;
45
+ hundredsToCardinal(number: any): any;
46
+ thousandsToCardinal(number: any): string;
47
+ exponentLengthToString(exponentLength: any): string;
48
+ bigNumberToCardinal(number: any): string;
49
+ convertWholePart(number: any): any;
50
+ }
51
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Converts a value to cardinal (written) form in Japanese.
3
+ *
4
+ * @param {number|string|bigint} value - Number to convert.
5
+ * @param {Object} [options] - Options for the converter.
6
+ * @returns {string} Value in Japanese kanji numerals.
7
+ * @throws {Error} If value is invalid.
8
+ *
9
+ * @example
10
+ * convertToWords(42, { lang: 'ja' }); // '四十二'
11
+ * convertToWords(1000, { lang: 'ja' }); // '千'
12
+ * convertToWords(10000, { lang: 'ja' }); // '一万'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * Japanese language converter.
17
+ *
18
+ * Converts numbers to Japanese kanji numerals using the Sino-Japanese system:
19
+ * - Uses kanji characters (一, 二, 三, etc.)
20
+ * - Grouping by 万 (man, 10,000) and 億 (oku, 100,000,000)
21
+ * - Unique scale units: 兆 (chō, trillion), 京 (kei, 10^16)
22
+ * - Special rules for 1: omitted before 十 (10), 百 (100), 千 (1000), but kept for 万 and above
23
+ *
24
+ * Key Features:
25
+ * - Sino-Japanese number system (standard for general counting)
26
+ * - Grouping by powers of 10,000 (万-based system, not 1,000)
27
+ * - Scale units: 万 (10^4), 億 (10^8), 兆 (10^12), 京 (10^16)
28
+ * - Special handling of 一 (one) prefix
29
+ * - Support for very large numbers up to 無量大数 (10^68)
30
+ *
31
+ * Algorithm:
32
+ * 1. Split number into groups of 4 digits (万-based, not 3-digit thousand-based)
33
+ * 2. Convert each group to kanji using special rules
34
+ * 3. Append appropriate scale word (万, 億, 兆, etc.)
35
+ * 4. Join all groups
36
+ *
37
+ * Special Rules:
38
+ * - 10, 100, 1000: Don't use 一 prefix (十, 百, 千 not 一十, 一百, 一千)
39
+ * - 10,000+: Keep 一 prefix (一万, 一億, 一兆)
40
+ * - Zero: 零 or 〇 (both acceptable, 零 is more formal)
41
+ */
42
+ export class Japanese extends AbstractLanguage {
43
+ scales: string[];
44
+ /**
45
+ * Converts a group of up to 4 digits to Japanese kanji.
46
+ * Handles special rules for omitting 一 before 十, 百, 千.
47
+ *
48
+ * Rule: Within a group, omit 一 before 十/百/千 EXCEPT when:
49
+ * - It's a lower group (not isTopGroup) AND
50
+ * - It would be the only character in that position
51
+ *
52
+ * @param {bigint} num - Number from 0 to 9999
53
+ * @param {boolean} isTopGroup - Whether this is the highest non-zero group
54
+ * @returns {string} Japanese kanji representation
55
+ */
56
+ convertGroup(num: bigint, isTopGroup?: boolean): string;
57
+ }
58
+ import AbstractLanguage from '../classes/abstract-language.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Converts a number to its word representation in Kannada.
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(100000) // 'ಒಂದು ಲಕ್ಷ'
10
+ */
11
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Converts a number to Korean cardinal (written) form.
3
+ *
4
+ * @param {number|string|bigint} value The number to convert.
5
+ * @param {Object} [options] Conversion options (see Korean class options).
6
+ * @returns {string} The number expressed in Korean 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); // '사십이'
12
+ * convertToWords(10001); // '만 일'
13
+ */
14
+ export default function convertToWords(value: number | string | bigint, options?: any): string;
15
+ /**
16
+ * Korean language converter.
17
+ *
18
+ * Features:
19
+ * - Space-separated for large numbers (>= 만/10,000)
20
+ * - Concatenated for smaller numbers
21
+ * - Omits '일' (1) before multipliers
22
+ */
23
+ export class Korean extends GreedyScaleLanguage {
24
+ }
25
+ import GreedyScaleLanguage from '../classes/greedy-scale-language.js';