n2words 5.1.0 → 5.1.2

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 (229) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/am-ET.js +1 -1
  3. package/dist/am-ET.umd.js +1 -1
  4. package/dist/am-Latn-ET.js +1 -1
  5. package/dist/am-Latn-ET.umd.js +1 -1
  6. package/dist/ar-SA.js +1 -1
  7. package/dist/ar-SA.umd.js +1 -1
  8. package/dist/az-AZ.js +1 -1
  9. package/dist/az-AZ.umd.js +1 -1
  10. package/dist/bn-BD.js +1 -1
  11. package/dist/bn-BD.umd.js +1 -1
  12. package/dist/cs-CZ.js +1 -1
  13. package/dist/cs-CZ.umd.js +1 -1
  14. package/dist/da-DK.js +1 -1
  15. package/dist/da-DK.umd.js +1 -1
  16. package/dist/de-DE.js +1 -1
  17. package/dist/de-DE.umd.js +1 -1
  18. package/dist/el-GR.js +1 -1
  19. package/dist/el-GR.umd.js +1 -1
  20. package/dist/en-AU.js +1 -1
  21. package/dist/en-AU.umd.js +1 -1
  22. package/dist/en-BD.js +1 -1
  23. package/dist/en-BD.umd.js +1 -1
  24. package/dist/en-CA.js +1 -1
  25. package/dist/en-CA.umd.js +1 -1
  26. package/dist/en-GB.js +1 -1
  27. package/dist/en-GB.umd.js +1 -1
  28. package/dist/en-GH.js +1 -1
  29. package/dist/en-GH.umd.js +1 -1
  30. package/dist/en-IE.js +1 -1
  31. package/dist/en-IE.umd.js +1 -1
  32. package/dist/en-IN.js +1 -1
  33. package/dist/en-IN.umd.js +1 -1
  34. package/dist/en-KE.js +1 -1
  35. package/dist/en-KE.umd.js +1 -1
  36. package/dist/en-MY.js +1 -1
  37. package/dist/en-MY.umd.js +1 -1
  38. package/dist/en-NG.js +1 -1
  39. package/dist/en-NG.umd.js +1 -1
  40. package/dist/en-NZ.js +1 -1
  41. package/dist/en-NZ.umd.js +1 -1
  42. package/dist/en-PH.js +1 -1
  43. package/dist/en-PH.umd.js +1 -1
  44. package/dist/en-PK.js +1 -1
  45. package/dist/en-PK.umd.js +1 -1
  46. package/dist/en-SG.js +1 -1
  47. package/dist/en-SG.umd.js +1 -1
  48. package/dist/en-US.js +1 -1
  49. package/dist/en-US.umd.js +1 -1
  50. package/dist/en-ZA.js +1 -1
  51. package/dist/en-ZA.umd.js +1 -1
  52. package/dist/es-ES.js +1 -1
  53. package/dist/es-ES.umd.js +1 -1
  54. package/dist/es-MX.js +1 -1
  55. package/dist/es-MX.umd.js +1 -1
  56. package/dist/es-US.js +1 -1
  57. package/dist/es-US.umd.js +1 -1
  58. package/dist/fa-IR.js +1 -1
  59. package/dist/fa-IR.umd.js +1 -1
  60. package/dist/fi-FI.js +1 -1
  61. package/dist/fi-FI.umd.js +1 -1
  62. package/dist/fil-PH.js +1 -1
  63. package/dist/fil-PH.umd.js +1 -1
  64. package/dist/fr-BE.js +1 -1
  65. package/dist/fr-BE.umd.js +1 -1
  66. package/dist/fr-FR.js +1 -1
  67. package/dist/fr-FR.umd.js +1 -1
  68. package/dist/gu-IN.js +1 -1
  69. package/dist/gu-IN.umd.js +1 -1
  70. package/dist/ha-NG.js +1 -1
  71. package/dist/ha-NG.umd.js +1 -1
  72. package/dist/hbo-IL.js +1 -1
  73. package/dist/hbo-IL.umd.js +1 -1
  74. package/dist/he-IL.js +1 -1
  75. package/dist/he-IL.umd.js +1 -1
  76. package/dist/hi-IN.js +1 -1
  77. package/dist/hi-IN.umd.js +1 -1
  78. package/dist/hr-HR.js +2 -2
  79. package/dist/hr-HR.umd.js +2 -2
  80. package/dist/hu-HU.js +1 -1
  81. package/dist/hu-HU.umd.js +1 -1
  82. package/dist/id-ID.js +1 -1
  83. package/dist/id-ID.umd.js +1 -1
  84. package/dist/it-IT.js +1 -1
  85. package/dist/it-IT.umd.js +1 -1
  86. package/dist/ja-JP.js +1 -1
  87. package/dist/ja-JP.umd.js +1 -1
  88. package/dist/ka-GE.js +1 -1
  89. package/dist/ka-GE.umd.js +1 -1
  90. package/dist/kn-IN.js +1 -1
  91. package/dist/kn-IN.umd.js +1 -1
  92. package/dist/ko-KR.js +1 -1
  93. package/dist/ko-KR.umd.js +1 -1
  94. package/dist/lt-LT.js +1 -1
  95. package/dist/lt-LT.umd.js +1 -1
  96. package/dist/lv-LV.js +1 -1
  97. package/dist/lv-LV.umd.js +1 -1
  98. package/dist/mr-IN.js +1 -1
  99. package/dist/mr-IN.umd.js +1 -1
  100. package/dist/ms-MY.js +1 -1
  101. package/dist/ms-MY.umd.js +1 -1
  102. package/dist/nb-NO.js +1 -1
  103. package/dist/nb-NO.umd.js +1 -1
  104. package/dist/nl-NL.js +1 -1
  105. package/dist/nl-NL.umd.js +1 -1
  106. package/dist/pa-IN.js +1 -1
  107. package/dist/pa-IN.umd.js +1 -1
  108. package/dist/pl-PL.js +1 -1
  109. package/dist/pl-PL.umd.js +1 -1
  110. package/dist/pt-BR.js +1 -1
  111. package/dist/pt-BR.umd.js +1 -1
  112. package/dist/pt-PT.js +1 -1
  113. package/dist/pt-PT.umd.js +1 -1
  114. package/dist/ro-RO.js +1 -1
  115. package/dist/ro-RO.umd.js +1 -1
  116. package/dist/ru-RU.js +1 -1
  117. package/dist/ru-RU.umd.js +1 -1
  118. package/dist/sr-Cyrl-RS.js +2 -2
  119. package/dist/sr-Cyrl-RS.umd.js +2 -2
  120. package/dist/sr-Latn-RS.js +2 -2
  121. package/dist/sr-Latn-RS.umd.js +2 -2
  122. package/dist/sv-SE.js +1 -1
  123. package/dist/sv-SE.umd.js +1 -1
  124. package/dist/sw-KE.js +1 -1
  125. package/dist/sw-KE.umd.js +1 -1
  126. package/dist/ta-IN.js +1 -1
  127. package/dist/ta-IN.umd.js +1 -1
  128. package/dist/te-IN.js +1 -1
  129. package/dist/te-IN.umd.js +1 -1
  130. package/dist/th-TH.js +1 -1
  131. package/dist/th-TH.umd.js +1 -1
  132. package/dist/tr-TR.js +1 -1
  133. package/dist/tr-TR.umd.js +1 -1
  134. package/dist/uk-UA.js +1 -1
  135. package/dist/uk-UA.umd.js +1 -1
  136. package/dist/ur-PK.js +1 -1
  137. package/dist/ur-PK.umd.js +1 -1
  138. package/dist/vi-VN.js +1 -1
  139. package/dist/vi-VN.umd.js +1 -1
  140. package/dist/yo-NG.js +1 -1
  141. package/dist/yo-NG.umd.js +1 -1
  142. package/dist/zh-Hans-CN.js +1 -1
  143. package/dist/zh-Hans-CN.umd.js +1 -1
  144. package/dist/zh-Hant-TW.js +1 -1
  145. package/dist/zh-Hant-TW.umd.js +1 -1
  146. package/package.json +17 -17
  147. package/src/am-ET.d.ts +19 -6
  148. package/src/am-Latn-ET.d.ts +19 -6
  149. package/src/ar-SA.d.ts +46 -32
  150. package/src/az-AZ.d.ts +17 -6
  151. package/src/bn-BD.d.ts +18 -6
  152. package/src/cs-CZ.d.ts +19 -6
  153. package/src/da-DK.d.ts +19 -6
  154. package/src/de-DE.d.ts +30 -16
  155. package/src/el-GR.d.ts +18 -6
  156. package/src/en-AU.d.ts +27 -16
  157. package/src/en-BD.d.ts +28 -16
  158. package/src/en-CA.d.ts +46 -25
  159. package/src/en-GB.d.ts +28 -16
  160. package/src/en-GH.d.ts +35 -16
  161. package/src/en-IE.d.ts +38 -16
  162. package/src/en-IN.d.ts +28 -16
  163. package/src/en-KE.d.ts +35 -16
  164. package/src/en-MY.d.ts +38 -16
  165. package/src/en-NG.d.ts +38 -16
  166. package/src/en-NZ.d.ts +35 -16
  167. package/src/en-PH.d.ts +35 -16
  168. package/src/en-PK.d.ts +28 -16
  169. package/src/en-SG.d.ts +35 -16
  170. package/src/en-US.d.ts +44 -25
  171. package/src/en-ZA.d.ts +37 -16
  172. package/src/es-ES.d.ts +61 -42
  173. package/src/es-MX.d.ts +61 -42
  174. package/src/es-US.d.ts +61 -42
  175. package/src/fa-IR.d.ts +17 -6
  176. package/src/fi-FI.d.ts +19 -6
  177. package/src/fil-PH.d.ts +18 -6
  178. package/src/fr-BE.d.ts +35 -23
  179. package/src/fr-FR.d.ts +36 -23
  180. package/src/gu-IN.d.ts +19 -6
  181. package/src/ha-NG.d.ts +21 -6
  182. package/src/hbo-IL.d.ts +30 -17
  183. package/src/he-IL.d.ts +24 -11
  184. package/src/hi-IN.d.ts +19 -6
  185. package/src/hr-HR.d.ts +28 -15
  186. package/src/hr-HR.js +8 -6
  187. package/src/hu-HU.d.ts +18 -6
  188. package/src/id-ID.d.ts +18 -6
  189. package/src/it-IT.d.ts +30 -16
  190. package/src/ja-JP.d.ts +18 -6
  191. package/src/ka-GE.d.ts +20 -6
  192. package/src/kn-IN.d.ts +19 -6
  193. package/src/ko-KR.d.ts +18 -6
  194. package/src/lt-LT.d.ts +27 -15
  195. package/src/lv-LV.d.ts +28 -15
  196. package/src/mr-IN.d.ts +19 -6
  197. package/src/ms-MY.d.ts +18 -6
  198. package/src/nb-NO.d.ts +18 -6
  199. package/src/nl-NL.d.ts +42 -27
  200. package/src/pa-IN.d.ts +18 -6
  201. package/src/pl-PL.d.ts +28 -15
  202. package/src/pt-BR.d.ts +34 -21
  203. package/src/pt-PT.d.ts +29 -16
  204. package/src/ro-RO.d.ts +27 -15
  205. package/src/ru-RU.d.ts +38 -26
  206. package/src/sr-Cyrl-RS.d.ts +40 -26
  207. package/src/sr-Cyrl-RS.js +6 -5
  208. package/src/sr-Latn-RS.d.ts +40 -26
  209. package/src/sr-Latn-RS.js +6 -5
  210. package/src/sv-SE.d.ts +19 -6
  211. package/src/sw-KE.d.ts +17 -6
  212. package/src/ta-IN.d.ts +21 -6
  213. package/src/te-IN.d.ts +19 -6
  214. package/src/th-TH.d.ts +19 -6
  215. package/src/tr-TR.d.ts +22 -11
  216. package/src/uk-UA.d.ts +27 -15
  217. package/src/ur-PK.d.ts +18 -6
  218. package/src/utils/check-max.d.ts +1 -1
  219. package/src/utils/expand-scientific.d.ts +3 -3
  220. package/src/utils/is-plain-object.d.ts +1 -1
  221. package/src/utils/parse-cardinal.d.ts +7 -1
  222. package/src/utils/parse-currency.d.ts +6 -1
  223. package/src/utils/parse-ordinal.d.ts +6 -1
  224. package/src/utils/resolve-options.d.ts +1 -1
  225. package/src/utils/scale.d.ts +22 -22
  226. package/src/vi-VN.d.ts +17 -6
  227. package/src/yo-NG.d.ts +24 -6
  228. package/src/zh-Hans-CN.d.ts +46 -34
  229. package/src/zh-Hant-TW.d.ts +50 -34
