n2words 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/am-ET.js +1 -1
  3. package/dist/am-ET.umd.js +1 -1
  4. package/dist/am-Latn-ET.js +1 -1
  5. package/dist/am-Latn-ET.umd.js +1 -1
  6. package/dist/ar-SA.js +1 -1
  7. package/dist/ar-SA.umd.js +1 -1
  8. package/dist/az-AZ.js +1 -1
  9. package/dist/az-AZ.umd.js +1 -1
  10. package/dist/bn-BD.js +1 -1
  11. package/dist/bn-BD.umd.js +1 -1
  12. package/dist/cs-CZ.js +1 -1
  13. package/dist/cs-CZ.umd.js +1 -1
  14. package/dist/da-DK.js +1 -1
  15. package/dist/da-DK.umd.js +1 -1
  16. package/dist/de-DE.js +1 -1
  17. package/dist/de-DE.umd.js +1 -1
  18. package/dist/el-GR.js +1 -1
  19. package/dist/el-GR.umd.js +1 -1
  20. package/dist/en-AU.js +1 -1
  21. package/dist/en-AU.umd.js +1 -1
  22. package/dist/en-BD.js +1 -1
  23. package/dist/en-BD.umd.js +1 -1
  24. package/dist/en-CA.js +1 -1
  25. package/dist/en-CA.umd.js +1 -1
  26. package/dist/en-GB.js +1 -1
  27. package/dist/en-GB.umd.js +1 -1
  28. package/dist/en-GH.js +1 -1
  29. package/dist/en-GH.umd.js +1 -1
  30. package/dist/en-IE.js +1 -1
  31. package/dist/en-IE.umd.js +1 -1
  32. package/dist/en-IN.js +1 -1
  33. package/dist/en-IN.umd.js +1 -1
  34. package/dist/en-KE.js +1 -1
  35. package/dist/en-KE.umd.js +1 -1
  36. package/dist/en-MY.js +1 -1
  37. package/dist/en-MY.umd.js +1 -1
  38. package/dist/en-NG.js +1 -1
  39. package/dist/en-NG.umd.js +1 -1
  40. package/dist/en-NZ.js +1 -1
  41. package/dist/en-NZ.umd.js +1 -1
  42. package/dist/en-PH.js +1 -1
  43. package/dist/en-PH.umd.js +1 -1
  44. package/dist/en-PK.js +1 -1
  45. package/dist/en-PK.umd.js +1 -1
  46. package/dist/en-SG.js +1 -1
  47. package/dist/en-SG.umd.js +1 -1
  48. package/dist/en-US.js +1 -1
  49. package/dist/en-US.umd.js +1 -1
  50. package/dist/en-ZA.js +1 -1
  51. package/dist/en-ZA.umd.js +1 -1
  52. package/dist/es-ES.js +1 -1
  53. package/dist/es-ES.umd.js +1 -1
  54. package/dist/es-MX.js +1 -1
  55. package/dist/es-MX.umd.js +1 -1
  56. package/dist/es-US.js +1 -1
  57. package/dist/es-US.umd.js +1 -1
  58. package/dist/fa-IR.js +1 -1
  59. package/dist/fa-IR.umd.js +1 -1
  60. package/dist/fi-FI.js +1 -1
  61. package/dist/fi-FI.umd.js +1 -1
  62. package/dist/fil-PH.js +1 -1
  63. package/dist/fil-PH.umd.js +1 -1
  64. package/dist/fr-BE.js +1 -1
  65. package/dist/fr-BE.umd.js +1 -1
  66. package/dist/fr-FR.js +1 -1
  67. package/dist/fr-FR.umd.js +1 -1
  68. package/dist/gu-IN.js +1 -1
  69. package/dist/gu-IN.umd.js +1 -1
  70. package/dist/ha-NG.js +1 -1
  71. package/dist/ha-NG.umd.js +1 -1
  72. package/dist/hbo-IL.js +1 -1
  73. package/dist/hbo-IL.umd.js +1 -1
  74. package/dist/he-IL.js +1 -1
  75. package/dist/he-IL.umd.js +1 -1
  76. package/dist/hi-IN.js +1 -1
  77. package/dist/hi-IN.umd.js +1 -1
  78. package/dist/hr-HR.js +2 -2
  79. package/dist/hr-HR.umd.js +2 -2
  80. package/dist/hu-HU.js +1 -1
  81. package/dist/hu-HU.umd.js +1 -1
  82. package/dist/id-ID.js +1 -1
  83. package/dist/id-ID.umd.js +1 -1
  84. package/dist/it-IT.js +1 -1
  85. package/dist/it-IT.umd.js +1 -1
  86. package/dist/ja-JP.js +1 -1
  87. package/dist/ja-JP.umd.js +1 -1
  88. package/dist/ka-GE.js +1 -1
  89. package/dist/ka-GE.umd.js +1 -1
  90. package/dist/kn-IN.js +1 -1
  91. package/dist/kn-IN.umd.js +1 -1
  92. package/dist/ko-KR.js +1 -1
  93. package/dist/ko-KR.umd.js +1 -1
  94. package/dist/lt-LT.js +1 -1
  95. package/dist/lt-LT.umd.js +1 -1
  96. package/dist/lv-LV.js +1 -1
  97. package/dist/lv-LV.umd.js +1 -1
  98. package/dist/mr-IN.js +1 -1
  99. package/dist/mr-IN.umd.js +1 -1
  100. package/dist/ms-MY.js +1 -1
  101. package/dist/ms-MY.umd.js +1 -1
  102. package/dist/nb-NO.js +1 -1
  103. package/dist/nb-NO.umd.js +1 -1
  104. package/dist/nl-NL.js +1 -1
  105. package/dist/nl-NL.umd.js +1 -1
  106. package/dist/pa-IN.js +1 -1
  107. package/dist/pa-IN.umd.js +1 -1
  108. package/dist/pl-PL.js +1 -1
  109. package/dist/pl-PL.umd.js +1 -1
  110. package/dist/pt-BR.js +1 -1
  111. package/dist/pt-BR.umd.js +1 -1
  112. package/dist/pt-PT.js +1 -1
  113. package/dist/pt-PT.umd.js +1 -1
  114. package/dist/ro-RO.js +1 -1
  115. package/dist/ro-RO.umd.js +1 -1
  116. package/dist/ru-RU.js +1 -1
  117. package/dist/ru-RU.umd.js +1 -1
  118. package/dist/sr-Cyrl-RS.js +1 -1
  119. package/dist/sr-Cyrl-RS.umd.js +1 -1
  120. package/dist/sr-Latn-RS.js +1 -1
  121. package/dist/sr-Latn-RS.umd.js +1 -1
  122. package/dist/sv-SE.js +1 -1
  123. package/dist/sv-SE.umd.js +1 -1
  124. package/dist/sw-KE.js +1 -1
  125. package/dist/sw-KE.umd.js +1 -1
  126. package/dist/ta-IN.js +1 -1
  127. package/dist/ta-IN.umd.js +1 -1
  128. package/dist/te-IN.js +1 -1
  129. package/dist/te-IN.umd.js +1 -1
  130. package/dist/th-TH.js +1 -1
  131. package/dist/th-TH.umd.js +1 -1
  132. package/dist/tr-TR.js +1 -1
  133. package/dist/tr-TR.umd.js +1 -1
  134. package/dist/uk-UA.js +1 -1
  135. package/dist/uk-UA.umd.js +1 -1
  136. package/dist/ur-PK.js +1 -1
  137. package/dist/ur-PK.umd.js +1 -1
  138. package/dist/vi-VN.js +1 -1
  139. package/dist/vi-VN.umd.js +1 -1
  140. package/dist/yo-NG.js +1 -1
  141. package/dist/yo-NG.umd.js +1 -1
  142. package/dist/zh-Hans-CN.js +1 -1
  143. package/dist/zh-Hans-CN.umd.js +1 -1
  144. package/dist/zh-Hant-TW.js +1 -1
  145. package/dist/zh-Hant-TW.umd.js +1 -1
  146. package/package.json +13 -13
  147. package/src/am-ET.d.ts +19 -6
  148. package/src/am-Latn-ET.d.ts +19 -6
  149. package/src/ar-SA.d.ts +46 -32
  150. package/src/az-AZ.d.ts +17 -6
  151. package/src/bn-BD.d.ts +18 -6
  152. package/src/cs-CZ.d.ts +19 -6
  153. package/src/da-DK.d.ts +19 -6
  154. package/src/de-DE.d.ts +30 -16
  155. package/src/el-GR.d.ts +18 -6
  156. package/src/en-AU.d.ts +27 -16
  157. package/src/en-BD.d.ts +28 -16
  158. package/src/en-CA.d.ts +46 -25
  159. package/src/en-GB.d.ts +28 -16
  160. package/src/en-GH.d.ts +35 -16
  161. package/src/en-IE.d.ts +38 -16
  162. package/src/en-IN.d.ts +28 -16
  163. package/src/en-KE.d.ts +35 -16
  164. package/src/en-MY.d.ts +38 -16
  165. package/src/en-NG.d.ts +38 -16
  166. package/src/en-NZ.d.ts +35 -16
  167. package/src/en-PH.d.ts +35 -16
  168. package/src/en-PK.d.ts +28 -16
  169. package/src/en-SG.d.ts +35 -16
  170. package/src/en-US.d.ts +44 -25
  171. package/src/en-ZA.d.ts +37 -16
  172. package/src/es-ES.d.ts +61 -42
  173. package/src/es-MX.d.ts +61 -42
  174. package/src/es-US.d.ts +61 -42
  175. package/src/fa-IR.d.ts +17 -6
  176. package/src/fi-FI.d.ts +19 -6
  177. package/src/fil-PH.d.ts +18 -6
  178. package/src/fr-BE.d.ts +35 -23
  179. package/src/fr-FR.d.ts +36 -23
  180. package/src/gu-IN.d.ts +19 -6
  181. package/src/ha-NG.d.ts +21 -6
  182. package/src/hbo-IL.d.ts +30 -17
  183. package/src/he-IL.d.ts +24 -11
  184. package/src/hi-IN.d.ts +19 -6
  185. package/src/hr-HR.d.ts +28 -15
  186. package/src/hr-HR.js +8 -6
  187. package/src/hu-HU.d.ts +18 -6
  188. package/src/id-ID.d.ts +18 -6
  189. package/src/it-IT.d.ts +30 -16
  190. package/src/ja-JP.d.ts +18 -6
  191. package/src/ka-GE.d.ts +20 -6
  192. package/src/kn-IN.d.ts +19 -6
  193. package/src/ko-KR.d.ts +18 -6
  194. package/src/lt-LT.d.ts +27 -15
  195. package/src/lv-LV.d.ts +28 -15
  196. package/src/mr-IN.d.ts +19 -6
  197. package/src/ms-MY.d.ts +18 -6
  198. package/src/nb-NO.d.ts +18 -6
  199. package/src/nl-NL.d.ts +42 -27
  200. package/src/pa-IN.d.ts +18 -6
  201. package/src/pl-PL.d.ts +28 -15
  202. package/src/pt-BR.d.ts +34 -21
  203. package/src/pt-PT.d.ts +29 -16
  204. package/src/ro-RO.d.ts +27 -15
  205. package/src/ru-RU.d.ts +38 -26
  206. package/src/sr-Cyrl-RS.d.ts +40 -26
  207. package/src/sr-Latn-RS.d.ts +40 -26
  208. package/src/sv-SE.d.ts +19 -6
  209. package/src/sw-KE.d.ts +17 -6
  210. package/src/ta-IN.d.ts +21 -6
  211. package/src/te-IN.d.ts +19 -6
  212. package/src/th-TH.d.ts +19 -6
  213. package/src/tr-TR.d.ts +22 -11
  214. package/src/uk-UA.d.ts +27 -15
  215. package/src/ur-PK.d.ts +18 -6
  216. package/src/utils/check-max.d.ts +1 -1
  217. package/src/utils/expand-scientific.d.ts +3 -3
  218. package/src/utils/is-plain-object.d.ts +1 -1
  219. package/src/utils/parse-cardinal.d.ts +7 -1
  220. package/src/utils/parse-currency.d.ts +6 -1
  221. package/src/utils/parse-ordinal.d.ts +6 -1
  222. package/src/utils/resolve-options.d.ts +1 -1
  223. package/src/utils/scale.d.ts +22 -22
  224. package/src/vi-VN.d.ts +17 -6
  225. package/src/yo-NG.d.ts +24 -6
  226. package/src/zh-Hans-CN.d.ts +46 -34
  227. package/src/zh-Hant-TW.d.ts +50 -34
