n2words 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/am-ET.js +1 -1
- package/dist/am-ET.umd.js +1 -1
- package/dist/am-Latn-ET.js +1 -1
- package/dist/am-Latn-ET.umd.js +1 -1
- package/dist/ar-SA.js +1 -1
- package/dist/ar-SA.umd.js +1 -1
- package/dist/az-AZ.js +1 -1
- package/dist/az-AZ.umd.js +1 -1
- package/dist/bn-BD.js +1 -1
- package/dist/bn-BD.umd.js +1 -1
- package/dist/cs-CZ.js +1 -1
- package/dist/cs-CZ.umd.js +1 -1
- package/dist/da-DK.js +1 -1
- package/dist/da-DK.umd.js +1 -1
- package/dist/de-DE.js +1 -1
- package/dist/de-DE.umd.js +1 -1
- package/dist/el-GR.js +1 -1
- package/dist/el-GR.umd.js +1 -1
- package/dist/en-AU.js +1 -1
- package/dist/en-AU.umd.js +1 -1
- package/dist/en-BD.js +1 -1
- package/dist/en-BD.umd.js +1 -1
- package/dist/en-CA.js +1 -1
- package/dist/en-CA.umd.js +1 -1
- package/dist/en-GB.js +1 -1
- package/dist/en-GB.umd.js +1 -1
- package/dist/en-GH.js +1 -1
- package/dist/en-GH.umd.js +1 -1
- package/dist/en-IE.js +1 -1
- package/dist/en-IE.umd.js +1 -1
- package/dist/en-IN.js +1 -1
- package/dist/en-IN.umd.js +1 -1
- package/dist/en-KE.js +1 -1
- package/dist/en-KE.umd.js +1 -1
- package/dist/en-MY.js +1 -1
- package/dist/en-MY.umd.js +1 -1
- package/dist/en-NG.js +1 -1
- package/dist/en-NG.umd.js +1 -1
- package/dist/en-NZ.js +1 -1
- package/dist/en-NZ.umd.js +1 -1
- package/dist/en-PH.js +1 -1
- package/dist/en-PH.umd.js +1 -1
- package/dist/en-PK.js +1 -1
- package/dist/en-PK.umd.js +1 -1
- package/dist/en-SG.js +1 -1
- package/dist/en-SG.umd.js +1 -1
- package/dist/en-US.js +1 -1
- package/dist/en-US.umd.js +1 -1
- package/dist/en-ZA.js +1 -1
- package/dist/en-ZA.umd.js +1 -1
- package/dist/es-ES.js +1 -1
- package/dist/es-ES.umd.js +1 -1
- package/dist/es-MX.js +1 -1
- package/dist/es-MX.umd.js +1 -1
- package/dist/es-US.js +1 -1
- package/dist/es-US.umd.js +1 -1
- package/dist/fa-IR.js +1 -1
- package/dist/fa-IR.umd.js +1 -1
- package/dist/fi-FI.js +1 -1
- package/dist/fi-FI.umd.js +1 -1
- package/dist/fil-PH.js +1 -1
- package/dist/fil-PH.umd.js +1 -1
- package/dist/fr-BE.js +1 -1
- package/dist/fr-BE.umd.js +1 -1
- package/dist/fr-FR.js +1 -1
- package/dist/fr-FR.umd.js +1 -1
- package/dist/gu-IN.js +1 -1
- package/dist/gu-IN.umd.js +1 -1
- package/dist/ha-NG.js +1 -1
- package/dist/ha-NG.umd.js +1 -1
- package/dist/hbo-IL.js +1 -1
- package/dist/hbo-IL.umd.js +1 -1
- package/dist/he-IL.js +1 -1
- package/dist/he-IL.umd.js +1 -1
- package/dist/hi-IN.js +1 -1
- package/dist/hi-IN.umd.js +1 -1
- package/dist/hr-HR.js +1 -1
- package/dist/hr-HR.umd.js +1 -1
- package/dist/hu-HU.js +1 -1
- package/dist/hu-HU.umd.js +1 -1
- package/dist/id-ID.js +1 -1
- package/dist/id-ID.umd.js +1 -1
- package/dist/it-IT.js +1 -1
- package/dist/it-IT.umd.js +1 -1
- package/dist/ja-JP.js +1 -1
- package/dist/ja-JP.umd.js +1 -1
- package/dist/ka-GE.js +1 -1
- package/dist/ka-GE.umd.js +1 -1
- package/dist/kn-IN.js +1 -1
- package/dist/kn-IN.umd.js +1 -1
- package/dist/ko-KR.js +1 -1
- package/dist/ko-KR.umd.js +1 -1
- package/dist/lt-LT.js +1 -1
- package/dist/lt-LT.umd.js +1 -1
- package/dist/lv-LV.js +1 -1
- package/dist/lv-LV.umd.js +1 -1
- package/dist/mr-IN.js +1 -1
- package/dist/mr-IN.umd.js +1 -1
- package/dist/ms-MY.js +1 -1
- package/dist/ms-MY.umd.js +1 -1
- package/dist/nb-NO.js +1 -1
- package/dist/nb-NO.umd.js +1 -1
- package/dist/nl-NL.js +1 -1
- package/dist/nl-NL.umd.js +1 -1
- package/dist/pa-IN.js +1 -1
- package/dist/pa-IN.umd.js +1 -1
- package/dist/pl-PL.js +1 -1
- package/dist/pl-PL.umd.js +1 -1
- package/dist/pt-BR.js +1 -1
- package/dist/pt-BR.umd.js +1 -1
- package/dist/pt-PT.js +1 -1
- package/dist/pt-PT.umd.js +1 -1
- package/dist/ro-RO.js +1 -1
- package/dist/ro-RO.umd.js +1 -1
- package/dist/ru-RU.js +1 -1
- package/dist/ru-RU.umd.js +1 -1
- package/dist/sr-Cyrl-RS.js +2 -2
- package/dist/sr-Cyrl-RS.umd.js +2 -2
- package/dist/sr-Latn-RS.js +2 -2
- package/dist/sr-Latn-RS.umd.js +2 -2
- package/dist/sv-SE.js +1 -1
- package/dist/sv-SE.umd.js +1 -1
- package/dist/sw-KE.js +1 -1
- package/dist/sw-KE.umd.js +1 -1
- package/dist/ta-IN.js +1 -1
- package/dist/ta-IN.umd.js +1 -1
- package/dist/te-IN.js +1 -1
- package/dist/te-IN.umd.js +1 -1
- package/dist/th-TH.js +1 -1
- package/dist/th-TH.umd.js +1 -1
- package/dist/tr-TR.js +1 -1
- package/dist/tr-TR.umd.js +1 -1
- package/dist/uk-UA.js +1 -1
- package/dist/uk-UA.umd.js +1 -1
- package/dist/ur-PK.js +1 -1
- package/dist/ur-PK.umd.js +1 -1
- package/dist/vi-VN.js +1 -1
- package/dist/vi-VN.umd.js +1 -1
- package/dist/yo-NG.js +1 -1
- package/dist/yo-NG.umd.js +1 -1
- package/dist/zh-Hans-CN.js +1 -1
- package/dist/zh-Hans-CN.umd.js +1 -1
- package/dist/zh-Hant-TW.js +1 -1
- package/dist/zh-Hant-TW.umd.js +1 -1
- package/package.json +13 -13
- package/src/sr-Cyrl-RS.js +6 -5
- package/src/sr-Latn-RS.js +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.1.1](https://github.com/forzagreen/n2words/compare/v5.1.0...v5.1.1) (2026-07-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **sr-Cyrl-RS,sr-Latn-RS:** feminine number words before -arda scale words ([#413](https://github.com/forzagreen/n2words/issues/413)) ([075ae2e](https://github.com/forzagreen/n2words/commit/075ae2ed531823225403aedf1629e14ac9f1956e))
|
|
9
|
+
|
|
3
10
|
## [5.1.0](https://github.com/forzagreen/n2words/compare/v5.0.0...v5.1.0) (2026-06-17)
|
|
4
11
|
|
|
5
12
|
|
package/dist/am-ET.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/am-ET v5.1.
|
|
1
|
+
/*! n2words/am-ET v5.1.1 | 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)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=["","አንድ","ሁለት","ሶስት","አራት","አምስት","ስድስት","ሰባት","ስምንት","ዘጠኝ"],a=["አስር","አስራ አንድ","አስራ ሁለት","አስራ ሶስት","አስራ አራት","አስራ አምስት","አስራ ስድስት","አስራ ሰባት","አስራ ስምንት","አስራ ዘጠኝ"],c=["","","ሃያ","ሰላሳ","አርባ","ሃምሳ","ስልሳ","ሰባ","ሰማንያ","ዘጠና"],g="አሉታዊ",l=["","ሺ","ሚሊዮን","ቢሊዮን"],f=s(l.length-1),h=s(l.length-1),m=s(l.length-1);function b(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(u[r]+" መቶ"),1===t?i.push(a[n]):(t>1&&i.push(c[t]),n>0&&i.push(u[n])),i.join(" ")}function p(e){return 0n===e?"ዜሮ":e<1000n?b(Number(e)):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=l[u]||"";s.push(0===u?b(n):b(n)+" "+e)}u--}return s.join(" ")}(e)}function w(i){const{isNegative:s,integerPart:a,decimalPart:c}=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,f);let l="";return s&&(l=g+" "),l+=p(a),c&&(l+=" ነጥብ "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?"ዜሮ":u[e])}return n.join(" ")}(c)),l}function d(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,h),1n===(i=r)?"አንደኛ":p(i)+"ኛ";var i}function N(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 u="";return t&&(u=g+" "),(r>0n||0n===s)&&(u+=p(r),u+=" ብር"),s>0n&&(r>0n&&(u+=" "),u+=p(s),u+=" ሳንቲም"),u}export{f as cardinalMax,m as currencyMax,h as ordinalMax,w as toCardinal,N as toCurrency,d as toOrdinal};
|
package/dist/am-ET.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/am-ET v5.1.
|
|
1
|
+
/*! n2words/am-ET v5.1.1 | 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*(e+1))}const a=["","አንድ","ሁለት","ሶስት","አራት","አምስት","ስድስት","ሰባት","ስምንት","ዘጠኝ"],c=["አስር","አስራ አንድ","አስራ ሁለት","አስራ ሶስት","አስራ አራት","አስራ አምስት","አስራ ስድስት","አስራ ሰባት","አስራ ስምንት","አስራ ዘጠኝ"],g=["","","ሃያ","ሰላሳ","አርባ","ሃምሳ","ስልሳ","ሰባ","ሰማንያ","ዘጠና"],f="አሉታዊ",l=["","ሺ","ሚሊዮን","ቢሊዮን"],d=u(l.length-1),h=u(l.length-1),m=u(l.length-1);function p(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(a[r]+" መቶ"),1===t?i.push(c[n]):(t>1&&i.push(g[t]),n>0&&i.push(a[n])),i.join(" ")}function b(e){return 0n===e?"ዜሮ":e<1000n?p(Number(e)):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=l[u]||"";s.push(0===u?p(n):p(n)+" "+e)}u--}return s.join(" ")}(e)}const w={amET:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,h),1n===(i=t)?"አንደኛ":b(i)+"ኛ";var i}},v={amET: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,m);let u="";return n&&(u=f+" "),(r>0n||0n===i)&&(u+=b(r),u+=" ብር"),i>0n&&(r>0n&&(u+=" "),u+=b(i),u+=" ሳንቲም"),u}};e.amET=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,d);let g="";return o&&(g=f+" "),g+=b(u),c&&(g+=" ነጥብ "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?"ዜሮ":a[e])}return n.join(" ")}(c)),g},e.currency=v,e.ordinal=w},"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/am-Latn-ET.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/am-Latn-ET v5.1.
|
|
1
|
+
/*! n2words/am-Latn-ET v5.1.1 | 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),a=(-1===s?n.length:s)+r;return a>=o.length?i+o+"0".repeat(a-o.length):a<=0?i+"0."+"0".repeat(-a)+o:i+o.slice(0,a)+"."+o.slice(a)}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",a=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(a)}}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 o(e){return 10n**BigInt(3*(e+1))}const a=["","and","hulet","sost","arat","amist","siddist","sebat","siment","zeteny"],u=["asir","asra and","asra hulet","asra sost","asra arat","asra amist","asra siddist","asra sebat","asra siment","asra zeteny"],c=["","","haya","selasa","arba","hamsa","silsa","seba","semanya","zetena"],g="zero",l="asitegna",f=["","shi","miliyon","billiyon"],m=o(f.length-1),h=o(f.length-1),b=o(f.length-1);function d(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(a[r]+" meto"),1===t?i.push(u[n]):(t>1&&i.push(c[t]),n>0&&i.push(a[n])),i.join(" ")}function p(e){return 0n===e?g:e<1000n?d(Number(e)):function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let a=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=f[a]||"";o.push(0===a?d(n):d(n)+" "+e)}a--}return o.join(" ")}(e)}function w(i){const{isNegative:o,integerPart:u,decimalPart:c}=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);s(u,m);let f="";return o&&(f=l+" "),f+=p(u),c&&(f+=" netib "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?g:a[e])}return n.join(" ")}(c)),f}function N(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 s(r,h),1n===(i=r)?"andenya":p(i)+"nya";var i}function v(e){const{isNegative:t,dollars:r,cents:o}=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);s(r,b);let a="";return t&&(a=l+" "),(r>0n||0n===o)&&(a+=p(r),a+=" birr"),o>0n&&(r>0n&&(a+=" "),a+=p(o),a+=" santim"),a}export{m as cardinalMax,b as currencyMax,h as ordinalMax,w as toCardinal,v as toCurrency,N as toOrdinal};
|
package/dist/am-Latn-ET.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/am-Latn-ET v5.1.
|
|
1
|
+
/*! n2words/am-Latn-ET v5.1.1 | 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 s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),a=(-1===s?n.length:s)+r;return a>=o.length?i+o+"0".repeat(a-o.length):a<=0?i+"0."+"0".repeat(-a)+o:i+o.slice(0,a)+"."+o.slice(a)}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 s(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 s=t.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(t),cents:0n};const o=t.slice(0,s)||"0",a=(t.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(a)}}function o(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 a(e){return 10n**BigInt(3*(e+1))}const u=["","and","hulet","sost","arat","amist","siddist","sebat","siment","zeteny"],c=["asir","asra and","asra hulet","asra sost","asra arat","asra amist","asra siddist","asra sebat","asra siment","asra zeteny"],l=["","","haya","selasa","arba","hamsa","silsa","seba","semanya","zetena"],g="zero",f="asitegna",d=["","shi","miliyon","billiyon"],m=a(d.length-1),h=a(d.length-1),b=a(d.length-1);function p(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(u[r]+" meto"),1===t?i.push(c[n]):(t>1&&i.push(l[t]),n>0&&i.push(u[n])),i.join(" ")}function w(e){return 0n===e?g:e<1000n?p(Number(e)):function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let a=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=d[a]||"";o.push(0===a?p(n):p(n)+" "+e)}a--}return o.join(" ")}(e)}const y={amLatnET: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 o(t,h),1n===(i=t)?"andenya":w(i)+"nya";var i}},v={amLatnET: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}:s(t(e))}if("string"==typeof e)return s(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);o(r,b);let a="";return n&&(a=f+" "),(r>0n||0n===i)&&(a+=w(r),a+=" birr"),i>0n&&(r>0n&&(a+=" "),a+=w(i),a+=" santim"),a}};e.amLatnET=function(e){const{isNegative:s,integerPart:a,decimalPart:c}=function(e){const s=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 ${s}`)}(e);o(a,m);let l="";return s&&(l=f+" "),l+=w(a),c&&(l+=" netib "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?g:u[e])}return n.join(" ")}(c)),l},e.currency=v,e.ordinal=y},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/ar-SA.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ar-SA v5.1.
|
|
1
|
+
/*! n2words/ar-SA v5.1.1 | 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))}function u(e,n,t){const r={...n};if(void 0===e)return r;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const i=Object.keys(n);for(const[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${i.join(", ")}`);if(void 0!==s){if(typeof s!=typeof r[o])throw new TypeError(`Option "${o}" must be a ${typeof r[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)}`)}r[o]=s}}return r}const c=["عشرون","ثلاثون","أربعون","خمسون","ستون","سبعون","ثمانون","تسعون"],f=["","مائة","مئتان","ثلاثمائة","أربعمائة","خمسمائة","ستمائة","سبعمائة","ثمانمائة","تسعمائة"],a=["مائة","ألف","مليون","مليار","تريليون","كوادريليون","كوينتليون","سكستيليون"],g=s(a.length-1),l=s(a.length-1),p=s(a.length-1),d=["","ألفاً","مليوناً","ملياراً","تريليوناً","كوادريليوناً","كوينتليوناً","سكستيليوناً"],m=["","آلاف","ملايين","مليارات","تريليونات","كوادريليونات","كوينتليونات","سكستيليونات"],h=["مئتان","ألفان","مليونان","ملياران","تريليونان","كوادريليونان","كوينتليونان","سكستيليونان"],b=["مئتا","ألفا","مليونا","مليارا","تريليونا","كوادريليونا","كوينتليونا","سكستيليونا"],w=["واحد","اثنان","ثلاثة","أربعة","خمسة","ستة","سبعة","ثمانية","تسعة","عشرة","أحد عشر","اثنا عشر","ثلاثة عشر","أربعة عشر","خمسة عشر","ستة عشر","سبعة عشر","ثمانية عشر","تسعة عشر"],v=["واحدة","اثنتان","ثلاث","أربع","خمس","ست","سبع","ثمان","تسع","عشر","إحدى عشرة","اثنتا عشرة","ثلاث عشرة","أربع عشرة","خمس عشرة","ست عشرة","سبع عشرة","ثماني عشرة","تسع عشرة"],y="ناقص",N=["الأول","الثاني","الثالث","الرابع","الخامس","السادس","السابع","الثامن","التاسع","العاشر"],I=["الأولى","الثانية","الثالثة","الرابعة","الخامسة","السادسة","السابعة","الثامنة","التاسعة","العاشرة"],E="ريال",O="ريالان",R="هللة",B="هللتان";function $(e,n,t,r){const i=e%100,o=Math.trunc(e/100);let s="";if(o>0)if(0===i&&2===o)s=h[0];else{const e=f[o];e&&(s=e,0!==i&&(s+=" و"))}if(i>0)if(i<20)if(2===i&&0===o&&n>0){const r=Number(t),i=Math.trunc(Math.log10(r));i%3==0&&t===BigInt(2*Math.pow(10,i))?s+=2===e?h[n]:b[n]:s+=h[n]}else s+=1===i&&n>0?a[n]:r[i-1];else{const e=i%10,n=Math.trunc(i/10)-2;e>0&&(s+=r[e-1]+" و"),s+=c[n]}return s}function j(e,n){if(0n===e)return"صفر";const t="feminine"===n?v:w;let r=e,i=0;const o=[];for(;r>0n;){const n=Number(r%1000n);if(r/=1000n,n>0){const r=$(n,i,e,t);if(r){let e=r;i>0&&n>2&&(e+=1==n%100?" "+a[i]:n>=3&&n<=10?" "+m[i]:" "+(o.length>0?d[i]:a[i])),o.unshift(e)}}i++}if(1===o.length)return o[0];let s=o[0];for(let e=1;e<o.length;e++)s+=" و"+o[e];return s}const P={gender:"masculine",negativeWord:y},x={gender:["masculine","feminine"]};function T(i,s){const{isNegative:c,integerPart:f,decimalPart:a}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(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(f,g,a);const{gender:l,negativeWord:p}=u(s,P,x),d=[];return c&&d.push(p),d.push(j(f,l)),a&&(d.push("فاصلة"),d.push(function(e,n){const t=[];let r=0;for(;r<e.length&&"0"===e[r];)t.push("صفر"),r++;const i=e.slice(r);return i&&t.push(j(BigInt(i),n)),t.join(" ")}(a,l))),d.join(" ")}const M={gender:"masculine"},S={gender:["masculine","feminine"]};function F(n,r){const i=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);o(i,l);const{gender:s}=u(r,M,S);return function(e,n){return e>=1n&&e<=10n?("feminine"===n?I:N)[Number(e)-1]:"ال"+j(e,n)}(i,s)}function k(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,p);let u="";var c;return t&&(u=y+" "),(r>0n||0n===s)&&(u+=1n===r?E+" "+w[0]:2n===r?O:j(r,"masculine")+" "+(1n===(c=r)?E:2n===c?O:c>=3n&&c<=10n?"ريالات":"ريالاً")),s>0n&&(r>0n&&(u+=" و"),u+=1n===s?R+" "+v[0]:2n===s?B:j(s,"feminine")+" "+function(e){return 1n===e?R:2n===e?B:e>=3n&&e<=10n?"هللات":"هللة"}(s)),u}export{P as cardinalDefaults,g as cardinalMax,x as cardinalValues,p as currencyMax,M as ordinalDefaults,l as ordinalMax,S as ordinalValues,T as toCardinal,k as toCurrency,F as toOrdinal};
|
package/dist/ar-SA.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ar-SA v5.1.
|
|
1
|
+
/*! n2words/ar-SA v5.1.1 | 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))}function c(e,n,t){const r={...n};if(void 0===e)return r;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const i=Object.keys(n);for(const[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${i.join(", ")}`);if(void 0!==s){if(typeof s!=typeof r[o])throw new TypeError(`Option "${o}" must be a ${typeof r[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)}`)}r[o]=s}}return r}const f=["عشرون","ثلاثون","أربعون","خمسون","ستون","سبعون","ثمانون","تسعون"],a=["","مائة","مئتان","ثلاثمائة","أربعمائة","خمسمائة","ستمائة","سبعمائة","ثمانمائة","تسعمائة"],g=["مائة","ألف","مليون","مليار","تريليون","كوادريليون","كوينتليون","سكستيليون"],l=u(g.length-1),d=u(g.length-1),p=u(g.length-1),h=["","ألفاً","مليوناً","ملياراً","تريليوناً","كوادريليوناً","كوينتليوناً","سكستيليوناً"],m=["","آلاف","ملايين","مليارات","تريليونات","كوادريليونات","كوينتليونات","سكستيليونات"],b=["مئتان","ألفان","مليونان","ملياران","تريليونان","كوادريليونان","كوينتليونان","سكستيليونان"],w=["مئتا","ألفا","مليونا","مليارا","تريليونا","كوادريليونا","كوينتليونا","سكستيليونا"],v=["واحد","اثنان","ثلاثة","أربعة","خمسة","ستة","سبعة","ثمانية","تسعة","عشرة","أحد عشر","اثنا عشر","ثلاثة عشر","أربعة عشر","خمسة عشر","ستة عشر","سبعة عشر","ثمانية عشر","تسعة عشر"],y=["واحدة","اثنتان","ثلاث","أربع","خمس","ست","سبع","ثمان","تسع","عشر","إحدى عشرة","اثنتا عشرة","ثلاث عشرة","أربع عشرة","خمس عشرة","ست عشرة","سبع عشرة","ثماني عشرة","تسع عشرة"],N="ناقص",I=["الأول","الثاني","الثالث","الرابع","الخامس","السادس","السابع","الثامن","التاسع","العاشر"],E=["الأولى","الثانية","الثالثة","الرابعة","الخامسة","السادسة","السابعة","الثامنة","التاسعة","العاشرة"],O="ريال",R="ريالان",B="هللة",$="هللتان";function j(e,n,t,r){const i=e%100,o=Math.trunc(e/100);let s="";if(o>0)if(0===i&&2===o)s=b[0];else{const e=a[o];e&&(s=e,0!==i&&(s+=" و"))}if(i>0)if(i<20)if(2===i&&0===o&&n>0){const r=Number(t),i=Math.trunc(Math.log10(r));i%3==0&&t===BigInt(2*Math.pow(10,i))?s+=2===e?b[n]:w[n]:s+=b[n]}else s+=1===i&&n>0?g[n]:r[i-1];else{const e=i%10,n=Math.trunc(i/10)-2;e>0&&(s+=r[e-1]+" و"),s+=f[n]}return s}function x(e,n){if(0n===e)return"صفر";const t="feminine"===n?y:v;let r=e,i=0;const o=[];for(;r>0n;){const n=Number(r%1000n);if(r/=1000n,n>0){const r=j(n,i,e,t);if(r){let e=r;i>0&&n>2&&(e+=1==n%100?" "+g[i]:n>=3&&n<=10?" "+m[i]:" "+(o.length>0?h[i]:g[i])),o.unshift(e)}}i++}if(1===o.length)return o[0];let s=o[0];for(let e=1;e<o.length;e++)s+=" و"+o[e];return s}const P={gender:"masculine",negativeWord:N},S={gender:["masculine","feminine"]},T={gender:"masculine"},M={gender:["masculine","feminine"]},A={arSA:function(e,t){const i=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);s(i,d);const{gender:o}=c(t,T,M);return function(e,n){return e>=1n&&e<=10n?("feminine"===n?E:I)[Number(e)-1]:"ال"+x(e,n)}(i,o)}},F={arSA: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,p);let u="";var c;return n&&(u=N+" "),(r>0n||0n===i)&&(u+=1n===r?O+" "+v[0]:2n===r?R:x(r,"masculine")+" "+(1n===(c=r)?O:2n===c?R:c>=3n&&c<=10n?"ريالات":"ريالاً")),i>0n&&(r>0n&&(u+=" و"),u+=1n===i?B+" "+y[0]:2n===i?$:x(i,"feminine")+" "+function(e){return 1n===e?B:2n===e?$:e>=3n&&e<=10n?"هللات":"هللة"}(i)),u}};e.arSA=function(e,o){const{isNegative:u,integerPart:f,decimalPart:a}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(f,l,a);const{gender:g,negativeWord:d}=c(o,P,S),p=[];return u&&p.push(d),p.push(x(f,g)),a&&(p.push("فاصلة"),p.push(function(e,n){const t=[];let r=0;for(;r<e.length&&"0"===e[r];)t.push("صفر"),r++;const i=e.slice(r);return i&&t.push(x(BigInt(i),n)),t.join(" ")}(a,g))),p.join(" ")},e.currency=F,e.ordinal=A},"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/az-AZ.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/az-AZ v5.1.
|
|
1
|
+
/*! n2words/az-AZ v5.1.1 | 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örd","beş","altı","yeddi","səkkiz","doqquz"],c=["on","on bir","on iki","on üç","on dörd","on beş","on altı","on yeddi","on səkkiz","on doqquz"],a=["","","iyirmi","otuz","qırx","əlli","altmış","yetmiş","səksən","doxsan"],l="sıfır",g="mənfi",f=["","min","milyon","milyar","trilyon","katrilyon","kentilyon"],d=s(f.length-1),m=s(f.length-1),b=s(f.length-1),h={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yeddinci",8:"səkkizinci",9:"doqquzuncu",10:"onuncu"};function p(n){if(0===n)return"";const e=n%10,t=Math.trunc(n/10)%10,r=Math.trunc(n/100),i=[];return r>0&&i.push(1===r?"yüz":u[r]+" yüz"),1===t?i.push(c[e]):(t>1&&i.push(a[t]),e>0&&i.push(u[e])),i.join(" ")}function w(n){return 0n===n?l:n<1000n?p(Number(n)):function(n){const e=n.toString(),t=e.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(e.slice(0,i))),o=i);o<t;)r.push(Number(e.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let n=0;n<r.length;n++){const e=r[n];if(0!==e){const n=f[u]||"";s.push(0===u?p(e):1===u&&1===e?n:p(e)+" "+n)}u--}return s.join(" ")}(n)}function N(i){const{isNegative:s,integerPart:u,decimalPart:c}=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(u,d,c);let a="";return s&&(a=g+" "),a+=w(u),c&&(a+=" nöqtə "+function(n){let e="",t=0;for(;t<n.length&&"0"===n[t];)e&&(e+=" "),e+=l,t++;const r=n.slice(t);return r&&(e&&(e+=" "),e+=w(BigInt(r))),e}(c)),a}function y(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,m),function(n){if(n>=1n&&n<=10n)return h[Number(n)];const e=w(n).replace(/ /g,"");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 v(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,b);let u="";return t&&(u=g+" "),(r>0n||0n===s)&&(u+=w(r)+" manat"),s>0n&&(r>0n&&(u+=" "),u+=w(s)+" qəpik"),u}export{d as cardinalMax,b as currencyMax,m as ordinalMax,N as toCardinal,v as toCurrency,y as toOrdinal};
|
package/dist/az-AZ.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/az-AZ v5.1.
|
|
1
|
+
/*! n2words/az-AZ v5.1.1 | 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&&!(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 u(n){return 10n**BigInt(3*(n+1))}const c=["","bir","iki","üç","dörd","beş","altı","yeddi","səkkiz","doqquz"],a=["on","on bir","on iki","on üç","on dörd","on beş","on altı","on yeddi","on səkkiz","on doqquz"],l=["","","iyirmi","otuz","qırx","əlli","altmış","yetmiş","səksən","doxsan"],f="sıfır",g="mənfi",d=["","min","milyon","milyar","trilyon","katrilyon","kentilyon"],m=u(d.length-1),b=u(d.length-1),h=u(d.length-1),p={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yeddinci",8:"səkkizinci",9:"doqquzuncu",10:"onuncu"};function w(n){if(0===n)return"";const e=n%10,t=Math.trunc(n/10)%10,r=Math.trunc(n/100),i=[];return r>0&&i.push(1===r?"yüz":c[r]+" yüz"),1===t?i.push(a[e]):(t>1&&i.push(l[t]),e>0&&i.push(c[e])),i.join(" ")}function y(n){return 0n===n?f:n<1000n?w(Number(n)):function(n){const e=n.toString(),t=e.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(e.slice(0,i))),o=i);o<t;)r.push(Number(e.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let n=0;n<r.length;n++){const e=r[n];if(0!==e){const n=d[u]||"";s.push(0===u?w(e):1===u&&1===e?n:w(e)+" "+n)}u--}return s.join(" ")}(n)}const N={azAZ:function(n){const t=function(n){const t=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const t=n.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const n=e(t);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(n);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);return s(t,b),function(n){if(n>=1n&&n<=10n)return p[Number(n)];const e=y(n).replace(/ /g,"");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)}(t)}},v={azAZ:function(n){const{isNegative:e,dollars:r,cents:i}=function(n){const e=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:o(t(n))}if("string"==typeof n)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);s(r,h);let u="";return e&&(u=g+" "),(r>0n||0n===i)&&(u+=y(r)+" manat"),i>0n&&(r>0n&&(u+=" "),u+=y(i)+" qəpik"),u}};n.azAZ=function(n){const{isNegative:o,integerPart:u,decimalPart:c}=function(n){const o=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(n)?n<0?{isNegative:!0,integerPart:BigInt(-n)}:{isNegative:!1,integerPart:BigInt(n)}:i(t(n))}if("string"==typeof n)return i(function(n){const t=n.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${n}"`);return r(t)?e(t):t}(n));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(n);s(u,m,c);let a="";return o&&(a=g+" "),a+=y(u),c&&(a+=" nöqtə "+function(n){let e="",t=0;for(;t<n.length&&"0"===n[t];)e&&(e+=" "),e+=f,t++;const r=n.slice(t);return r&&(e&&(e+=" "),e+=y(BigInt(r))),e}(c)),a},n.currency=v,n.ordinal=N},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
|
package/dist/bn-BD.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/bn-BD v5.1.
|
|
1
|
+
/*! n2words/bn-BD v5.1.1 | 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=["","হাজার","লাখ","কোটি","আরব","খরব","নীল","পদ্ম","শঙ্খ"],f=s(l.length),m=s(l.length),b=s(l.length);function w(e){if(0===e)return"";if(e<100)return c[e];const n=Math.trunc(e/100),t=e%100;return 0===t?c[n]+" শত":c[n]+" শত "+c[t]}function d(e){if(0n===e)return u;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):c[t]),e>0&&l[e]&&r.push(l[e]))}return r.join(" ")}function h(i){const{isNegative:s,integerPart:g,decimalPart:c}=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(g,f,c);let l="";return s&&(l=a+" "),l+=d(g),c&&(l+=" দশমিক "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=u,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=d(BigInt(r))),n}(c)),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,m),(i=r)>=1n&&i<=6n?g[Number(i)]:d(i)+"তম";var i}function N(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,b);let u="";return t&&(u=a+" "),(r>0n||0n===s)&&(u+=d(r)+" টাকা"),s>0n&&(r>0n&&(u+=" "),u+=d(s)+" পয়সা"),u}export{f as cardinalMax,b as currencyMax,m as ordinalMax,h as toCardinal,N as toCurrency,p as toOrdinal};
|
package/dist/bn-BD.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/bn-BD v5.1.
|
|
1
|
+
/*! n2words/bn-BD v5.1.1 | 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=["","হাজার","লাখ","কোটি","আরব","খরব","নীল","পদ্ম","শঙ্খ"],d=u(l.length),b=u(l.length),m=u(l.length);function h(e){if(0===e)return"";if(e<100)return f[e];const n=Math.trunc(e/100),t=e%100;return 0===t?f[n]+" শত":f[n]+" শত "+f[t]}function p(e){if(0n===e)return a;if(e<1000n)return h(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?h(t):f[t]),e>0&&l[e]&&r.push(l[e]))}return r.join(" ")}const w={bnBD: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,b),(i=t)>=1n&&i<=6n?g[Number(i)]:p(i)+"তম";var i}},N={bnBD: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,m);let u="";return n&&(u=c+" "),(r>0n||0n===i)&&(u+=p(r)+" টাকা"),i>0n&&(r>0n&&(u+=" "),u+=p(i)+" পয়সা"),u}};e.bnBD=function(e){const{isNegative:o,integerPart:u,decimalPart:g}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,d,g);let f="";return o&&(f=c+" "),f+=p(u),g&&(f+=" দশমিক "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=a,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=p(BigInt(r))),n}(g)),f},e.currency=N,e.ordinal=w},"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/cs-CZ.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/cs-CZ v5.1.
|
|
1
|
+
/*! n2words/cs-CZ v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
2
|
function t(t){let[n,e]=t.toLowerCase().split("e");const r=parseInt(e,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 e(r)?t(r):r}function e(t){return t.includes("e")||t.includes("E")}function r(t){const n="-"===t[0];n&&(t=t.slice(1));const e=t.indexOf(".");if(-1===e)return{isNegative:n,integerPart:BigInt(t)};const r=t.slice(0,e)||"0",i=t.slice(e+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}"`);e(r)&&(r=t(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)}}function s(t,n,e){if(null===n)return;if(t<n&&!(e&&BigInt(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 o(t){return 10n**BigInt(3*(t+1))}const u=["","jedna","dva","tři","čtyři","pět","šest","sedm","osm","devět"],c=["deset","jedenáct","dvanáct","třináct","čtrnáct","patnáct","šestnáct","sedmnáct","osmnáct","devatenáct"],a=["","","dvacet","třicet","čtyřicet","padesát","šedesát","sedmdesát","osmdesát","devadesát"],l=["","sto","dvě stě","tři sta","čtyři sta","pět set","šest set","sedm set","osm set","devět set"],f={1:["tisíc","tisíce","tisíc"],2:["milion","miliony","milionů"],3:["miliarda","miliardy","miliard"],4:["bilion","biliony","bilionů"],5:["biliarda","biliardy","biliard"],6:["trilion","triliony","trilionů"],7:["triliarda","triliardy","triliard"],8:["kvadrilion","kvadriliony","kvadrilionů"],9:["kvadriliarda","kvadriliardy","kvadriliard"]},d=Math.max(...Object.keys(f).map(Number)),g=o(d),m=o(d),b=o(d),h="nula",p="mínus",v=["","první","druhý","třetí","čtvrtý","pátý","šestý","sedmý","osmý","devátý"],N=["desátý","jedenáctý","dvanáctý","třináctý","čtrnáctý","patnáctý","šestnáctý","sedmnáctý","osmnáctý","devatenáctý"],w=["","","dvacátý","třicátý","čtyřicátý","padesátý","šedesátý","sedmdesátý","osmdesátý","devadesátý"],y=["","stý","dvoustý","třístý","čtyřstý","pětistý","šestistý","sedmistý","osmistý","devítistý"],I=["tisící","miliontý","miliardtý","biliontý"],E=["koruna","koruny","korun"],B=["haléř","haléře","haléřů"];function R(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(l[r]),1===e?i.push(c[n]):e>=2?(i.push(a[e]),n>0&&i.push(u[n])):n>0&&i.push(u[n]),i.join(" ")}function O(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(l[r]),1===e?i.push(c[n]):e>=2?(i.push(a[e]),n>0&&i.push(u[n])):n>0&&i.push(u[n]),i.join(" ")}function k(t,n){if(1n===t)return n[0];const e=t%10n,r=t%100n;return e>=2n&&e<=4n&&(r<10n||r>20n)?n[1]:n[2]}function P(t){if(0n===t)return h;if(t<1000n)return R(Number(t));if(t<1000000n){const n=t/1000n,e=Number(t%1000n),r=k(n,f[1]);let i;return i=1n===n?r:R(Number(n))+" "+r,e>0&&(i+=" "+O(e)),i}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r="";for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n!==e)if(r&&(r+=" "),0===t)r+=O(Number(e));else{const n=f[t];if(n){const t=k(e,n);r+=1n===e?t:R(Number(e))+" "+t}else r+=R(Number(e))}}return r}(t)}function x(i){const{isNegative:o,integerPart:u,decimalPart:c}=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 e(r)?t(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);s(u,g,c);let a="";if(o&&(a=p+" "),a+=P(u),c){const t=function(t){return 0n===t||1n===t?"celá":t>=2n&&t<=4n?"celé":"celých"}(u);a+=" "+t+" "+function(t){let n="",e=0;for(;e<t.length&&"0"===t[e];)n&&(n+=" "),n+=h,e++;const r=t.slice(e);return r&&(n&&(n+=" "),n+=P(BigInt(r))),n}(c)}return a}function $(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10);return 0===e?v[n]:1===e?N[n]:0===n?w[e]:a[e]+" "+v[n]}function j(t){if(t<100n)return $(Number(t));if(t<1000n){const n=Number(t),e=Math.trunc(n/100),r=n%100;return 0===r?y[e]:l[e]+" "+$(r)}if(t<1000000n){const n=Number(t/1000n),e=Number(t%1000n);if(0===e)return 1===n?I[0]:R(n)+" "+I[0];const r=k(BigInt(n),f[1]),i=1===n?"":R(n)+" ";return(1===n?"tisíc":i+r)+" "+j(BigInt(e))}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r=0;for(let t=0;t<n.length;t++)0n!==n[t]&&(r=t);const i=[];for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n===e)continue;const s=t===r;if(0===t)i.push(s?j(e):O(Number(e)));else if(s)i.push(1n===e?I[t-1]||f[t][0]:R(Number(e))+" "+(I[t-1]||f[t][0]));else{const n=f[t];if(n){const t=k(e,n);i.push(1n===e?t:R(Number(e))+" "+t)}}}return i.join(" ")}(t)}function M(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(e(r)){const n=t(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const e=BigInt(n);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}try{const t=BigInt(r);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}catch(t){if(t instanceof RangeError)throw t;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:t})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return s(r,m),j(r)}function S(t){const{isNegative:e,dollars:r,cents:o}=function(t){const e=typeof t;if("bigint"==typeof t)return t<0n?{isNegative:!0,dollars:-t,cents:0n}:{isNegative:!1,dollars:t,cents:0n};if("number"==typeof t){if(!Number.isFinite(t))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(t)?t<0?{isNegative:!0,dollars:BigInt(-t),cents:0n}:{isNegative:!1,dollars:BigInt(t),cents:0n}:i(n(t))}if("string"==typeof t)return i(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(t);s(r,b);let u="";return e&&(u=p+" "),(r>0n||0n===o)&&(u+=P(r),u+=" "+k(r,E)),o>0n&&(r>0n&&(u+=" "),u+=P(o),u+=" "+k(o,B)),u}export{g as cardinalMax,b as currencyMax,m as ordinalMax,x as toCardinal,S as toCurrency,M as toOrdinal};
|
package/dist/cs-CZ.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/cs-CZ v5.1.
|
|
1
|
+
/*! n2words/cs-CZ v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
2
|
var t,n;t=this,n=function(t){"use strict";function n(t){let[n,e]=t.toLowerCase().split("e");const r=parseInt(e,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 e(t){const e=t.toString();return r(e)?n(e):e}function r(t){return t.includes("e")||t.includes("E")}function i(t){const n="-"===t[0];n&&(t=t.slice(1));const e=t.indexOf(".");if(-1===e)return{isNegative:n,integerPart:BigInt(t)};const r=t.slice(0,e)||"0",i=t.slice(e+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function s(t){let e=t.trim();if(0===e.length||Number.isNaN(Number(e)))throw new RangeError(`Invalid currency format: "${t}"`);r(e)&&(e=n(e));const i="-"===e[0];i&&(e=e.slice(1));const s=e.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(e),cents:0n};const o=e.slice(0,s)||"0",u=(e.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}function o(t,n,e){if(null===n)return;if(t<n&&!(e&&BigInt(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(t){return 10n**BigInt(3*(t+1))}const c=["","jedna","dva","tři","čtyři","pět","šest","sedm","osm","devět"],a=["deset","jedenáct","dvanáct","třináct","čtrnáct","patnáct","šestnáct","sedmnáct","osmnáct","devatenáct"],l=["","","dvacet","třicet","čtyřicet","padesát","šedesát","sedmdesát","osmdesát","devadesát"],f=["","sto","dvě stě","tři sta","čtyři sta","pět set","šest set","sedm set","osm set","devět set"],d={1:["tisíc","tisíce","tisíc"],2:["milion","miliony","milionů"],3:["miliarda","miliardy","miliard"],4:["bilion","biliony","bilionů"],5:["biliarda","biliardy","biliard"],6:["trilion","triliony","trilionů"],7:["triliarda","triliardy","triliard"],8:["kvadrilion","kvadriliony","kvadrilionů"],9:["kvadriliarda","kvadriliardy","kvadriliard"]},g=Math.max(...Object.keys(d).map(Number)),m=u(g),b=u(g),h=u(g),p="nula",v="mínus",N=["","první","druhý","třetí","čtvrtý","pátý","šestý","sedmý","osmý","devátý"],w=["desátý","jedenáctý","dvanáctý","třináctý","čtrnáctý","patnáctý","šestnáctý","sedmnáctý","osmnáctý","devatenáctý"],y=["","","dvacátý","třicátý","čtyřicátý","padesátý","šedesátý","sedmdesátý","osmdesátý","devadesátý"],I=["","stý","dvoustý","třístý","čtyřstý","pětistý","šestistý","sedmistý","osmistý","devítistý"],E=["tisící","miliontý","miliardtý","biliontý"],B=["koruna","koruny","korun"],R=["haléř","haléře","haléřů"];function O(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(f[r]),1===e?i.push(a[n]):e>=2?(i.push(l[e]),n>0&&i.push(c[n])):n>0&&i.push(c[n]),i.join(" ")}function k(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(f[r]),1===e?i.push(a[n]):e>=2?(i.push(l[e]),n>0&&i.push(c[n])):n>0&&i.push(c[n]),i.join(" ")}function x(t,n){if(1n===t)return n[0];const e=t%10n,r=t%100n;return e>=2n&&e<=4n&&(r<10n||r>20n)?n[1]:n[2]}function P(t){if(0n===t)return p;if(t<1000n)return O(Number(t));if(t<1000000n){const n=t/1000n,e=Number(t%1000n),r=x(n,d[1]);let i;return i=1n===n?r:O(Number(n))+" "+r,e>0&&(i+=" "+k(e)),i}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r="";for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n!==e)if(r&&(r+=" "),0===t)r+=k(Number(e));else{const n=d[t];if(n){const t=x(e,n);r+=1n===e?t:O(Number(e))+" "+t}else r+=O(Number(e))}}return r}(t)}function j(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10);return 0===e?N[n]:1===e?w[n]:0===n?y[e]:l[e]+" "+N[n]}function $(t){if(t<100n)return j(Number(t));if(t<1000n){const n=Number(t),e=Math.trunc(n/100),r=n%100;return 0===r?I[e]:f[e]+" "+j(r)}if(t<1000000n){const n=Number(t/1000n),e=Number(t%1000n);if(0===e)return 1===n?E[0]:O(n)+" "+E[0];const r=x(BigInt(n),d[1]),i=1===n?"":O(n)+" ";return(1===n?"tisíc":i+r)+" "+$(BigInt(e))}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r=0;for(let t=0;t<n.length;t++)0n!==n[t]&&(r=t);const i=[];for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n===e)continue;const s=t===r;if(0===t)i.push(s?$(e):k(Number(e)));else if(s)i.push(1n===e?E[t-1]||d[t][0]:O(Number(e))+" "+(E[t-1]||d[t][0]));else{const n=d[t];if(n){const t=x(e,n);i.push(1n===e?t:O(Number(e))+" "+t)}}}return i.join(" ")}(t)}const M={csCZ:function(t){const e=function(t){const e=typeof t;if("bigint"==typeof t){if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}if("number"==typeof t){if(!Number.isFinite(t))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(t))throw new RangeError("Ordinals must be whole numbers");if(t<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(t)}if("string"==typeof t)return function(t){const e=t.trim();if(0===e.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===e[0])throw new RangeError("Ordinals cannot be negative");if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(e)){const t=n(e);if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(t);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const t=BigInt(e);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${t}"`,{cause:n})}}(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(t);return o(e,b),$(e)}},C={csCZ:function(t){const{isNegative:n,dollars:r,cents:i}=function(t){const n=typeof t;if("bigint"==typeof t)return t<0n?{isNegative:!0,dollars:-t,cents:0n}:{isNegative:!1,dollars:t,cents:0n};if("number"==typeof t){if(!Number.isFinite(t))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(t)?t<0?{isNegative:!0,dollars:BigInt(-t),cents:0n}:{isNegative:!1,dollars:BigInt(t),cents:0n}:s(e(t))}if("string"==typeof t)return s(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(t);o(r,h);let u="";return n&&(u=v+" "),(r>0n||0n===i)&&(u+=P(r),u+=" "+x(r,B)),i>0n&&(r>0n&&(u+=" "),u+=P(i),u+=" "+x(i,R)),u}};t.csCZ=function(t){const{isNegative:s,integerPart:u,decimalPart:c}=function(t){const s=typeof t;if("bigint"==typeof t)return t<0n?{isNegative:!0,integerPart:-t}:{isNegative:!1,integerPart:t};if("number"==typeof t){if(!Number.isFinite(t))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(t)?t<0?{isNegative:!0,integerPart:BigInt(-t)}:{isNegative:!1,integerPart:BigInt(t)}:i(e(t))}if("string"==typeof t)return i(function(t){const e=t.trim();if(0===e.length||Number.isNaN(Number(e)))throw new RangeError(`Invalid number format: "${t}"`);return r(e)?n(e):e}(t));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(t);o(u,m,c);let a="";if(s&&(a=v+" "),a+=P(u),c){const t=function(t){return 0n===t||1n===t?"celá":t>=2n&&t<=4n?"celé":"celých"}(u);a+=" "+t+" "+function(t){let n="",e=0;for(;e<t.length&&"0"===t[e];)n&&(n+=" "),n+=p,e++;const r=t.slice(e);return r&&(n&&(n+=" "),n+=P(BigInt(r))),n}(c)}return a},t.currency=C,t.ordinal=M},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).n2words=t.n2words||{});
|
package/dist/da-DK.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/da-DK v5.1.
|
|
1
|
+
/*! n2words/da-DK v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
2
|
function e(e){let[t,n]=e.toLowerCase().split("e");const r=parseInt(n,10);let i="";"-"===t[0]&&(i="-",t=t.slice(1));const o=t.indexOf("."),s=-1===o?t:t.slice(0,o)+t.slice(o+1),u=(-1===o?t.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(t){const r=t.toString();return n(r)?e(r):r}function n(e){return e.includes("e")||e.includes("E")}function r(e){const t="-"===e[0];t&&(e=e.slice(1));const n=e.indexOf(".");if(-1===n)return{isNegative:t,integerPart:BigInt(e)};const r=e.slice(0,n)||"0",i=e.slice(n+1);return{isNegative:t,integerPart:BigInt(r),decimalPart:i}}function i(t){let r=t.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${t}"`);n(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,t,n){if(null===t)return;if(e<t&&!(n&&BigInt(n)>=t))return;const r=t.toString().length-1,i=t===10n**BigInt(r)?`10^${r} - 1`:""+(t-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3*(e+1))}const u=["","et","to","tre","fire","fem","seks","syv","otte","ni"],l=["","en","to","tre","fire","fem","seks","syv","otte","ni"],a=["ti","elleve","tolv","tretten","fjorten","femten","seksten","sytten","atten","nitten"],g=["","","tyve","tredive","fyrre","halvtreds","treds","halvfjerds","firs","halvfems"],f="tusind",c="nul",d="minus",m=["millioner","millarder","billioner","billarder","trillioner","trillarder","quadrillioner","quadrillarder"],h=s(m.length+1),b=s(m.length+1),p=s(m.length+1),w={1:"første",2:"anden",3:"tredje",4:"fjerde",5:"femte",6:"sjette",7:"syvende",8:"ottende",9:"niende",10:"tiende",11:"ellevte",12:"tolvte"};function v(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];r>0&&i.push(u[r]+"hundrede");const o=e%100;return 0===o||i.push(o<10?u[t]:o<20?a[t]:0===t?g[n]:l[t]+"og"+g[n]),2===i.length?i[0]+" og "+i[1]:i[0]||""}function N(e){if(0n===e)return c;if(e<1000n)return v(Number(e));if(e<1000000n){const t=Number(e/1000n),n=Number(e%1000n);let r=v(t)+f;return n>0&&(r+="e og "+v(n)),r}return function(e){const t=e.toString(),n=t.length,r=[],i=n%3;let o=0;for(i>0&&(r.push(Number(t.slice(0,i))),o=i);o<n;)r.push(Number(t.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let e=0;e<r.length;e++){const t=r[e];if(0!==t){const e=v(t);if(0===u)s.push({word:e,type:"units"});else if(1===u)s.push({word:e+f,type:"thousand"});else{let n=e;1===t&&(n="en"),s.push({word:n+" "+m[u-2],type:"million"})}}u--}return function(e){if(0===e.length)return c;const t=[];for(let n=0;n<e.length;n++){const r=e[n],i=e[n+1];"thousand"===r.type&&i&&"units"===i.type?(t.push(r.word+"e og "+i.word),n++):t.push(r.word)}return t.join(" ")}(s)}(e)}function y(i){const{isNegative:s,integerPart:u,decimalPart:l}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(t(i))}if("string"==typeof i)return r(function(t){const r=t.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${t}"`);return n(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,h,l);let a="";return s&&(a=d+" "),a+=N(u),l&&(a+=" komma "+function(e){let t="",n=0;for(;n<e.length&&"0"===e[n];)t&&(t+=" "),t+=c,n++;const r=e.slice(n);return r&&(t&&(t+=" "),t+=N(BigInt(r))),t}(l)),a}function I(t){const r=function(t){const r=typeof t;if("bigint"==typeof t){if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}if("number"==typeof t){if(!Number.isFinite(t))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(t))throw new RangeError("Ordinals must be whole numbers");if(t<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(t)}if("string"==typeof t)return function(t){const r=t.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(n(r)){const t=e(r);if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${t}"`,{cause:e})}}(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(t);return o(r,b),(i=r)>=1n&&i<=12n?w[Number(i)]:N(i)+"de";var i}function E(e){const{isNegative:n,dollars:r,cents:s}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(t(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);o(r,p);let u="";return n&&(u=d+" "),(r>0n||0n===s)&&(u+=1n===r?"en krone":N(r)+" kroner"),s>0n&&(r>0n&&(u+=" og "),u+=N(s)+" øre"),u}export{h as cardinalMax,p as currencyMax,b as ordinalMax,y as toCardinal,E as toCurrency,I as toOrdinal};
|
package/dist/da-DK.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/da-DK v5.1.
|
|
1
|
+
/*! n2words/da-DK v5.1.1 | 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 l=["","et","to","tre","fire","fem","seks","syv","otte","ni"],a=["","en","to","tre","fire","fem","seks","syv","otte","ni"],f=["ti","elleve","tolv","tretten","fjorten","femten","seksten","sytten","atten","nitten"],c=["","","tyve","tredive","fyrre","halvtreds","treds","halvfjerds","firs","halvfems"],g="tusind",d="nul",h="minus",m=["millioner","millarder","billioner","billarder","trillioner","trillarder","quadrillioner","quadrillarder"],p=u(m.length+1),b=u(m.length+1),w=u(m.length+1),v={1:"første",2:"anden",3:"tredje",4:"fjerde",5:"femte",6:"sjette",7:"syvende",8:"ottende",9:"niende",10:"tiende",11:"ellevte",12:"tolvte"};function y(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];r>0&&i.push(l[r]+"hundrede");const o=e%100;return 0===o||i.push(o<10?l[n]:o<20?f[n]:0===n?c[t]:a[n]+"og"+c[t]),2===i.length?i[0]+" og "+i[1]:i[0]||""}function N(e){if(0n===e)return d;if(e<1000n)return y(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);let r=y(n)+g;return t>0&&(r+="e og "+y(t)),r}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=y(n);if(0===u)s.push({word:e,type:"units"});else if(1===u)s.push({word:e+g,type:"thousand"});else{let t=e;1===n&&(t="en"),s.push({word:t+" "+m[u-2],type:"million"})}}u--}return function(e){if(0===e.length)return d;const n=[];for(let t=0;t<e.length;t++){const r=e[t],i=e[t+1];"thousand"===r.type&&i&&"units"===i.type?(n.push(r.word+"e og "+i.word),t++):n.push(r.word)}return n.join(" ")}(s)}(e)}const I={daDK: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,b),(i=t)>=1n&&i<=12n?v[Number(i)]:N(i)+"de";var i}};e.currency={daDK: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,w);let u="";return n&&(u=h+" "),(r>0n||0n===i)&&(u+=1n===r?"en krone":N(r)+" kroner"),i>0n&&(r>0n&&(u+=" og "),u+=N(i)+" øre"),u}},e.daDK=function(e){const{isNegative:o,integerPart:u,decimalPart:l}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,p,l);let a="";return o&&(a=h+" "),a+=N(u),l&&(a+=" komma "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=d,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=N(BigInt(r))),n}(l)),a},e.ordinal=I},"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/de-DE.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/de-DE v5.1.
|
|
1
|
+
/*! n2words/de-DE v5.1.1 | 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),l=(-1===s?n.length:s)+r;return l>=o.length?i+o+"0".repeat(l-o.length):l<=0?i+"0."+"0".repeat(-l)+o:i+o.slice(0,l)+"."+o.slice(l)}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",l=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(l)}}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 o(e){return 10n**BigInt(3*(e+1))}const l=["","eins","zwei","drei","vier","fünf","sechs","sieben","acht","neun"],u="ein",c=["zehn","elf","zwölf","dreizehn","vierzehn","fünfzehn","sechzehn","siebzehn","achtzehn","neunzehn"],a=["","","zwanzig","dreißig","vierzig","fünfzig","sechzig","siebzig","achtzig","neunzig"],f=["tausend","Million","Milliarde","Billion","Billiarde","Trillion","Trilliarde","Quadrillion","Quadrilliarde"],g=["tausend","Millionen","Milliarden","Billionen","Billiarden","Trillionen","Trilliarden","Quadrillionen","Quadrilliarden"],h=o(f.length),d=o(f.length),w=o(f.length),b="hundert",p="null",m="minus",v=["","erste","zweite","dritte","vierte","fünfte","sechste","siebte","achte","neunte"],N=["zehnte","elfte","zwölfte","dreizehnte","vierzehnte","fünfzehnte","sechzehnte","siebzehnte","achtzehnte","neunzehnte"],z=["","","zwanzigste","dreißigste","vierzigste","fünfzigste","sechzigste","siebzigste","achtzigste","neunzigste"],y="ste";function I(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?u:l[r])+b),1===t?i+=c[n]:t>=2&&n>0?i+=(1===n?u:l[n])+"und"+a[t]:t>=2?i+=a[t]:n>0&&(i+=l[n]),i}function E(e){if(0===e)return"";if(1===e)return u;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?u:l[r])+b),1===t?i+=c[n]:t>=2&&n>0?i+=(1===n?u:l[n])+"und"+a[t]:t>=2?i+=a[t]:(n>0&&r>0||n>0)&&(i+=l[n]),i}function O(e){if(0n===e)return p;if(e<1000n)return I(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);let r=E(n)+f[0];return t>0&&(r+=I(t)),r}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let l=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n)if(0===l)o.push({words:I(n),isScale:!1,scaleLevel:0});else if(1===l){const e=E(n);o.push({words:e+f[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":I(n);const t=1===n?f[l-1]:g[l-1];o.push({words:e,isScale:!1,scaleLevel:l}),o.push({words:t,isScale:!0,scaleLevel:l})}l--}return B(o)}(e)}function B(e){if(0===e.length)return p;let n="";for(let t=0;t<e.length;t++){const r=e[t],i=t>0?e[t-1]:null;t>0&&(r.isScale||i&&i.isScale)&&(n+=" "),n+=r.words}return n}function S(i){const{isNegative:o,integerPart:l,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);s(l,h,u);let c="";return o&&(c=m+" "),c+=O(l),u&&(c+=" komma "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=p,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=O(BigInt(r))),n}(u)),c}function R(e,n){if(0===e)return"";const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let s="";return i>0&&(s+=(1===i?u:l[i])+b),1===r?s+=N[t]:r>=2&&t>0?s+=(1===t?u:l[t])+"und"+z[r]:r>=2?s+=z[r]:t>0&&(s+=v[t]),i>0&&0===r&&0===t&&(s+=y),s}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 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 s(r,d),function(e){if(e<1000n)return R(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?E(n)+f[0]+y:E(n)+f[0]+R(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;let o=0;for(let e=r.length-1;e>=0;e--)if(0!==r[e]){o=e;break}const l=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e],t=e===o;if(0!==n)if(0===u)l.push({words:R(n),isScale:!1,scaleLevel:0});else if(1===u){const e=E(n);l.push(t?{words:e+f[0]+y,isScale:!1,scaleLevel:1}:{words:e+f[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":I(n);const r=1===n?f[u-1]:g[u-1];l.push({words:e,isScale:!1,scaleLevel:u}),l.push(t?{words:r+y,isScale:!0,scaleLevel:u}:{words:r,isScale:!0,scaleLevel:u})}u--}return B(l)}(e)}(r)}const L={and:!0};function M(e,t){const{isNegative:r,dollars:o,cents:l}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);s(o,w);const{and:c}=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,s]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof s}`);t[i]=s}}return t}(t,L);let a="";return r&&(a=m+" "),(o>0n||0n===l)&&(a+=1n===o?u:O(o),a+=" Euro"),l>0n&&(o>0n&&(a+=c?" und ":" "),a+=1n===l?u:O(l),a+=" Cent"),a}export{h as cardinalMax,L as currencyDefaults,w as currencyMax,d as ordinalMax,S as toCardinal,M as toCurrency,$ as toOrdinal};
|
package/dist/de-DE.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/de-DE v5.1.
|
|
1
|
+
/*! n2words/de-DE v5.1.1 | 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 s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),l=(-1===s?n.length:s)+r;return l>=o.length?i+o+"0".repeat(l-o.length):l<=0?i+"0."+"0".repeat(-l)+o:i+o.slice(0,l)+"."+o.slice(l)}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 s(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 s=t.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(t),cents:0n};const o=t.slice(0,s)||"0",l=(t.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(l)}}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 l(e){return 10n**BigInt(3*(e+1))}const u=["","eins","zwei","drei","vier","fünf","sechs","sieben","acht","neun"],c="ein",a=["zehn","elf","zwölf","dreizehn","vierzehn","fünfzehn","sechzehn","siebzehn","achtzehn","neunzehn"],f=["","","zwanzig","dreißig","vierzig","fünfzig","sechzig","siebzig","achtzig","neunzig"],g=["tausend","Million","Milliarde","Billion","Billiarde","Trillion","Trilliarde","Quadrillion","Quadrilliarde"],d=["tausend","Millionen","Milliarden","Billionen","Billiarden","Trillionen","Trilliarden","Quadrillionen","Quadrilliarden"],h=l(g.length),p=l(g.length),b=l(g.length),w="hundert",m="null",v="minus",N=["","erste","zweite","dritte","vierte","fünfte","sechste","siebte","achte","neunte"],y=["zehnte","elfte","zwölfte","dreizehnte","vierzehnte","fünfzehnte","sechzehnte","siebzehnte","achtzehnte","neunzehnte"],z=["","","zwanzigste","dreißigste","vierzigste","fünfzigste","sechzigste","siebzigste","achtzigste","neunzigste"],E="ste";function I(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?c:u[r])+w),1===t?i+=a[n]:t>=2&&n>0?i+=(1===n?c:u[n])+"und"+f[t]:t>=2?i+=f[t]:n>0&&(i+=u[n]),i}function O(e){if(0===e)return"";if(1===e)return c;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?c:u[r])+w),1===t?i+=a[n]:t>=2&&n>0?i+=(1===n?c:u[n])+"und"+f[t]:t>=2?i+=f[t]:(n>0&&r>0||n>0)&&(i+=u[n]),i}function B(e){if(0n===e)return m;if(e<1000n)return I(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);let r=O(n)+g[0];return t>0&&(r+=I(t)),r}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let l=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n)if(0===l)o.push({words:I(n),isScale:!1,scaleLevel:0});else if(1===l){const e=O(n);o.push({words:e+g[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":I(n);const t=1===n?g[l-1]:d[l-1];o.push({words:e,isScale:!1,scaleLevel:l}),o.push({words:t,isScale:!0,scaleLevel:l})}l--}return S(o)}(e)}function S(e){if(0===e.length)return m;let n="";for(let t=0;t<e.length;t++){const r=e[t],i=t>0?e[t-1]:null;t>0&&(r.isScale||i&&i.isScale)&&(n+=" "),n+=r.words}return n}function R(e,n){if(0===e)return"";const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let s="";return i>0&&(s+=(1===i?c:u[i])+w),1===r?s+=y[t]:r>=2&&t>0?s+=(1===t?c:u[t])+"und"+z[r]:r>=2?s+=z[r]:t>0&&(s+=N[t]),i>0&&0===r&&0===t&&(s+=E),s}const $={and:!0},T={deDE: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 o(t,p),function(e){if(e<1000n)return R(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?O(n)+g[0]+E:O(n)+g[0]+R(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;let o=0;for(let e=r.length-1;e>=0;e--)if(0!==r[e]){o=e;break}const l=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e],t=e===o;if(0!==n)if(0===u)l.push({words:R(n),isScale:!1,scaleLevel:0});else if(1===u){const e=O(n);l.push(t?{words:e+g[0]+E,isScale:!1,scaleLevel:1}:{words:e+g[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":I(n);const r=1===n?g[u-1]:d[u-1];l.push({words:e,isScale:!1,scaleLevel:u}),l.push(t?{words:r+E,isScale:!0,scaleLevel:u}:{words:r,isScale:!0,scaleLevel:u})}u--}return S(l)}(e)}(t)}};e.currency={deDE:function(e,n){const{isNegative:r,dollars:i,cents:l}=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}:s(t(e))}if("string"==typeof e)return s(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);o(i,b);const{and:u}=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,s]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof s}`);t[i]=s}}return t}(n,$);let a="";return r&&(a=v+" "),(i>0n||0n===l)&&(a+=1n===i?c:B(i),a+=" Euro"),l>0n&&(i>0n&&(a+=u?" und ":" "),a+=1n===l?c:B(l),a+=" Cent"),a}},e.deDE=function(e){const{isNegative:s,integerPart:l,decimalPart:u}=function(e){const s=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 ${s}`)}(e);o(l,h,u);let c="";return s&&(c=v+" "),c+=B(l),u&&(c+=" komma "+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+=B(BigInt(r))),n}(u)),c},e.ordinal=T},"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/el-GR.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/el-GR v5.1.
|
|
1
|
+
/*! n2words/el-GR v5.1.1 | 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(3*(n+1))}const u=["","ένα","δύο","τρία","τέσσερα","πέντε","έξι","επτά","οκτώ","εννέα"],c=["δέκα","έντεκα","δώδεκα","δεκατρία","δεκατέσσερα","δεκαπέντε","δεκαέξι","δεκαεπτά","δεκαοκτώ","δεκαεννέα"],f=["","","είκοσι","τριάντα","σαράντα","πενήντα","εξήντα","εβδομήντα","ογδόντα","ενενήντα"],a=["","εκατό","διακόσια","τριακόσια","τετρακόσια","πεντακόσια","εξακόσια","επτακόσια","οκτακόσια","εννιακόσια"],g="χίλια",l="μηδέν",m="μείον",b=["εκατομμύριο","δισεκατομμύριο","τρισεκατομμύριο"],h=s(b.length+1),p=10n**BigInt(9),w=s(b.length+1),N=["","πρώτος","δεύτερος","τρίτος","τέταρτος","πέμπτος","έκτος","έβδομος","όγδοος","ένατος"],d=["δέκατος","ενδέκατος","δωδέκατος","δέκατος τρίτος","δέκατος τέταρτος","δέκατος πέμπτος","δέκατος έκτος","δέκατος έβδομος","δέκατος όγδοος","δέκατος ένατος"],v=["","","εικοστός","τριακοστός","τεσσαρακοστός","πεντηκοστός","εξηκοστός","εβδομηκοστός","ογδοηκοστός","ενενηκοστός"],I=["","εκατοστός","διακοσιοστός","τριακοσιοστός","τετρακοσιοστός","πεντακοσιοστός","εξακοσιοστός","επτακοσιοστός","οκτακοσιοστός","εννιακοσιοστός"],y="χιλιοστός",E="εκατομμυριοστός",R=["ευρώ","ευρώ"],B=["λεπτό","λεπτά"];function O(n){if(0===n)return"";const e=n%10,t=Math.trunc(n/10)%10,r=Math.trunc(n/100),i=[];r>0&&i.push(a[r]);const o=n%100;return 0===o||i.push(o<10?u[e]:o<20?c[e]:0===e?f[t]:f[t]+" "+u[e]),i.join(" ")}function P(n){if(0n===n)return l;if(n<1000n)return O(Number(n));if(n<1000000n){const e=Number(n/1000n),t=Number(n%1000n);let r;return r=1===e?g:O(e)+" "+g,t>0&&(r+=" "+O(t)),r}return function(n){const e=n.toString(),t=e.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(e.slice(0,i))),o=i);o<t;)r.push(Number(e.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let n=0;n<r.length;n++){const e=r[n];if(0!==e){const n=O(e);if(0===u)s.push(n);else if(1===u)s.push(1===e?g:n+" "+g);else{const t=b[u-2];s.push(1===e?t:n+" "+t)}}u--}return s.join(" ")}(n)}function $(i){const{isNegative:s,integerPart:c,decimalPart:f}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(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,h);let a="";return s&&(a=m+" "),a+=P(c),f&&(a+=" κόμμα "+function(n){const e=[];for(const t of n){const n=parseInt(t,10);e.push(0===n?l:u[n])}return e.join(" ")}(f)),a}function x(n){if(0===n)return"";if(n<10)return N[n];if(n<20)return d[n-10];const e=n%10,t=Math.trunc(n/10);return 0===e?v[t]:v[t]+" "+N[e]}function S(n){if(0n===n)return"";if(1n===n)return N[1];if(n<100n)return x(Number(n));if(n<1000n){const e=Number(n/100n),t=Number(n%100n);return 0===t?I[e]:a[e]+" "+x(t)}if(n<1000000n){const e=Number(n/1000n),t=Number(n%1000n);if(0===t)return 1===e?y:O(e)+" "+y;let r;if(r=1===e?g:O(e)+" "+g,t<100)return r+" "+x(t);const i=Math.trunc(t/100),o=t%100;return 0===o?r+" "+I[i]:r+" "+a[i]+" "+x(o)}const e=Number(n/1000000n),t=n%1000000n;if(0n===t)return 1===e?E:O(e)+" "+E;let r;return r=1===e?b[0]:O(e)+" "+b[0],r+" "+S(t)}function j(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),S(r)}function M(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,w);const u=[];if(t&&u.push(m),r>0n||0n===s){const n=P(r);u.push(n+" "+(1n===r?R[0]:R[1]))}if(s>0n){const n=P(s);u.push(n+" "+(1n===s?B[0]:B[1]))}return u.join(" ")}export{h as cardinalMax,w as currencyMax,p as ordinalMax,$ as toCardinal,M as toCurrency,j as toOrdinal};
|
package/dist/el-GR.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/el-GR v5.1.
|
|
1
|
+
/*! n2words/el-GR v5.1.1 | 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(3*(n+1))}const c=["","ένα","δύο","τρία","τέσσερα","πέντε","έξι","επτά","οκτώ","εννέα"],f=["δέκα","έντεκα","δώδεκα","δεκατρία","δεκατέσσερα","δεκαπέντε","δεκαέξι","δεκαεπτά","δεκαοκτώ","δεκαεννέα"],a=["","","είκοσι","τριάντα","σαράντα","πενήντα","εξήντα","εβδομήντα","ογδόντα","ενενήντα"],l=["","εκατό","διακόσια","τριακόσια","τετρακόσια","πεντακόσια","εξακόσια","επτακόσια","οκτακόσια","εννιακόσια"],g="χίλια",b="μηδέν",m="μείον",h=["εκατομμύριο","δισεκατομμύριο","τρισεκατομμύριο"],d=u(h.length+1),p=10n**BigInt(9),w=u(h.length+1),N=["","πρώτος","δεύτερος","τρίτος","τέταρτος","πέμπτος","έκτος","έβδομος","όγδοος","ένατος"],v=["δέκατος","ενδέκατος","δωδέκατος","δέκατος τρίτος","δέκατος τέταρτος","δέκατος πέμπτος","δέκατος έκτος","δέκατος έβδομος","δέκατος όγδοος","δέκατος ένατος"],y=["","","εικοστός","τριακοστός","τεσσαρακοστός","πεντηκοστός","εξηκοστός","εβδομηκοστός","ογδοηκοστός","ενενηκοστός"],I=["","εκατοστός","διακοσιοστός","τριακοσιοστός","τετρακοσιοστός","πεντακοσιοστός","εξακοσιοστός","επτακοσιοστός","οκτακοσιοστός","εννιακοσιοστός"],E="χιλιοστός",R="εκατομμυριοστός",B=["ευρώ","ευρώ"],O=["λεπτό","λεπτά"];function x(n){if(0===n)return"";const e=n%10,t=Math.trunc(n/10)%10,r=Math.trunc(n/100),i=[];r>0&&i.push(l[r]);const o=n%100;return 0===o||i.push(o<10?c[e]:o<20?f[e]:0===e?a[t]:a[t]+" "+c[e]),i.join(" ")}function P(n){if(0n===n)return b;if(n<1000n)return x(Number(n));if(n<1000000n){const e=Number(n/1000n),t=Number(n%1000n);let r;return r=1===e?g:x(e)+" "+g,t>0&&(r+=" "+x(t)),r}return function(n){const e=n.toString(),t=e.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(e.slice(0,i))),o=i);o<t;)r.push(Number(e.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let n=0;n<r.length;n++){const e=r[n];if(0!==e){const n=x(e);if(0===u)s.push(n);else if(1===u)s.push(1===e?g:n+" "+g);else{const t=h[u-2];s.push(1===e?t:n+" "+t)}}u--}return s.join(" ")}(n)}function $(n){if(0===n)return"";if(n<10)return N[n];if(n<20)return v[n-10];const e=n%10,t=Math.trunc(n/10);return 0===e?y[t]:y[t]+" "+N[e]}function j(n){if(0n===n)return"";if(1n===n)return N[1];if(n<100n)return $(Number(n));if(n<1000n){const e=Number(n/100n),t=Number(n%100n);return 0===t?I[e]:l[e]+" "+$(t)}if(n<1000000n){const e=Number(n/1000n),t=Number(n%1000n);if(0===t)return 1===e?E:x(e)+" "+E;let r;if(r=1===e?g:x(e)+" "+g,t<100)return r+" "+$(t);const i=Math.trunc(t/100),o=t%100;return 0===o?r+" "+I[i]:r+" "+l[i]+" "+$(o)}const e=Number(n/1000000n),t=n%1000000n;if(0n===t)return 1===e?R:x(e)+" "+R;let r;return r=1===e?h[0]:x(e)+" "+h[0],r+" "+j(t)}const S={elGR:function(n){const t=function(n){const t=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const t=n.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const n=e(t);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(n);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);return s(t,p),j(t)}};n.currency={elGR:function(n){const{isNegative:e,dollars:r,cents:i}=function(n){const e=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:o(t(n))}if("string"==typeof n)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);s(r,w);const u=[];if(e&&u.push(m),r>0n||0n===i){const n=P(r);u.push(n+" "+(1n===r?B[0]:B[1]))}if(i>0n){const n=P(i);u.push(n+" "+(1n===i?O[0]:O[1]))}return u.join(" ")}},n.elGR=function(n){const{isNegative:o,integerPart:u,decimalPart:f}=function(n){const o=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(n)?n<0?{isNegative:!0,integerPart:BigInt(-n)}:{isNegative:!1,integerPart:BigInt(n)}:i(t(n))}if("string"==typeof n)return i(function(n){const t=n.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${n}"`);return r(t)?e(t):t}(n));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(n);s(u,d);let a="";return o&&(a=m+" "),a+=P(u),f&&(a+=" κόμμα "+function(n){const e=[];for(const t of n){const n=parseInt(t,10);e.push(0===n?b:c[n])}return e.join(" ")}(f)),a},n.ordinal=S},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
|
package/dist/en-AU.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/en-AU v5.1.
|
|
1
|
+
/*! n2words/en-AU v5.1.1 | 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=["","one","two","three","four","five","six","seven","eight","nine"],l=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],f=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],a=s(f.length),g=s(f.length),d=s(f.length),h="hundred",w="zero",b="minus",p=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],m=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],y={word:"",hasHundred:!1};function N(e){if(0===e)return y.word="",y.hasHundred=!1,y;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=l[n]:t>=2?i=n>0?c[t]+"-"+u[n]:c[t]:n>0&&(i=u[n]),r>0?(y.word=i?u[r]+" "+h+" and "+i:u[r]+" "+h,y.hasHundred=!0):(y.word=i,y.hasHundred=!1),y}function I(e){if(0n===e)return w;if(e<1000n)return N(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=N(n);let i=r+" "+f[0];if(t>0){const{word:e,hasHundred:n}=N(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=N(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+f[e-1],o=!0):o=!1}return i}(e)}function E(i){const{isNegative:s,integerPart:u,decimalPart:l}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,a,l);let c="";return s&&(c=b+" "),c+=I(u),l&&(c+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=w,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=I(BigInt(r))),n}(l)),c}function O(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=m[n]:t>=2?i=n>0?c[t]+"-"+p[n]:v[t]:n>0&&(i=p[n]),r>0?i?u[r]+" "+h+" "+i:u[r]+" hundredth":i}function x(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return o(r,g),function(e){if(e<1000n)return O(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return N(n).word+" "+f[0]+"th";const{word:r}=N(n);return r+" "+f[0]+" "+O(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?O(t):N(t).word+" "+f[e-1]+"th":(i+=N(t).word,e>0&&(i+=" "+f[e-1])))}return i}(e)}(r)}const R={and:!0};function B(e,t){const{isNegative:r,dollars:s,cents:u}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(s,d);const{and:l}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(t,R);let c="";return r&&(c=b+" "),(s>0n||0n===u)&&(c+=I(s),c+=" "+(1n===s?"dollar":"dollars")),u>0n&&(s>0n&&(c+=l?" and ":" "),c+=I(u),c+=" "+(1n===u?"cent":"cents")),c}export{a as cardinalMax,R as currencyDefaults,d as currencyMax,g as ordinalMax,E as toCardinal,B as toCurrency,x as toOrdinal};
|
package/dist/en-AU.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/en-AU v5.1.
|
|
1
|
+
/*! n2words/en-AU v5.1.1 | 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 l=["","one","two","three","four","five","six","seven","eight","nine"],f=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],a=["thousand","million","billion","trillion","quadrillion","quintillion","sextillion","septillion","octillion","nonillion","decillion","undecillion","duodecillion","tredecillion","quattuordecillion","quindecillion","sexdecillion","septendecillion","octodecillion","novemdecillion","vigintillion"],d=u(a.length),g=u(a.length),h=u(a.length),w="hundred",b="zero",p="minus",m=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],v=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],y=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],N={word:"",hasHundred:!1};function I(e){if(0===e)return N.word="",N.hasHundred=!1,N;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=f[n]:t>=2?i=n>0?c[t]+"-"+l[n]:c[t]:n>0&&(i=l[n]),r>0?(N.word=i?l[r]+" "+w+" and "+i:l[r]+" "+w,N.hasHundred=!0):(N.word=i,N.hasHundred=!1),N}function E(e){if(0n===e)return b;if(e<1000n)return I(Number(e)).word;if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),{word:r}=I(n);let i=r+" "+a[0];if(t>0){const{word:e,hasHundred:n}=I(t);i+=n?" "+e:" and "+e}return i}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=-1;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="",o=!1;for(let e=n.length-1;e>=0;e--){const t=n[e];if(0===t)continue;const{word:s,hasHundred:u}=I(t);i&&e===r&&o&&!u&&(i+=" and"),i&&(i+=" "),i+=s,e>0?(i+=" "+a[e-1],o=!0):o=!1}return i}(e)}function O(e){const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===t?i=v[n]:t>=2?i=n>0?c[t]+"-"+m[n]:y[t]:n>0&&(i=m[n]),r>0?i?l[r]+" "+w+" "+i:l[r]+" hundredth":i}const x={and:!0},R={enAU:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,g),function(e){if(e<1000n)return O(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return I(n).word+" "+a[0]+"th";const{word:r}=I(n);return r+" "+a[0]+" "+O(t)}return function(e){const n=[];let t=e;for(;t>0n;)n.push(Number(t%1000n)),t/=1000n;let r=0;for(let e=0;e<n.length;e++)if(0!==n[e]){r=e;break}let i="";for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(i&&(i+=" "),e===r?i+=0===e?O(t):I(t).word+" "+a[e-1]+"th":(i+=I(t).word,e>0&&(i+=" "+a[e-1])))}return i}(e)}(t)}};e.currency={enAU:function(e,n){const{isNegative:r,dollars:i,cents:u}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(i,h);const{and:l}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(n,x);let f="";return r&&(f=p+" "),(i>0n||0n===u)&&(f+=E(i),f+=" "+(1n===i?"dollar":"dollars")),u>0n&&(i>0n&&(f+=l?" and ":" "),f+=E(u),f+=" "+(1n===u?"cent":"cents")),f}},e.enAU=function(e){const{isNegative:o,integerPart:u,decimalPart:l}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,d,l);let f="";return o&&(f=p+" "),f+=E(u),l&&(f+=" point "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=b,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=E(BigInt(r))),n}(l)),f},e.ordinal=R},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/en-BD.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/en-BD v5.1.
|
|
1
|
+
/*! n2words/en-BD v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
2
|
function e(e){let[t,n]=e.toLowerCase().split("e");const r=parseInt(n,10);let i="";"-"===t[0]&&(i="-",t=t.slice(1));const o=t.indexOf("."),s=-1===o?t:t.slice(0,o)+t.slice(o+1),u=(-1===o?t.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(t){const r=t.toString();return n(r)?e(r):r}function n(e){return e.includes("e")||e.includes("E")}function r(e){const t="-"===e[0];t&&(e=e.slice(1));const n=e.indexOf(".");if(-1===n)return{isNegative:t,integerPart:BigInt(e)};const r=e.slice(0,n)||"0",i=e.slice(n+1);return{isNegative:t,integerPart:BigInt(r),decimalPart:i}}function i(t){let r=t.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${t}"`);n(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,t,n){if(null===t)return;if(e<t&&!(n&&BigInt(n)>=t))return;const r=t.toString().length-1,i=t===10n**BigInt(r)?`10^${r} - 1`:""+(t-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3+2*(e-1))}const u=["","one","two","three","four","five","six","seven","eight","nine"],a=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],f=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],c=["thousand","lakh","crore","arab","kharab","neel","padma","shankh"],h=s(c.length+1),l=s(c.length+1),g=s(c.length+1),d="hundred",p="zero",w="minus",b=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],m=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],y={word:"",hasHundred:!1};function N(e){if(0===e)return y.word="",y.hasHundred=!1,y;const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=a[t]:n>=2?i=t>0?f[n]+"-"+u[t]:f[n]:t>0&&(i=u[t]),r>0?(y.word=i?u[r]+" "+d+" and "+i:u[r]+" "+d,y.hasHundred=!0):(y.word=i,y.hasHundred=!1),y}function I(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10);return 1===n?a[t]:n>=2?t>0?f[n]+"-"+u[t]:f[n]:u[t]}function E(e){if(0n===e)return p;if(e<1000n)return N(Number(e)).word;const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;const r=[];for(let e=t.length-1;e>=0;e--){const n=t[e];if(0!==n)if(0===e){const{word:e,hasHundred:t}=N(n);r.length>0&&!t&&r.push("and"),r.push(e)}else r.push(I(n)),c[e-1]&&r.push(c[e-1])}return r.join(" ")}function O(i){const{isNegative:s,integerPart:u,decimalPart:a}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(t(i))}if("string"==typeof i)return r(function(t){const r=t.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${t}"`);return n(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,h,a);let f="";return s&&(f=w+" "),f+=E(u),a&&(f+=" point "+function(e){let t="",n=0;for(;n<e.length&&"0"===e[n];)t&&(t+=" "),t+=p,n++;const r=e.slice(n);return r&&(t&&(t+=" "),t+=E(BigInt(r))),t}(a)),f}function R(e){const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=m[t]:n>=2?i=t>0?f[n]+"-"+b[t]:v[n]:t>0&&(i=b[t]),r>0?i?u[r]+" "+d+" "+i:u[r]+" hundredth":i}function B(t){const r=function(t){const r=typeof t;if("bigint"==typeof t){if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}if("number"==typeof t){if(!Number.isFinite(t))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(t))throw new RangeError("Ordinals must be whole numbers");if(t<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(t)}if("string"==typeof t)return function(t){const r=t.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(n(r)){const t=e(r);if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${t}"`,{cause:e})}}(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(t);return o(r,l),function(e){if(e<1000n)return R(Number(e));const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;let r=0;for(let e=0;e<t.length;e++)if(0!==t[e]){r=e;break}const i=[];for(let e=t.length-1;e>=0;e--){const n=t[e];0!==n&&(e===r?0===e?i.push(R(n)):(i.push(I(n)),i.push(c[e-1]+"th")):0===e?i.push(N(n).word):(i.push(I(n)),i.push(c[e-1])))}return i.join(" ")}(r)}const x={and:!0};function $(e,n){const{isNegative:r,dollars:s,cents:u}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(t(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);o(s,g);const{and:a}=function(e,t){const n={...t};if(void 0===e)return n;if(!function(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(t);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(t,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof n[i])throw new TypeError(`Option "${i}" must be a ${typeof n[i]}, got ${typeof o}`);n[i]=o}}return n}(n,x);let f="";return r&&(f=w+" "),(s>0n||0n===u)&&(f+=E(s),f+=" taka"),u>0n&&(s>0n&&(f+=a?" and ":" "),f+=E(u),f+=" "+(1n===u?"paisa":"paise")),f}export{h as cardinalMax,x as currencyDefaults,g as currencyMax,l as ordinalMax,O as toCardinal,$ as toCurrency,B as toOrdinal};
|
package/dist/en-BD.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/en-BD v5.1.
|
|
1
|
+
/*! n2words/en-BD v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
2
|
var e,t;e=this,t=function(e){"use strict";function t(e){let[t,n]=e.toLowerCase().split("e");const r=parseInt(n,10);let i="";"-"===t[0]&&(i="-",t=t.slice(1));const o=t.indexOf("."),s=-1===o?t:t.slice(0,o)+t.slice(o+1),u=(-1===o?t.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(e){const n=e.toString();return r(n)?t(n):n}function r(e){return e.includes("e")||e.includes("E")}function i(e){const t="-"===e[0];t&&(e=e.slice(1));const n=e.indexOf(".");if(-1===n)return{isNegative:t,integerPart:BigInt(e)};const r=e.slice(0,n)||"0",i=e.slice(n+1);return{isNegative:t,integerPart:BigInt(r),decimalPart:i}}function o(e){let n=e.trim();if(0===n.length||Number.isNaN(Number(n)))throw new RangeError(`Invalid currency format: "${e}"`);r(n)&&(n=t(n));const i="-"===n[0];i&&(n=n.slice(1));const o=n.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(n),cents:0n};const s=n.slice(0,o)||"0",u=(n.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e,t,n){if(null===t)return;if(e<t&&!(n&&BigInt(n)>=t))return;const r=t.toString().length-1,i=t===10n**BigInt(r)?`10^${r} - 1`:""+(t-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(e){return 10n**BigInt(3+2*(e-1))}const f=["","one","two","three","four","five","six","seven","eight","nine"],a=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],c=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"],h=["thousand","lakh","crore","arab","kharab","neel","padma","shankh"],l=u(h.length+1),g=u(h.length+1),d=u(h.length+1),p="hundred",w="zero",b="minus",m=["","first","second","third","fourth","fifth","sixth","seventh","eighth","ninth"],y=["tenth","eleventh","twelfth","thirteenth","fourteenth","fifteenth","sixteenth","seventeenth","eighteenth","nineteenth"],v=["","","twentieth","thirtieth","fortieth","fiftieth","sixtieth","seventieth","eightieth","ninetieth"],N={word:"",hasHundred:!1};function I(e){if(0===e)return N.word="",N.hasHundred=!1,N;const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=a[t]:n>=2?i=t>0?c[n]+"-"+f[t]:c[n]:t>0&&(i=f[t]),r>0?(N.word=i?f[r]+" "+p+" and "+i:f[r]+" "+p,N.hasHundred=!0):(N.word=i,N.hasHundred=!1),N}function E(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10);return 1===n?a[t]:n>=2?t>0?c[n]+"-"+f[t]:c[n]:f[t]}function O(e){if(0n===e)return w;if(e<1000n)return I(Number(e)).word;const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;const r=[];for(let e=t.length-1;e>=0;e--){const n=t[e];if(0!==n)if(0===e){const{word:e,hasHundred:t}=I(n);r.length>0&&!t&&r.push("and"),r.push(e)}else r.push(E(n)),h[e-1]&&r.push(h[e-1])}return r.join(" ")}function B(e){const t=e%10,n=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return 1===n?i=y[t]:n>=2?i=t>0?c[n]+"-"+m[t]:v[n]:t>0&&(i=m[t]),r>0?i?f[r]+" "+p+" "+i:f[r]+" hundredth":i}const x={and:!0},R={enBD:function(e){const n=function(e){const n=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const n=e.trim();if(0===n.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===n[0])throw new RangeError("Ordinals cannot be negative");if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(n)){const e=t(n);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(n);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(t){if(t instanceof RangeError)throw t;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:t})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);return s(n,g),function(e){if(e<1000n)return B(Number(e));const t=[];t.push(Number(e%1000n));let n=e/1000n;for(;n>0n;)t.push(Number(n%100n)),n/=100n;let r=0;for(let e=0;e<t.length;e++)if(0!==t[e]){r=e;break}const i=[];for(let e=t.length-1;e>=0;e--){const n=t[e];0!==n&&(e===r?0===e?i.push(B(n)):(i.push(E(n)),i.push(h[e-1]+"th")):0===e?i.push(I(n).word):(i.push(E(n)),i.push(h[e-1])))}return i.join(" ")}(n)}};e.currency={enBD:function(e,t){const{isNegative:r,dollars:i,cents:u}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(n(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);s(i,d);const{and:f}=function(e,t){const n={...t};if(void 0===e)return n;if(!function(e){if(null===e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(t);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(t,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof n[i])throw new TypeError(`Option "${i}" must be a ${typeof n[i]}, got ${typeof o}`);n[i]=o}}return n}(t,x);let a="";return r&&(a=b+" "),(i>0n||0n===u)&&(a+=O(i),a+=" taka"),u>0n&&(i>0n&&(a+=f?" and ":" "),a+=O(u),a+=" "+(1n===u?"paisa":"paise")),a}},e.enBD=function(e){const{isNegative:o,integerPart:u,decimalPart:f}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(n(e))}if("string"==typeof e)return i(function(e){const n=e.trim();if(0===n.length||Number.isNaN(Number(n)))throw new RangeError(`Invalid number format: "${e}"`);return r(n)?t(n):n}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,l,f);let a="";return o&&(a=b+" "),a+=O(u),f&&(a+=" point "+function(e){let t="",n=0;for(;n<e.length&&"0"===e[n];)t&&(t+=" "),t+=w,n++;const r=e.slice(n);return r&&(t&&(t+=" "),t+=O(BigInt(r))),t}(f)),a},e.ordinal=R},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|