package/src/en-NZ.d.ts CHANGED
@@ -1,18 +1,24 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
4
1
  /**
5
- * @typedef {object} CurrencyOptions
6
- * @property {boolean} [and] - Use "and" between dollars and cents
2
+ * New Zealand English language converter
3
+ *
4
+ * CLDR: en-NZ | English as used in New Zealand
5
+ *
6
+ * Exports:
7
+ * - toCardinal(value) - Cardinal numbers: 42 → "forty-two"
8
+ * - toOrdinal(value) - Ordinal numbers: 42 → "forty-second"
9
+ * - toCurrency(value, options?) - Currency: 42.50 → "forty-two dollars and fifty cents"
10
+ *
11
+ * New Zealand English conventions:
12
+ * - Follows British English style
13
+ * - "and" after hundreds: "one hundred and twenty-three"
14
+ * - "and" before final segment: "one million and one"
15
+ * - Hyphenated tens-ones: "twenty-one", "forty-two"
16
+ * - Western numbering system (short scale: billion = 10^9)
17
+ * - Currency: New Zealand Dollar (NZD) - dollar/dollars, cent/cents
7
18
  */
8
- /** @type {Required<CurrencyOptions>} */
9
- export const currencyDefaults: Required<CurrencyOptions>;
10
- export type CurrencyOptions = {
11
- /**
12
- * - Use "and" between dollars and cents
13
- */
14
- and?: boolean | undefined;
15
- };
19
+ export declare const cardinalMax: bigint;
20
+ export declare const ordinalMax: bigint;
21
+ export declare const currencyMax: bigint;
16
22
  /**
17
23
  * Converts a numeric value to New Zealand English words.
18
24
  * @param {number | string | bigint} value - The numeric value to convert
@@ -20,7 +26,7 @@ export type CurrencyOptions = {
20
26
  * @throws {TypeError} If value is not a valid numeric type
21
27
  * @throws {Error} If value is not a valid number format
22
28
  */
