n2words 5.0.0 → 5.1.1

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 (309) hide show
  1. package/CHANGELOG.md +133 -40
  2. package/README.md +6 -4
  3. package/dist/am-ET.js +2 -2
  4. package/dist/am-ET.umd.js +2 -2
  5. package/dist/am-Latn-ET.js +2 -2
  6. package/dist/am-Latn-ET.umd.js +2 -2
  7. package/dist/ar-SA.js +2 -2
  8. package/dist/ar-SA.umd.js +2 -2
  9. package/dist/az-AZ.js +2 -2
  10. package/dist/az-AZ.umd.js +2 -2
  11. package/dist/bn-BD.js +2 -2
  12. package/dist/bn-BD.umd.js +2 -2
  13. package/dist/cs-CZ.js +2 -2
  14. package/dist/cs-CZ.umd.js +2 -2
  15. package/dist/da-DK.js +2 -2
  16. package/dist/da-DK.umd.js +2 -2
  17. package/dist/de-DE.js +2 -2
  18. package/dist/de-DE.umd.js +2 -2
  19. package/dist/el-GR.js +2 -2
  20. package/dist/el-GR.umd.js +2 -2
  21. package/dist/en-AU.js +2 -2
  22. package/dist/en-AU.umd.js +2 -2
  23. package/dist/en-BD.js +2 -2
  24. package/dist/en-BD.umd.js +2 -2
  25. package/dist/en-CA.js +2 -2
  26. package/dist/en-CA.umd.js +2 -2
  27. package/dist/en-GB.js +2 -2
  28. package/dist/en-GB.umd.js +2 -2
  29. package/dist/en-GH.js +2 -2
  30. package/dist/en-GH.umd.js +2 -2
  31. package/dist/en-IE.js +2 -2
  32. package/dist/en-IE.umd.js +2 -2
  33. package/dist/en-IN.js +2 -2
  34. package/dist/en-IN.umd.js +2 -2
  35. package/dist/en-KE.js +2 -2
  36. package/dist/en-KE.umd.js +2 -2
  37. package/dist/en-MY.js +2 -2
  38. package/dist/en-MY.umd.js +2 -2
  39. package/dist/en-NG.js +2 -2
  40. package/dist/en-NG.umd.js +2 -2
  41. package/dist/en-NZ.js +2 -2
  42. package/dist/en-NZ.umd.js +2 -2
  43. package/dist/en-PH.js +2 -2
  44. package/dist/en-PH.umd.js +2 -2
  45. package/dist/en-PK.js +2 -2
  46. package/dist/en-PK.umd.js +2 -2
  47. package/dist/en-SG.js +2 -2
  48. package/dist/en-SG.umd.js +2 -2
  49. package/dist/en-US.js +2 -2
  50. package/dist/en-US.umd.js +2 -2
  51. package/dist/en-ZA.js +2 -2
  52. package/dist/en-ZA.umd.js +2 -2
  53. package/dist/es-ES.js +2 -2
  54. package/dist/es-ES.umd.js +2 -2
  55. package/dist/es-MX.js +2 -2
  56. package/dist/es-MX.umd.js +2 -2
  57. package/dist/es-US.js +2 -2
  58. package/dist/es-US.umd.js +2 -2
  59. package/dist/fa-IR.js +2 -2
  60. package/dist/fa-IR.umd.js +2 -2
  61. package/dist/fi-FI.js +2 -2
  62. package/dist/fi-FI.umd.js +2 -2
  63. package/dist/fil-PH.js +2 -2
  64. package/dist/fil-PH.umd.js +2 -2
  65. package/dist/fr-BE.js +2 -2
  66. package/dist/fr-BE.umd.js +2 -2
  67. package/dist/fr-FR.js +2 -2
  68. package/dist/fr-FR.umd.js +2 -2
  69. package/dist/gu-IN.js +2 -2
  70. package/dist/gu-IN.umd.js +2 -2
  71. package/dist/ha-NG.js +2 -2
  72. package/dist/ha-NG.umd.js +2 -2
  73. package/dist/hbo-IL.js +2 -2
  74. package/dist/hbo-IL.umd.js +2 -2
  75. package/dist/he-IL.js +2 -2
  76. package/dist/he-IL.umd.js +2 -2
  77. package/dist/hi-IN.js +2 -2
  78. package/dist/hi-IN.umd.js +2 -2
  79. package/dist/hr-HR.js +2 -2
  80. package/dist/hr-HR.umd.js +2 -2
  81. package/dist/hu-HU.js +2 -2
  82. package/dist/hu-HU.umd.js +2 -2
  83. package/dist/id-ID.js +2 -2
  84. package/dist/id-ID.umd.js +2 -2
  85. package/dist/it-IT.js +2 -2
  86. package/dist/it-IT.umd.js +2 -2
  87. package/dist/ja-JP.js +2 -2
  88. package/dist/ja-JP.umd.js +2 -2
  89. package/dist/ka-GE.js +2 -2
  90. package/dist/ka-GE.umd.js +2 -2
  91. package/dist/kn-IN.js +2 -2
  92. package/dist/kn-IN.umd.js +2 -2
  93. package/dist/ko-KR.js +2 -2
  94. package/dist/ko-KR.umd.js +2 -2
  95. package/dist/lt-LT.js +2 -2
  96. package/dist/lt-LT.umd.js +2 -2
  97. package/dist/lv-LV.js +2 -2
  98. package/dist/lv-LV.umd.js +2 -2
  99. package/dist/mr-IN.js +2 -2
  100. package/dist/mr-IN.umd.js +2 -2
  101. package/dist/ms-MY.js +2 -2
  102. package/dist/ms-MY.umd.js +2 -2
  103. package/dist/nb-NO.js +2 -2
  104. package/dist/nb-NO.umd.js +2 -2
  105. package/dist/nl-NL.js +2 -2
  106. package/dist/nl-NL.umd.js +2 -2
  107. package/dist/pa-IN.js +2 -2
  108. package/dist/pa-IN.umd.js +2 -2
  109. package/dist/pl-PL.js +2 -2
  110. package/dist/pl-PL.umd.js +2 -2
  111. package/dist/pt-BR.js +2 -2
  112. package/dist/pt-BR.umd.js +2 -2
  113. package/dist/pt-PT.js +2 -2
  114. package/dist/pt-PT.umd.js +2 -2
  115. package/dist/ro-RO.js +2 -2
  116. package/dist/ro-RO.umd.js +2 -2
  117. package/dist/ru-RU.js +2 -2
  118. package/dist/ru-RU.umd.js +2 -2
  119. package/dist/sr-Cyrl-RS.js +2 -2
  120. package/dist/sr-Cyrl-RS.umd.js +2 -2
  121. package/dist/sr-Latn-RS.js +2 -2
  122. package/dist/sr-Latn-RS.umd.js +2 -2
  123. package/dist/sv-SE.js +2 -2
  124. package/dist/sv-SE.umd.js +2 -2
  125. package/dist/sw-KE.js +2 -2
  126. package/dist/sw-KE.umd.js +2 -2
  127. package/dist/ta-IN.js +2 -2
  128. package/dist/ta-IN.umd.js +2 -2
  129. package/dist/te-IN.js +2 -2
  130. package/dist/te-IN.umd.js +2 -2
  131. package/dist/th-TH.js +2 -2
  132. package/dist/th-TH.umd.js +2 -2
  133. package/dist/tr-TR.js +2 -2
  134. package/dist/tr-TR.umd.js +2 -2
  135. package/dist/uk-UA.js +2 -2
  136. package/dist/uk-UA.umd.js +2 -2
  137. package/dist/ur-PK.js +2 -2
  138. package/dist/ur-PK.umd.js +2 -2
  139. package/dist/vi-VN.js +2 -2
  140. package/dist/vi-VN.umd.js +2 -2
  141. package/dist/yo-NG.js +2 -2
  142. package/dist/yo-NG.umd.js +2 -2
  143. package/dist/zh-Hans-CN.js +2 -2
  144. package/dist/zh-Hans-CN.umd.js +2 -2
  145. package/dist/zh-Hant-TW.js +2 -2
  146. package/dist/zh-Hant-TW.umd.js +2 -2
  147. package/package.json +33 -24
  148. package/src/am-ET.d.ts +3 -5
  149. package/src/am-ET.js +41 -16
  150. package/src/am-Latn-ET.d.ts +3 -5
  151. package/src/am-Latn-ET.js +45 -16
  152. package/src/ar-SA.d.ts +44 -18
  153. package/src/ar-SA.js +93 -40
  154. package/src/az-AZ.d.ts +3 -5
  155. package/src/az-AZ.js +58 -20
  156. package/src/bn-BD.d.ts +3 -5
  157. package/src/bn-BD.js +32 -16
  158. package/src/cs-CZ.d.ts +3 -6
  159. package/src/cs-CZ.js +66 -42
  160. package/src/da-DK.d.ts +3 -6
  161. package/src/da-DK.js +53 -48
  162. package/src/de-DE.d.ts +17 -11
  163. package/src/de-DE.js +88 -57
  164. package/src/el-GR.d.ts +3 -6
  165. package/src/el-GR.js +45 -32
  166. package/src/en-AU.d.ts +17 -11
  167. package/src/en-AU.js +56 -41
  168. package/src/en-BD.d.ts +17 -11
  169. package/src/en-BD.js +60 -41
  170. package/src/en-CA.d.ts +36 -18
  171. package/src/en-CA.js +67 -46
  172. package/src/en-GB.d.ts +17 -11
  173. package/src/en-GB.js +56 -41
  174. package/src/en-GH.d.ts +32 -3
  175. package/src/en-GH.js +104 -26
  176. package/src/en-IE.d.ts +17 -11
  177. package/src/en-IE.js +56 -41
  178. package/src/en-IN.d.ts +17 -11
  179. package/src/en-IN.js +60 -41
  180. package/src/en-KE.d.ts +28 -3
  181. package/src/en-KE.js +93 -26
  182. package/src/en-MY.d.ts +26 -3
  183. package/src/en-MY.js +91 -26
  184. package/src/en-NG.d.ts +17 -11
  185. package/src/en-NG.js +56 -41
  186. package/src/en-NZ.d.ts +32 -3
  187. package/src/en-NZ.js +85 -31
  188. package/src/en-PH.d.ts +32 -3
  189. package/src/en-PH.js +97 -26
  190. package/src/en-PK.d.ts +17 -11
  191. package/src/en-PK.js +60 -41
  192. package/src/en-SG.d.ts +28 -3
  193. package/src/en-SG.js +93 -26
  194. package/src/en-US.d.ts +36 -18
  195. package/src/en-US.js +70 -47
  196. package/src/en-ZA.d.ts +17 -11
  197. package/src/en-ZA.js +56 -41
  198. package/src/es-ES.d.ts +53 -21
  199. package/src/es-ES.js +104 -56
  200. package/src/es-MX.d.ts +53 -21
  201. package/src/es-MX.js +104 -56
  202. package/src/es-US.d.ts +53 -21
  203. package/src/es-US.js +92 -51
  204. package/src/fa-IR.d.ts +3 -5
  205. package/src/fa-IR.js +28 -13
  206. package/src/fi-FI.d.ts +3 -6
  207. package/src/fi-FI.js +47 -29
  208. package/src/fil-PH.d.ts +3 -5
  209. package/src/fil-PH.js +61 -28
  210. package/src/fr-BE.d.ts +31 -15
  211. package/src/fr-BE.js +128 -57
  212. package/src/fr-FR.d.ts +31 -16
  213. package/src/fr-FR.js +97 -60
  214. package/src/gu-IN.d.ts +3 -5
  215. package/src/gu-IN.js +31 -16
  216. package/src/ha-NG.d.ts +3 -5
  217. package/src/ha-NG.js +55 -27
  218. package/src/hbo-IL.d.ts +26 -12
  219. package/src/hbo-IL.js +92 -51
  220. package/src/he-IL.d.ts +17 -10
  221. package/src/he-IL.js +92 -50
  222. package/src/hi-IN.d.ts +3 -5
  223. package/src/hi-IN.js +30 -17
  224. package/src/hr-HR.d.ts +21 -10
  225. package/src/hr-HR.js +89 -33
  226. package/src/hu-HU.d.ts +3 -5
  227. package/src/hu-HU.js +57 -23
  228. package/src/id-ID.d.ts +3 -5
  229. package/src/id-ID.js +56 -23
  230. package/src/it-IT.d.ts +17 -11
  231. package/src/it-IT.js +74 -43
  232. package/src/ja-JP.d.ts +3 -6
  233. package/src/ja-JP.js +39 -26
  234. package/src/ka-GE.d.ts +3 -6
  235. package/src/ka-GE.js +38 -26
  236. package/src/kn-IN.d.ts +3 -5
  237. package/src/kn-IN.js +31 -16
  238. package/src/ko-KR.d.ts +3 -6
  239. package/src/ko-KR.js +34 -26
  240. package/src/lt-LT.d.ts +21 -11
  241. package/src/lt-LT.js +64 -42
  242. package/src/lv-LV.d.ts +21 -11
  243. package/src/lv-LV.js +79 -51
  244. package/src/mr-IN.d.ts +3 -5
  245. package/src/mr-IN.js +31 -16
  246. package/src/ms-MY.d.ts +3 -5
  247. package/src/ms-MY.js +58 -24
  248. package/src/nb-NO.d.ts +3 -6
  249. package/src/nb-NO.js +54 -34
  250. package/src/nl-NL.d.ts +41 -20
  251. package/src/nl-NL.js +111 -69
  252. package/src/pa-IN.d.ts +3 -5
  253. package/src/pa-IN.js +32 -16
  254. package/src/pl-PL.d.ts +21 -11
  255. package/src/pl-PL.js +69 -45
  256. package/src/pt-BR.d.ts +22 -11
  257. package/src/pt-BR.js +93 -53
  258. package/src/pt-PT.d.ts +17 -11
  259. package/src/pt-PT.js +80 -48
  260. package/src/ro-RO.d.ts +21 -11
  261. package/src/ro-RO.js +77 -39
  262. package/src/ru-RU.d.ts +35 -15
  263. package/src/ru-RU.js +100 -38
  264. package/src/sr-Cyrl-RS.d.ts +35 -15
  265. package/src/sr-Cyrl-RS.js +106 -43
  266. package/src/sr-Latn-RS.d.ts +35 -15
  267. package/src/sr-Latn-RS.js +106 -43
  268. package/src/sv-SE.d.ts +3 -6
  269. package/src/sv-SE.js +53 -34
  270. package/src/sw-KE.d.ts +3 -5
  271. package/src/sw-KE.js +50 -20
  272. package/src/ta-IN.d.ts +3 -5
  273. package/src/ta-IN.js +29 -17
  274. package/src/te-IN.d.ts +3 -5
  275. package/src/te-IN.js +31 -16
  276. package/src/th-TH.d.ts +3 -5
  277. package/src/th-TH.js +42 -19
  278. package/src/tr-TR.d.ts +17 -11
  279. package/src/tr-TR.js +63 -37
  280. package/src/uk-UA.d.ts +21 -10
  281. package/src/uk-UA.js +89 -33
  282. package/src/ur-PK.d.ts +3 -5
  283. package/src/ur-PK.js +32 -16
  284. package/src/utils/check-max.d.ts +26 -0
  285. package/src/utils/check-max.js +33 -0
  286. package/src/utils/expand-scientific.d.ts +0 -4
  287. package/src/utils/expand-scientific.js +7 -9
  288. package/src/utils/is-plain-object.d.ts +3 -4
  289. package/src/utils/is-plain-object.js +3 -4
  290. package/src/utils/parse-cardinal.d.ts +1 -2
  291. package/src/utils/parse-cardinal.js +12 -9
  292. package/src/utils/parse-currency.d.ts +1 -2
  293. package/src/utils/parse-currency.js +9 -11
  294. package/src/utils/parse-ordinal.d.ts +0 -1
  295. package/src/utils/parse-ordinal.js +9 -10
  296. package/src/utils/resolve-options.d.ts +17 -0
  297. package/src/utils/resolve-options.js +56 -0
  298. package/src/utils/scale.d.ts +49 -0
  299. package/src/utils/scale.js +65 -0
  300. package/src/vi-VN.d.ts +3 -6
  301. package/src/vi-VN.js +41 -28
  302. package/src/yo-NG.d.ts +3 -5
  303. package/src/yo-NG.js +49 -33
  304. package/src/zh-Hans-CN.d.ts +45 -20
  305. package/src/zh-Hans-CN.js +84 -31
  306. package/src/zh-Hant-TW.d.ts +45 -20
  307. package/src/zh-Hant-TW.js +85 -34
  308. package/src/utils/validate-options.d.ts +0 -8
  309. package/src/utils/validate-options.js +0 -16