package/dist/te-IN.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/te-IN v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/te-IN v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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)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+2*(e-1))}const a="సున్నా",c="మైనస్",f=["","మొదటి","రెండవ","మూడవ","నాలుగవ","ఐదవ","ఆరవ"],g=["సున్నా","ఒకటి","రెండు","మూడు","నాలుగు","ఐదు","ఆరు","ఏడు","ఎనిమిది","తొమ్మిది","పది","పదకొండు","పన్నెండు","పదమూడు","పద్నాలుగు","పదిహేను","పదహారు","పదిహేడు","పద్దెనిమిది","పంతొమ్మిది","ఇరవై","ఇరవై ఒక్కటి","ఇరవై రెండు","ఇరవై మూడు","ఇరవై నాలుగు","ఇరవై ఐదు","ఇరవై ఆరు","ఇరవై ఏడు","ఇరవై ఎనిమిది","ఇరవై తొమ్మిది","ముప్పై","ముప్పై ఒకటి","ముప్పై రెండు","ముప్పై మూడు","ముప్పై నాలుగు","ముప్పై ఐదు","ముప్పై ఆరు","ముప్పై ఏడు","ముప్పై ఎనిమిది","ముప్పై తొమ్మిది","నలభై","నలభై ఒకటి","నలభై రెండు","నలభై మూడు","నలభై నాలుగు","నలభై ఐదు","నలభై ఆరు","నలభై ఏడు","నలభై ఎనిమిది","నలభై తొమ్మిది","యాభై","యాభై ఒకటి","యాభై రెండు","యాభై మూడు","యాభై నాలుగు","యాభై ఐదు","యాభై ఆరు","యాభై ఏడు","యాభై ఎనిమిది","యాభై తొమ్మిది","అరవై","అరవై ఒకటి","అరవై రెండు","అరవై మూడు","అరవై నాలుగు","అరవై ఐదు","అరవై ఆరు","అరవై ఏడు","అరవై ఎనిమిది","అరవై తొమ్మిది","డెబ్బై","డెబ్బై ఒకటి","డెబ్బై రెండు","డెబ్బై మూడు","డెబ్బై నాలుగు","డెబ్బై ఐదు","డెబ్బై ఆరు","డెబ్బై ఏడు","డెబ్బై ఎనిమిది","డెబ్బై తొమ్మిది","ఎనభై","ఎనభై ఒకటి","ఎనభై రెండు","ఎనభై మూడు","ఎనభై నాలుగు","ఎనభై ఐదు","ఎనభై ఆరు","ఎనభై ఏడు","ఎనభై ఎనిమిది","ఎనభై తొమ్మిది","తొంభై","తొంభై ఒకటి","తొంభై రెండు","తొంభై మూడు","తొంభై నాలుగు","తొంభై ఐదు","తొంభై ఆరు","తొంభై ఏడు","తొంభై ఎనిమిది","తొంభై తొమ్మిది"],l=["","వంద","రెండు వందలు","మూడు వందలు","నాలుగు వందలు","ఐదు వందలు","ఆరు వందలు","ఏడు వందలు","ఎనిమిది వందలు","తొమ్మిది వందలు"],d=["ఒకటి","రెండు","మూడు","నాలుగు","ఐదు","ఆరు","ఏడు","ఎనిమిది","తొమ్మిది"],b=["","వెయ్యి","లక్ష","కోటి","అరబ్","ఖరబ్","నిల్","పడ్మ","శంకు"],m=u(b.length),p=u(b.length),h=u(b.length);function w(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?l[n]:l[n]+" "+g[t]}function N(e){if(0n===e)return a;if(e<1000n)return w(Number(e));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];0!==t&&(r.push(0===e?w(t):1===t?"ఒక":g[t]),e>0&&b[e]&&r.push(b[e]))}return r.join(" ")}const v={teIN: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,p),(i=t)>=1n&&i<=6n?f[Number(i)]:N(i)+"వ";var i}};e.currency={teIN:function(e){const{isNegative:n,dollars:r,cents:i}=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(r,h);let u="";return n&&(u=c+" "),(r>0n||0n===i)&&(u+=N(r),u+=" "+(1n===r?"రూపాయి":"రూపాయలు")),i>0n&&(r>0n&&(u+=" "),u+=N(i),u+=" "+(1n===i?"పైసా":"పైసలు")),u}},e.ordinal=v,e.teIN=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(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,m);let g="";return o&&(g=c+" "),g+=N(u),f&&(g+=" పాయింట్ "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?a:d[e-1])}return n.join(" ")}(f)),g}},"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/th-TH.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/th-TH v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/th-TH v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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=null,o=s,u=s,c=s,a=["หนึ่ง","สอง","สาม","สี่","ห้า","หก","เจ็ด","แปด","เก้า"],g="ศูนย์";function f(e){if(0===e)return"";let n=e;const t=[],r=Math.trunc(n/1e5);n%=1e5;const i=Math.trunc(n/1e4);n%=1e4;const s=Math.trunc(n/1e3);n%=1e3;const o=Math.trunc(n/100);n%=100;const u=Math.trunc(n/10),c=n%10;return r>0&&t.push(a[r-1]+"แสน"),i>0&&t.push(1===i?"หนึ่งหมื่น":a[i-1]+"หมื่น"),s>0&&t.push(a[s-1]+"พัน"),o>0&&t.push(a[o-1]+"ร้อย"),u>0&&t.push(1===u?"สิบ":2===u?"ยี่สิบ":a[u-1]+"สิบ"),c>0&&t.push(1===c&&(u>0||r>0||i>0||s>0||o>0||u>0)?"เอ็ด":a[c-1]),t.join("")}function l(e){if(0n===e)return g;const n=function(e){const n=[];let t=e;const r=1000000n;for(;t>0n;){const e=Number(t%r);n.unshift(e),t/=r}return n}(e),t=[];for(let e=0;e<n.length;e++){const r=n[e];if(0===r)continue;t.push(f(r));const i=n.length-e-1;i>0&&t.push("ล้าน".repeat(i))}return t.join("")}function h(i){const{isNegative:s,integerPart:o,decimalPart:u}=function(i){const s=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 ${s}`)}(i);let c="";return s&&(c="ลบ"),c+=l(o),u&&(c+="จุด"+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?g:a[e-1])}return n.join("")}(u)),c}function p(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"ที่"+l(r)}function m(e){const{isNegative:t,dollars:r,cents:s}=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);let o="";return t&&(o="ลบ"),o+=l(r),o+="บาท",s>0n?(o+=l(s),o+="สตางค์"):o+="ถ้วน",o}export{o as cardinalMax,c as currencyMax,u as ordinalMax,h as toCardinal,m as toCurrency,p as toOrdinal};
package/dist/th-TH.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/th-TH v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/th-TH v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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=["หนึ่ง","สอง","สาม","สี่","ห้า","หก","เจ็ด","แปด","เก้า"],u="ศูนย์";function c(e){if(0===e)return"";let n=e;const t=[],r=Math.trunc(n/1e5);n%=1e5;const i=Math.trunc(n/1e4);n%=1e4;const o=Math.trunc(n/1e3);n%=1e3;const u=Math.trunc(n/100);n%=100;const c=Math.trunc(n/10),a=n%10;return r>0&&t.push(s[r-1]+"แสน"),i>0&&t.push(1===i?"หนึ่งหมื่น":s[i-1]+"หมื่น"),o>0&&t.push(s[o-1]+"พัน"),u>0&&t.push(s[u-1]+"ร้อย"),c>0&&t.push(1===c?"สิบ":2===c?"ยี่สิบ":s[c-1]+"สิบ"),a>0&&t.push(1===a&&(c>0||r>0||i>0||o>0||u>0||c>0)?"เอ็ด":s[a-1]),t.join("")}function a(e){if(0n===e)return u;const n=function(e){const n=[];let t=e;const r=1000000n;for(;t>0n;){const e=Number(t%r);n.unshift(e),t/=r}return n}(e),t=[];for(let e=0;e<n.length;e++){const r=n[e];if(0===r)continue;t.push(c(r));const i=n.length-e-1;i>0&&t.push("ล้าน".repeat(i))}return t.join("")}const f={thTH:function(e){return"ที่"+a(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))}};e.currency={thTH:function(e){const{isNegative:n,dollars:r,cents:i}=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);let s="";return n&&(s="ลบ"),s+=a(r),s+="บาท",i>0n?(s+=a(i),s+="สตางค์"):s+="ถ้วน",s}},e.ordinal=f,e.thTH=function(e){const{isNegative:o,integerPart:c,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(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);let g="";return o&&(g="ลบ"),g+=a(c),f&&(g+="จุด"+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?u:s[e-1])}return n.join("")}(f)),g}},"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/tr-TR.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/tr-TR v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/tr-TR v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
2
  function n(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 e(e){const r=e.toString();return t(r)?n(r):r}function t(n){return n.includes("e")||n.includes("E")}function r(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 i(e){let r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${e}"`);t(r)&&(r=n(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(n,e,t){if(null===e)return;if(n<e&&!(t&&BigInt(t)>=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 s(n){return 10n**BigInt(3*(n+1))}const u=["","bir","iki","üç","dört","beş","altı","yedi","sekiz","dokuz"],c=["on","on bir","on iki","on üç","on dört","on beş","on altı","on yedi","on sekiz","on dokuz"],l=["","","yirmi","otuz","kırk","elli","altmış","yetmiş","seksen","doksan"],a="bin",f="sıfır",g="eksi",d=["milyon","milyar","trilyon","katrilyon","kentilyon"],b=s(d.length+1),p=s(d.length+1),m=s(d.length+1),h={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yedinci",8:"sekizinci",9:"dokuzuncu",10:"onuncu"};function w(n,e=" "){if(0===n)return"";const t=n%10,r=Math.trunc(n/10)%10,i=Math.trunc(n/100),o=[];i>0&&o.push(1===i?"yüz":u[i]+e+"yüz");const s=n%100;return 0===s||o.push(s<10?u[t]:s<20?c[t].replace(" ",e):0===t?l[r]:l[r]+e+u[t]),o.join(e)}function y(n,e){if(0n===n)return f;const t=e?"":" ";if(n<1000n)return w(Number(n),t);if(n<1000000n){const e=Number(n/1000n),r=Number(n%1000n);let i;return i=1===e?a:w(e,t)+t+a,r>0&&(i+=t+w(r,t)),i}return function(n,e){const t=e?"":" ",r=n.toString(),i=r.length,o=[],s=i%3;let u=0;for(s>0&&(o.push(Number(r.slice(0,s))),u=s);u<i;)o.push(Number(r.slice(u,u+3))),u+=3;const c=[];let l=o.length-1;for(let n=0;n<o.length;n++){const e=o[n];if(0!==e){const n=w(e,t);c.push(0===l?n:1===l?1===e?a:n+t+a:n+t+d[l-2])}l--}return c.join(t)}(n,e)}const N={dropSpaces:!1};function v(i,s){const{isNegative:u,integerPart:c,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(e(i))}if("string"==typeof i)return r(function(e){const r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${e}"`);return t(r)?n(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(c,b,l);const{dropSpaces:a}=function(n,e){const t={...e};if(void 0===n)return t;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const r=Object.keys(e);for(const[i,o]of Object.entries(n)){if(!Object.hasOwn(e,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}(s,N),d=a?"":" ";let p="";return u&&(p=g+d),p+=y(c,a),l&&(p+=d+"virgül"+d+function(n,e){const t=e?"":" ";let r="",i=0;for(;i<n.length&&"0"===n[i];)r&&(r+=t),r+=f,i++;const o=n.slice(i);return o&&(r&&(r+=t),r+=y(BigInt(o),e)),r}(l,a)),p}function I(e){const r=function(e){const r=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 r=e.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 e=n(r);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(e);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(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 ${r}`)}(e);return o(r,p),function(n){if(n>=1n&&n<=10n)return h[Number(n)];const e=y(n,!0);return e+function(n){for(let e=n.length-1;e>=0;e--){const t=n[e];if("aıou".includes(t))return"ou".includes(t)?"uncu":"ıncı";if("eiöü".includes(t))return"öü".includes(t)?"üncü":"inci"}return"inci"}(e)}(r)}function E(n){const{isNegative:t,dollars:r,cents:s}=function(n){const t=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}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);o(r,m);let u="";return t&&(u=g+" "),(r>0n||0n===s)&&(u+=y(r,!1)+" lira"),s>0n&&(r>0n&&(u+=" "),u+=y(s,!1)+" kuruş"),u}export{N as cardinalDefaults,b as cardinalMax,m as currencyMax,p as ordinalMax,v as toCardinal,E as toCurrency,I as toOrdinal};
package/dist/tr-TR.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/tr-TR v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/tr-TR v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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 c=["","bir","iki","üç","dört","beş","altı","yedi","sekiz","dokuz"],l=["on","on bir","on iki","on üç","on dört","on beş","on altı","on yedi","on sekiz","on dokuz"],f=["","","yirmi","otuz","kırk","elli","altmış","yetmiş","seksen","doksan"],a="bin",g="sıfır",d="eksi",p=["milyon","milyar","trilyon","katrilyon","kentilyon"],b=u(p.length+1),m=u(p.length+1),h=u(p.length+1),w={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yedinci",8:"sekizinci",9:"dokuzuncu",10:"onuncu"};function y(e,n=" "){if(0===e)return"";const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100),o=[];i>0&&o.push(1===i?"yüz":c[i]+n+"yüz");const s=e%100;return 0===s||o.push(s<10?c[t]:s<20?l[t].replace(" ",n):0===t?f[r]:f[r]+n+c[t]),o.join(n)}function v(e,n){if(0n===e)return g;const t=n?"":" ";if(e<1000n)return y(Number(e),t);if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n);let i;return i=1===n?a:y(n,t)+t+a,r>0&&(i+=t+y(r,t)),i}return function(e,n){const t=n?"":" ",r=e.toString(),i=r.length,o=[],s=i%3;let u=0;for(s>0&&(o.push(Number(r.slice(0,s))),u=s);u<i;)o.push(Number(r.slice(u,u+3))),u+=3;const c=[];let l=o.length-1;for(let e=0;e<o.length;e++){const n=o[e];if(0!==n){const e=y(n,t);c.push(0===l?e:1===l?1===n?a:e+t+a:e+t+p[l-2])}l--}return c.join(t)}(e,n)}const N={dropSpaces:!1},I={trTR: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,m),function(e){if(e>=1n&&e<=10n)return w[Number(e)];const n=v(e,!0);return n+function(e){for(let n=e.length-1;n>=0;n--){const t=e[n];if("aıou".includes(t))return"ou".includes(t)?"uncu":"ıncı";if("eiöü".includes(t))return"öü".includes(t)?"üncü":"inci"}return"inci"}(n)}(t)}};e.currency={trTR:function(e){const{isNegative:n,dollars:r,cents:i}=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(r,h);let u="";return n&&(u=d+" "),(r>0n||0n===i)&&(u+=v(r,!1)+" lira"),i>0n&&(r>0n&&(u+=" "),u+=v(i,!1)+" kuruş"),u}},e.ordinal=I,e.trTR=function(e,o){const{isNegative:u,integerPart:c,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(c,b,l);const{dropSpaces:f}=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}(o,N),a=f?"":" ";let p="";return u&&(p=d+a),p+=v(c,f),l&&(p+=a+"virgül"+a+function(e,n){const t=n?"":" ";let r="",i=0;for(;i<e.length&&"0"===e[i];)r&&(r+=t),r+=g,i++;const o=e.slice(i);return o&&(r&&(r+=t),r+=v(BigInt(o),n)),r}(l,f)),p}},"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/uk-UA.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/uk-UA v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/uk-UA v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
2
  function e(e){let[n,t]=e.toLowerCase().split("e");const i=parseInt(t,10);let r="";"-"===n[0]&&(r="-",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)+i;return u>=s.length?r+s+"0".repeat(u-s.length):u<=0?r+"0."+"0".repeat(-u)+s:r+s.slice(0,u)+"."+s.slice(u)}function n(n){const i=n.toString();return t(i)?e(i):i}function t(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 i=e.slice(0,t)||"0",r=e.slice(t+1);return{isNegative:n,integerPart:BigInt(i),decimalPart:r}}function r(n){let i=n.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid currency format: "${n}"`);t(i)&&(i=e(i));const r="-"===i[0];r&&(i=i.slice(1));const o=i.indexOf(".");if(-1===o)return{isNegative:r,dollars:BigInt(i),cents:0n};const s=i.slice(0,o)||"0",u=(i.slice(o+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const i=n.toString().length-1,r=n===10n**BigInt(i)?`10^${i} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function s(e){return 10n**BigInt(3*(e+1))}const u=["","один","два","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],c=["","одна","двi","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],f=["десять","одинадцять","дванадцять","тринадцять","чотирнадцять","п'ятнадцять","шiстнадцять","сiмнадцять","вiсiмнадцять","дев'ятнадцять"],g=["","","двадцять","тридцять","сорок","п'ятдесят","шiстдесят","сiмдесят","вiсiмдесят","дев'яносто"],l=["","сто","двiстi","триста","чотириста","п'ятсот","шiстсот","сiмсот","вiсiмсот","дев'ятсот"],a="нуль",h="мiнус",p=["","перший","другий","третiй","четвертий","п'ятий","шостий","сьомий","восьмий","дев'ятий"],b=["десятий","одинадцятий","дванадцятий","тринадцятий","чотирнадцятий","п'ятнадцятий","шiстнадцятий","сiмнадцятий","вiсiмнадцятий","дев'ятнадцятий"],m=["","","двадцятий","тридцятий","сороковий","п'ятдесятий","шiстдесятий","сiмдесятий","вiсiмдесятий","дев'яностий"],d=["","сотий","двохсотий","трьохсотий","чотирьохсотий","п'ятисотий","шестисотий","семисотий","восьмисотий","дев'ятисотий"],w=["тисячний","мiльйонний","мiльярдний","трильйонний"],N=["гривня","гривнi","гривень"],v=["копiйка","копiйки","копiйок"],y=[["тисяча","тисячi","тисяч"],["мiльйон","мiльйони","мiльйонiв"],["мiльярд","мiльярди","мiльярдiв"],["трильйон","трильйони","трильйонiв"],["квадрильйон","квадрильйони","квадрильйонiв"],["квiнтильйон","квiнтильйони","квiнтильйонiв"],["секстильйон","секстильйони","секстильйонiв"],["септильйон","септильйони","септильйонiв"],["октильйон","октильйони","октильйонiв"]];function I(e,n){const t="bigint"==typeof e?Number(e):e,i=t%10,r=t%100;return r>=11&&r<=19?n[2]:1===i?n[0]:i>=2&&i<=4?n[1]:n[2]}function E(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(l[i]),t>1&&r.push(g[t]),1===t?r.push(f[n]):n>0&&r.push(u[n]),r.join(" ")}function O(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(l[i]),t>1&&r.push(g[t]),1===t?r.push(f[n]):n>0&&r.push(c[n]),r.join(" ")}function B(e,n){return 0n===e?a:e<1000n?"feminine"===n?O(Number(e)):E(Number(e)):function(e,n){const t=e.toString(),i=t.length,r=[],o=i%3;let s=0;for(o>0&&(r.push(Number(t.slice(0,o))),s=o);s<i;)r.push(Number(t.slice(s,s+3))),s+=3;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const t=r[e];if(0!==t)if(0===c)u.push("feminine"===n?O(t):E(t));else{const e=I(t,y[c-1]),n=1===c?O(t):E(t);u.push(n+" "+e)}c--}return u.join(" ")}(e,n)}const R=s(y.length),$=s(w.length),j=s(y.length),P={gender:"masculine"},x={gender:["masculine","feminine"]};function S(r,s){const{isNegative:u,integerPart:c,decimalPart:f}=function(r){const o=typeof r;if("bigint"==typeof r)return r<0n?{isNegative:!0,integerPart:-r}:{isNegative:!1,integerPart:r};if("number"==typeof r){if(!Number.isFinite(r))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(r)?r<0?{isNegative:!0,integerPart:BigInt(-r)}:{isNegative:!1,integerPart:BigInt(r)}:i(n(r))}if("string"==typeof r)return i(function(n){const i=n.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid number format: "${n}"`);return t(i)?e(i):i}(r));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(r);o(c,R,f);const{gender:g}=function(e,n,t){const i={...n};if(void 0===e)return i;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[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof i[o])throw new TypeError(`Option "${o}" must be a ${typeof i[o]}, got ${typeof s}`);if(void 0!==t&&Object.hasOwn(t,o)){const e=t[o];if(!e.includes(s))throw new RangeError(`Option "${o}" must be one of: ${e.join(", ")} — got ${JSON.stringify(s)}`)}i[o]=s}}return i}(s,P,x);let l="";return u&&(l=h+" "),l+=B(c,g),f&&(l+=" кома "+function(e,n){let t="",i=0;for(;i<e.length&&"0"===e[i];)t&&(t+=" "),t+=a,i++;const r=e.slice(i);return r&&(t&&(t+=" "),t+=B(BigInt(r),n)),t}(f,g)),l}function M(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?p[n]:1===t?b[n]:0===n?m[t]:g[t]+" "+p[n]}function T(e){if(e<100n)return M(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),i=n%100;return 0===i?d[t]:l[t]+" "+M(i)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return 1===n?w[0]:O(n)+" "+w[0];const i=I(n,y[0]);return O(n)+" "+i+" "+T(BigInt(t))}return function(e){const n=e.toString(),t=n.length,i=[],r=t%3;let o=0;for(r>0&&(i.push(Number(n.slice(0,r))),o=r);o<t;)i.push(Number(n.slice(o,o+3))),o+=3;let s=i.length-1;for(;s>=0&&0===i[s];)s--;const u=[];let c=i.length-1;for(let e=0;e<i.length;e++){const n=i[e];if(0!==n){const t=e===s;if(0===c)u.push(t?T(BigInt(n)):E(n));else if(t)if(1===n)u.push(w[c-1]);else{const e=1===c?O(n):E(n);u.push(e+" "+w[c-1])}else{const e=I(n,y[c-1]),t=1===c?O(n):E(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}function F(n){const i=function(n){const i=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 i=n.trim();if(0===i.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===i[0])throw new RangeError("Ordinals cannot be negative");if(i.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(i)){const n=e(i);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(i);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 ${i}`)}(n);return o(i,$),T(i)}function k(e){const{isNegative:t,dollars:i,cents:s}=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}:r(n(e))}if("string"==typeof e)return r(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(i,j);let u="";return t&&(u=h+" "),(i>0n||0n===s)&&(u+=B(i,"feminine"),u+=" "+I(i,N)),s>0n&&(i>0n&&(u+=" "),u+=B(s,"feminine"),u+=" "+I(s,v)),u}export{P as cardinalDefaults,R as cardinalMax,x as cardinalValues,j as currencyMax,$ as ordinalMax,S as toCardinal,k as toCurrency,F as toOrdinal};
package/dist/uk-UA.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/uk-UA v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/uk-UA v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
2
  var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const i=parseInt(t,10);let r="";"-"===n[0]&&(r="-",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)+i;return u>=s.length?r+s+"0".repeat(u-s.length):u<=0?r+"0."+"0".repeat(-u)+s:r+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return i(t)?n(t):t}function i(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 i=e.slice(0,t)||"0",r=e.slice(t+1);return{isNegative:n,integerPart:BigInt(i),decimalPart:r}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);i(t)&&(t=n(t));const r="-"===t[0];r&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:r,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(s),cents:BigInt(u)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const i=n.toString().length-1,r=n===10n**BigInt(i)?`10^${i} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function u(e){return 10n**BigInt(3*(e+1))}const c=["","один","два","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],f=["","одна","двi","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],l=["десять","одинадцять","дванадцять","тринадцять","чотирнадцять","п'ятнадцять","шiстнадцять","сiмнадцять","вiсiмнадцять","дев'ятнадцять"],g=["","","двадцять","тридцять","сорок","п'ятдесят","шiстдесят","сiмдесят","вiсiмдесят","дев'яносто"],a=["","сто","двiстi","триста","чотириста","п'ятсот","шiстсот","сiмсот","вiсiмсот","дев'ятсот"],p="нуль",h="мiнус",b=["","перший","другий","третiй","четвертий","п'ятий","шостий","сьомий","восьмий","дев'ятий"],d=["десятий","одинадцятий","дванадцятий","тринадцятий","чотирнадцятий","п'ятнадцятий","шiстнадцятий","сiмнадцятий","вiсiмнадцятий","дев'ятнадцятий"],m=["","","двадцятий","тридцятий","сороковий","п'ятдесятий","шiстдесятий","сiмдесятий","вiсiмдесятий","дев'яностий"],w=["","сотий","двохсотий","трьохсотий","чотирьохсотий","п'ятисотий","шестисотий","семисотий","восьмисотий","дев'ятисотий"],N=["тисячний","мiльйонний","мiльярдний","трильйонний"],y=["гривня","гривнi","гривень"],v=["копiйка","копiйки","копiйок"],I=[["тисяча","тисячi","тисяч"],["мiльйон","мiльйони","мiльйонiв"],["мiльярд","мiльярди","мiльярдiв"],["трильйон","трильйони","трильйонiв"],["квадрильйон","квадрильйони","квадрильйонiв"],["квiнтильйон","квiнтильйони","квiнтильйонiв"],["секстильйон","секстильйони","секстильйонiв"],["септильйон","септильйони","септильйонiв"],["октильйон","октильйони","октильйонiв"]];function E(e,n){const t="bigint"==typeof e?Number(e):e,i=t%10,r=t%100;return r>=11&&r<=19?n[2]:1===i?n[0]:i>=2&&i<=4?n[1]:n[2]}function O(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(a[i]),t>1&&r.push(g[t]),1===t?r.push(l[n]):n>0&&r.push(c[n]),r.join(" ")}function B(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(a[i]),t>1&&r.push(g[t]),1===t?r.push(l[n]):n>0&&r.push(f[n]),r.join(" ")}function R(e,n){return 0n===e?p:e<1000n?"feminine"===n?B(Number(e)):O(Number(e)):function(e,n){const t=e.toString(),i=t.length,r=[],o=i%3;let s=0;for(o>0&&(r.push(Number(t.slice(0,o))),s=o);s<i;)r.push(Number(t.slice(s,s+3))),s+=3;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const t=r[e];if(0!==t)if(0===c)u.push("feminine"===n?B(t):O(t));else{const e=E(t,I[c-1]),n=1===c?B(t):O(t);u.push(n+" "+e)}c--}return u.join(" ")}(e,n)}const $=u(I.length),j=u(N.length),x=u(I.length),P={gender:"masculine"},T={gender:["masculine","feminine"]};function S(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?b[n]:1===t?d[n]:0===n?m[t]:g[t]+" "+b[n]}function M(e){if(e<100n)return S(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),i=n%100;return 0===i?w[t]:a[t]+" "+S(i)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return 1===n?N[0]:B(n)+" "+N[0];const i=E(n,I[0]);return B(n)+" "+i+" "+M(BigInt(t))}return function(e){const n=e.toString(),t=n.length,i=[],r=t%3;let o=0;for(r>0&&(i.push(Number(n.slice(0,r))),o=r);o<t;)i.push(Number(n.slice(o,o+3))),o+=3;let s=i.length-1;for(;s>=0&&0===i[s];)s--;const u=[];let c=i.length-1;for(let e=0;e<i.length;e++){const n=i[e];if(0!==n){const t=e===s;if(0===c)u.push(t?M(BigInt(n)):O(n));else if(t)if(1===n)u.push(N[c-1]);else{const e=1===c?B(n):O(n);u.push(e+" "+N[c-1])}else{const e=E(n,I[c-1]),t=1===c?B(n):O(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}const k={ukUA: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(i(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const i=BigInt(e);if(i<=0n)throw new RangeError("Ordinals must be positive integers");return i}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,j),M(t)}};e.currency={ukUA:function(e){const{isNegative:n,dollars:i,cents:r}=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,x);let u="";return n&&(u=h+" "),(i>0n||0n===r)&&(u+=R(i,"feminine"),u+=" "+E(i,y)),r>0n&&(i>0n&&(u+=" "),u+=R(r,"feminine"),u+=" "+E(r,v)),u}},e.ordinal=k,e.ukUA=function(e,o){const{isNegative:u,integerPart:c,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)}:r(t(e))}if("string"==typeof e)return r(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return i(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(c,$,f);const{gender:l}=function(e,n,t){const i={...n};if(void 0===e)return i;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[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof i[o])throw new TypeError(`Option "${o}" must be a ${typeof i[o]}, got ${typeof s}`);if(void 0!==t&&Object.hasOwn(t,o)){const e=t[o];if(!e.includes(s))throw new RangeError(`Option "${o}" must be one of: ${e.join(", ")} — got ${JSON.stringify(s)}`)}i[o]=s}}return i}(o,P,T);let g="";return u&&(g=h+" "),g+=R(c,l),f&&(g+=" кома "+function(e,n){let t="",i=0;for(;i<e.length&&"0"===e[i];)t&&(t+=" "),t+=p,i++;const r=e.slice(i);return r&&(t&&(t+=" "),t+=R(BigInt(r),n)),t}(f,l)),g}},"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/ur-PK.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/ur-PK v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/ur-PK v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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+2*(e-1))}const u="منفی",a=["","پہلا","دوسرا","تیسرا","چوتھا","پانچواں","چھٹا"],g=["صفر","ایک","دو","تین","چار","پانچ","چھ","سات","آٹھ","نو","دس","گیارہ","بارہ","تیرہ","چودہ","پندرہ","سولہ","سترہ","اٹھارہ","انیس","بیس","اکیس","بائیس","تیئیس","چوبیس","پچیس","چھبیس","ستائیس","اٹھائیس","انتیس","تیس","اکتیس","بتیس","تینتیس","چونتیس","پینتیس","چھتیس","سینتیس","اڑتیس","انتالیس","چالیس","اکتالیس","بیالیس","تینتالیس","چوالیس","پینتالیس","چھالیس","سینتالیس","اڑتالیس","انچاس","پچاس","اکاون","باون","ترپن","چون","پچپن","چھپن","ستاون","اٹھاون","انسٹھ","ساٹھ","اکسٹھ","باسٹھ","ترسٹھ","چونسٹھ","پینسٹھ","چھیاسٹھ","سڑسٹھ","اڑسٹھ","انہتر","ستر","اکہتر","بہتر","تہتر","چوہتر","پچھتر","چھہتر","ستتر","اٹھہتر","اناسی","اسی","اکیاسی","بیاسی","تریاسی","چوراسی","پچاسی","چھیاسی","ستاسی","اٹھاسی","نواسی","نوے","اکانوے","بانوے","ترانوے","چورانوے","پچانوے","چھیانوے","ستانوے","اٹھانوے","ننانوے"],c=["","ہزار","لاکھ","کروڑ","ارب","کھرب","نیل","پدم","شنکھ"],l=s(c.length),f=s(c.length),m=s(c.length);function b(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?g[n]+" سو":g[n]+" سو "+g[t]}function w(e){if(0n===e)return"صفر";if(e<1000n)return b(Number(e));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];0!==t&&(r.push(0===e?b(t):g[t]),e>0&&c[e]&&r.push(c[e]))}return r.join(" ")}function d(i){const{isNegative:s,integerPart:a,decimalPart:g}=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(a,l,g);let c="";return s&&(c=u+" "),c+=w(a),g&&(c+=" اعشاریہ "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+="صفر",t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=w(BigInt(r))),n}(g)),c}function h(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,f),(i=r)>=1n&&i<=6n?a[Number(i)]:w(i)+"واں";var i}function p(e){const{isNegative:t,dollars:r,cents:s}=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(r,m);let a="";return t&&(a=u+" "),(r>0n||0n===s)&&(a+=w(r),a+=" "+(1n===r?"روپیہ":"روپے")),s>0n&&(r>0n&&(a+=" "),a+=w(s),a+=" "+(1n===s?"پیسہ":"پیسے")),a}export{l as cardinalMax,m as currencyMax,f as ordinalMax,d as toCardinal,p as toCurrency,h as toOrdinal};
package/dist/ur-PK.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/ur-PK v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/ur-PK v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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+2*(e-1))}const a="منفی",c=["","پہلا","دوسرا","تیسرا","چوتھا","پانچواں","چھٹا"],g=["صفر","ایک","دو","تین","چار","پانچ","چھ","سات","آٹھ","نو","دس","گیارہ","بارہ","تیرہ","چودہ","پندرہ","سولہ","سترہ","اٹھارہ","انیس","بیس","اکیس","بائیس","تیئیس","چوبیس","پچیس","چھبیس","ستائیس","اٹھائیس","انتیس","تیس","اکتیس","بتیس","تینتیس","چونتیس","پینتیس","چھتیس","سینتیس","اڑتیس","انتالیس","چالیس","اکتالیس","بیالیس","تینتالیس","چوالیس","پینتالیس","چھالیس","سینتالیس","اڑتالیس","انچاس","پچاس","اکاون","باون","ترپن","چون","پچپن","چھپن","ستاون","اٹھاون","انسٹھ","ساٹھ","اکسٹھ","باسٹھ","ترسٹھ","چونسٹھ","پینسٹھ","چھیاسٹھ","سڑسٹھ","اڑسٹھ","انہتر","ستر","اکہتر","بہتر","تہتر","چوہتر","پچھتر","چھہتر","ستتر","اٹھہتر","اناسی","اسی","اکیاسی","بیاسی","تریاسی","چوراسی","پچاسی","چھیاسی","ستاسی","اٹھاسی","نواسی","نوے","اکانوے","بانوے","ترانوے","چورانوے","پچانوے","چھیانوے","ستانوے","اٹھانوے","ننانوے"],f=["","ہزار","لاکھ","کروڑ","ارب","کھرب","نیل","پدم","شنکھ"],l=u(f.length),d=u(f.length),b=u(f.length);function m(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?g[n]+" سو":g[n]+" سو "+g[t]}function h(e){if(0n===e)return"صفر";if(e<1000n)return m(Number(e));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];0!==t&&(r.push(0===e?m(t):g[t]),e>0&&f[e]&&r.push(f[e]))}return r.join(" ")}const p={urPK: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,d),(i=t)>=1n&&i<=6n?c[Number(i)]:h(i)+"واں";var i}};e.currency={urPK:function(e){const{isNegative:n,dollars:r,cents:i}=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(r,b);let u="";return n&&(u=a+" "),(r>0n||0n===i)&&(u+=h(r),u+=" "+(1n===r?"روپیہ":"روپے")),i>0n&&(r>0n&&(u+=" "),u+=h(i),u+=" "+(1n===i?"پیسہ":"پیسے")),u}},e.ordinal=p,e.urPK=function(e){const{isNegative:o,integerPart:u,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(u,l,c);let g="";return o&&(g=a+" "),g+=h(u),c&&(g+=" اعشاریہ "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+="صفر",t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=h(BigInt(r))),n}(c)),g}},"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/vi-VN.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/vi-VN v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/vi-VN v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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=["không","một","hai","ba","bốn","năm","sáu","bảy","tám","chín"],g=["","nghìn","triệu","tỷ","nghìn tỷ","triệu tỷ","tỷ tỷ"],c=s(g.length-1),l=s(g.length-1),a=s(g.length-1),f="không";function m(e){if(0===e)return u[0];if(e<10)return u[e];if(e<20){const n=e-10;return 0===n?"mười":5===n?"mười lăm":"mười "+u[n]}const n=e%10,t=Math.trunc(e/10),r=u[t]+" mươi";return 0===n?r:1===n?r+" mốt":5===n?r+" lăm":r+" "+u[n]}function h(e){if(0===e)return"";const n=Math.trunc(e/100),t=e%100;let r="";return n>0&&(r=u[n]+" trăm"),t>0&&(t<10?r?(r+=" lẻ ",r+=5===t?"năm":u[t]):r=u[t]:(r&&(r+=" "),r+=m(t))),r}function b(e){return 0===e?"":e<10?"lẻ "+(5===e?"năm":u[e]):"lẻ "+m(e)}function w(e){if(0n===e)return f;if(e<100n)return m(Number(e));if(e<1000n)return h(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),r=h(n)+" "+g[1];return 0===t?r:t<100?r+" "+b(t):r+" "+h(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=h(n);e&&s.push(u>0?e+" "+g[u]:e)}u--}const c=s.length;if(0===c)return f;if(1===c)return s[0];const l=r[r.length-1];if(l>0&&l<=99){let e=s[0];for(let n=1;n<c-1;n++)e+=" "+s[n];return e+" "+b(l)}let a=s[0];for(let e=1;e<c;e++)a+=" "+s[e];return a}(e)}function d(i){const{isNegative:s,integerPart:u,decimalPart:g}=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,c,g);let l="";return s&&(l="âm "),l+=w(u),g&&(l+=" phẩy "+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+=w(BigInt(r))),n}(g)),l}function p(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,l),1n===(i=r)?"thứ nhất":"thứ "+w(i);var i}function N(e){const{isNegative:t,dollars:r}=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(r,a);let s="";return t&&(s="âm "),s+=w(r),s+=" đồng",s}export{c as cardinalMax,a as currencyMax,l as ordinalMax,d as toCardinal,N as toCurrency,p as toOrdinal};
package/dist/vi-VN.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/vi-VN v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/vi-VN v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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 c=["không","một","hai","ba","bốn","năm","sáu","bảy","tám","chín"],l=["","nghìn","triệu","tỷ","nghìn tỷ","triệu tỷ","tỷ tỷ"],f=u(l.length-1),a=u(l.length-1),g=u(l.length-1),m="không";function h(e){if(0===e)return c[0];if(e<10)return c[e];if(e<20){const n=e-10;return 0===n?"mười":5===n?"mười lăm":"mười "+c[n]}const n=e%10,t=Math.trunc(e/10),r=c[t]+" mươi";return 0===n?r:1===n?r+" mốt":5===n?r+" lăm":r+" "+c[n]}function b(e){if(0===e)return"";const n=Math.trunc(e/100),t=e%100;let r="";return n>0&&(r=c[n]+" trăm"),t>0&&(t<10?r?(r+=" lẻ ",r+=5===t?"năm":c[t]):r=c[t]:(r&&(r+=" "),r+=h(t))),r}function d(e){return 0===e?"":e<10?"lẻ "+(5===e?"năm":c[e]):"lẻ "+h(e)}function p(e){if(0n===e)return m;if(e<100n)return h(Number(e));if(e<1000n)return b(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),r=b(n)+" "+l[1];return 0===t?r:t<100?r+" "+d(t):r+" "+b(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=b(n);e&&s.push(u>0?e+" "+l[u]:e)}u--}const c=s.length;if(0===c)return m;if(1===c)return s[0];const f=r[r.length-1];if(f>0&&f<=99){let e=s[0];for(let n=1;n<c-1;n++)e+=" "+s[n];return e+" "+d(f)}let a=s[0];for(let e=1;e<c;e++)a+=" "+s[e];return a}(e)}const w={viVN: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,a),1n===(i=t)?"thứ nhất":"thứ "+p(i);var i}};e.currency={viVN:function(e){const{isNegative:n,dollars:r}=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(r,g);let i="";return n&&(i="âm "),i+=p(r),i+=" đồng",i}},e.ordinal=w,e.viVN=function(e){const{isNegative:o,integerPart:u,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(u,f,c);let l="";return o&&(l="âm "),l+=p(u),c&&(l+=" phẩy "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=m,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=p(BigInt(r))),n}(c)),l}},"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/yo-NG.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/yo-NG v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/yo-NG v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
2
  function n(n){let[e,r]=n.toLowerCase().split("e");const t=parseInt(r,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)+t;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 e(e){const t=e.toString();return r(t)?n(t):t}function r(n){return n.includes("e")||n.includes("E")}function t(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 i(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 o=null,s=o,u=o,a=o,g=["","ọ̀kan","èjì","ẹ̀ta","ẹ̀rin","àrùn","ẹ̀fà","èje","ẹ̀jọ","ẹ̀sán","ẹ̀wá"],l=["","ọ̀kànlá","èjìlá","ẹ̀talá","ẹ̀rinlá"],c=["àrùndínlógún","ẹ̀rìndínlógún","ẹ̀tadínlógún","èjìdínlógún","ọ̀kàndínlógún"],f={20:"ogún",30:"ọgbọ̀n",40:"ogójì",50:"àádọ́ta",60:"ogóta",70:"àádọ́rin",80:"ogórin",90:"àádọ́rùn",100:"ọgọ́rùn"},d={20:"lógún",30:"lọgbọ̀n",40:"lógójì",50:"láàádọ́ta",60:"lógóta",70:"láàádọ́rin",80:"lógórin",90:"láàádọ́rùn",100:"lọ́gọ́rùn"},b={20:"dínlógún",30:"dínlọgbọ̀n",40:"dínlógójì",50:"dínláàádọ́ta",60:"dínlógóta",70:"dínláàádọ́rin",80:"dínlógórin",90:"dínláàádọ́rùn",100:"dínlọ́gọ́rùn"},m="ọgọ́rùn",w="igba",N="irinwó",p="ẹgbẹ̀rún",h="mílíọ̀nù",v="àìní",I="ó lé";function y(n){if(0===n)return"";if(n<=10)return g[n];if(n<=14)return l[n-10];if(n<=19)return c[n-15];if(n%10==0)return f[n];const e=10*Math.trunc(n/10),r=n%10;return r<=4?g[r]+" lé "+d[e]:g[10-r]+b[e+10]}function E(n){if(n<100)return y(n);const e=Math.trunc(n/100),r=n%100;let t;return 2===e&&0===r?w:4===e&&0===r?N:(t=1===e?m:2===e?w:4===e?N:g[e]+" "+m,r>0&&(t+=" ó lé "+y(r)),t)}function R(n){if(0n===n)return"òdo";if(n<100n)return y(Number(n));if(n<1000n)return E(Number(n));const e=[];let r=n;if(r>=1000000n){const n=r/1000000n;r%=1000000n,e.push(1n===n?h+" kan":h+" "+R(n))}if(r>=1000n){const n=r/1000n;r%=1000n,e.push(1n===n?p+" kan":10n===n?"ẹgbàárùn":20n===n?"ọ̀kẹ́":n<100n?p+" "+y(Number(n)):p+" "+E(Number(n)))}return r>0n&&e.push(r<100n?e.length>0?I+" "+y(Number(r)):y(Number(r)):e.length>0?I+" "+E(Number(r)):E(Number(r))),e.join(", ")}function O(i){const{isNegative:o,integerPart:s,decimalPart:u}=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)}:t(e(i))}if("string"==typeof i)return t(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}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);let a="";return o&&(a=v+" "),a+=R(s),u&&(a+=" àmì "+function(n){const e=[];for(const r of n){const n=parseInt(r,10);e.push(0===n?"òdo":g[n])}return e.join(" ")}(u)),a}function B(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 n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}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 1n===(i=t)?"àkọ́kọ́":2n===i?"ìkejì":"ìkẹ"+R(i);var i}function j(n){const{isNegative:r,dollars:t,cents:o}=function(n){const r=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}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);let s="";return r&&(s=v+" "),(t>0n||0n===o)&&(s+=R(t)+" náírà"),o>0n&&(t>0n&&(s+=" àti "),s+=R(o)+" kọ́bọ̀"),s}export{s as cardinalMax,a as currencyMax,u as ordinalMax,O as toCardinal,j as toCurrency,B as toOrdinal};
package/dist/yo-NG.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/yo-NG v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/yo-NG v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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 o=e.indexOf("."),s=-1===o?e:e.slice(0,o)+e.slice(o+1),u=(-1===o?e.length:o)+t;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 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 o(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 s=["","ọ̀kan","èjì","ẹ̀ta","ẹ̀rin","àrùn","ẹ̀fà","èje","ẹ̀jọ","ẹ̀sán","ẹ̀wá"],u=["","ọ̀kànlá","èjìlá","ẹ̀talá","ẹ̀rinlá"],a=["àrùndínlógún","ẹ̀rìndínlógún","ẹ̀tadínlógún","èjìdínlógún","ọ̀kàndínlógún"],l={20:"ogún",30:"ọgbọ̀n",40:"ogójì",50:"àádọ́ta",60:"ogóta",70:"àádọ́rin",80:"ogórin",90:"àádọ́rùn",100:"ọgọ́rùn"},g={20:"lógún",30:"lọgbọ̀n",40:"lógójì",50:"láàádọ́ta",60:"lógóta",70:"láàádọ́rin",80:"lógórin",90:"láàádọ́rùn",100:"lọ́gọ́rùn"},c={20:"dínlógún",30:"dínlọgbọ̀n",40:"dínlógójì",50:"dínláàádọ́ta",60:"dínlógóta",70:"dínláàádọ́rin",80:"dínlógórin",90:"dínláàádọ́rùn",100:"dínlọ́gọ́rùn"},f="ọgọ́rùn",d="igba",b="irinwó",m="ẹgbẹ̀rún",w="mílíọ̀nù",p="àìní",N="ó lé";function h(n){if(0===n)return"";if(n<=10)return s[n];if(n<=14)return u[n-10];if(n<=19)return a[n-15];if(n%10==0)return l[n];const e=10*Math.trunc(n/10),r=n%10;return r<=4?s[r]+" lé "+g[e]:s[10-r]+c[e+10]}function v(n){if(n<100)return h(n);const e=Math.trunc(n/100),r=n%100;let t;return 2===e&&0===r?d:4===e&&0===r?b:(t=1===e?f:2===e?d:4===e?b:s[e]+" "+f,r>0&&(t+=" ó lé "+h(r)),t)}function y(n){if(0n===n)return"òdo";if(n<100n)return h(Number(n));if(n<1000n)return v(Number(n));const e=[];let r=n;if(r>=1000000n){const n=r/1000000n;r%=1000000n,e.push(1n===n?w+" kan":w+" "+y(n))}if(r>=1000n){const n=r/1000n;r%=1000n,e.push(1n===n?m+" kan":10n===n?"ẹgbàárùn":20n===n?"ọ̀kẹ́":n<100n?m+" "+h(Number(n)):m+" "+v(Number(n)))}return r>0n&&e.push(r<100n?e.length>0?N+" "+h(Number(r)):h(Number(r)):e.length>0?N+" "+v(Number(r)):v(Number(r))),e.join(", ")}const I={yoNG:function(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 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}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return 1n===(i=r)?"àkọ́kọ́":2n===i?"ìkejì":"ìkẹ"+y(i);var i}};n.currency={yoNG:function(n){const{isNegative:e,dollars:t,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(r(n))}if("string"==typeof n)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);let s="";return e&&(s=p+" "),(t>0n||0n===i)&&(s+=y(t)+" náírà"),i>0n&&(t>0n&&(s+=" àti "),s+=y(i)+" kọ́bọ̀"),s}},n.ordinal=I,n.yoNG=function(n){const{isNegative:o,integerPart:u,decimalPart:a}=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(r(n))}if("string"==typeof n)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 ${o}`)}(n);let l="";return o&&(l=p+" "),l+=y(u),a&&(l+=" àmì "+function(n){const e=[];for(const r of n){const n=parseInt(r,10);e.push(0===n?"òdo":s[n])}return e.join(" ")}(a)),l}},"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,2 +1,2 @@
1
- /*! n2words/zh-Hans-CN v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/zh-Hans-CN v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
2
  function n(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 e(e){const r=e.toString();return t(r)?n(r):r}function t(n){return n.includes("e")||n.includes("E")}function r(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 i(e){let r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${e}"`);t(r)&&(r=n(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(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 s(n){return 10n**BigInt(n)}function u(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,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 c=["零","一","二","三","四","五","六","七","八","九"],f=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],a=s(16),l=s(16),g=s(16),b="零";function m(n,e,t,r,i){if(0n===n)return"";let o="",s=!1;const u=n/1000n,c=n%1000n;u>0n&&(o=e[Number(u)]+i,s=c>0n&&c<100n);const f=c/100n,a=c%100n;f>0n?(s&&(o+=b),o+=e[Number(f)]+r,s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(o+=b),o+=e[Number(l)]+t,s=!1):(f>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&(o+=b),o+=e[Number(g)]),o}function p(n,e,t,r,i){if(0n===n)return"";if(n>=10000n){const o=n/10000n,s=n%10000n;let u=m(o,e,t,r,i)+"万";return s>0n&&((o%10n==0n||s<1000n)&&(u+=b),u+=m(s,e,t,r,i)),u}return m(n,e,t,r,i)}function w(n,e=!0){if(0n===n)return b;const t=e?f:c,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";if(n>=100000000n){const e=n%100000000n;let s=p(n/100000000n,t,r,i,o)+"亿";return e>0n&&(e<10000000n&&(s+=b),s+=p(e,t,r,i,o)),s}return p(n,t,r,i,o)}const d={formal:!0};function N(i,s){const{isNegative:l,integerPart:g,decimalPart:b}=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(e(i))}if("string"==typeof i)return r(function(e){const r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${e}"`);return t(r)?n(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(g,a);const{formal:m}=u(s,d);let p=l?"负":"";return p+=w(g,m),b&&(p+="点"+function(n,e){let t="";for(let r=0;r<n.length;r++)t+=e[Number(n[r])];return t}(b,m?f:c)),p}const h={formal:!0};function v(e,r){const i=function(e){const r=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 r=e.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 e=n(r);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(e);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(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 ${r}`)}(e);o(i,l);const{formal:s}=u(r,h);return function(n,e){return"第"+w(n,e)}(i,s)}const y={formal:!0};function I(n,t){const{isNegative:r,dollars:s,cents:a}=function(n){const t=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}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);o(s,g);const{formal:l}=u(t,y),m=l?f:c,p=l?"圆":"元",d=a/10n,N=a%10n;let h="";return r&&(h="负"),s>0n&&(h+=w(s,l)+p),d>0n?h+=m[Number(d)]+"角":s>0n&&N>0n&&(h+=b),N>0n?h+=m[Number(N)]+"分":(s>0n||d>0n)&&(h+="整"),0n===s&&0n===d&&0n===N&&(h+=b+p+"整"),h}export{d as cardinalDefaults,a as cardinalMax,y as currencyDefaults,g as currencyMax,h as ordinalDefaults,l as ordinalMax,N as toCardinal,I as toCurrency,v as toOrdinal};
@@ -1,2 +1,2 @@
1
- /*! n2words/zh-Hans-CN v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/zh-Hans-CN v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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(n)}function f(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,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 c=["零","一","二","三","四","五","六","七","八","九"],a=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],l=u(16),g=u(16),d=u(16),b="零";function m(n,e,t,r,i){if(0n===n)return"";let o="",s=!1;const u=n/1000n,f=n%1000n;u>0n&&(o=e[Number(u)]+i,s=f>0n&&f<100n);const c=f/100n,a=f%100n;c>0n?(s&&(o+=b),o+=e[Number(c)]+r,s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(o+=b),o+=e[Number(l)]+t,s=!1):(c>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&(o+=b),o+=e[Number(g)]),o}function p(n,e,t,r,i){if(0n===n)return"";if(n>=10000n){const o=n/10000n,s=n%10000n;let u=m(o,e,t,r,i)+"万";return s>0n&&((o%10n==0n||s<1000n)&&(u+=b),u+=m(s,e,t,r,i)),u}return m(n,e,t,r,i)}function w(n,e=!0){if(0n===n)return b;const t=e?a:c,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";if(n>=100000000n){const e=n%100000000n;let s=p(n/100000000n,t,r,i,o)+"亿";return e>0n&&(e<10000000n&&(s+=b),s+=p(e,t,r,i,o)),s}return p(n,t,r,i,o)}const h={formal:!0},N={formal:!0},y={formal:!0},v={zhHansCN:function(n,t){const i=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);s(i,g);const{formal:o}=f(t,N);return function(n,e){return"第"+w(n,e)}(i,o)}};n.currency={zhHansCN:function(n,e){const{isNegative:r,dollars:i,cents:u}=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(i,d);const{formal:l}=f(e,y),g=l?a:c,m=l?"圆":"元",p=u/10n,h=u%10n;let N="";return r&&(N="负"),i>0n&&(N+=w(i,l)+m),p>0n?N+=g[Number(p)]+"角":i>0n&&h>0n&&(N+=b),h>0n?N+=g[Number(h)]+"分":(i>0n||p>0n)&&(N+="整"),0n===i&&0n===p&&0n===h&&(N+=b+m+"整"),N}},n.ordinal=v,n.zhHansCN=function(n,o){const{isNegative:u,integerPart:g,decimalPart:d}=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(g,l);const{formal:b}=f(o,h);let m=u?"负":"";return m+=w(g,b),d&&(m+="点"+function(n,e){let t="";for(let r=0;r<n.length;r++)t+=e[Number(n[r])];return t}(d,b?a:c)),m}},"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,2 +1,2 @@
1
- /*! n2words/zh-Hant-TW v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/zh-Hant-TW v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
2
  function n(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 e(e){const r=e.toString();return t(r)?n(r):r}function t(n){return n.includes("e")||n.includes("E")}function r(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 i(e){let r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${e}"`);t(r)&&(r=n(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(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 s(n){return 10n**BigInt(n)}function u(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,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 c=["零","一","二","三","四","五","六","七","八","九"],f=["零","壹","貳","參","肆","伍","陸","柒","捌","玖"],a=s(16),l=s(16),g=s(16),p="零";function b(n,e=!0){if(0n===n)return p;const t=e?f:c,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";function s(n){if(0n===n)return"";const e=[];let s=!1;const u=n/1000n,c=n%1000n;u>0n&&(e.push(t[Number(u)]+o),s=c>0n&&c<100n);const f=c/100n,a=c%100n;f>0n?(s&&e.push(p),e.push(t[Number(f)]+i),s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(e.push(p),s=!1),e.push(t[Number(l)]+r)):(f>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&e.push(p),e.push(t[Number(g)])),e.join("")}function u(n){if(0n===n)return"";const e=[];if(n>=10000n){const t=n/10000n,r=n%10000n;e.push(s(t)+"萬"),r>0n&&((t%10n==0n||r<1000n)&&e.push(p),e.push(s(r)))}else e.push(s(n));return e.join("")}const a=[];if(n>=100000000n){const e=n%100000000n,t=u(n/100000000n);a.push(t+"億"),e>0n&&(e<10000000n&&a.push(p),a.push(u(e)))}else a.push(u(n));return a.join("")}const m={formal:!0};function h(i,s){const{isNegative:l,integerPart:g,decimalPart:p}=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(e(i))}if("string"==typeof i)return r(function(e){const r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${e}"`);return t(r)?n(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(g,a);const{formal:h}=u(s,m);let w="";return l&&(w="負"),w+=b(g,h),p&&(w+="點"+function(n,e=!0){const t=e?f:c,r=[];for(const e of n)r.push(t[Number(e)]);return r}(p,h).join("")),w}const w={formal:!0};function d(e,r){const i=function(e){const r=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 r=e.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 e=n(r);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(e);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(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 ${r}`)}(e);o(i,l);const{formal:s}=u(r,w);return function(n,e=!0){return"第"+b(n,e)}(i,s)}const N={formal:!0};function v(n,t){const{isNegative:r,dollars:s,cents:a}=function(n){const t=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}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);o(s,g);const{formal:l}=u(t,N),m=l?"圓":"元",h=a/10n,w=a%10n;let d="";return r&&(d="負"),(s>0n||0n===a)&&(d+=b(s,l),d+=m),h>0n&&(d+=(l?f:c)[Number(h)]+"角"),w>0n?(s>0n&&0n===h&&(d+=p),d+=(l?f:c)[Number(w)]+"分"):d+="整",d}export{m as cardinalDefaults,a as cardinalMax,N as currencyDefaults,g as currencyMax,w as ordinalDefaults,l as ordinalMax,h as toCardinal,v as toCurrency,d as toOrdinal};
@@ -1,2 +1,2 @@
1
- /*! n2words/zh-Hant-TW v5.1.1 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/zh-Hant-TW v5.1.2 | MIT License | github.com/forzagreen/n2words */
2
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(n)}function c(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,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=["零","一","二","三","四","五","六","七","八","九"],a=["零","壹","貳","參","肆","伍","陸","柒","捌","玖"],l=u(16),g=u(16),p=u(16),d="零";function b(n,e=!0){if(0n===n)return d;const t=e?a:f,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";function s(n){if(0n===n)return"";const e=[];let s=!1;const u=n/1000n,c=n%1000n;u>0n&&(e.push(t[Number(u)]+o),s=c>0n&&c<100n);const f=c/100n,a=c%100n;f>0n?(s&&e.push(d),e.push(t[Number(f)]+i),s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(e.push(d),s=!1),e.push(t[Number(l)]+r)):(f>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&e.push(d),e.push(t[Number(g)])),e.join("")}function u(n){if(0n===n)return"";const e=[];if(n>=10000n){const t=n/10000n,r=n%10000n;e.push(s(t)+"萬"),r>0n&&((t%10n==0n||r<1000n)&&e.push(d),e.push(s(r)))}else e.push(s(n));return e.join("")}const c=[];if(n>=100000000n){const e=n%100000000n,t=u(n/100000000n);c.push(t+"億"),e>0n&&(e<10000000n&&c.push(d),c.push(u(e)))}else c.push(u(n));return c.join("")}const m={formal:!0},h={formal:!0},w={formal:!0},y={zhHantTW:function(n,t){const i=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);s(i,g);const{formal:o}=c(t,h);return function(n,e=!0){return"第"+b(n,e)}(i,o)}};n.currency={zhHantTW:function(n,e){const{isNegative:r,dollars:i,cents:u}=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(i,p);const{formal:l}=c(e,w),g=l?"圓":"元",m=u/10n,h=u%10n;let y="";return r&&(y="負"),(i>0n||0n===u)&&(y+=b(i,l),y+=g),m>0n&&(y+=(l?a:f)[Number(m)]+"角"),h>0n?(i>0n&&0n===m&&(y+=d),y+=(l?a:f)[Number(h)]+"分"):y+="整",y}},n.ordinal=y,n.zhHantTW=function(n,o){const{isNegative:u,integerPart:g,decimalPart:p}=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(g,l);const{formal:d}=c(o,m);let h="";return u&&(h="負"),h+=b(g,d),p&&(h+="點"+function(n,e=!0){const t=e?a:f,r=[];for(const e of n)r.push(t[Number(e)]);return r}(p,d).join("")),h}},"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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n2words",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.",
5
5
  "keywords": [
6
6
  "number-to-words",
@@ -127,34 +127,34 @@
127
127
  ]
128
128
  },
129
129
  "devDependencies": {
130
- "@commitlint/cli": "^21.1.0",
131
- "@commitlint/config-conventional": "^21.1.0",
130
+ "@commitlint/cli": "^21.2.1",
131
+ "@commitlint/config-conventional": "^21.2.0",
132
132
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
133
133
  "@eslint/js": "^10.0.1",
134
134
  "@rollup/plugin-terser": "^1.0.0",
135
135
  "@rollup/plugin-virtual": "^3.0.2",
136
136
  "@stylistic/eslint-plugin": "^5.10.0",
137
- "@types/node": "^26.0.1",
137
+ "@types/node": "^26.1.1",
138
138
  "ava": "^8.0.1",
139
- "browserslist": "^4.28.4",
139
+ "browserslist": "^4.28.6",
140
140
  "c8": "^11.0.0",
141
141
  "chalk": "^5.6.2",
142
- "eslint": "^10.5.0",
142
+ "eslint": "^10.7.0",
143
143
  "eslint-plugin-ava": "^17.0.1",
144
144
  "eslint-plugin-compat": "^7.0.2",
145
- "eslint-plugin-es-x": "^9.7.0",
146
- "eslint-plugin-import-x": "^4.17.0",
147
- "eslint-plugin-jsdoc": "^63.0.8",
148
- "eslint-plugin-n": "^18.2.1",
149
- "fast-check": "^4.8.0",
145
+ "eslint-plugin-es-x": "^10.0.0",
146
+ "eslint-plugin-import-x": "^4.17.1",
147
+ "eslint-plugin-jsdoc": "^63.0.13",
148
+ "eslint-plugin-n": "^18.2.2",
149
+ "fast-check": "^4.9.0",
150
150
  "globals": "^17.7.0",
151
151
  "husky": "^9.1.7",
152
152
  "lint-staged": "^17.0.8",
153
- "markdownlint-cli2": "^0.22.1",
153
+ "markdownlint-cli2": "^0.23.0",
154
154
  "rimraf": "^6.1.3",
155
155
  "rollup": "^4.62.2",
156
156
  "tinybench": "^6.0.2",
157
- "typescript": "^6.0.3"
157
+ "typescript": "^7.0.2"
158
158
  },
159
159
  "engines": {
160
160
  "node": "^22 || ^24 || ^26"
package/src/am-ET.d.ts CHANGED
@@ -1,12 +1,24 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
1
+ /**
2
+ * Amharic (Ethiopia) language converter
3
+ *
4
+ * CLDR: am-ET | Amharic as used in Ethiopia (Ge'ez script)
5
+ *
6
+ * Key features:
7
+ * - Ge'ez/Ethiopic script numerals
8
+ * - Teens formed with "አስራ" prefix
9
+ * - Keeps "one" before hundred: "አንድ መቶ" (100)
10
+ * - Short scale naming
11
+ * - Per-digit decimal reading
12
+ */
13
+ export declare const cardinalMax: bigint;
14
+ export declare const ordinalMax: bigint;
15
+ export declare const currencyMax: bigint;
4
16
  /**
5
17
  * Converts a numeric value to Amharic words.
6
18
  * @param {number | string | bigint} value - The numeric value to convert
7
19
  * @returns {string} The number in Amharic words
8
20
  */
9
- export function toCardinal(value: number | string | bigint): string;
21
+ declare function toCardinal(value: number | string | bigint): string;
10
22
  /**
11
23
  * Converts a numeric value to Amharic ordinal words.
12
24
  *
@@ -22,7 +34,7 @@ export function toCardinal(value: number | string | bigint): string;
22
34
  * toOrdinal(10) // 'አስርኛ'
23
35
  * toOrdinal(100) // 'አንድ መቶኛ'
24
36
  */
25
- export function toOrdinal(value: number | string | bigint): string;
37
+ declare function toOrdinal(value: number | string | bigint): string;
26
38
  /**
27
39
  * Converts a numeric value to Amharic currency words (Ethiopian Birr).
28
40
  * @param {number | string | bigint} value - The currency amount to convert
@@ -35,4 +47,5 @@ export function toOrdinal(value: number | string | bigint): string;
35
47
  * toCurrency(0.99) // 'ዘጠና ዘጠኝ ሳንቲም'
36
48
  * toCurrency(0.01) // 'አንድ ሳንቲም'
37
49
  */
38
- export function toCurrency(value: number | string | bigint): string;
50
+ declare function toCurrency(value: number | string | bigint): string;
51
+ export { toCardinal, toOrdinal, toCurrency };
@@ -1,12 +1,24 @@
1
- export const cardinalMax: bigint;
2
- export const ordinalMax: bigint;
3
- export const currencyMax: bigint;
1
+ /**
2
+ * Amharic (Ethiopia, Latin script) language converter
3
+ *
4
+ * CLDR: am-Latn-ET | Amharic as used in Ethiopia (Latin script romanization)
5
+ *
6
+ * Key features:
7
+ * - Romanized numerals (and, hulet, sost)
8
+ * - Teens formed with "asra" prefix
9
+ * - Keeps "one" before hundred: "and meto" (100)
10
+ * - Short scale naming
11
+ * - Per-digit decimal reading
12
+ */
13
+ export declare const cardinalMax: bigint;
14
+ export declare const ordinalMax: bigint;
15
+ export declare const currencyMax: bigint;
4
16
  /**
5
17
  * Converts a numeric value to Amharic (Latin script) words.
6
18
  * @param {number | string | bigint} value - The numeric value to convert
7
19
  * @returns {string} The number in Amharic Latin words
8
20
  */
9
- export function toCardinal(value: number | string | bigint): string;
21
+ declare function toCardinal(value: number | string | bigint): string;
10
22
  /**
11
23
  * Converts a numeric value to Amharic (Latin script) ordinal words.
12
24
  * @param {number | string | bigint} value - The numeric value to convert (positive integer)
@@ -18,7 +30,7 @@ export function toCardinal(value: number | string | bigint): string;
18
30
  * toOrdinal(2) // 'huletnya'
19
31
  * toOrdinal(10) // 'asirnya'
20
32
  */
21
- export function toOrdinal(value: number | string | bigint): string;
33
+ declare function toOrdinal(value: number | string | bigint): string;
22
34
  /**
23
35
  * Converts a numeric value to Amharic (Latin script) currency words (Ethiopian Birr).
24
36
  * @param {number | string | bigint} value - The currency amount to convert
@@ -30,4 +42,5 @@ export function toOrdinal(value: number | string | bigint): string;
30
42
  * toCurrency(1) // 'and birr'
31
43
  * toCurrency(0.01) // 'and santim'
32
44
  */
33
- export function toCurrency(value: number | string | bigint): string;
45
+ declare function toCurrency(value: number | string | bigint): string;
46
+ export { toCardinal, toOrdinal, toCurrency };