23
- export function toCardinal(value: number | string | bigint): string;
29
+ declare function toCardinal(value: number | string | bigint): string;
24
30
  /**
25
31
  * Converts a numeric value to New Zealand English ordinal words.
26
32
  * @param {number | string | bigint} value - The numeric value to convert (positive integer)
@@ -28,7 +34,19 @@ export function toCardinal(value: number | string | bigint): string;
28
34
  * @throws {TypeError} If value is not a valid numeric type
29
35
  * @throws {RangeError} If value is negative, zero, or has a decimal part
30
36
  */
31
- export function toOrdinal(value: number | string | bigint): string;
37
+ declare function toOrdinal(value: number | string | bigint): string;
38
+ export type CurrencyOptions = {
39
+ /**
40
+ * - Use "and" between dollars and cents
41
+ */
42
+ and?: boolean;
43
+ };
44
+ /**
45
+ * @typedef {object} CurrencyOptions
46
+ * @property {boolean} [and] - Use "and" between dollars and cents
47
+ */
48
+ /** @type {Required<CurrencyOptions>} */
49
+ export declare const currencyDefaults: Required<CurrencyOptions>;
32
50
  /**
33
51
  * Converts a numeric value to New Zealand English currency words (New Zealand Dollar).
34
52
  * @param {number | string | bigint} value - The currency amount to convert
@@ -37,4 +55,5 @@ export function toOrdinal(value: number | string | bigint): string;
37
55
  * @throws {TypeError} If value is not a valid numeric type
38
56
  * @throws {Error} If value is not a valid number format
39
57
  */
