n2words 5.0.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +133 -40
- package/README.md +6 -4
- package/dist/am-ET.js +2 -2
- package/dist/am-ET.umd.js +2 -2
- package/dist/am-Latn-ET.js +2 -2
- package/dist/am-Latn-ET.umd.js +2 -2
- package/dist/ar-SA.js +2 -2
- package/dist/ar-SA.umd.js +2 -2
- package/dist/az-AZ.js +2 -2
- package/dist/az-AZ.umd.js +2 -2
- package/dist/bn-BD.js +2 -2
- package/dist/bn-BD.umd.js +2 -2
- package/dist/cs-CZ.js +2 -2
- package/dist/cs-CZ.umd.js +2 -2
- package/dist/da-DK.js +2 -2
- package/dist/da-DK.umd.js +2 -2
- package/dist/de-DE.js +2 -2
- package/dist/de-DE.umd.js +2 -2
- package/dist/el-GR.js +2 -2
- package/dist/el-GR.umd.js +2 -2
- package/dist/en-AU.js +2 -2
- package/dist/en-AU.umd.js +2 -2
- package/dist/en-BD.js +2 -2
- package/dist/en-BD.umd.js +2 -2
- package/dist/en-CA.js +2 -2
- package/dist/en-CA.umd.js +2 -2
- package/dist/en-GB.js +2 -2
- package/dist/en-GB.umd.js +2 -2
- package/dist/en-GH.js +2 -2
- package/dist/en-GH.umd.js +2 -2
- package/dist/en-IE.js +2 -2
- package/dist/en-IE.umd.js +2 -2
- package/dist/en-IN.js +2 -2
- package/dist/en-IN.umd.js +2 -2
- package/dist/en-KE.js +2 -2
- package/dist/en-KE.umd.js +2 -2
- package/dist/en-MY.js +2 -2
- package/dist/en-MY.umd.js +2 -2
- package/dist/en-NG.js +2 -2
- package/dist/en-NG.umd.js +2 -2
- package/dist/en-NZ.js +2 -2
- package/dist/en-NZ.umd.js +2 -2
- package/dist/en-PH.js +2 -2
- package/dist/en-PH.umd.js +2 -2
- package/dist/en-PK.js +2 -2
- package/dist/en-PK.umd.js +2 -2
- package/dist/en-SG.js +2 -2
- package/dist/en-SG.umd.js +2 -2
- package/dist/en-US.js +2 -2
- package/dist/en-US.umd.js +2 -2
- package/dist/en-ZA.js +2 -2
- package/dist/en-ZA.umd.js +2 -2
- package/dist/es-ES.js +2 -2
- package/dist/es-ES.umd.js +2 -2
- package/dist/es-MX.js +2 -2
- package/dist/es-MX.umd.js +2 -2
- package/dist/es-US.js +2 -2
- package/dist/es-US.umd.js +2 -2
- package/dist/fa-IR.js +2 -2
- package/dist/fa-IR.umd.js +2 -2
- package/dist/fi-FI.js +2 -2
- package/dist/fi-FI.umd.js +2 -2
- package/dist/fil-PH.js +2 -2
- package/dist/fil-PH.umd.js +2 -2
- package/dist/fr-BE.js +2 -2
- package/dist/fr-BE.umd.js +2 -2
- package/dist/fr-FR.js +2 -2
- package/dist/fr-FR.umd.js +2 -2
- package/dist/gu-IN.js +2 -2
- package/dist/gu-IN.umd.js +2 -2
- package/dist/ha-NG.js +2 -2
- package/dist/ha-NG.umd.js +2 -2
- package/dist/hbo-IL.js +2 -2
- package/dist/hbo-IL.umd.js +2 -2
- package/dist/he-IL.js +2 -2
- package/dist/he-IL.umd.js +2 -2
- package/dist/hi-IN.js +2 -2
- package/dist/hi-IN.umd.js +2 -2
- package/dist/hr-HR.js +2 -2
- package/dist/hr-HR.umd.js +2 -2
- package/dist/hu-HU.js +2 -2
- package/dist/hu-HU.umd.js +2 -2
- package/dist/id-ID.js +2 -2
- package/dist/id-ID.umd.js +2 -2
- package/dist/it-IT.js +2 -2
- package/dist/it-IT.umd.js +2 -2
- package/dist/ja-JP.js +2 -2
- package/dist/ja-JP.umd.js +2 -2
- package/dist/ka-GE.js +2 -2
- package/dist/ka-GE.umd.js +2 -2
- package/dist/kn-IN.js +2 -2
- package/dist/kn-IN.umd.js +2 -2
- package/dist/ko-KR.js +2 -2
- package/dist/ko-KR.umd.js +2 -2
- package/dist/lt-LT.js +2 -2
- package/dist/lt-LT.umd.js +2 -2
- package/dist/lv-LV.js +2 -2
- package/dist/lv-LV.umd.js +2 -2
- package/dist/mr-IN.js +2 -2
- package/dist/mr-IN.umd.js +2 -2
- package/dist/ms-MY.js +2 -2
- package/dist/ms-MY.umd.js +2 -2
- package/dist/nb-NO.js +2 -2
- package/dist/nb-NO.umd.js +2 -2
- package/dist/nl-NL.js +2 -2
- package/dist/nl-NL.umd.js +2 -2
- package/dist/pa-IN.js +2 -2
- package/dist/pa-IN.umd.js +2 -2
- package/dist/pl-PL.js +2 -2
- package/dist/pl-PL.umd.js +2 -2
- package/dist/pt-BR.js +2 -2
- package/dist/pt-BR.umd.js +2 -2
- package/dist/pt-PT.js +2 -2
- package/dist/pt-PT.umd.js +2 -2
- package/dist/ro-RO.js +2 -2
- package/dist/ro-RO.umd.js +2 -2
- package/dist/ru-RU.js +2 -2
- package/dist/ru-RU.umd.js +2 -2
- 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 +2 -2
- package/dist/sv-SE.umd.js +2 -2
- package/dist/sw-KE.js +2 -2
- package/dist/sw-KE.umd.js +2 -2
- package/dist/ta-IN.js +2 -2
- package/dist/ta-IN.umd.js +2 -2
- package/dist/te-IN.js +2 -2
- package/dist/te-IN.umd.js +2 -2
- package/dist/th-TH.js +2 -2
- package/dist/th-TH.umd.js +2 -2
- package/dist/tr-TR.js +2 -2
- package/dist/tr-TR.umd.js +2 -2
- package/dist/uk-UA.js +2 -2
- package/dist/uk-UA.umd.js +2 -2
- package/dist/ur-PK.js +2 -2
- package/dist/ur-PK.umd.js +2 -2
- package/dist/vi-VN.js +2 -2
- package/dist/vi-VN.umd.js +2 -2
- package/dist/yo-NG.js +2 -2
- package/dist/yo-NG.umd.js +2 -2
- package/dist/zh-Hans-CN.js +2 -2
- package/dist/zh-Hans-CN.umd.js +2 -2
- package/dist/zh-Hant-TW.js +2 -2
- package/dist/zh-Hant-TW.umd.js +2 -2
- package/package.json +33 -24
- package/src/am-ET.d.ts +3 -5
- package/src/am-ET.js +41 -16
- package/src/am-Latn-ET.d.ts +3 -5
- package/src/am-Latn-ET.js +45 -16
- package/src/ar-SA.d.ts +44 -18
- package/src/ar-SA.js +93 -40
- package/src/az-AZ.d.ts +3 -5
- package/src/az-AZ.js +58 -20
- package/src/bn-BD.d.ts +3 -5
- package/src/bn-BD.js +32 -16
- package/src/cs-CZ.d.ts +3 -6
- package/src/cs-CZ.js +66 -42
- package/src/da-DK.d.ts +3 -6
- package/src/da-DK.js +53 -48
- package/src/de-DE.d.ts +17 -11
- package/src/de-DE.js +88 -57
- package/src/el-GR.d.ts +3 -6
- package/src/el-GR.js +45 -32
- package/src/en-AU.d.ts +17 -11
- package/src/en-AU.js +56 -41
- package/src/en-BD.d.ts +17 -11
- package/src/en-BD.js +60 -41
- package/src/en-CA.d.ts +36 -18
- package/src/en-CA.js +67 -46
- package/src/en-GB.d.ts +17 -11
- package/src/en-GB.js +56 -41
- package/src/en-GH.d.ts +32 -3
- package/src/en-GH.js +104 -26
- package/src/en-IE.d.ts +17 -11
- package/src/en-IE.js +56 -41
- package/src/en-IN.d.ts +17 -11
- package/src/en-IN.js +60 -41
- package/src/en-KE.d.ts +28 -3
- package/src/en-KE.js +93 -26
- package/src/en-MY.d.ts +26 -3
- package/src/en-MY.js +91 -26
- package/src/en-NG.d.ts +17 -11
- package/src/en-NG.js +56 -41
- package/src/en-NZ.d.ts +32 -3
- package/src/en-NZ.js +85 -31
- package/src/en-PH.d.ts +32 -3
- package/src/en-PH.js +97 -26
- package/src/en-PK.d.ts +17 -11
- package/src/en-PK.js +60 -41
- package/src/en-SG.d.ts +28 -3
- package/src/en-SG.js +93 -26
- package/src/en-US.d.ts +36 -18
- package/src/en-US.js +70 -47
- package/src/en-ZA.d.ts +17 -11
- package/src/en-ZA.js +56 -41
- package/src/es-ES.d.ts +53 -21
- package/src/es-ES.js +104 -56
- package/src/es-MX.d.ts +53 -21
- package/src/es-MX.js +104 -56
- package/src/es-US.d.ts +53 -21
- package/src/es-US.js +92 -51
- package/src/fa-IR.d.ts +3 -5
- package/src/fa-IR.js +28 -13
- package/src/fi-FI.d.ts +3 -6
- package/src/fi-FI.js +47 -29
- package/src/fil-PH.d.ts +3 -5
- package/src/fil-PH.js +61 -28
- package/src/fr-BE.d.ts +31 -15
- package/src/fr-BE.js +128 -57
- package/src/fr-FR.d.ts +31 -16
- package/src/fr-FR.js +97 -60
- package/src/gu-IN.d.ts +3 -5
- package/src/gu-IN.js +31 -16
- package/src/ha-NG.d.ts +3 -5
- package/src/ha-NG.js +55 -27
- package/src/hbo-IL.d.ts +26 -12
- package/src/hbo-IL.js +92 -51
- package/src/he-IL.d.ts +17 -10
- package/src/he-IL.js +92 -50
- package/src/hi-IN.d.ts +3 -5
- package/src/hi-IN.js +30 -17
- package/src/hr-HR.d.ts +21 -10
- package/src/hr-HR.js +89 -33
- package/src/hu-HU.d.ts +3 -5
- package/src/hu-HU.js +57 -23
- package/src/id-ID.d.ts +3 -5
- package/src/id-ID.js +56 -23
- package/src/it-IT.d.ts +17 -11
- package/src/it-IT.js +74 -43
- package/src/ja-JP.d.ts +3 -6
- package/src/ja-JP.js +39 -26
- package/src/ka-GE.d.ts +3 -6
- package/src/ka-GE.js +38 -26
- package/src/kn-IN.d.ts +3 -5
- package/src/kn-IN.js +31 -16
- package/src/ko-KR.d.ts +3 -6
- package/src/ko-KR.js +34 -26
- package/src/lt-LT.d.ts +21 -11
- package/src/lt-LT.js +64 -42
- package/src/lv-LV.d.ts +21 -11
- package/src/lv-LV.js +79 -51
- package/src/mr-IN.d.ts +3 -5
- package/src/mr-IN.js +31 -16
- package/src/ms-MY.d.ts +3 -5
- package/src/ms-MY.js +58 -24
- package/src/nb-NO.d.ts +3 -6
- package/src/nb-NO.js +54 -34
- package/src/nl-NL.d.ts +41 -20
- package/src/nl-NL.js +111 -69
- package/src/pa-IN.d.ts +3 -5
- package/src/pa-IN.js +32 -16
- package/src/pl-PL.d.ts +21 -11
- package/src/pl-PL.js +69 -45
- package/src/pt-BR.d.ts +22 -11
- package/src/pt-BR.js +93 -53
- package/src/pt-PT.d.ts +17 -11
- package/src/pt-PT.js +80 -48
- package/src/ro-RO.d.ts +21 -11
- package/src/ro-RO.js +77 -39
- package/src/ru-RU.d.ts +35 -15
- package/src/ru-RU.js +100 -38
- package/src/sr-Cyrl-RS.d.ts +35 -15
- package/src/sr-Cyrl-RS.js +106 -43
- package/src/sr-Latn-RS.d.ts +35 -15
- package/src/sr-Latn-RS.js +106 -43
- package/src/sv-SE.d.ts +3 -6
- package/src/sv-SE.js +53 -34
- package/src/sw-KE.d.ts +3 -5
- package/src/sw-KE.js +50 -20
- package/src/ta-IN.d.ts +3 -5
- package/src/ta-IN.js +29 -17
- package/src/te-IN.d.ts +3 -5
- package/src/te-IN.js +31 -16
- package/src/th-TH.d.ts +3 -5
- package/src/th-TH.js +42 -19
- package/src/tr-TR.d.ts +17 -11
- package/src/tr-TR.js +63 -37
- package/src/uk-UA.d.ts +21 -10
- package/src/uk-UA.js +89 -33
- package/src/ur-PK.d.ts +3 -5
- package/src/ur-PK.js +32 -16
- package/src/utils/check-max.d.ts +26 -0
- package/src/utils/check-max.js +33 -0
- package/src/utils/expand-scientific.d.ts +0 -4
- package/src/utils/expand-scientific.js +7 -9
- package/src/utils/is-plain-object.d.ts +3 -4
- package/src/utils/is-plain-object.js +3 -4
- package/src/utils/parse-cardinal.d.ts +1 -2
- package/src/utils/parse-cardinal.js +12 -9
- package/src/utils/parse-currency.d.ts +1 -2
- package/src/utils/parse-currency.js +9 -11
- package/src/utils/parse-ordinal.d.ts +0 -1
- package/src/utils/parse-ordinal.js +9 -10
- package/src/utils/resolve-options.d.ts +17 -0
- package/src/utils/resolve-options.js +56 -0
- package/src/utils/scale.d.ts +49 -0
- package/src/utils/scale.js +65 -0
- package/src/vi-VN.d.ts +3 -6
- package/src/vi-VN.js +41 -28
- package/src/yo-NG.d.ts +3 -5
- package/src/yo-NG.js +49 -33
- package/src/zh-Hans-CN.d.ts +45 -20
- package/src/zh-Hans-CN.js +84 -31
- package/src/zh-Hant-TW.d.ts +45 -20
- package/src/zh-Hant-TW.js +85 -34
- package/src/utils/validate-options.d.ts +0 -8
- package/src/utils/validate-options.js +0 -16
package/dist/pt-PT.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/pt-PT v5.
|
|
2
|
-
var e,
|
|
1
|
+
/*! n2words/pt-PT v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
var e,t;e=this,t=function(e){"use strict";function t(e){let[t,n]=e.toLowerCase().split("e");const i=parseInt(n,10);let r="";"-"===t[0]&&(r="-",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)+i;return u>=s.length?r+s+"0".repeat(u-s.length):u<=0?r+"0."+"0".repeat(-u)+s:r+s.slice(0,u)+"."+s.slice(u)}function n(e){const n=e.toString();return i(n)?t(n):n}function i(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 i=e.slice(0,n)||"0",r=e.slice(n+1);return{isNegative:t,integerPart:BigInt(i),decimalPart:r}}function o(e){let n=e.trim();if(0===n.length||Number.isNaN(Number(n)))throw new RangeError(`Invalid currency format: "${e}"`);i(n)&&(n=t(n));const r="-"===n[0];r&&(n=n.slice(1));const o=n.indexOf(".");if(-1===o)return{isNegative:r,dollars:BigInt(n),cents:0n};const s=n.slice(0,o)||"0",u=(n.slice(o+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(s),cents:BigInt(u)}}function s(e,t,n){if(null===t)return;if(e<t&&!(n&&BigInt(n)>=t))return;const i=t.toString().length-1,r=t===10n**BigInt(i)?`10^${i} - 1`:""+(t-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function u(e){return 10n**BigInt(3*(e+1))}const c=["","um","dois","três","quatro","cinco","seis","sete","oito","nove"],a=["dez","onze","doze","treze","catorze","quinze","dezasseis","dezassete","dezoito","dezanove"],l=["","","vinte","trinta","quarenta","cinquenta","sessenta","setenta","oitenta","noventa"],f=["","cento","duzentos","trezentos","quatrocentos","quinhentos","seiscentos","setecentos","oitocentos","novecentos"],m="mil",g="zero",d="menos",p=["","primeiro","segundo","terceiro","quarto","quinto","sexto","sétimo","oitavo","nono"],b=["décimo","décimo primeiro","décimo segundo","décimo terceiro","décimo quarto","décimo quinto","décimo sexto","décimo sétimo","décimo oitavo","décimo nono"],h=["","","vigésimo","trigésimo","quadragésimo","quinquagésimo","sexagésimo","septuagésimo","octogésimo","nonagésimo"],w=["","centésimo","ducentésimo","tricentésimo","quadringentésimo","quingentésimo","sexcentésimo","septingentésimo","octingentésimo","nongentésimo"],v="euros";function N(e){if(0===e)return{word:"",isExactHundred:!1};if(100===e)return{word:"cem",isExactHundred:!0};const t=e%10,n=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(f[i]),1===n?r.push(a[t]):n>=2?r.push(t>0?l[n]+" e "+c[t]:l[n]):t>0&&r.push(c[t]),{word:r.join(" e "),isExactHundred:i>0&&0===n&&0===t,startsWithHundreds:e>=100}}const y=["",m,"milhão","mil milhões","bilião","mil biliões","trilião","mil triliões","quatrilião"],I=["",m,"milhões","mil milhões","biliões","mil biliões","triliões","mil triliões","quatriliões"],E=["","milésimo","milionésimo","mil milionésimo","bilionésimo","mil bilionésimo","trilionésimo"],O=u(y.length-1),x=u(E.length-1),q=u(y.length-1);function R(e){if(0n===e)return g;if(e<1000n)return N(Number(e)).word;if(e<1000000n){const t=Number(e/1000n),n=Number(e%1000n);let i;if(i=1===t?m:N(t).word+" "+m,n>0){const e=N(n);i+=e.startsWithHundreds?" "+e.word:" e "+e.word}return i}return function(e){const t=[];let n=e;for(;n>0n;)t.push(Number(n%1000n)),n/=1000n;let i=0;for(let e=0;e<t.length;e++)if(0!==t[e]){i=e;break}let r="",o=!1;for(let e=t.length-1;e>=0;e--){const n=t[e];if(0===n)continue;const s=N(n);if(r&&e===i&&o&&!s.startsWithHundreds&&(r+=" e"),r&&(r+=" "),0===e)r+=s.word,o=!1;else if(1===e)r+=1===n?m:s.word+" "+m,o=!0;else{const t=1===n?y[e]:I[e];r+=1===n?"um "+t:s.word+" "+t,o=!0}}return r}(e)}function B(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(w[i]),1===n?r.push(b[t]):n>=2?(r.push(h[n]),t>0&&r.push(p[t])):t>0&&r.push(p[t]),r.join(" ")}const z={and:!0},P={ptPT: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(i(n)){const e=t(n);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const i=BigInt(e);if(i<=0n)throw new RangeError("Ordinals must be positive integers");return i}try{const e=BigInt(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);if(s(n,x),n<10n)return p[Number(n)];if(n<20n)return b[Number(n)-10];if(n<100n){const e=Number(n%10n),t=Number(n/10n);return 0===e?h[t]:h[t]+" "+p[e]}return n<1000n?B(Number(n)):function(e){const t=[];let n=e;for(;n>0n;)t.push(Number(n%1000n)),n/=1000n;let i=0;for(let e=0;e<t.length;e++)if(0!==t[e]){i=e;break}let r="";for(let e=t.length-1;e>=0;e--){const n=t[e];if(0!==n)if(r&&(r+=" "),e===i)r+=0===e?B(n):1===n&&e>0?E[e]:B(n)+" "+E[e];else if(0===e)r+=N(n).word;else if(1===e)r+=1===n?m:N(n).word+" "+m;else{const t=1===n?y[e]:I[e];r+=1===n?"um "+t:N(n).word+" "+t}}return r}(n)}};e.currency={ptPT:function(e,t){const{isNegative:i,dollars:r,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(r,q);const{and:c}=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 i=Object.keys(t);for(const[r,o]of Object.entries(e)){if(!Object.hasOwn(t,r))throw new TypeError(`Unknown option "${r}" — expected one of: ${i.join(", ")}`);if(void 0!==o){if(typeof o!=typeof n[r])throw new TypeError(`Option "${r}" must be a ${typeof n[r]}, got ${typeof o}`);n[r]=o}}return n}(t,z);let a="";i&&(a=d+" ");const l=r>0n,f=u>0n;return l||f?(l&&(a+=R(r)+" "+(1n===r?"euro":v)),f&&(l&&(a+=c?" e ":" "),a+=R(u)+" "+(1n===u?"cêntimo":"cêntimos")),a):g+" "+v}},e.ordinal=P,e.ptPT=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)}:r(n(e))}if("string"==typeof e)return r(function(e){const n=e.trim();if(0===n.length||Number.isNaN(Number(n)))throw new RangeError(`Invalid number format: "${e}"`);return i(n)?t(n):n}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,O,c);let a="";return o&&(a=d+" "),a+=R(u),c&&(a+=" vírgula "+function(e){let t="",n=0;for(;n<e.length&&"0"===e[n];)t&&(t+=" "),t+=g,n++;const i=e.slice(n);return i&&(t&&(t+=" "),t+=R(BigInt(i))),t}(c)),a}},"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/ro-RO.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ro-RO v5.
|
|
2
|
-
function e(e){let[n,
|
|
1
|
+
/*! n2words/ro-RO v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
function e(e){let[n,t]=e.toLowerCase().split("e");const i=parseInt(t,10);let r="";"-"===n[0]&&(r="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),a=(-1===o?n.length:o)+i;return a>=s.length?r+s+"0".repeat(a-s.length):a<=0?r+"0."+"0".repeat(-a)+s:r+s.slice(0,a)+"."+s.slice(a)}function n(n){const i=n.toString();return t(i)?e(i):i}function t(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const i=e.slice(0,t)||"0",r=e.slice(t+1);return{isNegative:n,integerPart:BigInt(i),decimalPart:r}}function r(n){let i=n.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid currency format: "${n}"`);t(i)&&(i=e(i));const r="-"===i[0];r&&(i=i.slice(1));const o=i.indexOf(".");if(-1===o)return{isNegative:r,dollars:BigInt(i),cents:0n};const s=i.slice(0,o)||"0",a=(i.slice(o+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(s),cents:BigInt(a)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const i=n.toString().length-1,r=n===10n**BigInt(i)?`10^${i} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function s(e){return 10n**BigInt(3*(e+1))}const a=["","unu","doi","trei","patru","cinci","șase","șapte","opt","nouă"],u=["","una","două","trei","patru","cinci","șase","șapte","opt","nouă"],l=["zece","unsprezece","douăsprezece","treisprezece","paisprezece","cincisprezece","șaisprezece","șaptesprezece","optsprezece","nouăsprezece"],c=["zece","unsprezece","doisprezece","treisprezece","paisprezece","cincisprezece","șaisprezece","șaptesprezece","optsprezece","nouăsprezece"],f=["","","douăzeci","treizeci","patruzeci","cincizeci","șaizeci","șaptezeci","optzeci","nouăzeci"],p=["","o sută","două sute","trei sute","patru sute","cinci sute","șase sute","șapte sute","opt sute","nouă sute"],g="zero",d="minus",m=["","primul","al doilea","al treilea","al patrulea","al cincilea","al șaselea","al șaptelea","al optulea","al nouălea"],b=["al zecelea","al unsprezecelea","al doisprezecelea","al treisprezecelea","al paisprezecelea","al cincisprezecelea","al șaisprezecelea","al șaptesprezecelea","al optsprezecelea","al nouăsprezecelea"],w=["","","al douăzecilea","al treizecilea","al patruzecilea","al cincizecilea","al șaizecilea","al șaptezecilea","al optzecilea","al nouăzecilea"],h="al sutălea",z="al miilea",N="al milionulea",v="bani",y=[{singular:"mie",plural:"mii",article:"o",feminine:!0,needsDe:!0},{singular:"milion",plural:"milioane",article:"un",feminine:!1,needsDe:!0},{singular:"miliard",plural:"miliarde",article:"un",feminine:!1,needsDe:!0},{singular:"trilion",plural:"trilioane",article:"un",feminine:!1,needsDe:!0},{singular:"cvadrilion",plural:"cvadrilioane",article:"un",feminine:!1,needsDe:!0},{singular:"cvintilion",plural:"cvintilioane",article:"un",feminine:!1,needsDe:!0},{singular:"sextilion",plural:"sextilioane",article:"un",feminine:!1,needsDe:!0},{singular:"septilion",plural:"septilioane",article:"un",feminine:!1,needsDe:!0},{singular:"octilion",plural:"octilioane",article:"un",feminine:!1,needsDe:!0}],I=s(y.length),E=10n**BigInt(9),O=s(y.length);function R(e,n=!1,t=!1){if(0===e)return"";if(e<10)return n?u[e]:a[e];if(e<20)return t?c[e-10]:l[e-10];const i=Math.trunc(e/10),r=e%10;return 0===r?f[i]:f[i]+" și "+(n?u[r]:a[r])}function B(e,n=!1,t=!1){if(0===e)return"";if(e<100)return R(e,n,t);const i=Math.trunc(e/100),r=e%100,o=p[i];return 0===r?o:o+" "+R(r,n,t)}function $(e,n){const t=y[n-1];return t?1===e?t.article+" "+t.singular:21===e&&t.needsDe?"douăzeci și una de "+t.plural:B(e,!0)+(t.needsDe&&e>=20?" de ":" ")+t.plural:B(e,!0)}function j(e,n){if(0n===e)return g;if(e<1000n){const t="feminine"===n;return B(Number(e),t)}return function(e,n){const t=[];let i=e;for(;i>0n;)t.push(Number(i%1000n)),i/=1000n;let r="";for(let e=t.length-1;e>=0;e--){const i=t[e];if(0===i)continue;let o;o=0===e?B(i,"feminine"===n):$(i,e),r&&o?r+=" "+o:o&&(r=o)}return r}(e,n)}const x={gender:"masculine"},D={gender:["masculine","feminine"]};function P(r,s){const{isNegative:a,integerPart:u,decimalPart:l}=function(r){const o=typeof r;if("bigint"==typeof r)return r<0n?{isNegative:!0,integerPart:-r}:{isNegative:!1,integerPart:r};if("number"==typeof r){if(!Number.isFinite(r))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(r)?r<0?{isNegative:!0,integerPart:BigInt(-r)}:{isNegative:!1,integerPart:BigInt(r)}:i(n(r))}if("string"==typeof r)return i(function(n){const i=n.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid number format: "${n}"`);return t(i)?e(i):i}(r));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(r);o(u,I,l);const{gender:c}=function(e,n,t){const i={...n};if(void 0===e)return i;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof i[o])throw new TypeError(`Option "${o}" must be a ${typeof i[o]}, got ${typeof s}`);if(void 0!==t&&Object.hasOwn(t,o)){const e=t[o];if(!e.includes(s))throw new RangeError(`Option "${o}" must be one of: ${e.join(", ")} — got ${JSON.stringify(s)}`)}i[o]=s}}return i}(s,x,D);let f="";return a&&(f=d+" "),f+=j(u,c),l&&(f+=" virgulă "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=g,t++;const i=e.slice(t);if(i){n&&(n+=" ");const e=BigInt(i);n+=e<1000n?B(Number(e),!1,!0):j(e,{})}return n}(l)),f}function T(e){if(0===e)return"";if(e<10)return m[e];if(e<20)return b[e-10];const n=e%10,t=Math.trunc(e/10);return 0===n?w[t]:f[t]+" și "+m[n]}function S(e){if(0n===e)return"";if(1n===e)return m[1];if(e<100n)return T(Number(e));if(e<1000n){const n=Number(e/100n),t=Number(e%100n);return 0===t?h:p[n]+" "+T(t)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return 1===n?z:$(n,1)+" "+z;let i;if(i=1===n?"o mie":$(n,1),t<100)return i+" "+T(t);const r=Math.trunc(t/100),o=t%100;return 0===o?i+" "+h:i+" "+p[r]+" "+T(o)}const n=Number(e/1000000n),t=e%1000000n;if(0n===t)return 1===n?N:$(n,2)+" "+N;let i;return i=1===n?"un milion":$(n,2),i+" "+S(t)}function M(n){const i=function(n){const i=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const i=n.trim();if(0===i.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===i[0])throw new RangeError("Ordinals cannot be negative");if(i.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(i)){const n=e(i);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(i);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${i}`)}(n);return o(i,E),S(i)}function F(e){const{isNegative:t,dollars:i,cents:s}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:r(n(e))}if("string"==typeof e)return r(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(i,O);const a=[];if(t&&a.push(d),i>0n||0n===s)if(1n===i)a.push("un leu");else{const e=j(i,"masculine"),n=i%100n;a.push(e+(i>=20n&&(0n===n||n>=20n)?" de ":" ")+"lei")}if(s>0n){const e=Number(s);if(1===e)a.push("un ban");else if(e>=20){const n=R(e,!1);a.push(n+" de "+v)}else{const n=R(e,!1);a.push(n+" "+v)}}return a.join(" ")}export{x as cardinalDefaults,I as cardinalMax,D as cardinalValues,O as currencyMax,E as ordinalMax,P as toCardinal,F as toCurrency,M as toOrdinal};
|
package/dist/ro-RO.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ro-RO v5.
|
|
2
|
-
var e,n;e=this,n=function(e){"use strict";function n(e){let[n,
|
|
1
|
+
/*! n2words/ro-RO v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const i=parseInt(t,10);let r="";"-"===n[0]&&(r="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),a=(-1===o?n.length:o)+i;return a>=s.length?r+s+"0".repeat(a-s.length):a<=0?r+"0."+"0".repeat(-a)+s:r+s.slice(0,a)+"."+s.slice(a)}function t(e){const t=e.toString();return i(t)?n(t):t}function i(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const i=e.slice(0,t)||"0",r=e.slice(t+1);return{isNegative:n,integerPart:BigInt(i),decimalPart:r}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);i(t)&&(t=n(t));const r="-"===t[0];r&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:r,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",a=(t.slice(o+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(s),cents:BigInt(a)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const i=n.toString().length-1,r=n===10n**BigInt(i)?`10^${i} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function a(e){return 10n**BigInt(3*(e+1))}const u=["","unu","doi","trei","patru","cinci","șase","șapte","opt","nouă"],l=["","una","două","trei","patru","cinci","șase","șapte","opt","nouă"],c=["zece","unsprezece","douăsprezece","treisprezece","paisprezece","cincisprezece","șaisprezece","șaptesprezece","optsprezece","nouăsprezece"],f=["zece","unsprezece","doisprezece","treisprezece","paisprezece","cincisprezece","șaisprezece","șaptesprezece","optsprezece","nouăsprezece"],p=["","","douăzeci","treizeci","patruzeci","cincizeci","șaizeci","șaptezeci","optzeci","nouăzeci"],g=["","o sută","două sute","trei sute","patru sute","cinci sute","șase sute","șapte sute","opt sute","nouă sute"],d="zero",m="minus",b=["","primul","al doilea","al treilea","al patrulea","al cincilea","al șaselea","al șaptelea","al optulea","al nouălea"],h=["al zecelea","al unsprezecelea","al doisprezecelea","al treisprezecelea","al paisprezecelea","al cincisprezecelea","al șaisprezecelea","al șaptesprezecelea","al optsprezecelea","al nouăsprezecelea"],w=["","","al douăzecilea","al treizecilea","al patruzecilea","al cincizecilea","al șaizecilea","al șaptezecilea","al optzecilea","al nouăzecilea"],z="al sutălea",v="al miilea",N="al milionulea",y="bani",I=[{singular:"mie",plural:"mii",article:"o",feminine:!0,needsDe:!0},{singular:"milion",plural:"milioane",article:"un",feminine:!1,needsDe:!0},{singular:"miliard",plural:"miliarde",article:"un",feminine:!1,needsDe:!0},{singular:"trilion",plural:"trilioane",article:"un",feminine:!1,needsDe:!0},{singular:"cvadrilion",plural:"cvadrilioane",article:"un",feminine:!1,needsDe:!0},{singular:"cvintilion",plural:"cvintilioane",article:"un",feminine:!1,needsDe:!0},{singular:"sextilion",plural:"sextilioane",article:"un",feminine:!1,needsDe:!0},{singular:"septilion",plural:"septilioane",article:"un",feminine:!1,needsDe:!0},{singular:"octilion",plural:"octilioane",article:"un",feminine:!1,needsDe:!0}],O=a(I.length),E=10n**BigInt(9),R=a(I.length);function B(e,n=!1,t=!1){if(0===e)return"";if(e<10)return n?l[e]:u[e];if(e<20)return t?f[e-10]:c[e-10];const i=Math.trunc(e/10),r=e%10;return 0===r?p[i]:p[i]+" și "+(n?l[r]:u[r])}function $(e,n=!1,t=!1){if(0===e)return"";if(e<100)return B(e,n,t);const i=Math.trunc(e/100),r=e%100,o=g[i];return 0===r?o:o+" "+B(r,n,t)}function x(e,n){const t=I[n-1];return t?1===e?t.article+" "+t.singular:21===e&&t.needsDe?"douăzeci și una de "+t.plural:$(e,!0)+(t.needsDe&&e>=20?" de ":" ")+t.plural:$(e,!0)}function j(e,n){if(0n===e)return d;if(e<1000n){const t="feminine"===n;return $(Number(e),t)}return function(e,n){const t=[];let i=e;for(;i>0n;)t.push(Number(i%1000n)),i/=1000n;let r="";for(let e=t.length-1;e>=0;e--){const i=t[e];if(0===i)continue;let o;o=0===e?$(i,"feminine"===n):x(i,e),r&&o?r+=" "+o:o&&(r=o)}return r}(e,n)}const D={gender:"masculine"},P={gender:["masculine","feminine"]};function T(e){if(0===e)return"";if(e<10)return b[e];if(e<20)return h[e-10];const n=e%10,t=Math.trunc(e/10);return 0===n?w[t]:p[t]+" și "+b[n]}function S(e){if(0n===e)return"";if(1n===e)return b[1];if(e<100n)return T(Number(e));if(e<1000n){const n=Number(e/100n),t=Number(e%100n);return 0===t?z:g[n]+" "+T(t)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return 1===n?v:x(n,1)+" "+v;let i;if(i=1===n?"o mie":x(n,1),t<100)return i+" "+T(t);const r=Math.trunc(t/100),o=t%100;return 0===o?i+" "+z:i+" "+g[r]+" "+T(o)}const n=Number(e/1000000n),t=e%1000000n;if(0n===t)return 1===n?N:x(n,2)+" "+N;let i;return i=1===n?"un milion":x(n,2),i+" "+S(t)}const M={roRO:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(i(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const i=BigInt(e);if(i<=0n)throw new RangeError("Ordinals must be positive integers");return i}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,E),S(t)}};e.currency={roRO:function(e){const{isNegative:n,dollars:i,cents:r}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(i,R);const a=[];if(n&&a.push(m),i>0n||0n===r)if(1n===i)a.push("un leu");else{const e=j(i,"masculine"),n=i%100n;a.push(e+(i>=20n&&(0n===n||n>=20n)?" de ":" ")+"lei")}if(r>0n){const e=Number(r);if(1===e)a.push("un ban");else if(e>=20){const n=B(e,!1);a.push(n+" de "+y)}else{const n=B(e,!1);a.push(n+" "+y)}}return a.join(" ")}},e.ordinal=M,e.roRO=function(e,o){const{isNegative:a,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)}:r(t(e))}if("string"==typeof e)return r(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return i(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,O,l);const{gender:c}=function(e,n,t){const i={...n};if(void 0===e)return i;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof i[o])throw new TypeError(`Option "${o}" must be a ${typeof i[o]}, got ${typeof s}`);if(void 0!==t&&Object.hasOwn(t,o)){const e=t[o];if(!e.includes(s))throw new RangeError(`Option "${o}" must be one of: ${e.join(", ")} — got ${JSON.stringify(s)}`)}i[o]=s}}return i}(o,D,P);let f="";return a&&(f=m+" "),f+=j(u,c),l&&(f+=" virgulă "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=d,t++;const i=e.slice(t);if(i){n&&(n+=" ");const e=BigInt(i);n+=e<1000n?$(Number(e),!1,!0):j(e,{})}return n}(l)),f}},"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/ru-RU.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ru-RU v5.
|
|
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
|
|
1
|
+
/*! n2words/ru-RU v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3*(e+1))}function u(e,n,t){const r={...n};if(void 0===e)return r;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const i=Object.keys(n);for(const[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=["","одна","две","три","четыре","пять","шесть","семь","восемь","девять"],l=["десять","одиннадцать","двенадцать","тринадцать","четырнадцать","пятнадцать","шестнадцать","семнадцать","восемнадцать","девятнадцать"],g=["","","двадцать","тридцать","сорок","пятьдесят","шестьдесят","семьдесят","восемьдесят","девяносто"],a=["","сто","двести","триста","четыреста","пятьсот","шестьсот","семьсот","восемьсот","девятьсот"],h="ноль",p="минус",b=[["тысяча","тысячи","тысяч"],["миллион","миллиона","миллионов"],["миллиард","миллиарда","миллиардов"],["триллион","триллиона","триллионов"],["квадриллион","квадриллиона","квадриллионов"],["квинтиллион","квинтиллиона","квинтиллионов"],["секстиллион","секстиллиона","секстиллионов"],["септиллион","септиллиона","септиллионов"],["октиллион","октиллиона","октиллионов"],["нониллион","нониллиона","нониллионов"]],m=["","первый","второй","третий","четвёртый","пятый","шестой","седьмой","восьмой","девятый"],d=["десятый","одиннадцатый","двенадцатый","тринадцатый","четырнадцатый","пятнадцатый","шестнадцатый","семнадцатый","восемнадцатый","девятнадцатый"],w=["","","двадцатый","тридцатый","сороковой","пятидесятый","шестидесятый","семидесятый","восьмидесятый","девяностый"],N=["","сотый","двухсотый","трёхсотый","четырёхсотый","пятисотый","шестисотый","семисотый","восьмисотый","девятисотый"],v=["тысячный","миллионный","миллиардный","триллионный","квадриллионный","квинтиллионный","секстиллионный","септиллионный","октиллионный","нониллионный"],y=["","","двух","трёх","четырёх","пяти","шести","семи","восьми","девяти"],I=["рубль","рубля","рублей"],E=["копейка","копейки","копеек"];function O(e,n){const t="bigint"==typeof e?Number(e):e,r=t%10,i=t%100;return i>=11&&i<=19?n[2]:1===r?n[0]:r>=2&&r<=4?n[1]:n[2]}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(a[r]),t>1&&i.push(g[t]),1===t?i.push(l[n]):n>0&&i.push(c[n]),i.join(" ")}function R(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]),t>1&&i.push(g[t]),1===t?i.push(l[n]):n>0&&i.push(f[n]),i.join(" ")}function $(e,n){if(0n===e)return h;const t="feminine"===n;if(e<1000n)return t?R(Number(e)):B(Number(e));if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n);let i=R(n)+" "+O(n,b[0]);return r>0&&(i+=" "+(t?R(r):B(r))),i}return function(e,n){const t="feminine"===n,r=e.toString(),i=r.length,o=[],s=i%3;let u=0;for(s>0&&(o.push(Number(r.slice(0,s))),u=s);u<i;)o.push(Number(r.slice(u,u+3))),u+=3;const c=[];let f=o.length-1;for(let e=0;e<o.length;e++){const n=o[e];if(0!==n)if(0===f)c.push(t?R(n):B(n));else{const e=O(n,b[f-1]),t=1===f?R(n):B(n);c.push(t+" "+e)}f--}return c.join(" ")}(e,n)}const j=s(b.length),P=s(v.length),x=s(b.length),S={gender:"masculine"},M={gender:["masculine","feminine"]};function T(i,s){const{isNegative:c,integerPart:f,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(f,j,l);const{gender:g}=u(s,S,M);let a="";return c&&(a=p+" "),a+=$(f,g),l&&(a+=" запятая "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=h,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=$(BigInt(i),n)),t}(l,g)),a}function F(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?m[n]:1===t?d[n]:0===n?w[t]:g[t]+" "+m[n]}function k(e){if(e<100n)return F(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),r=n%100;return 0===r?N[t]:a[t]+" "+F(r)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?1===n?v[0]:n<10?y[n]+v[0]:R(n)+" "+v[0]:R(n)+" "+O(n,b[0])+" "+k(BigInt(t))}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;let s=r.length-1;for(;s>=0&&0===r[s];)s--;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const t=e===s;if(0===c)u.push(t?k(BigInt(n)):B(n));else if(t)if(1===n)u.push(v[c-1]);else{const e=1===c?R(n):B(n);u.push(e+" "+v[c-1])}else{const e=O(n,b[c-1]),t=1===c?R(n):B(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}function C(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,P),k(r)}const J={and:!0};function L(e,t){const{isNegative:r,dollars:s,cents:c}=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,x);const{and:f}=u(t,J);let l="";return r&&(l=p+" "),(s>0n||0n===c)&&(l+=$(s,"masculine"),l+=" "+O(s,I)),c>0n&&(s>0n&&(l+=f?" и ":" "),l+=$(c,"feminine"),l+=" "+O(c,E)),l}export{S as cardinalDefaults,j as cardinalMax,M as cardinalValues,J as currencyDefaults,x as currencyMax,P as ordinalMax,T as toCardinal,L as toCurrency,C as toOrdinal};
|
package/dist/ru-RU.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ru-RU v5.
|
|
2
|
-
var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e){if(
|
|
1
|
+
/*! n2words/ru-RU v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(e){return 10n**BigInt(3*(e+1))}function 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=["","один","два","три","четыре","пять","шесть","семь","восемь","девять"],l=["","одна","две","три","четыре","пять","шесть","семь","восемь","девять"],a=["десять","одиннадцать","двенадцать","тринадцать","четырнадцать","пятнадцать","шестнадцать","семнадцать","восемнадцать","девятнадцать"],g=["","","двадцать","тридцать","сорок","пятьдесят","шестьдесят","семьдесят","восемьдесят","девяносто"],p=["","сто","двести","триста","четыреста","пятьсот","шестьсот","семьсот","восемьсот","девятьсот"],h="ноль",b="минус",d=[["тысяча","тысячи","тысяч"],["миллион","миллиона","миллионов"],["миллиард","миллиарда","миллиардов"],["триллион","триллиона","триллионов"],["квадриллион","квадриллиона","квадриллионов"],["квинтиллион","квинтиллиона","квинтиллионов"],["секстиллион","секстиллиона","секстиллионов"],["септиллион","септиллиона","септиллионов"],["октиллион","октиллиона","октиллионов"],["нониллион","нониллиона","нониллионов"]],m=["","первый","второй","третий","четвёртый","пятый","шестой","седьмой","восьмой","девятый"],w=["десятый","одиннадцатый","двенадцатый","тринадцатый","четырнадцатый","пятнадцатый","шестнадцатый","семнадцатый","восемнадцатый","девятнадцатый"],N=["","","двадцатый","тридцатый","сороковой","пятидесятый","шестидесятый","семидесятый","восьмидесятый","девяностый"],y=["","сотый","двухсотый","трёхсотый","четырёхсотый","пятисотый","шестисотый","семисотый","восьмисотый","девятисотый"],v=["тысячный","миллионный","миллиардный","триллионный","квадриллионный","квинтиллионный","секстиллионный","септиллионный","октиллионный","нониллионный"],I=["","","двух","трёх","четырёх","пяти","шести","семи","восьми","девяти"],E=["рубль","рубля","рублей"],O=["копейка","копейки","копеек"];function R(e,n){const t="bigint"==typeof e?Number(e):e,r=t%10,i=t%100;return i>=11&&i<=19?n[2]:1===r?n[0]:r>=2&&r<=4?n[1]:n[2]}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(p[r]),t>1&&i.push(g[t]),1===t?i.push(a[n]):n>0&&i.push(f[n]),i.join(" ")}function $(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(p[r]),t>1&&i.push(g[t]),1===t?i.push(a[n]):n>0&&i.push(l[n]),i.join(" ")}function j(e,n){if(0n===e)return h;const t="feminine"===n;if(e<1000n)return t?$(Number(e)):B(Number(e));if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n);let i=$(n)+" "+R(n,d[0]);return r>0&&(i+=" "+(t?$(r):B(r))),i}return function(e,n){const t="feminine"===n,r=e.toString(),i=r.length,o=[],s=i%3;let u=0;for(s>0&&(o.push(Number(r.slice(0,s))),u=s);u<i;)o.push(Number(r.slice(u,u+3))),u+=3;const c=[];let f=o.length-1;for(let e=0;e<o.length;e++){const n=o[e];if(0!==n)if(0===f)c.push(t?$(n):B(n));else{const e=R(n,d[f-1]),t=1===f?$(n):B(n);c.push(t+" "+e)}f--}return c.join(" ")}(e,n)}const x=u(d.length),P=u(v.length),T=u(d.length),S={gender:"masculine"},M={gender:["masculine","feminine"]};function U(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?m[n]:1===t?w[n]:0===n?N[t]:g[t]+" "+m[n]}function F(e){if(e<100n)return U(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),r=n%100;return 0===r?y[t]:p[t]+" "+U(r)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?1===n?v[0]:n<10?I[n]+v[0]:$(n)+" "+v[0]:$(n)+" "+R(n,d[0])+" "+F(BigInt(t))}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;let s=r.length-1;for(;s>=0&&0===r[s];)s--;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const t=e===s;if(0===c)u.push(t?F(BigInt(n)):B(n));else if(t)if(1===n)u.push(v[c-1]);else{const e=1===c?$(n):B(n);u.push(e+" "+v[c-1])}else{const e=R(n,d[c-1]),t=1===c?$(n):B(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}const k={and:!0},C={ruRU:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,P),F(t)}};e.currency={ruRU: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,T);const{and:f}=c(n,k);let l="";return r&&(l=b+" "),(i>0n||0n===u)&&(l+=j(i,"masculine"),l+=" "+R(i,E)),u>0n&&(i>0n&&(l+=f?" и ":" "),l+=j(u,"feminine"),l+=" "+R(u,O)),l}},e.ordinal=C,e.ruRU=function(e,o){const{isNegative:u,integerPart:f,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(f,x,l);const{gender:a}=c(o,S,M);let g="";return u&&(g=b+" "),g+=j(f,a),l&&(g+=" запятая "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=h,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=j(BigInt(i),n)),t}(l,a)),g}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/sr-Cyrl-RS.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/sr-Cyrl-RS v5.
|
|
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
|
|
1
|
+
/*! n2words/sr-Cyrl-RS v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
function e(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function s(e){return 10n**BigInt(3*(e+1))}function u(e,n,t){const r={...n};if(void 0===e)return r;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const i=Object.keys(n);for(const[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=["","једна","две","три","четири","пет","шест","седам","осам","девет"],g=["десет","једанаест","дванаест","тринаест","четрнаест","петнаест","шеснаест","седамнаест","осамнаест","деветнаест"],l=["","","двадесет","тридесет","четрдесет","педесет","шездесет","седамдесет","осамдесет","деведесет"],a=["","сто","двеста","триста","четиристо","петсто","шесто","седамсто","осамсто","девестo"],h="нула",p="минус",b=["","први","други","трећи","четврти","пети","шести","седми","осми","девети"],m=["десети","једанаести","дванаести","тринаести","четрнаести","петнаести","шеснаести","седамнаести","осамнаести","деветнаести"],d=["","","двадесети","тридесети","четрдесети","педесети","шездесети","седамдесети","осамдесети","деведесети"],w=["","стоти","двестоти","тристоти","четиристоти","петстоти","шестоти","седамстоти","осамстоти","деветстоти"],N=["хиљадити","милионити","милијардити","билионити","билијардити","трилионити","трилијардити","квадрилионити","квадрилијардити"],v=["динар","динара","динара"],y=["пара","паре","пара"],I=[["хиљада","хиљаде","хиљада"],["милион","милиона","милиона"],["милијарда","милијарде","милијарда"],["билион","билиона","билиона"],["билијарда","билијарде","билијарда"],["трилион","трилиона","трилиона"],["трилијарда","трилијарде","трилијарда"],["квадрилион","квадрилиона","квадрилиона"],["квадрилијарда","квадрилијарде","квадрилијарда"]],E=s(I.length),O=s(N.length),B=s(I.length);function R(e,n){const t="bigint"==typeof e?Number(e):e,r=t%10,i=t%100;return i>=11&&i<=19?n[2]:1===r?n[0]:r>=2&&r<=4?n[1]:n[2]}function $(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]),t>1&&i.push(l[t]),1===t?i.push(g[n]):n>0&&i.push(c[n]),i.join(" ")}function j(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]),t>1&&i.push(l[t]),1===t?i.push(g[n]):n>0&&i.push(f[n]),i.join(" ")}function P(e,n){return 0n===e?h:e<1000n?"feminine"===n?j(Number(e)):$(Number(e)):function(e,n){const t=e.toString(),r=t.length,i=[],o=r%3;let s=0;for(o>0&&(i.push(Number(t.slice(0,o))),s=o);s<r;)i.push(Number(t.slice(s,s+3))),s+=3;const u=[];let c=i.length-1;for(let e=0;e<i.length;e++){const t=i[e];if(0!==t)if(0===c)u.push("feminine"===n?j(t):$(t));else{const e=R(t,I[c-1]),n=c%2==1?j(t):$(t);u.push(n+" "+e)}c--}return u.join(" ")}(e,n)}const x={gender:"masculine"},S={gender:["masculine","feminine"]};function M(i,s){const{isNegative:c,integerPart:f,decimalPart:g}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(f,E,g);const{gender:l}=u(s,x,S);let a="";return c&&(a=p+" "),a+=P(f,l),g&&(a+=" запета "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=h,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=P(BigInt(i),n)),t}(g,l)),a}function T(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?b[n]:1===t?m[n]:0===n?d[t]:l[t]+" "+b[n]}function F(e){if(e<100n)return T(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),r=n%100;return 0===r?w[t]:a[t]+" "+T(r)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?1===n?N[0]:j(n)+" "+N[0]:j(n)+" "+R(n,I[0])+" "+F(BigInt(t))}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;let s=r.length-1;for(;s>=0&&0===r[s];)s--;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const t=e===s;if(0===c)u.push(t?F(BigInt(n)):$(n));else if(t)if(1===n)u.push(N[c-1]);else{const e=c%2==1?j(n):$(n);u.push(e+" "+N[c-1])}else{const e=R(n,I[c-1]),t=c%2==1?j(n):$(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}function k(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,O),F(r)}const C={and:!0};function J(e,t){const{isNegative:r,dollars:s,cents:c}=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,B);const{and:f}=u(t,C);let g="";return r&&(g=p+" "),(s>0n||0n===c)&&(g+=P(s,"masculine"),g+=" "+R(s,v)),c>0n&&(s>0n&&(g+=f?" и ":" "),g+=P(c,"feminine"),g+=" "+R(c,y)),g}export{x as cardinalDefaults,E as cardinalMax,S as cardinalValues,C as currencyDefaults,B as currencyMax,O as ordinalMax,M as toCardinal,J as toCurrency,k as toOrdinal};
|
package/dist/sr-Cyrl-RS.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/sr-Cyrl-RS v5.
|
|
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
|
|
1
|
+
/*! n2words/sr-Cyrl-RS v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+r;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const r=n.toString().length-1,i=n===10n**BigInt(r)?`10^${r} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${i}`)}function u(e){return 10n**BigInt(3*(e+1))}function 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=["","један","два","три","четири","пет","шест","седам","осам","девет"],l=["","једна","две","три","четири","пет","шест","седам","осам","девет"],a=["десет","једанаест","дванаест","тринаест","четрнаест","петнаест","шеснаест","седамнаест","осамнаест","деветнаест"],g=["","","двадесет","тридесет","четрдесет","педесет","шездесет","седамдесет","осамдесет","деведесет"],p=["","сто","двеста","триста","четиристо","петсто","шесто","седамсто","осамсто","девестo"],h="нула",d="минус",b=["","први","други","трећи","четврти","пети","шести","седми","осми","девети"],m=["десети","једанаести","дванаести","тринаести","четрнаести","петнаести","шеснаести","седамнаести","осамнаести","деветнаести"],w=["","","двадесети","тридесети","четрдесети","педесети","шездесети","седамдесети","осамдесети","деведесети"],y=["","стоти","двестоти","тристоти","четиристоти","петстоти","шестоти","седамстоти","осамстоти","деветстоти"],N=["хиљадити","милионити","милијардити","билионити","билијардити","трилионити","трилијардити","квадрилионити","квадрилијардити"],v=["динар","динара","динара"],I=["пара","паре","пара"],E=[["хиљада","хиљаде","хиљада"],["милион","милиона","милиона"],["милијарда","милијарде","милијарда"],["билион","билиона","билиона"],["билијарда","билијарде","билијарда"],["трилион","трилиона","трилиона"],["трилијарда","трилијарде","трилијарда"],["квадрилион","квадрилиона","квадрилиона"],["квадрилијарда","квадрилијарде","квадрилијарда"]],O=u(E.length),R=u(N.length),B=u(E.length);function $(e,n){const t="bigint"==typeof e?Number(e):e,r=t%10,i=t%100;return i>=11&&i<=19?n[2]:1===r?n[0]:r>=2&&r<=4?n[1]:n[2]}function j(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(p[r]),t>1&&i.push(g[t]),1===t?i.push(a[n]):n>0&&i.push(f[n]),i.join(" ")}function x(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(p[r]),t>1&&i.push(g[t]),1===t?i.push(a[n]):n>0&&i.push(l[n]),i.join(" ")}function P(e,n){return 0n===e?h:e<1000n?"feminine"===n?x(Number(e)):j(Number(e)):function(e,n){const t=e.toString(),r=t.length,i=[],o=r%3;let s=0;for(o>0&&(i.push(Number(t.slice(0,o))),s=o);s<r;)i.push(Number(t.slice(s,s+3))),s+=3;const u=[];let c=i.length-1;for(let e=0;e<i.length;e++){const t=i[e];if(0!==t)if(0===c)u.push("feminine"===n?x(t):j(t));else{const e=$(t,E[c-1]),n=c%2==1?x(t):j(t);u.push(n+" "+e)}c--}return u.join(" ")}(e,n)}const S={gender:"masculine"},T={gender:["masculine","feminine"]};function M(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?b[n]:1===t?m[n]:0===n?w[t]:g[t]+" "+b[n]}function C(e){if(e<100n)return M(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),r=n%100;return 0===r?y[t]:p[t]+" "+M(r)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?1===n?N[0]:x(n)+" "+N[0]:x(n)+" "+$(n,E[0])+" "+C(BigInt(t))}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;let s=r.length-1;for(;s>=0&&0===r[s];)s--;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const t=e===s;if(0===c)u.push(t?C(BigInt(n)):j(n));else if(t)if(1===n)u.push(N[c-1]);else{const e=c%2==1?x(n):j(n);u.push(e+" "+N[c-1])}else{const e=$(n,E[c-1]),t=c%2==1?x(n):j(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}const F={and:!0},k={srCyrlRS: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,R),C(t)}};e.currency={srCyrlRS: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,B);const{and:f}=c(n,F);let l="";return r&&(l=d+" "),(i>0n||0n===u)&&(l+=P(i,"masculine"),l+=" "+$(i,v)),u>0n&&(i>0n&&(l+=f?" и ":" "),l+=P(u,"feminine"),l+=" "+$(u,I)),l}},e.ordinal=k,e.srCyrlRS=function(e,o){const{isNegative:u,integerPart:f,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(f,O,l);const{gender:a}=c(o,S,T);let g="";return u&&(g=d+" "),g+=P(f,a),l&&(g+=" запета "+function(e,n){let t="",r=0;for(;r<e.length&&"0"===e[r];)t&&(t+=" "),t+=h,r++;const i=e.slice(r);return i&&(t&&(t+=" "),t+=P(BigInt(i),n)),t}(l,a)),g}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/sr-Latn-RS.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/sr-Latn-RS v5.
|
|
2
|
-
function e(e){let[t,
|
|
1
|
+
/*! n2words/sr-Latn-RS v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
|
+
function e(e){let[t,n]=e.toLowerCase().split("e");const i=parseInt(n,10);let r="";"-"===t[0]&&(r="-",t=t.slice(1));const s=t.indexOf("."),o=-1===s?t:t.slice(0,s)+t.slice(s+1),a=(-1===s?t.length:s)+i;return a>=o.length?r+o+"0".repeat(a-o.length):a<=0?r+"0."+"0".repeat(-a)+o:r+o.slice(0,a)+"."+o.slice(a)}function t(t){const i=t.toString();return n(i)?e(i):i}function n(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 i=e.slice(0,n)||"0",r=e.slice(n+1);return{isNegative:t,integerPart:BigInt(i),decimalPart:r}}function r(t){let i=t.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid currency format: "${t}"`);n(i)&&(i=e(i));const r="-"===i[0];r&&(i=i.slice(1));const s=i.indexOf(".");if(-1===s)return{isNegative:r,dollars:BigInt(i),cents:0n};const o=i.slice(0,s)||"0",a=(i.slice(s+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(o),cents:BigInt(a)}}function s(e,t,n){if(null===t)return;if(e<t&&!(n&&BigInt(n)>=t))return;const i=t.toString().length-1,r=t===10n**BigInt(i)?`10^${i} - 1`:""+(t-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function o(e){return 10n**BigInt(3*(e+1))}function a(e,t,n){const i={...t};if(void 0===e)return i;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[s,o]of Object.entries(e)){if(!Object.hasOwn(t,s))throw new TypeError(`Unknown option "${s}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof i[s])throw new TypeError(`Option "${s}" must be a ${typeof i[s]}, got ${typeof o}`);if(void 0!==n&&Object.hasOwn(n,s)){const e=n[s];if(!e.includes(o))throw new RangeError(`Option "${s}" must be one of: ${e.join(", ")} — got ${JSON.stringify(o)}`)}i[s]=o}}return i}const u=["","jedan","dva","tri","četiri","pet","šest","sedam","osam","devet"],l=["","jedna","dve","tri","četiri","pet","šest","sedam","osam","devet"],c=["deset","jedanaest","dvanaest","trinaest","četrnaest","petnaest","šesnaest","sedamnaest","osamnaest","devetnaest"],d=["","","dvadeset","trideset","četrdeset","pedeset","šezdeset","sedamdeset","osamdeset","devedeset"],f=["","sto","dvesta","trista","četiristo","petsto","šesto","sedamsto","osamsto","devetsto"],g="nula",m="minus",p=["","prvi","drugi","treći","četvrti","peti","šesti","sedmi","osmi","deveti"],h=["deseti","jedanaesti","dvanaesti","trinaesti","četrnaesti","petnaesti","šesnaesti","sedamnaesti","osamnaesti","devetnaesti"],b=["","","dvadeseti","trideseti","četrdeseti","pedeseti","šezdeseti","sedamdeseti","osamdeseti","devedeseti"],v=["","stoti","dvestoti","tristoti","četiristoti","petstoti","šestoti","sedamstoti","osamstoti","devetstoti"],w=["hiljaditi","milioniti","milijarditi","bilioniti","bilijarditi","trilioniti","trilijarditi","kvadrilioniti","kvadrilijarditi"],N=["dinar","dinara","dinara"],j=["para","pare","para"],y=[["hiljada","hiljade","hiljada"],["milion","miliona","miliona"],["milijarda","milijarde","milijarda"],["bilion","biliona","biliona"],["bilijarda","bilijarde","bilijarda"],["trilion","triliona","triliona"],["trilijarda","trilijarde","trilijarda"],["kvadrilion","kvadriliona","kvadriliona"],["kvadrilijarda","kvadrilijarde","kvadrilijarda"]],I=o(y.length),E=o(w.length),O=o(y.length);function B(e,t){const n="bigint"==typeof e?Number(e):e,i=n%10,r=n%100;return r>=11&&r<=19?t[2]:1===i?t[0]:i>=2&&i<=4?t[1]:t[2]}function R(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(f[i]),n>1&&r.push(d[n]),1===n?r.push(c[t]):t>0&&r.push(u[t]),r.join(" ")}function $(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(f[i]),n>1&&r.push(d[n]),1===n?r.push(c[t]):t>0&&r.push(l[t]),r.join(" ")}function k(e,t){return 0n===e?g:e<1000n?"feminine"===t?$(Number(e)):R(Number(e)):function(e,t){const n=e.toString(),i=n.length,r=[],s=i%3;let o=0;for(s>0&&(r.push(Number(n.slice(0,s))),o=s);o<i;)r.push(Number(n.slice(o,o+3))),o+=3;const a=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n)if(0===u)a.push("feminine"===t?$(n):R(n));else{const e=B(n,y[u-1]),t=u%2==1?$(n):R(n);a.push(t+" "+e)}u--}return a.join(" ")}(e,t)}const P={gender:"masculine"},x={gender:["masculine","feminine"]};function S(r,o){const{isNegative:u,integerPart:l,decimalPart:c}=function(r){const s=typeof r;if("bigint"==typeof r)return r<0n?{isNegative:!0,integerPart:-r}:{isNegative:!1,integerPart:r};if("number"==typeof r){if(!Number.isFinite(r))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(r)?r<0?{isNegative:!0,integerPart:BigInt(-r)}:{isNegative:!1,integerPart:BigInt(r)}:i(t(r))}if("string"==typeof r)return i(function(t){const i=t.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid number format: "${t}"`);return n(i)?e(i):i}(r));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(r);s(l,I,c);const{gender:d}=a(o,P,x);let f="";return u&&(f=m+" "),f+=k(l,d),c&&(f+=" zapeta "+function(e,t){let n="",i=0;for(;i<e.length&&"0"===e[i];)n&&(n+=" "),n+=g,i++;const r=e.slice(i);return r&&(n&&(n+=" "),n+=k(BigInt(r),t)),n}(c,d)),f}function M(e){if(0===e)return"";const t=e%10,n=Math.trunc(e/10);return 0===n?p[t]:1===n?h[t]:0===t?b[n]:d[n]+" "+p[t]}function T(e){if(e<100n)return M(Number(e));if(e<1000n){const t=Number(e),n=Math.trunc(t/100),i=t%100;return 0===i?v[n]:f[n]+" "+M(i)}if(e<1000000n){const t=Number(e/1000n),n=Number(e%1000n);return 0===n?1===t?w[0]:$(t)+" "+w[0]:$(t)+" "+B(t,y[0])+" "+T(BigInt(n))}return function(e){const t=e.toString(),n=t.length,i=[],r=n%3;let s=0;for(r>0&&(i.push(Number(t.slice(0,r))),s=r);s<n;)i.push(Number(t.slice(s,s+3))),s+=3;let o=i.length-1;for(;o>=0&&0===i[o];)o--;const a=[];let u=i.length-1;for(let e=0;e<i.length;e++){const t=i[e];if(0!==t){const n=e===o;if(0===u)a.push(n?T(BigInt(t)):R(t));else if(n)if(1===t)a.push(w[u-1]);else{const e=u%2==1?$(t):R(t);a.push(e+" "+w[u-1])}else{const e=B(t,y[u-1]),n=u%2==1?$(t):R(t);a.push(n+" "+e)}}u--}return a.join(" ")}(e)}function z(t){const i=function(t){const i=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 i=t.trim();if(0===i.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===i[0])throw new RangeError("Ordinals cannot be negative");if(i.includes("."))throw new RangeError("Ordinals must be whole numbers");if(n(i)){const t=e(i);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(i);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${t}"`,{cause:e})}}(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${i}`)}(t);return s(i,E),T(i)}const F={and:!0};function C(e,n){const{isNegative:i,dollars:o,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}:r(t(e))}if("string"==typeof e)return r(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(o,O);const{and:l}=a(n,F);let c="";return i&&(c=m+" "),(o>0n||0n===u)&&(c+=k(o,"masculine"),c+=" "+B(o,N)),u>0n&&(o>0n&&(c+=l?" i ":" "),c+=k(u,"feminine"),c+=" "+B(u,j)),c}export{P as cardinalDefaults,I as cardinalMax,x as cardinalValues,F as currencyDefaults,O as currencyMax,E as ordinalMax,S as toCardinal,C as toCurrency,z as toOrdinal};
|