package/dist/el-GR.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/el-GR v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- var n,e;n=this,e=function(n){"use strict";function e(n){let[e,r]=n.toLowerCase().split("e");const t=parseInt(r,10);let i="";"-"===e[0]&&(i="-",e=e.slice(1));const s=e.indexOf("."),o=-1===s?e:e.slice(0,s)+e.slice(s+1),u=(-1===s?e.length:s)+t;return u>=o.length?i+o+"0".repeat(u-o.length):u<=0?i+"0."+"0".repeat(-u)+o:i+o.slice(0,u)+"."+o.slice(u)}function r(n){const r=n.toString();return t(r)?e(r):r}function t(n){return n.includes("e")||n.includes("E")}function i(n){const e="-"===n[0];e&&(n=n.slice(1));const r=n.indexOf(".");if(-1===r)return{isNegative:e,integerPart:BigInt(n)};const t=n.slice(0,r)||"0",i=n.slice(r+1);return{isNegative:e,integerPart:BigInt(t),decimalPart:i}}function s(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const s=r.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(r),cents:0n};const o=r.slice(0,s)||"0",u=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const o=["","ένα","δύο","τρία","τέσσερα","πέντε","έξι","επτά","οκτώ","εννέα"],u=["δέκα","έντεκα","δώδεκα","δεκατρία","δεκατέσσερα","δεκαπέντε","δεκαέξι","δεκαεπτά","δεκαοκτώ","δεκαεννέα"],c=["","","είκοσι","τριάντα","σαράντα","πενήντα","εξήντα","εβδομήντα","ογδόντα","ενενήντα"],a=["","εκατό","διακόσια","τριακόσια","τετρακόσια","πεντακόσια","εξακόσια","επτακόσια","οκτακόσια","εννιακόσια"],f="χίλια",l="μηδέν",g="μείον",b=["εκατομμύριο","δισεκατομμύριο","τρισεκατομμύριο"],m=["","πρώτος","δεύτερος","τρίτος","τέταρτος","πέμπτος","έκτος","έβδομος","όγδοος","ένατος"],d=["δέκατος","ενδέκατος","δωδέκατος","δέκατος τρίτος","δέκατος τέταρτος","δέκατος πέμπτος","δέκατος έκτος","δέκατος έβδομος","δέκατος όγδοος","δέκατος ένατος"],h=["","","εικοστός","τριακοστός","τεσσαρακοστός","πεντηκοστός","εξηκοστός","εβδομηκοστός","ογδοηκοστός","ενενηκοστός"],w=["","εκατοστός","διακοσιοστός","τριακοσιοστός","τετρακοσιοστός","πεντακοσιοστός","εξακοσιοστός","επτακοσιοστός","οκτακοσιοστός","εννιακοσιοστός"],p="χιλιοστός",N="εκατομμυριοστός",v=["ευρώ","ευρώ"],I=["λεπτό","λεπτά"];function E(n){if(0===n)return"";const e=n%10,r=Math.trunc(n/10)%10,t=Math.trunc(n/100),i=[];t>0&&i.push(a[t]);const s=n%100;return 0===s||i.push(s<10?o[e]:s<20?u[e]:0===e?c[r]:c[r]+" "+o[e]),i.join(" ")}function y(n){if(0n===n)return l;if(n<1000n)return E(Number(n));if(n<1000000n){const e=Number(n/1000n),r=Number(n%1000n);let t;return t=1===e?f:E(e)+" "+f,r>0&&(t+=" "+E(r)),t}return function(n){const e=n.toString(),r=e.length,t=[],i=r%3;let s=0;for(i>0&&(t.push(Number(e.slice(0,i))),s=i);s<r;)t.push(Number(e.slice(s,s+3))),s+=3;const o=[];let u=t.length-1;for(let n=0;n<t.length;n++){const e=t[n];if(0!==e){const n=E(e);if(0===u)o.push(n);else if(1===u)o.push(1===e?f:n+" "+f);else{const r=b[u-2];o.push(1===e?r:n+" "+r)}}u--}return o.join(" ")}(n)}function R(n){if(0===n)return"";if(n<10)return m[n];if(n<20)return d[n-10];const e=n%10,r=Math.trunc(n/10);return 0===e?h[r]:h[r]+" "+m[e]}function O(n){if(0n===n)return"";if(1n===n)return m[1];if(n<100n)return R(Number(n));if(n<1000n){const e=Number(n/100n),r=Number(n%100n);return 0===r?w[e]:a[e]+" "+R(r)}if(n<1000000n){const e=Number(n/1000n),r=Number(n%1000n);if(0===r)return 1===e?p:E(e)+" "+p;let t;if(t=1===e?f:E(e)+" "+f,r<100)return t+" "+R(r);const i=Math.trunc(r/100),s=r%100;return 0===s?t+" "+w[i]:t+" "+a[i]+" "+R(s)}const e=Number(n/1000000n),r=n%1000000n;if(0n===r)return 1===e?N:E(e)+" "+N;let t;return t=1===e?b[0]:E(e)+" "+b[0],t+" "+O(r)}const B={elGR:function(n){return O(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const n=BigInt(r);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}};n.currency={elGR:function(n){const{isNegative:e,dollars:t,cents:i}=function(n){const e=typeof n;if("bigint"===e)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"===e){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:s(r(n))}if("string"===e)return s(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n),o=[];if(e&&o.push(g),t>0n||0n===i){const n=y(t);o.push(n+" "+(1n===t?v[0]:v[1]))}if(i>0n){const n=y(i);o.push(n+" "+(1n===i?I[0]:I[1]))}return o.join(" ")}},n.elGR=function(n){const{isNegative:s,integerPart:u,decimalPart:c}=function(n){const s=typeof n;if("bigint"===s)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"===s){if(!Number.isFinite(n))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(n)?n<0?{isNegative:!0,integerPart:BigInt(-n)}:{isNegative:!1,integerPart:BigInt(n)}:i(r(n))}if("string"===s)return i(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(n));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(n);let a="";return s&&(a=g+" "),a+=y(u),c&&(a+=" κόμμα "+function(n){const e=[];for(const r of n){const n=parseInt(r,10);e.push(0===n?l:o[n])}return e.join(" ")}(c)),a},n.ordinal=B},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
1
+ /*! n2words/el-GR v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ var n,e;n=this,e=function(n){"use strict";function e(n){let[e,t]=n.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===e[0]&&(i="-",e=e.slice(1));const o=e.indexOf("."),s=-1===o?e:e.slice(0,o)+e.slice(o+1),u=(-1===o?e.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(n){const t=n.toString();return r(t)?e(t):t}function r(n){return n.includes("e")||n.includes("E")}function i(n){const e="-"===n[0];e&&(n=n.slice(1));const t=n.indexOf(".");if(-1===t)return{isNegative:e,integerPart:BigInt(n)};const r=n.slice(0,t)||"0",i=n.slice(t+1);return{isNegative:e,integerPart:BigInt(r),decimalPart:i}}function o(n){let t=n.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${n}"`);r(t)&&(t=e(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(n,e,t){if(null===e)return;if(n<e)return;const r=e.toString().length-1,i=e===10n**BigInt(r)?`10^${r} - 1`:""+(e-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(n){return 10n**BigInt(3*(n+1))}const c=["","ένα","δύο","τρία","τέσσερα","πέντε","έξι","επτά","οκτώ","εννέα"],f=["δέκα","έντεκα","δώδεκα","δεκατρία","δεκατέσσερα","δεκαπέντε","δεκαέξι","δεκαεπτά","δεκαοκτώ","δεκαεννέα"],a=["","","είκοσι","τριάντα","σαράντα","πενήντα","εξήντα","εβδομήντα","ογδόντα","ενενήντα"],l=["","εκατό","διακόσια","τριακόσια","τετρακόσια","πεντακόσια","εξακόσια","επτακόσια","οκτακόσια","εννιακόσια"],g="χίλια",b="μηδέν",m="μείον",h=["εκατομμύριο","δισεκατομμύριο","τρισεκατομμύριο"],d=u(h.length+1),p=10n**BigInt(9),w=u(h.length+1),N=["","πρώτος","δεύτερος","τρίτος","τέταρτος","πέμπτος","έκτος","έβδομος","όγδοος","ένατος"],v=["δέκατος","ενδέκατος","δωδέκατος","δέκατος τρίτος","δέκατος τέταρτος","δέκατος πέμπτος","δέκατος έκτος","δέκατος έβδομος","δέκατος όγδοος","δέκατος ένατος"],y=["","","εικοστός","τριακοστός","τεσσαρακοστός","πεντηκοστός","εξηκοστός","εβδομηκοστός","ογδοηκοστός","ενενηκοστός"],I=["","εκατοστός","διακοσιοστός","τριακοσιοστός","τετρακοσιοστός","πεντακοσιοστός","εξακοσιοστός","επτακοσιοστός","οκτακοσιοστός","εννιακοσιοστός"],E="χιλιοστός",R="εκατομμυριοστός",B=["ευρώ","ευρώ"],O=["λεπτό","λεπτά"];function x(n){if(0===n)return"";const e=n%10,t=Math.trunc(n/10)%10,r=Math.trunc(n/100),i=[];r>0&&i.push(l[r]);const o=n%100;return 0===o||i.push(o<10?c[e]:o<20?f[e]:0===e?a[t]:a[t]+" "+c[e]),i.join(" ")}function P(n){if(0n===n)return b;if(n<1000n)return x(Number(n));if(n<1000000n){const e=Number(n/1000n),t=Number(n%1000n);let r;return r=1===e?g:x(e)+" "+g,t>0&&(r+=" "+x(t)),r}return function(n){const e=n.toString(),t=e.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(e.slice(0,i))),o=i);o<t;)r.push(Number(e.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let n=0;n<r.length;n++){const e=r[n];if(0!==e){const n=x(e);if(0===u)s.push(n);else if(1===u)s.push(1===e?g:n+" "+g);else{const t=h[u-2];s.push(1===e?t:n+" "+t)}}u--}return s.join(" ")}(n)}function $(n){if(0===n)return"";if(n<10)return N[n];if(n<20)return v[n-10];const e=n%10,t=Math.trunc(n/10);return 0===e?y[t]:y[t]+" "+N[e]}function j(n){if(0n===n)return"";if(1n===n)return N[1];if(n<100n)return $(Number(n));if(n<1000n){const e=Number(n/100n),t=Number(n%100n);return 0===t?I[e]:l[e]+" "+$(t)}if(n<1000000n){const e=Number(n/1000n),t=Number(n%1000n);if(0===t)return 1===e?E:x(e)+" "+E;let r;if(r=1===e?g:x(e)+" "+g,t<100)return r+" "+$(t);const i=Math.trunc(t/100),o=t%100;return 0===o?r+" "+I[i]:r+" "+l[i]+" "+$(o)}const e=Number(n/1000000n),t=n%1000000n;if(0n===t)return 1===e?R:x(e)+" "+R;let r;return r=1===e?h[0]:x(e)+" "+h[0],r+" "+j(t)}const S={elGR:function(n){const t=function(n){const t=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const t=n.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const n=e(t);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(n);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);return s(t,p),j(t)}};n.currency={elGR:function(n){const{isNegative:e,dollars:r,cents:i}=function(n){const e=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:o(t(n))}if("string"==typeof n)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);s(r,w);const u=[];if(e&&u.push(m),r>0n||0n===i){const n=P(r);u.push(n+" "+(1n===r?B[0]:B[1]))}if(i>0n){const n=P(i);u.push(n+" "+(1n===i?O[0]:O[1]))}return u.join(" ")}},n.elGR=function(n){const{isNegative:o,integerPart:u,decimalPart:f}=function(n){const o=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(n)?n<0?{isNegative:!0,integerPart:BigInt(-n)}:{isNegative:!1,integerPart:BigInt(n)}:i(t(n))}if("string"==typeof n)return i(function(n){const t=n.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${n}"`);return r(t)?e(t):t}(n));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(n);s(u,d);let a="";return o&&(a=m+" "),a+=P(u),f&&(a+=" κόμμα "+function(n){const e=[];for(const t of n){const n=parseInt(t,10);e.push(0===n?b:c[n])}return e.join(" ")}(f)),a},n.ordinal=S},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
package/dist/en-AU.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-AU v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const o=["","one","two","three","four","five","six","seven","eight","nine"],s=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],u=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],l=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],c="hundred",a="zero",f="minus",d=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],g=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],h=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],w={word:"",hasHundred:!1};function b(e){if(0===e)return w.word="",w.hasHundred=!1,w;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=s[n]:t>=2?i=n>0?u[t]+"-"+o[n]:u[t]:n>0&&(i=o[n]),r>0?(w.word=i?o[r]+" "+c+" and "+i:o[r]+" "+c,w.hasHundred=!0):(w.word=i,w.hasHundred=!1),w}function m(e){if(0n===e)return a;if(e<1000n)return b(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=b(n);let i=r+" "+l[0];if(t>0){const{word:e,hasHundred:n}=b(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=b(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+l[e-1],o=!0):o=!1}return i}(e)}function v(i){const{isNegative:o,integerPart:s,decimalPart:u}=function(i){const o=typeof i;if("bigint"===o)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===o){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===o)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);let l="";return o&&(l=f+" "),l+=m(s),u&&(l+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=a,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=m(BigInt(r))),n}(u)),l}function N(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=g[n]:t>=2?i=n>0?u[t]+"-"+d[n]:h[t]:n>0&&(i=d[n]),r>0?i?o[r]+" "+c+" "+i:o[r]+" hundredth":i}function p(n){return function(e){if(e<1000n)return N(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return b(n).word+" "+l[0]+"th";const{word:r}=b(n);return r+" "+l[0]+" "+N(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?N(t):b(t).word+" "+l[e-1]+"th":(i+=b(t).word,e>0&&(i+=" "+l[e-1])))}return i}(e)}(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}function y(e,t){t=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(t);const{isNegative:r,dollars:o,cents:s}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e),{and:u=!0}=t;let l="";return r&&(l=f+" "),(o>0n||0n===s)&&(l+=m(o),l+=" "+(1n===o?"dollar":"dollars")),s>0n&&(o>0n&&(l+=u?" and ":" "),l+=m(s),l+=" "+(1n===s?"cent":"cents")),l}export{v as toCardinal,y as toCurrency,p as toOrdinal};
1
+ /*! n2words/en-AU v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3*(e+1))}const u=["","one","two","three","four","five","six","seven","eight","nine"],l=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],f=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],a=s(f.length),g=s(f.length),d=s(f.length),h="hundred",w="zero",b="minus",p=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],m=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],y={word:"",hasHundred:!1};function N(e){if(0===e)return y.word="",y.hasHundred=!1,y;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=l[n]:t>=2?i=n>0?c[t]+"-"+u[n]:c[t]:n>0&&(i=u[n]),r>0?(y.word=i?u[r]+" "+h+" and "+i:u[r]+" "+h,y.hasHundred=!0):(y.word=i,y.hasHundred=!1),y}function I(e){if(0n===e)return w;if(e<1000n)return N(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=N(n);let i=r+" "+f[0];if(t>0){const{word:e,hasHundred:n}=N(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=N(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+f[e-1],o=!0):o=!1}return i}(e)}function E(i){const{isNegative:s,integerPart:u,decimalPart:l}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,a,l);let c="";return s&&(c=b+" "),c+=I(u),l&&(c+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=w,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=I(BigInt(r))),n}(l)),c}function O(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=m[n]:t>=2?i=n>0?c[t]+"-"+p[n]:v[t]:n>0&&(i=p[n]),r>0?i?u[r]+" "+h+" "+i:u[r]+" hundredth":i}function x(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return o(r,g),function(e){if(e<1000n)return O(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return N(n).word+" "+f[0]+"th";const{word:r}=N(n);return r+" "+f[0]+" "+O(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?O(t):N(t).word+" "+f[e-1]+"th":(i+=N(t).word,e>0&&(i+=" "+f[e-1])))}return i}(e)}(r)}const R={and:!0};function B(e,t){const{isNegative:r,dollars:s,cents:u}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(s,d);const{and:l}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(t,R);let c="";return r&&(c=b+" "),(s>0n||0n===u)&&(c+=I(s),c+=" "+(1n===s?"dollar":"dollars")),u>0n&&(s>0n&&(c+=l?" and ":" "),c+=I(u),c+=" "+(1n===u?"cent":"cents")),c}export{a as cardinalMax,R as currencyDefaults,d as currencyMax,g as ordinalMax,E as toCardinal,B as toCurrency,x as toOrdinal};
package/dist/en-AU.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-AU v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const s=["","one","two","three","four","five","six","seven","eight","nine"],u=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],l=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],c=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],f="hundred",a="zero",d="minus",g=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],h=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],w=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],b={word:"",hasHundred:!1};function m(e){if(0===e)return b.word="",b.hasHundred=!1,b;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=u[n]:t>=2?i=n>0?l[t]+"-"+s[n]:l[t]:n>0&&(i=s[n]),r>0?(b.word=i?s[r]+" "+f+" and "+i:s[r]+" "+f,b.hasHundred=!0):(b.word=i,b.hasHundred=!1),b}function v(e){if(0n===e)return a;if(e<1000n)return m(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=m(n);let i=r+" "+c[0];if(t>0){const{word:e,hasHundred:n}=m(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=m(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+c[e-1],o=!0):o=!1}return i}(e)}function p(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=h[n]:t>=2?i=n>0?l[t]+"-"+g[n]:w[t]:n>0&&(i=g[n]),r>0?i?s[r]+" "+f+" "+i:s[r]+" hundredth":i}const N={enAU:function(e){return function(e){if(e<1000n)return p(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return m(n).word+" "+c[0]+"th";const{word:r}=m(n);return r+" "+c[0]+" "+p(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?p(t):m(t).word+" "+c[e-1]+"th":(i+=m(t).word,e>0&&(i+=" "+c[e-1])))}return i}(e)}(function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e))}};e.currency={enAU:function(e,n){n=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(n);const{isNegative:r,dollars:i,cents:s}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"===n)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e),{and:u=!0}=n;let l="";return r&&(l=d+" "),(i>0n||0n===s)&&(l+=v(i),l+=" "+(1n===i?"dollar":"dollars")),s>0n&&(i>0n&&(l+=u?" and ":" "),l+=v(s),l+=" "+(1n===s?"cent":"cents")),l}},e.enAU=function(e){const{isNegative:o,integerPart:s,decimalPart:u}=function(e){const o=typeof e;if("bigint"===o)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===o){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"===o)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);let l="";return o&&(l=d+" "),l+=v(s),u&&(l+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=a,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=v(BigInt(r))),n}(u)),l},e.ordinal=N},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
1
+ /*! n2words/en-AU v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(e){return 10n**BigInt(3*(e+1))}const l=["","one","two","three","four","five","six","seven","eight","nine"],f=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],a=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],d=u(a.length),g=u(a.length),h=u(a.length),w="hundred",b="zero",p="minus",m=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],v=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],y=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],N={word:"",hasHundred:!1};function I(e){if(0===e)return N.word="",N.hasHundred=!1,N;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=f[n]:t>=2?i=n>0?c[t]+"-"+l[n]:c[t]:n>0&&(i=l[n]),r>0?(N.word=i?l[r]+" "+w+" and "+i:l[r]+" "+w,N.hasHundred=!0):(N.word=i,N.hasHundred=!1),N}function E(e){if(0n===e)return b;if(e<1000n)return I(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=I(n);let i=r+" "+a[0];if(t>0){const{word:e,hasHundred:n}=I(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=I(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+a[e-1],o=!0):o=!1}return i}(e)}function O(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=v[n]:t>=2?i=n>0?c[t]+"-"+m[n]:y[t]:n>0&&(i=m[n]),r>0?i?l[r]+" "+w+" "+i:l[r]+" hundredth":i}const x={and:!0},R={enAU:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,g),function(e){if(e<1000n)return O(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return I(n).word+" "+a[0]+"th";const{word:r}=I(n);return r+" "+a[0]+" "+O(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?O(t):I(t).word+" "+a[e-1]+"th":(i+=I(t).word,e>0&&(i+=" "+a[e-1])))}return i}(e)}(t)}};e.currency={enAU:function(e,n){const{isNegative:r,dollars:i,cents:u}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(i,h);const{and:l}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(n,x);let f="";return r&&(f=p+" "),(i>0n||0n===u)&&(f+=E(i),f+=" "+(1n===i?"dollar":"dollars")),u>0n&&(i>0n&&(f+=l?" and ":" "),f+=E(u),f+=" "+(1n===u?"cent":"cents")),f}},e.enAU=function(e){const{isNegative:o,integerPart:u,decimalPart:l}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,d,l);let f="";return o&&(f=p+" "),f+=E(u),l&&(f+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=b,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=E(BigInt(r))),n}(l)),f},e.ordinal=R},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/en-BD.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-BD v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),u=(-1===s?n.length:s)+r;return u>=o.length?i+o+"0".repeat(u-o.length):u<=0?i+"0."+"0".repeat(-u)+o:i+o.slice(0,u)+"."+o.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const s=r.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(r),cents:0n};const o=r.slice(0,s)||"0",u=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const s=["","one","two","three","four","five","six","seven","eight","nine"],o=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],u=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],a=["thousand","lakh","crore","arab","kharab","neel","padma","shankh"],c="hundred",f="zero",h="minus",l=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],g=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],d=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],w={word:"",hasHundred:!1};function b(e){if(0===e)return w.word="",w.hasHundred=!1,w;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=o[n]:t>=2?i=n>0?u[t]+"-"+s[n]:u[t]:n>0&&(i=s[n]),r>0?(w.word=i?s[r]+" "+c+" and "+i:s[r]+" "+c,w.hasHundred=!0):(w.word=i,w.hasHundred=!1),w}function p(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 1===t?o[n]:t>=2?n>0?u[t]+"-"+s[n]:u[t]:s[n]}function m(e){if(0n===e)return f;if(e<1000n)return b(Number(e)).word;const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;const r=[];for(let e=n.length-1;e>=0;e--){const t=n[e];if(0!==t)if(0===e){const{word:e,hasHundred:n}=b(t);r.length>0&&!n&&r.push("and"),r.push(e)}else r.push(p(t)),a[e-1]&&r.push(a[e-1])}return r.join(" ")}function v(i){const{isNegative:s,integerPart:o,decimalPart:u}=function(i){const s=typeof i;if("bigint"===s)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===s){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===s)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let a="";return s&&(a=h+" "),a+=m(o),u&&(a+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=f,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=m(BigInt(r))),n}(u)),a}function N(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=g[n]:t>=2?i=n>0?u[t]+"-"+l[n]:d[t]:n>0&&(i=l[n]),r>0?i?s[r]+" "+c+" "+i:s[r]+" hundredth":i}function y(n){return function(e){if(e<1000n)return N(Number(e));const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}const i=[];for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(e===r?0===e?i.push(N(t)):(i.push(p(t)),i.push(a[e-1]+"th")):0===e?i.push(b(t).word):(i.push(p(t)),i.push(a[e-1])))}return i.join(" ")}(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}function I(e,t){t=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(t);const{isNegative:r,dollars:s,cents:o}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e),{and:u=!0}=t;let a="";return r&&(a=h+" "),(s>0n||0n===o)&&(a+=m(s),a+=" taka"),o>0n&&(s>0n&&(a+=u?" and ":" "),a+=m(o),a+=" "+(1n===o?"paisa":"paise")),a}export{v as toCardinal,I as toCurrency,y as toOrdinal};
1
+ /*! n2words/en-BD v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ function e(e){let[t,n]=e.toLowerCase().split("e");const r=parseInt(n,10);let i="";"-"===t[0]&&(i="-",t=t.slice(1));const o=t.indexOf("."),s=-1===o?t:t.slice(0,o)+t.slice(o+1),u=(-1===o?t.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(t){const r=t.toString();return n(r)?e(r):r}function n(e){return e.includes("e")||e.includes("E")}function r(e){const t="-"===e[0];t&&(e=e.slice(1));const n=e.indexOf(".");if(-1===n)return{isNegative:t,integerPart:BigInt(e)};const r=e.slice(0,n)||"0",i=e.slice(n+1);return{isNegative:t,integerPart:BigInt(r),decimalPart:i}}function i(t){let r=t.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${t}"`);n(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,t,n){if(null===t)return;if(e<t&&!(n&&BigInt(n)>=t))return;const r=t.toString().length-1,i=t===10n**BigInt(r)?`10^${r} - 1`:""+(t-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3+2*(e-1))}const u=["","one","two","three","four","five","six","seven","eight","nine"],a=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],f=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],c=["thousand","lakh","crore","arab","kharab","neel","padma","shankh"],h=s(c.length+1),l=s(c.length+1),g=s(c.length+1),d="hundred",p="zero",w="minus",b=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],m=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],y={word:"",hasHundred:!1};function N(e){if(0===e)return y.word="",y.hasHundred=!1,y;const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=a[t]:n>=2?i=t>0?f[n]+"-"+u[t]:f[n]:t>0&&(i=u[t]),r>0?(y.word=i?u[r]+" "+d+" and "+i:u[r]+" "+d,y.hasHundred=!0):(y.word=i,y.hasHundred=!1),y}function I(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10);return 1===n?a[t]:n>=2?t>0?f[n]+"-"+u[t]:f[n]:u[t]}function E(e){if(0n===e)return p;if(e<1000n)return N(Number(e)).word;const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;const r=[];for(let e=t.length-1;e>=0;e--){const n=t[e];if(0!==n)if(0===e){const{word:e,hasHundred:t}=N(n);r.length>0&&!t&&r.push("and"),r.push(e)}else r.push(I(n)),c[e-1]&&r.push(c[e-1])}return r.join(" ")}function O(i){const{isNegative:s,integerPart:u,decimalPart:a}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(t(i))}if("string"==typeof i)return r(function(t){const r=t.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${t}"`);return n(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,h,a);let f="";return s&&(f=w+" "),f+=E(u),a&&(f+=" point "+function(e){let t="",n=0;for(;n<e.length&&"0"===e[n];)t&&(t+=" "),t+=p,n++;const r=e.slice(n);return r&&(t&&(t+=" "),t+=E(BigInt(r))),t}(a)),f}function R(e){const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=m[t]:n>=2?i=t>0?f[n]+"-"+b[t]:v[n]:t>0&&(i=b[t]),r>0?i?u[r]+" "+d+" "+i:u[r]+" hundredth":i}function B(t){const r=function(t){const r=typeof t;if("bigint"==typeof t){if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}if("number"==typeof t){if(!Number.isFinite(t))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(t))throw new RangeError("Ordinals must be whole numbers");if(t<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(t)}if("string"==typeof t)return function(t){const r=t.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(n(r)){const t=e(r);if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${t}"`,{cause:e})}}(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(t);return o(r,l),function(e){if(e<1000n)return R(Number(e));const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;let r=0;for(let e=0;e<t.length;e++)if(0!==t[e]){r=e;break}const i=[];for(let e=t.length-1;e>=0;e--){const n=t[e];0!==n&&(e===r?0===e?i.push(R(n)):(i.push(I(n)),i.push(c[e-1]+"th")):0===e?i.push(N(n).word):(i.push(I(n)),i.push(c[e-1])))}return i.join(" ")}(r)}const x={and:!0};function $(e,n){const{isNegative:r,dollars:s,cents:u}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(t(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);o(s,g);const{and:a}=function(e,t){const n={...t};if(void 0===e)return n;if(!function(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(t);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(t,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof n[i])throw new TypeError(`Option "${i}" must be a ${typeof n[i]}, got ${typeof o}`);n[i]=o}}return n}(n,x);let f="";return r&&(f=w+" "),(s>0n||0n===u)&&(f+=E(s),f+=" taka"),u>0n&&(s>0n&&(f+=a?" and ":" "),f+=E(u),f+=" "+(1n===u?"paisa":"paise")),f}export{h as cardinalMax,x as currencyDefaults,g as currencyMax,l as ordinalMax,O as toCardinal,$ as toCurrency,B as toOrdinal};
package/dist/en-BD.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-BD v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const s=["","one","two","three","four","five","six","seven","eight","nine"],u=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],a=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],f=["thousand","lakh","crore","arab","kharab","neel","padma","shankh"],c="hundred",h="zero",l="minus",g=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],d=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],b=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],p={word:"",hasHundred:!1};function w(e){if(0===e)return p.word="",p.hasHundred=!1,p;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=u[n]:t>=2?i=n>0?a[t]+"-"+s[n]:a[t]:n>0&&(i=s[n]),r>0?(p.word=i?s[r]+" "+c+" and "+i:s[r]+" "+c,p.hasHundred=!0):(p.word=i,p.hasHundred=!1),p}function m(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 1===t?u[n]:t>=2?n>0?a[t]+"-"+s[n]:a[t]:s[n]}function v(e){if(0n===e)return h;if(e<1000n)return w(Number(e)).word;const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;const r=[];for(let e=n.length-1;e>=0;e--){const t=n[e];if(0!==t)if(0===e){const{word:e,hasHundred:n}=w(t);r.length>0&&!n&&r.push("and"),r.push(e)}else r.push(m(t)),f[e-1]&&r.push(f[e-1])}return r.join(" ")}function N(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=d[n]:t>=2?i=n>0?a[t]+"-"+g[n]:b[t]:n>0&&(i=g[n]),r>0?i?s[r]+" "+c+" "+i:s[r]+" hundredth":i}const y={enBD:function(e){return function(e){if(e<1000n)return N(Number(e));const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}const i=[];for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(e===r?0===e?i.push(N(t)):(i.push(m(t)),i.push(f[e-1]+"th")):0===e?i.push(w(t).word):(i.push(m(t)),i.push(f[e-1])))}return i.join(" ")}(function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e))}};e.currency={enBD:function(e,n){n=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(n);const{isNegative:r,dollars:i,cents:s}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"===n)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e),{and:u=!0}=n;let a="";return r&&(a=l+" "),(i>0n||0n===s)&&(a+=v(i),a+=" taka"),s>0n&&(i>0n&&(a+=u?" and ":" "),a+=v(s),a+=" "+(1n===s?"paisa":"paise")),a}},e.enBD=function(e){const{isNegative:o,integerPart:s,decimalPart:u}=function(e){const o=typeof e;if("bigint"===o)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===o){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"===o)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);let a="";return o&&(a=l+" "),a+=v(s),u&&(a+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=h,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=v(BigInt(r))),n}(u)),a},e.ordinal=y},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
1
+ /*! n2words/en-BD v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ var e,t;e=this,t=function(e){"use strict";function t(e){let[t,n]=e.toLowerCase().split("e");const r=parseInt(n,10);let i="";"-"===t[0]&&(i="-",t=t.slice(1));const o=t.indexOf("."),s=-1===o?t:t.slice(0,o)+t.slice(o+1),u=(-1===o?t.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(e){const n=e.toString();return r(n)?t(n):n}function r(e){return e.includes("e")||e.includes("E")}function i(e){const t="-"===e[0];t&&(e=e.slice(1));const n=e.indexOf(".");if(-1===n)return{isNegative:t,integerPart:BigInt(e)};const r=e.slice(0,n)||"0",i=e.slice(n+1);return{isNegative:t,integerPart:BigInt(r),decimalPart:i}}function o(e){let n=e.trim();if(0===n.length||Number.isNaN(Number(n)))throw new RangeError(`Invalid currency format: "${e}"`);r(n)&&(n=t(n));const i="-"===n[0];i&&(n=n.slice(1));const o=n.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(n),cents:0n};const s=n.slice(0,o)||"0",u=(n.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e,t,n){if(null===t)return;if(e<t&&!(n&&BigInt(n)>=t))return;const r=t.toString().length-1,i=t===10n**BigInt(r)?`10^${r} - 1`:""+(t-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(e){return 10n**BigInt(3+2*(e-1))}const f=["","one","two","three","four","five","six","seven","eight","nine"],a=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],h=["thousand","lakh","crore","arab","kharab","neel","padma","shankh"],l=u(h.length+1),g=u(h.length+1),d=u(h.length+1),p="hundred",w="zero",b="minus",m=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],y=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],N={word:"",hasHundred:!1};function I(e){if(0===e)return N.word="",N.hasHundred=!1,N;const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=a[t]:n>=2?i=t>0?c[n]+"-"+f[t]:c[n]:t>0&&(i=f[t]),r>0?(N.word=i?f[r]+" "+p+" and "+i:f[r]+" "+p,N.hasHundred=!0):(N.word=i,N.hasHundred=!1),N}function E(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10);return 1===n?a[t]:n>=2?t>0?c[n]+"-"+f[t]:c[n]:f[t]}function O(e){if(0n===e)return w;if(e<1000n)return I(Number(e)).word;const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;const r=[];for(let e=t.length-1;e>=0;e--){const n=t[e];if(0!==n)if(0===e){const{word:e,hasHundred:t}=I(n);r.length>0&&!t&&r.push("and"),r.push(e)}else r.push(E(n)),h[e-1]&&r.push(h[e-1])}return r.join(" ")}function B(e){const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=y[t]:n>=2?i=t>0?c[n]+"-"+m[t]:v[n]:t>0&&(i=m[t]),r>0?i?f[r]+" "+p+" "+i:f[r]+" hundredth":i}const x={and:!0},R={enBD:function(e){const n=function(e){const n=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const n=e.trim();if(0===n.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===n[0])throw new RangeError("Ordinals cannot be negative");if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(n)){const e=t(n);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(n);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(t){if(t instanceof RangeError)throw t;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:t})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);return s(n,g),function(e){if(e<1000n)return B(Number(e));const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;let r=0;for(let e=0;e<t.length;e++)if(0!==t[e]){r=e;break}const i=[];for(let e=t.length-1;e>=0;e--){const n=t[e];0!==n&&(e===r?0===e?i.push(B(n)):(i.push(E(n)),i.push(h[e-1]+"th")):0===e?i.push(I(n).word):(i.push(E(n)),i.push(h[e-1])))}return i.join(" ")}(n)}};e.currency={enBD:function(e,t){const{isNegative:r,dollars:i,cents:u}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(n(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);s(i,d);const{and:f}=function(e,t){const n={...t};if(void 0===e)return n;if(!function(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(t);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(t,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof n[i])throw new TypeError(`Option "${i}" must be a ${typeof n[i]}, got ${typeof o}`);n[i]=o}}return n}(t,x);let a="";return r&&(a=b+" "),(i>0n||0n===u)&&(a+=O(i),a+=" taka"),u>0n&&(i>0n&&(a+=f?" and ":" "),a+=O(u),a+=" "+(1n===u?"paisa":"paise")),a}},e.enBD=function(e){const{isNegative:o,integerPart:u,decimalPart:f}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(n(e))}if("string"==typeof e)return i(function(e){const n=e.trim();if(0===n.length||Number.isNaN(Number(n)))throw new RangeError(`Invalid number format: "${e}"`);return r(n)?t(n):n}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,l,f);let a="";return o&&(a=b+" "),a+=O(u),f&&(a+=" point "+function(e){let t="",n=0;for(;n<e.length&&"0"===e[n];)t&&(t+=" "),t+=w,n++;const r=e.slice(n);return r&&(t&&(t+=" "),t+=O(BigInt(r))),t}(f)),a},e.ordinal=R},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/en-CA.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-CA v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}const s=["","one","two","three","four","five","six","seven","eight","nine"],u=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],l=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],c=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],a="hundred",f="zero",d="minus",g=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],h=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],w=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],b={word:"",hasHundred:!1};function m(e,n){if(0===e)return b.word="",b.hasHundred=!1,b;const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let o="";return 1===r?o=u[t]:r>=2?o=t>0?l[r]+"-"+s[t]:l[r]:t>0&&(o=s[t]),i>0?(b.word=o?s[i]+" "+a+(n?" and ":" ")+o:s[i]+" "+a,b.hasHundred=!0):(b.word=o,b.hasHundred=!1),b}function v(e,n,t){if(0n===e)return f;if(e<1000n)return m(Number(e),t).word;if(n&&e>=1100n&&e<=9999n){const n=Number(e),r=Math.trunc(n/100),i=n%100,{word:o}=m(r,t);let s=o+" "+a;if(i>0){const{word:e}=m(i,t);t&&(s+=" and"),s+=" "+e}return s}if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n),{word:i}=m(n,t);let o=i+" "+c[0];if(r>0){const{word:e,hasHundred:n}=m(r,t);t&&!n&&(o+=" and"),o+=" "+e}return o}return function(e,n){const t=[];let r=e;for(;r>0n;)t.push(Number(r%1000n)),r/=1000n;let i=-1;if(n)for(let e=0;e<t.length;e++)if(0!==t[e]){i=e;break}let o="",s=!1;for(let e=t.length-1;e>=0;e--){const r=t[e];if(0===r)continue;const{word:u,hasHundred:l}=m(r,n);n&&o&&e===i&&s&&!l&&(o+=" and"),o&&(o+=" "),o+=u,e>0?(o+=" "+c[e-1],s=!0):s=!1}return o}(e,t)}function N(i,s){s=o(s);const{isNegative:u,integerPart:l,decimalPart:c}=function(i){const o=typeof i;if("bigint"===o)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===o){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===o)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i),{hundredPairing:a=!1,and:g=!0}=s;let h="";return u&&(h=d+" "),h+=v(l,a,g),c&&(h+=" point "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=f,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=v(BigInt(i),!1,n)),t}(c,g)),h}function p(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=h[n]:t>=2?i=n>0?l[t]+"-"+g[n]:w[t]:n>0&&(i=g[n]),r>0?i?s[r]+" "+a+" "+i:s[r]+" hundredth":i}function y(n){return function(e){if(e<1000n)return p(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return m(n,!1).word+" "+c[0]+"th";const{word:r}=m(n,!1);return r+" "+c[0]+" "+p(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?p(t):m(t,!1).word+" "+c[e-1]+"th":(i+=m(t,!1).word,e>0&&(i+=" "+c[e-1])))}return i}(e)}(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}function I(e,t){t=o(t);const{isNegative:r,dollars:s,cents:u}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e),{and:l=!0}=t;let c="";return r&&(c=d+" "),(s>0n||0n===u)&&(c+=v(s,!1,!1),c+=" "+(1n===s?"dollar":"dollars")),u>0n&&(s>0n&&(c+=l?" and ":" "),c+=v(u,!1,!1),c+=" "+(1n===u?"cent":"cents")),c}export{N as toCardinal,I as toCurrency,y as toOrdinal};
1
+ /*! n2words/en-CA v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3*(e+1))}function u(e,n,t){const r={...n};if(void 0===e)return r;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const i=Object.keys(n);for(const[t,o]of Object.entries(e)){if(!Object.hasOwn(n,t))throw new TypeError(`Unknown option "${t}" — expected one of: ${i.join(", ")}`);if(void 0!==o){if(typeof o!=typeof r[t])throw new TypeError(`Option "${t}" must be a ${typeof r[t]}, got ${typeof o}`);r[t]=o}}return r}const l=["","one","two","three","four","five","six","seven","eight","nine"],c=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],f=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],a=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],d=s(a.length),g=s(a.length),h=s(a.length),w="hundred",b="zero",p="minus",m=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],v=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],y=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],N={word:"",hasHundred:!1};function I(e,n){if(0===e)return N.word="",N.hasHundred=!1,N;const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let o="";return 1===r?o=c[t]:r>=2?o=t>0?f[r]+"-"+l[t]:f[r]:t>0&&(o=l[t]),i>0?(N.word=o?l[i]+" "+w+(n?" and ":" ")+o:l[i]+" "+w,N.hasHundred=!0):(N.word=o,N.hasHundred=!1),N}function E(e,n,t){if(0n===e)return b;if(e<1000n)return I(Number(e),t).word;if(n&&e>=1100n&&e<=9999n){const n=Number(e),r=Math.trunc(n/100),i=n%100,{word:o}=I(r,t);let s=o+" "+w;if(i>0){const{word:e}=I(i,t);t&&(s+=" and"),s+=" "+e}return s}if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n),{word:i}=I(n,t);let o=i+" "+a[0];if(r>0){const{word:e,hasHundred:n}=I(r,t);t&&!n&&(o+=" and"),o+=" "+e}return o}return function(e,n){const t=[];let r=e;for(;r>0n;)t.push(Number(r%1000n)),r/=1000n;let i=-1;if(n)for(let e=0;e<t.length;e++)if(0!==t[e]){i=e;break}let o="",s=!1;for(let e=t.length-1;e>=0;e--){const r=t[e];if(0===r)continue;const{word:u,hasHundred:l}=I(r,n);n&&o&&e===i&&s&&!l&&(o+=" and"),o&&(o+=" "),o+=u,e>0?(o+=" "+a[e-1],s=!0):s=!1}return o}(e,t)}const O={hundredPairing:!1,and:!0};function x(i,s){const{isNegative:l,integerPart:c,decimalPart:f}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(c,d,f);const{hundredPairing:a,and:g}=u(s,O);let h="";return l&&(h=p+" "),h+=E(c,a,g),f&&(h+=" point "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=b,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=E(BigInt(i),!1,n)),t}(f,g)),h}function R(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=v[n]:t>=2?i=n>0?f[t]+"-"+m[n]:y[t]:n>0&&(i=m[n]),r>0?i?l[r]+" "+w+" "+i:l[r]+" hundredth":i}function B(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return o(r,g),function(e){if(e<1000n)return R(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return I(n,!1).word+" "+a[0]+"th";const{word:r}=I(n,!1);return r+" "+a[0]+" "+R(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?R(t):I(t,!1).word+" "+a[e-1]+"th":(i+=I(t,!1).word,e>0&&(i+=" "+a[e-1])))}return i}(e)}(r)}const $={and:!0};function P(e,t){const{isNegative:r,dollars:s,cents:l}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(s,h);const{and:c}=u(t,$);let f="";return r&&(f=p+" "),(s>0n||0n===l)&&(f+=E(s,!1,!1),f+=" "+(1n===s?"dollar":"dollars")),l>0n&&(s>0n&&(f+=c?" and ":" "),f+=E(l,!1,!1),f+=" "+(1n===l?"cent":"cents")),f}export{O as cardinalDefaults,d as cardinalMax,$ as currencyDefaults,h as currencyMax,g as ordinalMax,x as toCardinal,P as toCurrency,B as toOrdinal};
package/dist/en-CA.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-CA v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}const u=["","one","two","three","four","five","six","seven","eight","nine"],l=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],f=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],a="hundred",d="zero",g="minus",h=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],w=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],b=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],m={word:"",hasHundred:!1};function v(e,n){if(0===e)return m.word="",m.hasHundred=!1,m;const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let o="";return 1===r?o=l[t]:r>=2?o=t>0?c[r]+"-"+u[t]:c[r]:t>0&&(o=u[t]),i>0?(m.word=o?u[i]+" "+a+(n?" and ":" ")+o:u[i]+" "+a,m.hasHundred=!0):(m.word=o,m.hasHundred=!1),m}function p(e,n,t){if(0n===e)return d;if(e<1000n)return v(Number(e),t).word;if(n&&e>=1100n&&e<=9999n){const n=Number(e),r=Math.trunc(n/100),i=n%100,{word:o}=v(r,t);let s=o+" "+a;if(i>0){const{word:e}=v(i,t);t&&(s+=" and"),s+=" "+e}return s}if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n),{word:i}=v(n,t);let o=i+" "+f[0];if(r>0){const{word:e,hasHundred:n}=v(r,t);t&&!n&&(o+=" and"),o+=" "+e}return o}return function(e,n){const t=[];let r=e;for(;r>0n;)t.push(Number(r%1000n)),r/=1000n;let i=-1;if(n)for(let e=0;e<t.length;e++)if(0!==t[e]){i=e;break}let o="",s=!1;for(let e=t.length-1;e>=0;e--){const r=t[e];if(0===r)continue;const{word:u,hasHundred:l}=v(r,n);n&&o&&e===i&&s&&!l&&(o+=" and"),o&&(o+=" "),o+=u,e>0?(o+=" "+f[e-1],s=!0):s=!1}return o}(e,t)}function N(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=w[n]:t>=2?i=n>0?c[t]+"-"+h[n]:b[t]:n>0&&(i=h[n]),r>0?i?u[r]+" "+a+" "+i:u[r]+" hundredth":i}const y={enCA:function(e){return function(e){if(e<1000n)return N(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return v(n,!1).word+" "+f[0]+"th";const{word:r}=v(n,!1);return r+" "+f[0]+" "+N(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?N(t):v(t,!1).word+" "+f[e-1]+"th":(i+=v(t,!1).word,e>0&&(i+=" "+f[e-1])))}return i}(e)}(function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e))}};e.currency={enCA:function(e,n){n=s(n);const{isNegative:r,dollars:i,cents:u}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"===n)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e),{and:l=!0}=n;let c="";return r&&(c=g+" "),(i>0n||0n===u)&&(c+=p(i,!1,!1),c+=" "+(1n===i?"dollar":"dollars")),u>0n&&(i>0n&&(c+=l?" and ":" "),c+=p(u,!1,!1),c+=" "+(1n===u?"cent":"cents")),c}},e.enCA=function(e,o){o=s(o);const{isNegative:u,integerPart:l,decimalPart:c}=function(e){const o=typeof e;if("bigint"===o)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===o){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"===o)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e),{hundredPairing:f=!1,and:a=!0}=o;let h="";return u&&(h=g+" "),h+=p(l,f,a),c&&(h+=" point "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=d,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=p(BigInt(i),!1,n)),t}(c,a)),h},e.ordinal=y},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
1
+ /*! n2words/en-CA v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(e){return 10n**BigInt(3*(e+1))}function l(e,n,t){const r={...n};if(void 0===e)return r;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const i=Object.keys(n);for(const[t,o]of Object.entries(e)){if(!Object.hasOwn(n,t))throw new TypeError(`Unknown option "${t}" — expected one of: ${i.join(", ")}`);if(void 0!==o){if(typeof o!=typeof r[t])throw new TypeError(`Option "${t}" must be a ${typeof r[t]}, got ${typeof o}`);r[t]=o}}return r}const f=["","one","two","three","four","five","six","seven","eight","nine"],c=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],a=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],d=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],g=u(d.length),h=u(d.length),w=u(d.length),b="hundred",p="zero",m="minus",v=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],y=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],N=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],I={word:"",hasHundred:!1};function E(e,n){if(0===e)return I.word="",I.hasHundred=!1,I;const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let o="";return 1===r?o=c[t]:r>=2?o=t>0?a[r]+"-"+f[t]:a[r]:t>0&&(o=f[t]),i>0?(I.word=o?f[i]+" "+b+(n?" and ":" ")+o:f[i]+" "+b,I.hasHundred=!0):(I.word=o,I.hasHundred=!1),I}function O(e,n,t){if(0n===e)return p;if(e<1000n)return E(Number(e),t).word;if(n&&e>=1100n&&e<=9999n){const n=Number(e),r=Math.trunc(n/100),i=n%100,{word:o}=E(r,t);let s=o+" "+b;if(i>0){const{word:e}=E(i,t);t&&(s+=" and"),s+=" "+e}return s}if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n),{word:i}=E(n,t);let o=i+" "+d[0];if(r>0){const{word:e,hasHundred:n}=E(r,t);t&&!n&&(o+=" and"),o+=" "+e}return o}return function(e,n){const t=[];let r=e;for(;r>0n;)t.push(Number(r%1000n)),r/=1000n;let i=-1;if(n)for(let e=0;e<t.length;e++)if(0!==t[e]){i=e;break}let o="",s=!1;for(let e=t.length-1;e>=0;e--){const r=t[e];if(0===r)continue;const{word:u,hasHundred:l}=E(r,n);n&&o&&e===i&&s&&!l&&(o+=" and"),o&&(o+=" "),o+=u,e>0?(o+=" "+d[e-1],s=!0):s=!1}return o}(e,t)}const x={hundredPairing:!1,and:!0};function R(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=y[n]:t>=2?i=n>0?a[t]+"-"+v[n]:N[t]:n>0&&(i=v[n]),r>0?i?f[r]+" "+b+" "+i:f[r]+" hundredth":i}const B={and:!0},$={enCA:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,h),function(e){if(e<1000n)return R(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return E(n,!1).word+" "+d[0]+"th";const{word:r}=E(n,!1);return r+" "+d[0]+" "+R(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?R(t):E(t,!1).word+" "+d[e-1]+"th":(i+=E(t,!1).word,e>0&&(i+=" "+d[e-1])))}return i}(e)}(t)}};e.currency={enCA:function(e,n){const{isNegative:r,dollars:i,cents:u}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(i,w);const{and:f}=l(n,B);let c="";return r&&(c=m+" "),(i>0n||0n===u)&&(c+=O(i,!1,!1),c+=" "+(1n===i?"dollar":"dollars")),u>0n&&(i>0n&&(c+=f?" and ":" "),c+=O(u,!1,!1),c+=" "+(1n===u?"cent":"cents")),c}},e.enCA=function(e,o){const{isNegative:u,integerPart:f,decimalPart:c}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(f,g,c);const{hundredPairing:a,and:d}=l(o,x);let h="";return u&&(h=m+" "),h+=O(f,a,d),c&&(h+=" point "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=p,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=O(BigInt(i),!1,n)),t}(c,d)),h},e.ordinal=$},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/en-GB.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-GB v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const o=["","one","two","three","four","five","six","seven","eight","nine"],s=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],u=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],l=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],c="hundred",a="zero",f="minus",d=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],g=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],h=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],w={word:"",hasHundred:!1};function b(e){if(0===e)return w.word="",w.hasHundred=!1,w;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=s[n]:t>=2?i=n>0?u[t]+"-"+o[n]:u[t]:n>0&&(i=o[n]),r>0?(w.word=i?o[r]+" "+c+" and "+i:o[r]+" "+c,w.hasHundred=!0):(w.word=i,w.hasHundred=!1),w}function m(e){if(0n===e)return a;if(e<1000n)return b(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=b(n);let i=r+" "+l[0];if(t>0){const{word:e,hasHundred:n}=b(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=b(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+l[e-1],o=!0):o=!1}return i}(e)}function v(i){const{isNegative:o,integerPart:s,decimalPart:u}=function(i){const o=typeof i;if("bigint"===o)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===o){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===o)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);let l="";return o&&(l=f+" "),l+=m(s),u&&(l+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=a,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=m(BigInt(r))),n}(u)),l}function p(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=g[n]:t>=2?i=n>0?u[t]+"-"+d[n]:h[t]:n>0&&(i=d[n]),r>0?i?o[r]+" "+c+" "+i:o[r]+" hundredth":i}function N(n){return function(e){if(e<1000n)return p(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return b(n).word+" "+l[0]+"th";const{word:r}=b(n);return r+" "+l[0]+" "+p(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?p(t):b(t).word+" "+l[e-1]+"th":(i+=b(t).word,e>0&&(i+=" "+l[e-1])))}return i}(e)}(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}function y(e,t){t=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(t);const{isNegative:r,dollars:o,cents:s}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e),{and:u=!0}=t;let l="";return r&&(l=f+" "),(o>0n||0n===s)&&(l+=m(o),l+=" "+(1n===o?"pound":"pounds")),s>0n&&(o>0n&&(l+=u?" and ":" "),l+=m(s),l+=" "+(1n===s?"penny":"pence")),l}export{v as toCardinal,y as toCurrency,N as toOrdinal};
1
+ /*! n2words/en-GB v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3*(e+1))}const u=["","one","two","three","four","five","six","seven","eight","nine"],l=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],f=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],a=s(f.length),g=s(f.length),d=s(f.length),h="hundred",w="zero",p="minus",b=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],m=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],y={word:"",hasHundred:!1};function N(e){if(0===e)return y.word="",y.hasHundred=!1,y;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=l[n]:t>=2?i=n>0?c[t]+"-"+u[n]:c[t]:n>0&&(i=u[n]),r>0?(y.word=i?u[r]+" "+h+" and "+i:u[r]+" "+h,y.hasHundred=!0):(y.word=i,y.hasHundred=!1),y}function I(e){if(0n===e)return w;if(e<1000n)return N(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=N(n);let i=r+" "+f[0];if(t>0){const{word:e,hasHundred:n}=N(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=N(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+f[e-1],o=!0):o=!1}return i}(e)}function E(i){const{isNegative:s,integerPart:u,decimalPart:l}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,a,l);let c="";return s&&(c=p+" "),c+=I(u),l&&(c+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=w,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=I(BigInt(r))),n}(l)),c}function O(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=m[n]:t>=2?i=n>0?c[t]+"-"+b[n]:v[t]:n>0&&(i=b[n]),r>0?i?u[r]+" "+h+" "+i:u[r]+" hundredth":i}function x(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return o(r,g),function(e){if(e<1000n)return O(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return N(n).word+" "+f[0]+"th";const{word:r}=N(n);return r+" "+f[0]+" "+O(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?O(t):N(t).word+" "+f[e-1]+"th":(i+=N(t).word,e>0&&(i+=" "+f[e-1])))}return i}(e)}(r)}const R={and:!0};function B(e,t){const{isNegative:r,dollars:s,cents:u}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(s,d);const{and:l}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(t,R);let c="";return r&&(c=p+" "),(s>0n||0n===u)&&(c+=I(s),c+=" "+(1n===s?"pound":"pounds")),u>0n&&(s>0n&&(c+=l?" and ":" "),c+=I(u),c+=" "+(1n===u?"penny":"pence")),c}export{a as cardinalMax,R as currencyDefaults,d as currencyMax,g as ordinalMax,E as toCardinal,B as toCurrency,x as toOrdinal};
package/dist/en-GB.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-GB v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const s=["","one","two","three","four","five","six","seven","eight","nine"],u=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],l=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],c=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],f="hundred",a="zero",d="minus",g=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],h=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],w=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],b={word:"",hasHundred:!1};function m(e){if(0===e)return b.word="",b.hasHundred=!1,b;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=u[n]:t>=2?i=n>0?l[t]+"-"+s[n]:l[t]:n>0&&(i=s[n]),r>0?(b.word=i?s[r]+" "+f+" and "+i:s[r]+" "+f,b.hasHundred=!0):(b.word=i,b.hasHundred=!1),b}function p(e){if(0n===e)return a;if(e<1000n)return m(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=m(n);let i=r+" "+c[0];if(t>0){const{word:e,hasHundred:n}=m(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=m(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+c[e-1],o=!0):o=!1}return i}(e)}function v(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=h[n]:t>=2?i=n>0?l[t]+"-"+g[n]:w[t]:n>0&&(i=g[n]),r>0?i?s[r]+" "+f+" "+i:s[r]+" hundredth":i}const N={enGB:function(e){return function(e){if(e<1000n)return v(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return m(n).word+" "+c[0]+"th";const{word:r}=m(n);return r+" "+c[0]+" "+v(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?v(t):m(t).word+" "+c[e-1]+"th":(i+=m(t).word,e>0&&(i+=" "+c[e-1])))}return i}(e)}(function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e))}};e.currency={enGB:function(e,n){n=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(n);const{isNegative:r,dollars:i,cents:s}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"===n)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e),{and:u=!0}=n;let l="";return r&&(l=d+" "),(i>0n||0n===s)&&(l+=p(i),l+=" "+(1n===i?"pound":"pounds")),s>0n&&(i>0n&&(l+=u?" and ":" "),l+=p(s),l+=" "+(1n===s?"penny":"pence")),l}},e.enGB=function(e){const{isNegative:o,integerPart:s,decimalPart:u}=function(e){const o=typeof e;if("bigint"===o)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===o){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"===o)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);let l="";return o&&(l=d+" "),l+=p(s),u&&(l+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=a,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=p(BigInt(r))),n}(u)),l},e.ordinal=N},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
1
+ /*! n2words/en-GB v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(e){return 10n**BigInt(3*(e+1))}const l=["","one","two","three","four","five","six","seven","eight","nine"],f=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],a=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],d=u(a.length),g=u(a.length),h=u(a.length),w="hundred",p="zero",b="minus",m=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],v=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],y=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],N={word:"",hasHundred:!1};function I(e){if(0===e)return N.word="",N.hasHundred=!1,N;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=f[n]:t>=2?i=n>0?c[t]+"-"+l[n]:c[t]:n>0&&(i=l[n]),r>0?(N.word=i?l[r]+" "+w+" and "+i:l[r]+" "+w,N.hasHundred=!0):(N.word=i,N.hasHundred=!1),N}function E(e){if(0n===e)return p;if(e<1000n)return I(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=I(n);let i=r+" "+a[0];if(t>0){const{word:e,hasHundred:n}=I(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=I(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+a[e-1],o=!0):o=!1}return i}(e)}function O(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=v[n]:t>=2?i=n>0?c[t]+"-"+m[n]:y[t]:n>0&&(i=m[n]),r>0?i?l[r]+" "+w+" "+i:l[r]+" hundredth":i}const x={and:!0},B={enGB:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,g),function(e){if(e<1000n)return O(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return I(n).word+" "+a[0]+"th";const{word:r}=I(n);return r+" "+a[0]+" "+O(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?O(t):I(t).word+" "+a[e-1]+"th":(i+=I(t).word,e>0&&(i+=" "+a[e-1])))}return i}(e)}(t)}};e.currency={enGB:function(e,n){const{isNegative:r,dollars:i,cents:u}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(i,h);const{and:l}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(n,x);let f="";return r&&(f=b+" "),(i>0n||0n===u)&&(f+=E(i),f+=" "+(1n===i?"pound":"pounds")),u>0n&&(i>0n&&(f+=l?" and ":" "),f+=E(u),f+=" "+(1n===u?"penny":"pence")),f}},e.enGB=function(e){const{isNegative:o,integerPart:u,decimalPart:l}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,d,l);let f="";return o&&(f=b+" "),f+=E(u),l&&(f+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=p,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=E(BigInt(r))),n}(l)),f},e.ordinal=B},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/en-GH.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/en-GH v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
- function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const o=["","one","two","three","four","five","six","seven","eight","nine"],s=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],u=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],l=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],c="hundred",a="zero",f="minus",d=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],g=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],h=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],w={word:"",hasHundred:!1};function b(e){if(0===e)return w.word="",w.hasHundred=!1,w;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=s[n]:t>=2?i=n>0?u[t]+"-"+o[n]:u[t]:n>0&&(i=o[n]),r>0?(w.word=i?o[r]+" "+c+" and "+i:o[r]+" "+c,w.hasHundred=!0):(w.word=i,w.hasHundred=!1),w}function m(e){if(0n===e)return a;if(e<1000n)return b(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=b(n);let i=r+" "+l[0];if(t>0){const{word:e,hasHundred:n}=b(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=b(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+l[e-1],o=!0):o=!1}return i}(e)}function v(i){const{isNegative:o,integerPart:s,decimalPart:u}=function(i){const o=typeof i;if("bigint"===o)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===o){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===o)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);let l="";return o&&(l=f+" "),l+=m(s),u&&(l+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=a,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=m(BigInt(r))),n}(u)),l}function p(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=g[n]:t>=2?i=n>0?u[t]+"-"+d[n]:h[t]:n>0&&(i=d[n]),r>0?i?o[r]+" "+c+" "+i:o[r]+" hundredth":i}function N(n){return function(e){if(e<1000n)return p(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return b(n).word+" "+l[0]+"th";const{word:r}=b(n);return r+" "+l[0]+" "+p(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?p(t):b(t).word+" "+l[e-1]+"th":(i+=b(t).word,e>0&&(i+=" "+l[e-1])))}return i}(e)}(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}function y(e,t){t=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(t);const{isNegative:r,dollars:o,cents:s}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e),{and:u=!0}=t;let l="";return r&&(l=f+" "),(o>0n||0n===s)&&(l+=m(o),l+=" "+(1n===o?"cedi":"cedis")),s>0n&&(o>0n&&(l+=u?" and ":" "),l+=m(s),l+=" "+(1n===s?"pesewa":"pesewas")),l}export{v as toCardinal,y as toCurrency,N as toOrdinal};
1
+ /*! n2words/en-GH v5.1.1 | MIT License | github.com/forzagreen/n2words */
2
+ function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3*(e+1))}const u=["","one","two","three","four","five","six","seven","eight","nine"],l=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],f=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],a=s(f.length),g=s(f.length),d=s(f.length),h="hundred",w="zero",b="minus",p=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],m=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],y={word:"",hasHundred:!1};function N(e){if(0===e)return y.word="",y.hasHundred=!1,y;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=l[n]:t>=2?i=n>0?c[t]+"-"+u[n]:c[t]:n>0&&(i=u[n]),r>0?(y.word=i?u[r]+" "+h+" and "+i:u[r]+" "+h,y.hasHundred=!0):(y.word=i,y.hasHundred=!1),y}function I(e){if(0n===e)return w;if(e<1000n)return N(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=N(n);let i=r+" "+f[0];if(t>0){const{word:e,hasHundred:n}=N(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=N(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+f[e-1],o=!0):o=!1}return i}(e)}function E(i){const{isNegative:s,integerPart:u,decimalPart:l}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,a,l);let c="";return s&&(c=b+" "),c+=I(u),l&&(c+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=w,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=I(BigInt(r))),n}(l)),c}function O(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=m[n]:t>=2?i=n>0?c[t]+"-"+p[n]:v[t]:n>0&&(i=p[n]),r>0?i?u[r]+" "+h+" "+i:u[r]+" hundredth":i}function x(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return o(r,g),function(e){if(e<1000n)return O(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return N(n).word+" "+f[0]+"th";const{word:r}=N(n);return r+" "+f[0]+" "+O(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?O(t):N(t).word+" "+f[e-1]+"th":(i+=N(t).word,e>0&&(i+=" "+f[e-1])))}return i}(e)}(r)}const R={and:!0};function B(e,t){const{isNegative:r,dollars:s,cents:u}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(s,d);const{and:l}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(t,R);let c="";return r&&(c=b+" "),(s>0n||0n===u)&&(c+=I(s),c+=" "+(1n===s?"cedi":"cedis")),u>0n&&(s>0n&&(c+=l?" and ":" "),c+=I(u),c+=" "+(1n===u?"pesewa":"pesewas")),c}export{a as cardinalMax,R as currencyDefaults,d as currencyMax,g as ordinalMax,E as toCardinal,B as toCurrency,x as toOrdinal};