40
- export function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
58
+ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
59
+ export { toCardinal, toOrdinal, toCurrency };
package/src/en-PH.d.ts CHANGED
@@ -1,18 +1,24 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
4
1
  /**
5
- * @typedef {object} CurrencyOptions
6
- * @property {boolean} [and] - Use "and" between pesos and centavos
2
+ * Philippine English language converter
3
+ *
4
+ * CLDR: en-PH | English as used in the Philippines
5
+ *
6
+ * Exports:
7
+ * - toCardinal(value) - Cardinal numbers: 42 → "forty-two"
8
+ * - toOrdinal(value) - Ordinal numbers: 42 → "forty-second"
9
+ * - toCurrency(value, options?) - Currency: 42.50 → "forty-two pesos and fifty centavos"
10
+ *
11
+ * Philippine English conventions:
12
+ * - Follows British English style
13
+ * - "and" after hundreds: "one hundred and twenty-three"
14
+ * - "and" before final segment: "one million and one"
15
+ * - Hyphenated tens-ones: "twenty-one", "forty-two"
16
+ * - Western numbering system (short scale: billion = 10^9)
17
+ * - Currency: Philippine Peso (PHP) - peso/pesos, centavo/centavos
7
18
  */
8
- /** @type {Required<CurrencyOptions>} */
9
- export const currencyDefaults: Required<CurrencyOptions>;
10
- export type CurrencyOptions = {
11
- /**
12
- * - Use "and" between pesos and centavos
13
- */
14
- and?: boolean | undefined;
15
- };
19
+ export declare const cardinalMax: bigint;
20
+ export declare const ordinalMax: bigint;
21
+ export declare const currencyMax: bigint;
16
22
  /**
17
23
  * Converts a numeric value to Philippine English words.
18
24
  * @param {number | string | bigint} value - The numeric value to convert
@@ -20,7 +26,7 @@ export type CurrencyOptions = {
20
26
  * @throws {TypeError} If value is not a valid numeric type
21
27
  * @throws {Error} If value is not a valid number format
22
28
  */
23
- export function toCardinal(value: number | string | bigint): string;
29
+ declare function toCardinal(value: number | string | bigint): string;
24
30
  /**
25
31
  * Converts a numeric value to Philippine English ordinal words.
26
32
  * @param {number | string | bigint} value - The numeric value to convert (must be a positive integer)
@@ -28,7 +34,19 @@ export function toCardinal(value: number | string | bigint): string;
28
34
  * @throws {TypeError} If value is not a valid numeric type
29
35
  * @throws {RangeError} If value is negative, zero, or has a decimal part
30
36
  */
31
- export function toOrdinal(value: number | string | bigint): string;
37
+ declare function toOrdinal(value: number | string | bigint): string;
38
+ export type CurrencyOptions = {
39
+ /**
40
+ * - Use "and" between pesos and centavos
41
+ */
42
+ and?: boolean;
43
+ };
44
+ /**
45
+ * @typedef {object} CurrencyOptions
46
+ * @property {boolean} [and] - Use "and" between pesos and centavos
47
+ */
48
+ /** @type {Required<CurrencyOptions>} */
49
+ export declare const currencyDefaults: Required<CurrencyOptions>;
32
50
  /**
33
51
  * Converts a numeric value to Philippine English currency words.
34
52
  * @param {number | string | bigint} value - The numeric value to convert
@@ -37,4 +55,5 @@ export function toOrdinal(value: number | string | bigint): string;
37
55
  * @throws {TypeError} If value is not a valid numeric type
38
56
  * @throws {Error} If value is not a valid number format
39
57
  */
40
- export function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
58
+ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
59
+ export { toCardinal, toOrdinal, toCurrency };
package/src/en-PK.d.ts CHANGED
@@ -1,18 +1,17 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
4
1
  /**
5
- * @typedef {object} CurrencyOptions
6
- * @property {boolean} [and] - Use "and" between rupees and paise
2
+ * English (Pakistan) language converter
3
+ *
4
+ * CLDR: en-PK | English as used in Pakistan
5
+ *
6
+ * Key features:
7
+ * - Indian numbering system (thousand, lakh, crore, arab, kharab)
8
+ * - 3-2-2 grouping pattern (last 3 digits, then groups of 2)
9
+ * - British-style "and" after hundreds
10
+ * - Pakistani Rupee currency (PKR)
7
11
  */
8
- /** @type {Required<CurrencyOptions>} */
9
- export const currencyDefaults: Required<CurrencyOptions>;
10
- export type CurrencyOptions = {
11
- /**
12
- * - Use "and" between rupees and paise
13
- */
14
- and?: boolean | undefined;
15
- };
12
+ export declare const cardinalMax: bigint;
13
+ export declare const ordinalMax: bigint;
14
+ export declare const currencyMax: bigint;
16
15
  /**
17
16
  * Converts a numeric value to English words using Indian numbering.
18
17
  * @param {number | string | bigint} value - The numeric value to convert
@@ -25,7 +24,7 @@ export type CurrencyOptions = {
25
24
  * toCardinal(10000000) // 'one crore'
26
25
  * toCardinal(1234567) // 'twelve lakh thirty-four thousand five hundred and sixty-seven'
27
26
  */
28
- export function toCardinal(value: number | string | bigint): string;
27
+ declare function toCardinal(value: number | string | bigint): string;
29
28
  /**
30
29
  * Converts a numeric value to English ordinal words using Indian numbering.
31
30
  * @param {number | string | bigint} value - The numeric value to convert (must be a positive integer)
@@ -37,7 +36,19 @@ export function toCardinal(value: number | string | bigint): string;
37
36
  * toOrdinal(100000) // 'one lakhth'
38
37
  * toOrdinal(100001) // 'one lakh first'
39
38
  */
40
- export function toOrdinal(value: number | string | bigint): string;
39
+ declare function toOrdinal(value: number | string | bigint): string;
40
+ export type CurrencyOptions = {
41
+ /**
42
+ * - Use "and" between rupees and paise
43
+ */
44
+ and?: boolean;
45
+ };
46
+ /**
47
+ * @typedef {object} CurrencyOptions
48
+ * @property {boolean} [and] - Use "and" between rupees and paise
49
+ */
50
+ /** @type {Required<CurrencyOptions>} */
51
+ export declare const currencyDefaults: Required<CurrencyOptions>;
41
52
  /**
42
53
  * Converts a numeric value to Pakistani English currency words.
43
54
  * @param {number | string | bigint} value - The currency amount to convert
@@ -52,4 +63,5 @@ export function toOrdinal(value: number | string | bigint): string;
52
63
  * toCurrency(0.50) // 'fifty paise'
53
64
  * toCurrency(42.50, { and: false }) // 'forty-two rupees fifty paise'
54
65
  */
55
- export function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
66
+ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
67
+ export { toCardinal, toOrdinal, toCurrency };
package/src/en-SG.d.ts CHANGED
@@ -1,18 +1,24 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
4
1
  /**
5
- * @typedef {object} CurrencyOptions
6
- * @property {boolean} [and] - Use "and" between dollars and cents
2
+ * Singaporean English language converter
3
+ *
4
+ * CLDR: en-SG | English as used in Singapore
5
+ *
6
+ * Exports:
7
+ * - toCardinal(value) - Cardinal numbers: 42 → "forty-two"
8
+ * - toOrdinal(value) - Ordinal numbers: 42 → "forty-second"
9
+ * - toCurrency(value, options?) - Currency: 42.50 → "forty-two dollars and fifty cents"
10
+ *
11
+ * Singaporean English conventions:
12
+ * - Follows British English style
13
+ * - "and" after hundreds: "one hundred and twenty-three"
14
+ * - "and" before final segment: "one million and one"
15
+ * - Hyphenated tens-ones: "twenty-one", "forty-two"
16
+ * - Western numbering system (short scale: billion = 10^9)
17
+ * - Currency: Singapore Dollar (SGD) - dollar/dollars, cent/cents
7
18
  */
8
- /** @type {Required<CurrencyOptions>} */
9
- export const currencyDefaults: Required<CurrencyOptions>;
10
- export type CurrencyOptions = {
11
- /**
12
- * - Use "and" between dollars and cents
13
- */
14
- and?: boolean | undefined;
15
- };
19
+ export declare const cardinalMax: bigint;
20
+ export declare const ordinalMax: bigint;
21
+ export declare const currencyMax: bigint;
16
22
  /**
17
23
  * Converts a numeric value to Singaporean English words.
18
24
  * @param {number | string | bigint} value - The numeric value to convert
@@ -20,17 +26,30 @@ export type CurrencyOptions = {
20
26
  * @throws {TypeError} If value is not a valid numeric type
21
27
  * @throws {Error} If value is not a valid number format
22
28
  */
23
- export function toCardinal(value: number | string | bigint): string;
29
+ declare function toCardinal(value: number | string | bigint): string;
24
30
  /**
25
31
  * Converts a numeric value to Singaporean English ordinal words.
26
32
  * @param {number | string | bigint} value - The numeric value to convert (must be a positive integer)
27
33
  * @returns {string} The number as ordinal words (e.g., "first", "forty-second")
28
34
  */
29
- export function toOrdinal(value: number | string | bigint): string;
35
+ declare function toOrdinal(value: number | string | bigint): string;
36
+ export type CurrencyOptions = {
37
+ /**
38
+ * - Use "and" between dollars and cents
39
+ */
40
+ and?: boolean;
41
+ };
42
+ /**
43
+ * @typedef {object} CurrencyOptions
44
+ * @property {boolean} [and] - Use "and" between dollars and cents
45
+ */
46
+ /** @type {Required<CurrencyOptions>} */
47
+ export declare const currencyDefaults: Required<CurrencyOptions>;
30
48
  /**
31
49
  * Converts a numeric value to Singaporean English currency words.
32
50
  * @param {number | string | bigint} value - The currency amount to convert
33
51
  * @param {CurrencyOptions} [options] - Optional configuration
34
52
  * @returns {string} The amount in Singaporean English currency words
35
53
  */
36
- export function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
54
+ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
55
+ export { toCardinal, toOrdinal, toCurrency };
package/src/en-US.d.ts CHANGED
@@ -1,35 +1,41 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
4
1
  /**
5
- * @typedef {object} CardinalOptions
6
- * @property {boolean} [hundredPairing] - Use hundred-pairing for 1100-9999 (e.g., "fifteen hundred" instead of "one thousand five hundred")
7
- * @property {boolean} [and] - Use "and" after hundreds and before final small numbers (e.g., "one hundred and one" instead of "one hundred one")
8
- */
9
- /** @type {Required<CardinalOptions>} */
10
- export const cardinalDefaults: Required<CardinalOptions>;
11
- /**
12
- * @typedef {object} CurrencyOptions
13
- * @property {boolean} [and] - Use "and" between dollars and cents (e.g., "one dollar and fifty cents")
2
+ * American English language converter
3
+ *
4
+ * CLDR: en-US | English as used in the United States
5
+ *
6
+ * Exports:
7
+ * - toCardinal(value, options?) - Cardinal numbers: 42 → "forty-two"
8
+ * - toOrdinal(value) - Ordinal numbers: 42 → "forty-second"
9
+ * - toCurrency(value, options?) - Currency: 42.50 → "forty-two dollars and fifty cents"
10
+ *
11
+ * American English conventions:
12
+ * - No "and" after hundreds: "one hundred twenty-three" (default)
13
+ * - No "and" before final segment: "one million one" (default)
14
+ * - Hyphenated tens-ones: "twenty-one", "forty-two"
15
+ * - Western numbering system (short scale: billion = 10^9)
16
+ * - Optional hundred-pairing: 1500 → "fifteen hundred" (colloquial)
17
+ * - Optional "and" insertion: 101 → "one hundred and one" (informal)
14
18
  */
15
- /** @type {Required<CurrencyOptions>} */
16
- export const currencyDefaults: Required<CurrencyOptions>;
19
+ export declare const cardinalMax: bigint;
20
+ export declare const ordinalMax: bigint;
21
+ export declare const currencyMax: bigint;
17
22
  export type CardinalOptions = {
18
23
  /**
19
24
  * - Use hundred-pairing for 1100-9999 (e.g., "fifteen hundred" instead of "one thousand five hundred")
20
25
  */
21
- hundredPairing?: boolean | undefined;
26
+ hundredPairing?: boolean;
22
27
  /**
23
28
  * - Use "and" after hundreds and before final small numbers (e.g., "one hundred and one" instead of "one hundred one")
24
29
  */
25
- and?: boolean | undefined;
26
- };
27
- export type CurrencyOptions = {
28
- /**
29
- * - Use "and" between dollars and cents (e.g., "one dollar and fifty cents")
30
- */
31
- and?: boolean | undefined;
30
+ and?: boolean;
32
31
  };
32
+ /**
33
+ * @typedef {object} CardinalOptions
34
+ * @property {boolean} [hundredPairing] - Use hundred-pairing for 1100-9999 (e.g., "fifteen hundred" instead of "one thousand five hundred")
35
+ * @property {boolean} [and] - Use "and" after hundreds and before final small numbers (e.g., "one hundred and one" instead of "one hundred one")
36
+ */
37
+ /** @type {Required<CardinalOptions>} */
38
+ export declare const cardinalDefaults: Required<CardinalOptions>;
33
39
  /**
34
40
  * Converts a numeric value to American English words.
35
41
  *
@@ -47,7 +53,7 @@ export type CurrencyOptions = {
47
53
  * toCardinal(1500) // 'one thousand five hundred'
48
54
  * toCardinal(1500, { hundredPairing: true }) // 'fifteen hundred'
49
55
  */
50
- export function toCardinal(value: number | string | bigint, options?: CardinalOptions): string;
56
+ declare function toCardinal(value: number | string | bigint, options?: CardinalOptions): string;
51
57
  /**
52
58
  * Converts a numeric value to American English ordinal words.
53
59
  * @param {number | string | bigint} value - The numeric value to convert (must be a positive integer)
@@ -64,7 +70,19 @@ export function toCardinal(value: number | string | bigint, options?: CardinalOp
64
70
  * toOrdinal(101) // 'one hundred first'
65
71
  * toOrdinal(1000) // 'one thousandth'
66
72
  */
67
- export function toOrdinal(value: number | string | bigint): string;
73
+ declare function toOrdinal(value: number | string | bigint): string;
74
+ export type CurrencyOptions = {
75
+ /**
76
+ * - Use "and" between dollars and cents (e.g., "one dollar and fifty cents")
77
+ */
78
+ and?: boolean;
79
+ };
80
+ /**
81
+ * @typedef {object} CurrencyOptions
82
+ * @property {boolean} [and] - Use "and" between dollars and cents (e.g., "one dollar and fifty cents")
83
+ */
84
+ /** @type {Required<CurrencyOptions>} */
85
+ export declare const currencyDefaults: Required<CurrencyOptions>;
68
86
  /**
69
87
  * Converts a numeric value to American English currency words.
70
88
  * @param {number | string | bigint} value - The currency amount to convert
@@ -78,4 +96,5 @@ export function toOrdinal(value: number | string | bigint): string;
78
96
  * toCurrency(0.99) // 'ninety-nine cents'
79
97
  * toCurrency(42.50, { and: false }) // 'forty-two dollars fifty cents'
80
98
  */
81
- export function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
99
+ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
100
+ export { toCardinal, toOrdinal, toCurrency };
package/src/en-ZA.d.ts CHANGED
@@ -1,18 +1,26 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
4
1
  /**
5
- * @typedef {object} CurrencyOptions
6
- * @property {boolean} [and] - Use "and" between rand and cents (e.g., "one rand and fifty cents")
2
+ * South African English language converter
3
+ *
4
+ * CLDR: en-ZA | English as used in South Africa
5
+ *
6
+ * Exports:
7
+ * - toCardinal(value) - Cardinal numbers: 42 → "forty-two"
8
+ * - toOrdinal(value) - Ordinal numbers: 42 → "forty-second"
9
+ * - toCurrency(value, options?) - Currency: 42.50 → "forty-two rand and fifty cents"
10
+ *
11
+ * South African English conventions:
12
+ * - Follows British English style
13
+ * - "and" after hundreds: "one hundred and twenty-three"
14
+ * - "and" before final segment: "one million and one"
15
+ * - Hyphenated tens-ones: "twenty-one", "forty-two"
16
+ * - Western numbering system (short scale: billion = 10^9)
17
+ * - Currency: South African Rand (ZAR) - rand (singular/plural), cent/cents
18
+ *
19
+ * Note: "Rand" is invariable (same for singular and plural).
7
20
  */
8
- /** @type {Required<CurrencyOptions>} */
9
- export const currencyDefaults: Required<CurrencyOptions>;
10
- export type CurrencyOptions = {
11
- /**
12
- * - Use "and" between rand and cents (e.g., "one rand and fifty cents")
13
- */
14
- and?: boolean | undefined;
15
- };
21
+ export declare const cardinalMax: bigint;
22
+ export declare const ordinalMax: bigint;
23
+ export declare const currencyMax: bigint;
16
24
  /**
17
25
  * Converts a numeric value to South African English words.
18
26
  *
@@ -27,7 +35,7 @@ export type CurrencyOptions = {
27
35
  * toCardinal(-3.14) // 'minus three point fourteen'
28
36
  * toCardinal('1000000') // 'one million'
29
37
  */
30
- export function toCardinal(value: number | string | bigint): string;
38
+ declare function toCardinal(value: number | string | bigint): string;
31
39
  /**
32
40
  * Converts a numeric value to South African English ordinal words.
33
41
  * @param {number | string | bigint} value - The numeric value to convert (must be a positive integer)
@@ -44,7 +52,19 @@ export function toCardinal(value: number | string | bigint): string;
44
52
  * toOrdinal(101) // 'one hundred first'
45
53
  * toOrdinal(1000) // 'one thousandth'
46
54
  */
47
- export function toOrdinal(value: number | string | bigint): string;
55
+ declare function toOrdinal(value: number | string | bigint): string;
56
+ export type CurrencyOptions = {
57
+ /**
58
+ * - Use "and" between rand and cents (e.g., "one rand and fifty cents")
59
+ */
60
+ and?: boolean;
61
+ };
62
+ /**
63
+ * @typedef {object} CurrencyOptions
64
+ * @property {boolean} [and] - Use "and" between rand and cents (e.g., "one rand and fifty cents")
65
+ */
66
+ /** @type {Required<CurrencyOptions>} */
67
+ export declare const currencyDefaults: Required<CurrencyOptions>;
48
68
  /**
49
69
  * Converts a numeric value to South African English currency words.
50
70
  * @param {number | string | bigint} value - The currency amount to convert
@@ -59,4 +79,5 @@ export function toOrdinal(value: number | string | bigint): string;
59
79
  * toCurrency(0.01) // 'one cent'
60
80
  * toCurrency(42.50, { and: false }) // 'forty-two rand fifty cents'
61
81
  */
62
- export function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
82
+ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
83
+ export { toCardinal, toOrdinal, toCurrency };
package/src/es-ES.d.ts CHANGED
@@ -1,49 +1,39 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
4
1
  /**
5
- * @typedef {object} CardinalOptions
6
- * @property {('masculine'|'feminine')} [gender] - Grammatical gender
7
- */
8
- /** @type {Required<CardinalOptions>} */
9
- export const cardinalDefaults: Required<CardinalOptions>;
10
- /** @type {{ gender: ReadonlyArray<Required<CardinalOptions>['gender']> }} */
11
- export const cardinalValues: {
12
- gender: ReadonlyArray<Required<CardinalOptions>["gender"]>;
13
- };
14
- /**
15
- * @typedef {object} OrdinalOptions
16
- * @property {('masculine'|'feminine')} [gender] - Grammatical gender
17
- */
18
- /** @type {Required<OrdinalOptions>} */
19
- export const ordinalDefaults: Required<OrdinalOptions>;
20
- /** @type {{ gender: ReadonlyArray<Required<OrdinalOptions>['gender']> }} */
21
- export const ordinalValues: {
22
- gender: ReadonlyArray<Required<OrdinalOptions>["gender"]>;
23
- };
24
- /**
25
- * @typedef {object} CurrencyOptions
26
- * @property {boolean} [and] - Use "con" between euros and cents
2
+ * Spanish (Spain) language converter
3
+ *
4
+ * CLDR: es-ES | Spanish as used in Spain
5
+ *
6
+ * Uses the European long scale numbering system:
7
+ * - 10⁶ = millón
8
+ * - 10⁹ = mil millones (thousand millions)
9
+ * - 10¹² = billón
10
+ *
11
+ * Spanish-specific rules:
12
+ * - Gender agreement: uno/una, veintiuno/veintiuna, hundreds
13
+ * - Special twenties: veinte, veintiuno, veintidós, ... veintinueve
14
+ * - "y" conjunction: treinta y uno (only 30-99 with ones)
15
+ * - "cien" for exact 100, "ciento/cienta" otherwise
16
+ * - Irregular hundreds: quinientos, setecientos, novecientos
17
+ * - "un" before millón (not "uno"), omit before mil
27
18
  */
28
- /** @type {Required<CurrencyOptions>} */
29
- export const currencyDefaults: Required<CurrencyOptions>;
19
+ export declare const cardinalMax: bigint;
20
+ export declare const ordinalMax: bigint;
21
+ export declare const currencyMax: bigint;
30
22
  export type CardinalOptions = {
31
23
  /**
32
24
  * - Grammatical gender
33
25
  */
34
- gender?: "feminine" | "masculine" | undefined;
35
- };
36
- export type OrdinalOptions = {
37
- /**
38
- * - Grammatical gender
39
- */
40
- gender?: "feminine" | "masculine" | undefined;
26
+ gender?: ('masculine' | 'feminine');
41
27
  };
42
- export type CurrencyOptions = {
43
- /**
44
- * - Use "con" between euros and cents
45
- */
46
- and?: boolean | undefined;
28
+ /**
29
+ * @typedef {object} CardinalOptions
30
+ * @property {('masculine'|'feminine')} [gender] - Grammatical gender
31
+ */
32
+ /** @type {Required<CardinalOptions>} */
33
+ export declare const cardinalDefaults: Required<CardinalOptions>;
34
+ /** @type {{ gender: ReadonlyArray<Required<CardinalOptions>['gender']> }} */
35
+ export declare const cardinalValues: {
36
+ gender: ReadonlyArray<Required<CardinalOptions>['gender']>;
47
37
  };
48
38
  /**
49
39
  * Converts a numeric value to Spanish words.
@@ -60,7 +50,23 @@ export type CurrencyOptions = {
60
50
  * toCardinal(21, {gender: 'feminine'}) // 'veintiuna'
61
51
  * toCardinal(1000000) // 'un millón'
62
52
  */
63
- export function toCardinal(value: number | string | bigint, options?: CardinalOptions): string;
53
+ declare function toCardinal(value: number | string | bigint, options?: CardinalOptions): string;
54
+ export type OrdinalOptions = {
55
+ /**
56
+ * - Grammatical gender
57
+ */
58
+ gender?: ('masculine' | 'feminine');
59
+ };
60
+ /**
61
+ * @typedef {object} OrdinalOptions
62
+ * @property {('masculine'|'feminine')} [gender] - Grammatical gender
63
+ */
64
+ /** @type {Required<OrdinalOptions>} */
65
+ export declare const ordinalDefaults: Required<OrdinalOptions>;
66
+ /** @type {{ gender: ReadonlyArray<Required<OrdinalOptions>['gender']> }} */
67
+ export declare const ordinalValues: {
68
+ gender: ReadonlyArray<Required<OrdinalOptions>['gender']>;
69
+ };
64
70
  /**
65
71
  * Converts a numeric value to Spanish ordinal words.
66
72
  *
@@ -77,7 +83,19 @@ export function toCardinal(value: number | string | bigint, options?: CardinalOp
77
83
  * toOrdinal(21) // 'vigésimo primero'
78
84
  * toOrdinal(100) // 'centésimo'
79
85
  */
80
- export function toOrdinal(value: number | string | bigint, options?: OrdinalOptions): string;
86
+ declare function toOrdinal(value: number | string | bigint, options?: OrdinalOptions): string;
87
+ export type CurrencyOptions = {
88
+ /**
89
+ * - Use "con" between euros and cents
90
+ */
91
+ and?: boolean;
92
+ };
93
+ /**
94
+ * @typedef {object} CurrencyOptions
95
+ * @property {boolean} [and] - Use "con" between euros and cents
96
+ */
97
+ /** @type {Required<CurrencyOptions>} */
98
+ export declare const currencyDefaults: Required<CurrencyOptions>;
81
99
  /**
82
100
  * Converts a numeric value to Spanish Euro currency words.
83
101
  *
@@ -94,4 +112,5 @@ export function toOrdinal(value: number | string | bigint, options?: OrdinalOpti
94
112
  * toCurrency(0.99) // 'noventa y nueve céntimos'
95
113
  * toCurrency(42.50, { and: false }) // 'cuarenta y dos euros cincuenta céntimos'
96
114
  */
97
- export function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
115
+ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string;
116
+ export { toCardinal, toOrdinal, toCurrency };