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/dist/ta-IN.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ta-IN v5.1.
|
|
1
|
+
/*! n2words/ta-IN 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+2*(e-1))}const a="பூஜ்ஜியம்",c="மைனஸ்",f=["","முதல்","இரண்டாவது","மூன்றாவது","நான்காவது","ஐந்தாவது","ஆறாவது"],g=["பூஜ்ஜியம்","ஒன்று","இரண்டு","மூன்று","நான்கு","ஐந்து","ஆறு","ஏழு","எட்டு","ஒன்பது","பத்து","பதினொன்று","பன்னிரண்டு","பதிமூன்று","பதினான்கு","பதினைந்து","பதினாறு","பதினேழு","பதினெட்டு","பத்தொன்பது","இருபது","இருபத்தொன்று","இருபத்திரண்டு","இருபத்திமூன்று","இருபத்திநான்கு","இருபத்தைந்து","இருபத்தாறு","இருபத்தேழு","இருபத்தெட்டு","இருபத்தொன்பது","முப்பது","முப்பத்தொன்று","முப்பத்திரண்டு","முப்பத்திமூன்று","முப்பத்திநான்கு","முப்பத்தைந்து","முப்பத்தாறு","முப்பத்தேழு","முப்பத்தெட்டு","முப்பத்தொன்பது","நாற்பது","நாற்பத்தொன்று","நாற்பத்திரண்டு","நாற்பத்திமூன்று","நாற்பத்திநான்கு","நாற்பத்தைந்து","நாற்பத்தாறு","நாற்பத்தேழு","நாற்பத்தெட்டு","நாற்பத்தொன்பது","ஐம்பது","ஐம்பத்தொன்று","ஐம்பத்திரண்டு","ஐம்பத்திமூன்று","ஐம்பத்திநான்கு","ஐம்பத்தைந்து","ஐம்பத்தாறு","ஐம்பத்தேழு","ஐம்பத்தெட்டு","ஐம்பத்தொன்பது","அறுபது","அறுபத்தொன்று","அறுபத்திரண்டு","அறுபத்திமூன்று","அறுபத்திநான்கு","அறுபத்தைந்து","அறுபத்தாறு","அறுபத்தேழு","அறுபத்தெட்டு","அறுபத்தொன்பது","எழுபது","எழுபத்தொன்று","எழுபத்திரண்டு","எழுபத்திமூன்று","எழுபத்திநான்கு","எழுபத்தைந்து","எழுபத்தாறு","எழுபத்தேழு","எழுபத்தெட்டு","எழுபத்தொன்பது","எண்பது","எண்பத்தொன்று","எண்பத்திரண்டு","எண்பத்திமூன்று","எண்பத்திநான்கு","எண்பத்தைந்து","எண்பத்தாறு","எண்பத்தேழு","எண்பத்தெட்டு","எண்பத்தொன்பது","தொண்ணூறு","தொண்ணூற்று ஒன்று","தொண்ணூற்று இரண்டு","தொண்ணூற்று மூன்று","தொண்ணூற்று நான்கு","தொண்ணூற்று ஐந்து","தொண்ணூற்று ஆறு","தொண்ணூற்று ஏழு","தொண்ணூற்று எட்டு","தொண்ணூற்று ஒன்பது"],l=["","நூறு","இருநூறு","முன்னூறு","நானூறு","ஐநூறு","அறுநூறு","எழுநூறு","எண்நூறு","தொள்ளாயிரம்"],d=["","நூற்று","இருநூற்று","முன்னூற்று","நானூற்று","ஐநூற்று","அறுநூற்று","எழுநூற்று","எண்நூற்று","தொள்ளாயிரத்து"],b=["ஒன்று","இரண்டு","மூன்று","நான்கு","ஐந்து","ஆறு","ஏழு","எட்டு","ஒன்பது"],m=["","ஆயிரம்","லட்சம்","கோடி","அரபு","கராபு","நீல்","பத்ம","சங்கு"],p=u(m.length),h=u(m.length),w=u(m.length);function N(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?l[n]:d[n]+" "+g[t]}function v(e){if(0n===e)return a;if(e<1000n)return N(Number(e));const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;const r=[];for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(r.push(0===e?N(t):1===t?"ஒரு":g[t]),e>0&&m[e]&&r.push(m[e]))}return r.join(" ")}const I={taIN: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),(i=t)>=1n&&i<=6n?f[Number(i)]:v(i)+"ஆவது";var i}};e.currency={taIN: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=c+" "),(r>0n||0n===i)&&(u+=v(r)+" ரூபாய்"),i>0n&&(r>0n&&(u+=" "),u+=v(i)+" பைசா"),u}},e.ordinal=I,e.taIN=function(e){const{isNegative:o,integerPart:u,decimalPart:f}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,p);let g="";return o&&(g=c+" "),g+=v(u),f&&(g+=" புள்ளி "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?a:b[e-1])}return n.join(" ")}(f)),g}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/te-IN.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/te-IN v5.1.
|
|
1
|
+
/*! n2words/te-IN 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+2*(e-1))}const u="సున్నా",a="మైనస్",c=["","మొదటి","రెండవ","మూడవ","నాలుగవ","ఐదవ","ఆరవ"],g=["సున్నా","ఒకటి","రెండు","మూడు","నాలుగు","ఐదు","ఆరు","ఏడు","ఎనిమిది","తొమ్మిది","పది","పదకొండు","పన్నెండు","పదమూడు","పద్నాలుగు","పదిహేను","పదహారు","పదిహేడు","పద్దెనిమిది","పంతొమ్మిది","ఇరవై","ఇరవై ఒక్కటి","ఇరవై రెండు","ఇరవై మూడు","ఇరవై నాలుగు","ఇరవై ఐదు","ఇరవై ఆరు","ఇరవై ఏడు","ఇరవై ఎనిమిది","ఇరవై తొమ్మిది","ముప్పై","ముప్పై ఒకటి","ముప్పై రెండు","ముప్పై మూడు","ముప్పై నాలుగు","ముప్పై ఐదు","ముప్పై ఆరు","ముప్పై ఏడు","ముప్పై ఎనిమిది","ముప్పై తొమ్మిది","నలభై","నలభై ఒకటి","నలభై రెండు","నలభై మూడు","నలభై నాలుగు","నలభై ఐదు","నలభై ఆరు","నలభై ఏడు","నలభై ఎనిమిది","నలభై తొమ్మిది","యాభై","యాభై ఒకటి","యాభై రెండు","యాభై మూడు","యాభై నాలుగు","యాభై ఐదు","యాభై ఆరు","యాభై ఏడు","యాభై ఎనిమిది","యాభై తొమ్మిది","అరవై","అరవై ఒకటి","అరవై రెండు","అరవై మూడు","అరవై నాలుగు","అరవై ఐదు","అరవై ఆరు","అరవై ఏడు","అరవై ఎనిమిది","అరవై తొమ్మిది","డెబ్బై","డెబ్బై ఒకటి","డెబ్బై రెండు","డెబ్బై మూడు","డెబ్బై నాలుగు","డెబ్బై ఐదు","డెబ్బై ఆరు","డెబ్బై ఏడు","డెబ్బై ఎనిమిది","డెబ్బై తొమ్మిది","ఎనభై","ఎనభై ఒకటి","ఎనభై రెండు","ఎనభై మూడు","ఎనభై నాలుగు","ఎనభై ఐదు","ఎనభై ఆరు","ఎనభై ఏడు","ఎనభై ఎనిమిది","ఎనభై తొమ్మిది","తొంభై","తొంభై ఒకటి","తొంభై రెండు","తొంభై మూడు","తొంభై నాలుగు","తొంభై ఐదు","తొంభై ఆరు","తొంభై ఏడు","తొంభై ఎనిమిది","తొంభై తొమ్మిది"],f=["","వంద","రెండు వందలు","మూడు వందలు","నాలుగు వందలు","ఐదు వందలు","ఆరు వందలు","ఏడు వందలు","ఎనిమిది వందలు","తొమ్మిది వందలు"],l=["ఒకటి","రెండు","మూడు","నాలుగు","ఐదు","ఆరు","ఏడు","ఎనిమిది","తొమ్మిది"],m=["","వెయ్యి","లక్ష","కోటి","అరబ్","ఖరబ్","నిల్","పడ్మ","శంకు"],b=s(m.length),w=s(m.length),d=s(m.length);function h(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?f[n]:f[n]+" "+g[t]}function p(e){if(0n===e)return u;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):1===t?"ఒక":g[t]),e>0&&m[e]&&r.push(m[e]))}return r.join(" ")}function N(i){const{isNegative:s,integerPart:c,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(c,b);let f="";return s&&(f=a+" "),f+=p(c),g&&(f+=" పాయింట్ "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?u:l[e-1])}return n.join(" ")}(g)),f}function v(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,w),(i=r)>=1n&&i<=6n?c[Number(i)]:p(i)+"వ";var i}function I(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,d);let u="";return t&&(u=a+" "),(r>0n||0n===s)&&(u+=p(r),u+=" "+(1n===r?"రూపాయి":"రూపాయలు")),s>0n&&(r>0n&&(u+=" "),u+=p(s),u+=" "+(1n===s?"పైసా":"పైసలు")),u}export{b as cardinalMax,d as currencyMax,w as ordinalMax,N as toCardinal,I as toCurrency,v as toOrdinal};
|
package/dist/te-IN.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/te-IN v5.1.
|
|
1
|
+
/*! n2words/te-IN 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+2*(e-1))}const a="సున్నా",c="మైనస్",f=["","మొదటి","రెండవ","మూడవ","నాలుగవ","ఐదవ","ఆరవ"],g=["సున్నా","ఒకటి","రెండు","మూడు","నాలుగు","ఐదు","ఆరు","ఏడు","ఎనిమిది","తొమ్మిది","పది","పదకొండు","పన్నెండు","పదమూడు","పద్నాలుగు","పదిహేను","పదహారు","పదిహేడు","పద్దెనిమిది","పంతొమ్మిది","ఇరవై","ఇరవై ఒక్కటి","ఇరవై రెండు","ఇరవై మూడు","ఇరవై నాలుగు","ఇరవై ఐదు","ఇరవై ఆరు","ఇరవై ఏడు","ఇరవై ఎనిమిది","ఇరవై తొమ్మిది","ముప్పై","ముప్పై ఒకటి","ముప్పై రెండు","ముప్పై మూడు","ముప్పై నాలుగు","ముప్పై ఐదు","ముప్పై ఆరు","ముప్పై ఏడు","ముప్పై ఎనిమిది","ముప్పై తొమ్మిది","నలభై","నలభై ఒకటి","నలభై రెండు","నలభై మూడు","నలభై నాలుగు","నలభై ఐదు","నలభై ఆరు","నలభై ఏడు","నలభై ఎనిమిది","నలభై తొమ్మిది","యాభై","యాభై ఒకటి","యాభై రెండు","యాభై మూడు","యాభై నాలుగు","యాభై ఐదు","యాభై ఆరు","యాభై ఏడు","యాభై ఎనిమిది","యాభై తొమ్మిది","అరవై","అరవై ఒకటి","అరవై రెండు","అరవై మూడు","అరవై నాలుగు","అరవై ఐదు","అరవై ఆరు","అరవై ఏడు","అరవై ఎనిమిది","అరవై తొమ్మిది","డెబ్బై","డెబ్బై ఒకటి","డెబ్బై రెండు","డెబ్బై మూడు","డెబ్బై నాలుగు","డెబ్బై ఐదు","డెబ్బై ఆరు","డెబ్బై ఏడు","డెబ్బై ఎనిమిది","డెబ్బై తొమ్మిది","ఎనభై","ఎనభై ఒకటి","ఎనభై రెండు","ఎనభై మూడు","ఎనభై నాలుగు","ఎనభై ఐదు","ఎనభై ఆరు","ఎనభై ఏడు","ఎనభై ఎనిమిది","ఎనభై తొమ్మిది","తొంభై","తొంభై ఒకటి","తొంభై రెండు","తొంభై మూడు","తొంభై నాలుగు","తొంభై ఐదు","తొంభై ఆరు","తొంభై ఏడు","తొంభై ఎనిమిది","తొంభై తొమ్మిది"],l=["","వంద","రెండు వందలు","మూడు వందలు","నాలుగు వందలు","ఐదు వందలు","ఆరు వందలు","ఏడు వందలు","ఎనిమిది వందలు","తొమ్మిది వందలు"],d=["ఒకటి","రెండు","మూడు","నాలుగు","ఐదు","ఆరు","ఏడు","ఎనిమిది","తొమ్మిది"],b=["","వెయ్యి","లక్ష","కోటి","అరబ్","ఖరబ్","నిల్","పడ్మ","శంకు"],m=u(b.length),p=u(b.length),h=u(b.length);function w(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?l[n]:l[n]+" "+g[t]}function N(e){if(0n===e)return a;if(e<1000n)return w(Number(e));const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;const r=[];for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(r.push(0===e?w(t):1===t?"ఒక":g[t]),e>0&&b[e]&&r.push(b[e]))}return r.join(" ")}const v={teIN:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,p),(i=t)>=1n&&i<=6n?f[Number(i)]:N(i)+"వ";var i}};e.currency={teIN:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(r,h);let u="";return n&&(u=c+" "),(r>0n||0n===i)&&(u+=N(r),u+=" "+(1n===r?"రూపాయి":"రూపాయలు")),i>0n&&(r>0n&&(u+=" "),u+=N(i),u+=" "+(1n===i?"పైసా":"పైసలు")),u}},e.ordinal=v,e.teIN=function(e){const{isNegative:o,integerPart:u,decimalPart:f}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,m);let g="";return o&&(g=c+" "),g+=N(u),f&&(g+=" పాయింట్ "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?a:d[e-1])}return n.join(" ")}(f)),g}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/th-TH.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/th-TH v5.1.
|
|
1
|
+
/*! n2words/th-TH 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),u=(-1===s?n.length:s)+r;return u>=o.length?i+o+"0".repeat(u-o.length):u<=0?i+"0."+"0".repeat(-u)+o:i+o.slice(0,u)+"."+o.slice(u)}function n(n){const r=n.toString();return t(r)?e(r):r}function t(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const s=r.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(r),cents:0n};const o=r.slice(0,s)||"0",u=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const s=null,o=s,u=s,c=s,a=["หนึ่ง","สอง","สาม","สี่","ห้า","หก","เจ็ด","แปด","เก้า"],g="ศูนย์";function f(e){if(0===e)return"";let n=e;const t=[],r=Math.trunc(n/1e5);n%=1e5;const i=Math.trunc(n/1e4);n%=1e4;const s=Math.trunc(n/1e3);n%=1e3;const o=Math.trunc(n/100);n%=100;const u=Math.trunc(n/10),c=n%10;return r>0&&t.push(a[r-1]+"แสน"),i>0&&t.push(1===i?"หนึ่งหมื่น":a[i-1]+"หมื่น"),s>0&&t.push(a[s-1]+"พัน"),o>0&&t.push(a[o-1]+"ร้อย"),u>0&&t.push(1===u?"สิบ":2===u?"ยี่สิบ":a[u-1]+"สิบ"),c>0&&t.push(1===c&&(u>0||r>0||i>0||s>0||o>0||u>0)?"เอ็ด":a[c-1]),t.join("")}function l(e){if(0n===e)return g;const n=function(e){const n=[];let t=e;const r=1000000n;for(;t>0n;){const e=Number(t%r);n.unshift(e),t/=r}return n}(e),t=[];for(let e=0;e<n.length;e++){const r=n[e];if(0===r)continue;t.push(f(r));const i=n.length-e-1;i>0&&t.push("ล้าน".repeat(i))}return t.join("")}function h(i){const{isNegative:s,integerPart:o,decimalPart:u}=function(i){const s=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let c="";return s&&(c="ลบ"),c+=l(o),u&&(c+="จุด"+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?g:a[e-1])}return n.join("")}(u)),c}function p(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return"ที่"+l(r)}function m(e){const{isNegative:t,dollars:r,cents:s}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);let o="";return t&&(o="ลบ"),o+=l(r),o+="บาท",s>0n?(o+=l(s),o+="สตางค์"):o+="ถ้วน",o}export{o as cardinalMax,c as currencyMax,u as ordinalMax,h as toCardinal,m as toCurrency,p as toOrdinal};
|
package/dist/th-TH.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/th-TH v5.1.
|
|
1
|
+
/*! n2words/th-TH 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)}}const s=["หนึ่ง","สอง","สาม","สี่","ห้า","หก","เจ็ด","แปด","เก้า"],u="ศูนย์";function c(e){if(0===e)return"";let n=e;const t=[],r=Math.trunc(n/1e5);n%=1e5;const i=Math.trunc(n/1e4);n%=1e4;const o=Math.trunc(n/1e3);n%=1e3;const u=Math.trunc(n/100);n%=100;const c=Math.trunc(n/10),a=n%10;return r>0&&t.push(s[r-1]+"แสน"),i>0&&t.push(1===i?"หนึ่งหมื่น":s[i-1]+"หมื่น"),o>0&&t.push(s[o-1]+"พัน"),u>0&&t.push(s[u-1]+"ร้อย"),c>0&&t.push(1===c?"สิบ":2===c?"ยี่สิบ":s[c-1]+"สิบ"),a>0&&t.push(1===a&&(c>0||r>0||i>0||o>0||u>0||c>0)?"เอ็ด":s[a-1]),t.join("")}function a(e){if(0n===e)return u;const n=function(e){const n=[];let t=e;const r=1000000n;for(;t>0n;){const e=Number(t%r);n.unshift(e),t/=r}return n}(e),t=[];for(let e=0;e<n.length;e++){const r=n[e];if(0===r)continue;t.push(c(r));const i=n.length-e-1;i>0&&t.push("ล้าน".repeat(i))}return t.join("")}const f={thTH:function(e){return"ที่"+a(function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e))}};e.currency={thTH:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);let s="";return n&&(s="ลบ"),s+=a(r),s+="บาท",i>0n?(s+=a(i),s+="สตางค์"):s+="ถ้วน",s}},e.ordinal=f,e.thTH=function(e){const{isNegative:o,integerPart:c,decimalPart:f}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);let g="";return o&&(g="ลบ"),g+=a(c),f&&(g+="จุด"+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?u:s[e-1])}return n.join("")}(f)),g}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/tr-TR.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/tr-TR v5.1.
|
|
1
|
+
/*! n2words/tr-TR 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ört","beş","altı","yedi","sekiz","dokuz"],c=["on","on bir","on iki","on üç","on dört","on beş","on altı","on yedi","on sekiz","on dokuz"],l=["","","yirmi","otuz","kırk","elli","altmış","yetmiş","seksen","doksan"],a="bin",f="sıfır",g="eksi",d=["milyon","milyar","trilyon","katrilyon","kentilyon"],b=s(d.length+1),p=s(d.length+1),m=s(d.length+1),h={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yedinci",8:"sekizinci",9:"dokuzuncu",10:"onuncu"};function w(n,e=" "){if(0===n)return"";const t=n%10,r=Math.trunc(n/10)%10,i=Math.trunc(n/100),o=[];i>0&&o.push(1===i?"yüz":u[i]+e+"yüz");const s=n%100;return 0===s||o.push(s<10?u[t]:s<20?c[t].replace(" ",e):0===t?l[r]:l[r]+e+u[t]),o.join(e)}function y(n,e){if(0n===n)return f;const t=e?"":" ";if(n<1000n)return w(Number(n),t);if(n<1000000n){const e=Number(n/1000n),r=Number(n%1000n);let i;return i=1===e?a:w(e,t)+t+a,r>0&&(i+=t+w(r,t)),i}return function(n,e){const t=e?"":" ",r=n.toString(),i=r.length,o=[],s=i%3;let u=0;for(s>0&&(o.push(Number(r.slice(0,s))),u=s);u<i;)o.push(Number(r.slice(u,u+3))),u+=3;const c=[];let l=o.length-1;for(let n=0;n<o.length;n++){const e=o[n];if(0!==e){const n=w(e,t);c.push(0===l?n:1===l?1===e?a:n+t+a:n+t+d[l-2])}l--}return c.join(t)}(n,e)}const N={dropSpaces:!1};function v(i,s){const{isNegative:u,integerPart:c,decimalPart:l}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(e(i))}if("string"==typeof i)return r(function(e){const r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${e}"`);return t(r)?n(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(c,b,l);const{dropSpaces:a}=function(n,e){const t={...e};if(void 0===n)return t;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const r=Object.keys(e);for(const[i,o]of Object.entries(n)){if(!Object.hasOwn(e,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(s,N),d=a?"":" ";let p="";return u&&(p=g+d),p+=y(c,a),l&&(p+=d+"virgül"+d+function(n,e){const t=e?"":" ";let r="",i=0;for(;i<n.length&&"0"===n[i];)r&&(r+=t),r+=f,i++;const o=n.slice(i);return o&&(r&&(r+=t),r+=y(BigInt(o),e)),r}(l,a)),p}function I(e){const r=function(e){const r=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const r=e.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const e=n(r);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(e);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const n=BigInt(r);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(e);return o(r,p),function(n){if(n>=1n&&n<=10n)return h[Number(n)];const e=y(n,!0);return e+function(n){for(let e=n.length-1;e>=0;e--){const t=n[e];if("aıou".includes(t))return"ou".includes(t)?"uncu":"ıncı";if("eiöü".includes(t))return"öü".includes(t)?"üncü":"inci"}return"inci"}(e)}(r)}function E(n){const{isNegative:t,dollars:r,cents:s}=function(n){const t=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);o(r,m);let u="";return t&&(u=g+" "),(r>0n||0n===s)&&(u+=y(r,!1)+" lira"),s>0n&&(r>0n&&(u+=" "),u+=y(s,!1)+" kuruş"),u}export{N as cardinalDefaults,b as cardinalMax,m as currencyMax,p as ordinalMax,v as toCardinal,E as toCurrency,I as toOrdinal};
|
package/dist/tr-TR.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/tr-TR v5.1.
|
|
1
|
+
/*! n2words/tr-TR 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 c=["","bir","iki","üç","dört","beş","altı","yedi","sekiz","dokuz"],l=["on","on bir","on iki","on üç","on dört","on beş","on altı","on yedi","on sekiz","on dokuz"],f=["","","yirmi","otuz","kırk","elli","altmış","yetmiş","seksen","doksan"],a="bin",g="sıfır",d="eksi",p=["milyon","milyar","trilyon","katrilyon","kentilyon"],b=u(p.length+1),m=u(p.length+1),h=u(p.length+1),w={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yedinci",8:"sekizinci",9:"dokuzuncu",10:"onuncu"};function y(e,n=" "){if(0===e)return"";const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100),o=[];i>0&&o.push(1===i?"yüz":c[i]+n+"yüz");const s=e%100;return 0===s||o.push(s<10?c[t]:s<20?l[t].replace(" ",n):0===t?f[r]:f[r]+n+c[t]),o.join(n)}function v(e,n){if(0n===e)return g;const t=n?"":" ";if(e<1000n)return y(Number(e),t);if(e<1000000n){const n=Number(e/1000n),r=Number(e%1000n);let i;return i=1===n?a:y(n,t)+t+a,r>0&&(i+=t+y(r,t)),i}return function(e,n){const t=n?"":" ",r=e.toString(),i=r.length,o=[],s=i%3;let u=0;for(s>0&&(o.push(Number(r.slice(0,s))),u=s);u<i;)o.push(Number(r.slice(u,u+3))),u+=3;const c=[];let l=o.length-1;for(let e=0;e<o.length;e++){const n=o[e];if(0!==n){const e=y(n,t);c.push(0===l?e:1===l?1===n?a:e+t+a:e+t+p[l-2])}l--}return c.join(t)}(e,n)}const N={dropSpaces:!1},I={trTR:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,m),function(e){if(e>=1n&&e<=10n)return w[Number(e)];const n=v(e,!0);return n+function(e){for(let n=e.length-1;n>=0;n--){const t=e[n];if("aıou".includes(t))return"ou".includes(t)?"uncu":"ıncı";if("eiöü".includes(t))return"öü".includes(t)?"üncü":"inci"}return"inci"}(n)}(t)}};e.currency={trTR:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(r,h);let u="";return n&&(u=d+" "),(r>0n||0n===i)&&(u+=v(r,!1)+" lira"),i>0n&&(r>0n&&(u+=" "),u+=v(i,!1)+" kuruş"),u}},e.ordinal=I,e.trTR=function(e,o){const{isNegative:u,integerPart:c,decimalPart:l}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(c,b,l);const{dropSpaces:f}=function(e,n){const t={...n};if(void 0===e)return t;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[i,o]of Object.entries(e)){if(!Object.hasOwn(n,i))throw new TypeError(`Unknown option "${i}" — expected one of: ${r.join(", ")}`);if(void 0!==o){if(typeof o!=typeof t[i])throw new TypeError(`Option "${i}" must be a ${typeof t[i]}, got ${typeof o}`);t[i]=o}}return t}(o,N),a=f?"":" ";let p="";return u&&(p=d+a),p+=v(c,f),l&&(p+=a+"virgül"+a+function(e,n){const t=n?"":" ";let r="",i=0;for(;i<e.length&&"0"===e[i];)r&&(r+=t),r+=g,i++;const o=e.slice(i);return o&&(r&&(r+=t),r+=v(BigInt(o),n)),r}(l,f)),p}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/uk-UA.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/uk-UA v5.1.
|
|
1
|
+
/*! n2words/uk-UA v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
2
|
function e(e){let[n,t]=e.toLowerCase().split("e");const i=parseInt(t,10);let r="";"-"===n[0]&&(r="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+i;return u>=s.length?r+s+"0".repeat(u-s.length):u<=0?r+"0."+"0".repeat(-u)+s:r+s.slice(0,u)+"."+s.slice(u)}function n(n){const i=n.toString();return t(i)?e(i):i}function t(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const i=e.slice(0,t)||"0",r=e.slice(t+1);return{isNegative:n,integerPart:BigInt(i),decimalPart:r}}function r(n){let i=n.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid currency format: "${n}"`);t(i)&&(i=e(i));const r="-"===i[0];r&&(i=i.slice(1));const o=i.indexOf(".");if(-1===o)return{isNegative:r,dollars:BigInt(i),cents:0n};const s=i.slice(0,o)||"0",u=(i.slice(o+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(s),cents:BigInt(u)}}function o(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const i=n.toString().length-1,r=n===10n**BigInt(i)?`10^${i} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function s(e){return 10n**BigInt(3*(e+1))}const u=["","один","два","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],c=["","одна","двi","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],f=["десять","одинадцять","дванадцять","тринадцять","чотирнадцять","п'ятнадцять","шiстнадцять","сiмнадцять","вiсiмнадцять","дев'ятнадцять"],g=["","","двадцять","тридцять","сорок","п'ятдесят","шiстдесят","сiмдесят","вiсiмдесят","дев'яносто"],l=["","сто","двiстi","триста","чотириста","п'ятсот","шiстсот","сiмсот","вiсiмсот","дев'ятсот"],a="нуль",h="мiнус",p=["","перший","другий","третiй","четвертий","п'ятий","шостий","сьомий","восьмий","дев'ятий"],b=["десятий","одинадцятий","дванадцятий","тринадцятий","чотирнадцятий","п'ятнадцятий","шiстнадцятий","сiмнадцятий","вiсiмнадцятий","дев'ятнадцятий"],m=["","","двадцятий","тридцятий","сороковий","п'ятдесятий","шiстдесятий","сiмдесятий","вiсiмдесятий","дев'яностий"],d=["","сотий","двохсотий","трьохсотий","чотирьохсотий","п'ятисотий","шестисотий","семисотий","восьмисотий","дев'ятисотий"],w=["тисячний","мiльйонний","мiльярдний","трильйонний"],N=["гривня","гривнi","гривень"],v=["копiйка","копiйки","копiйок"],y=[["тисяча","тисячi","тисяч"],["мiльйон","мiльйони","мiльйонiв"],["мiльярд","мiльярди","мiльярдiв"],["трильйон","трильйони","трильйонiв"],["квадрильйон","квадрильйони","квадрильйонiв"],["квiнтильйон","квiнтильйони","квiнтильйонiв"],["секстильйон","секстильйони","секстильйонiв"],["септильйон","септильйони","септильйонiв"],["октильйон","октильйони","октильйонiв"]];function I(e,n){const t="bigint"==typeof e?Number(e):e,i=t%10,r=t%100;return r>=11&&r<=19?n[2]:1===i?n[0]:i>=2&&i<=4?n[1]:n[2]}function E(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(l[i]),t>1&&r.push(g[t]),1===t?r.push(f[n]):n>0&&r.push(u[n]),r.join(" ")}function O(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(l[i]),t>1&&r.push(g[t]),1===t?r.push(f[n]):n>0&&r.push(c[n]),r.join(" ")}function B(e,n){return 0n===e?a:e<1000n?"feminine"===n?O(Number(e)):E(Number(e)):function(e,n){const t=e.toString(),i=t.length,r=[],o=i%3;let s=0;for(o>0&&(r.push(Number(t.slice(0,o))),s=o);s<i;)r.push(Number(t.slice(s,s+3))),s+=3;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const t=r[e];if(0!==t)if(0===c)u.push("feminine"===n?O(t):E(t));else{const e=I(t,y[c-1]),n=1===c?O(t):E(t);u.push(n+" "+e)}c--}return u.join(" ")}(e,n)}const R=s(y.length),$=s(w.length),j=s(y.length),P={gender:"masculine"},x={gender:["masculine","feminine"]};function S(r,s){const{isNegative:u,integerPart:c,decimalPart:f}=function(r){const o=typeof r;if("bigint"==typeof r)return r<0n?{isNegative:!0,integerPart:-r}:{isNegative:!1,integerPart:r};if("number"==typeof r){if(!Number.isFinite(r))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(r)?r<0?{isNegative:!0,integerPart:BigInt(-r)}:{isNegative:!1,integerPart:BigInt(r)}:i(n(r))}if("string"==typeof r)return i(function(n){const i=n.trim();if(0===i.length||Number.isNaN(Number(i)))throw new RangeError(`Invalid number format: "${n}"`);return t(i)?e(i):i}(r));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(r);o(c,R,f);const{gender:g}=function(e,n,t){const i={...n};if(void 0===e)return i;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof i[o])throw new TypeError(`Option "${o}" must be a ${typeof i[o]}, got ${typeof s}`);if(void 0!==t&&Object.hasOwn(t,o)){const e=t[o];if(!e.includes(s))throw new RangeError(`Option "${o}" must be one of: ${e.join(", ")} — got ${JSON.stringify(s)}`)}i[o]=s}}return i}(s,P,x);let l="";return u&&(l=h+" "),l+=B(c,g),f&&(l+=" кома "+function(e,n){let t="",i=0;for(;i<e.length&&"0"===e[i];)t&&(t+=" "),t+=a,i++;const r=e.slice(i);return r&&(t&&(t+=" "),t+=B(BigInt(r),n)),t}(f,g)),l}function M(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?p[n]:1===t?b[n]:0===n?m[t]:g[t]+" "+p[n]}function T(e){if(e<100n)return M(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),i=n%100;return 0===i?d[t]:l[t]+" "+M(i)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return 1===n?w[0]:O(n)+" "+w[0];const i=I(n,y[0]);return O(n)+" "+i+" "+T(BigInt(t))}return function(e){const n=e.toString(),t=n.length,i=[],r=t%3;let o=0;for(r>0&&(i.push(Number(n.slice(0,r))),o=r);o<t;)i.push(Number(n.slice(o,o+3))),o+=3;let s=i.length-1;for(;s>=0&&0===i[s];)s--;const u=[];let c=i.length-1;for(let e=0;e<i.length;e++){const n=i[e];if(0!==n){const t=e===s;if(0===c)u.push(t?T(BigInt(n)):E(n));else if(t)if(1===n)u.push(w[c-1]);else{const e=1===c?O(n):E(n);u.push(e+" "+w[c-1])}else{const e=I(n,y[c-1]),t=1===c?O(n):E(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}function F(n){const i=function(n){const i=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const i=n.trim();if(0===i.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===i[0])throw new RangeError("Ordinals cannot be negative");if(i.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(i)){const n=e(i);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(i);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${i}`)}(n);return o(i,$),T(i)}function k(e){const{isNegative:t,dollars:i,cents:s}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:r(n(e))}if("string"==typeof e)return r(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(i,j);let u="";return t&&(u=h+" "),(i>0n||0n===s)&&(u+=B(i,"feminine"),u+=" "+I(i,N)),s>0n&&(i>0n&&(u+=" "),u+=B(s,"feminine"),u+=" "+I(s,v)),u}export{P as cardinalDefaults,R as cardinalMax,x as cardinalValues,j as currencyMax,$ as ordinalMax,S as toCardinal,k as toCurrency,F as toOrdinal};
|
package/dist/uk-UA.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/uk-UA v5.1.
|
|
1
|
+
/*! n2words/uk-UA 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 i=parseInt(t,10);let r="";"-"===n[0]&&(r="-",n=n.slice(1));const o=n.indexOf("."),s=-1===o?n:n.slice(0,o)+n.slice(o+1),u=(-1===o?n.length:o)+i;return u>=s.length?r+s+"0".repeat(u-s.length):u<=0?r+"0."+"0".repeat(-u)+s:r+s.slice(0,u)+"."+s.slice(u)}function t(e){const t=e.toString();return i(t)?n(t):t}function i(e){return e.includes("e")||e.includes("E")}function r(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const i=e.slice(0,t)||"0",r=e.slice(t+1);return{isNegative:n,integerPart:BigInt(i),decimalPart:r}}function o(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);i(t)&&(t=n(t));const r="-"===t[0];r&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:r,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:r,dollars:BigInt(s),cents:BigInt(u)}}function s(e,n,t){if(null===n)return;if(e<n&&!(t&&BigInt(t)>=n))return;const i=n.toString().length-1,r=n===10n**BigInt(i)?`10^${i} - 1`:""+(n-1n);throw new RangeError(`Number too large to convert: the largest supported value is ${r}`)}function u(e){return 10n**BigInt(3*(e+1))}const c=["","один","два","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],f=["","одна","двi","три","чотири","п'ять","шiсть","сiм","вiсiм","дев'ять"],l=["десять","одинадцять","дванадцять","тринадцять","чотирнадцять","п'ятнадцять","шiстнадцять","сiмнадцять","вiсiмнадцять","дев'ятнадцять"],g=["","","двадцять","тридцять","сорок","п'ятдесят","шiстдесят","сiмдесят","вiсiмдесят","дев'яносто"],a=["","сто","двiстi","триста","чотириста","п'ятсот","шiстсот","сiмсот","вiсiмсот","дев'ятсот"],p="нуль",h="мiнус",b=["","перший","другий","третiй","четвертий","п'ятий","шостий","сьомий","восьмий","дев'ятий"],d=["десятий","одинадцятий","дванадцятий","тринадцятий","чотирнадцятий","п'ятнадцятий","шiстнадцятий","сiмнадцятий","вiсiмнадцятий","дев'ятнадцятий"],m=["","","двадцятий","тридцятий","сороковий","п'ятдесятий","шiстдесятий","сiмдесятий","вiсiмдесятий","дев'яностий"],w=["","сотий","двохсотий","трьохсотий","чотирьохсотий","п'ятисотий","шестисотий","семисотий","восьмисотий","дев'ятисотий"],N=["тисячний","мiльйонний","мiльярдний","трильйонний"],y=["гривня","гривнi","гривень"],v=["копiйка","копiйки","копiйок"],I=[["тисяча","тисячi","тисяч"],["мiльйон","мiльйони","мiльйонiв"],["мiльярд","мiльярди","мiльярдiв"],["трильйон","трильйони","трильйонiв"],["квадрильйон","квадрильйони","квадрильйонiв"],["квiнтильйон","квiнтильйони","квiнтильйонiв"],["секстильйон","секстильйони","секстильйонiв"],["септильйон","септильйони","септильйонiв"],["октильйон","октильйони","октильйонiв"]];function E(e,n){const t="bigint"==typeof e?Number(e):e,i=t%10,r=t%100;return r>=11&&r<=19?n[2]:1===i?n[0]:i>=2&&i<=4?n[1]:n[2]}function O(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(a[i]),t>1&&r.push(g[t]),1===t?r.push(l[n]):n>0&&r.push(c[n]),r.join(" ")}function B(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,i=Math.trunc(e/100),r=[];return i>0&&r.push(a[i]),t>1&&r.push(g[t]),1===t?r.push(l[n]):n>0&&r.push(f[n]),r.join(" ")}function R(e,n){return 0n===e?p:e<1000n?"feminine"===n?B(Number(e)):O(Number(e)):function(e,n){const t=e.toString(),i=t.length,r=[],o=i%3;let s=0;for(o>0&&(r.push(Number(t.slice(0,o))),s=o);s<i;)r.push(Number(t.slice(s,s+3))),s+=3;const u=[];let c=r.length-1;for(let e=0;e<r.length;e++){const t=r[e];if(0!==t)if(0===c)u.push("feminine"===n?B(t):O(t));else{const e=E(t,I[c-1]),n=1===c?B(t):O(t);u.push(n+" "+e)}c--}return u.join(" ")}(e,n)}const $=u(I.length),j=u(N.length),x=u(I.length),P={gender:"masculine"},T={gender:["masculine","feminine"]};function S(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10);return 0===t?b[n]:1===t?d[n]:0===n?m[t]:g[t]+" "+b[n]}function M(e){if(e<100n)return S(Number(e));if(e<1000n){const n=Number(e),t=Math.trunc(n/100),i=n%100;return 0===i?w[t]:a[t]+" "+S(i)}if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);if(0===t)return 1===n?N[0]:B(n)+" "+N[0];const i=E(n,I[0]);return B(n)+" "+i+" "+M(BigInt(t))}return function(e){const n=e.toString(),t=n.length,i=[],r=t%3;let o=0;for(r>0&&(i.push(Number(n.slice(0,r))),o=r);o<t;)i.push(Number(n.slice(o,o+3))),o+=3;let s=i.length-1;for(;s>=0&&0===i[s];)s--;const u=[];let c=i.length-1;for(let e=0;e<i.length;e++){const n=i[e];if(0!==n){const t=e===s;if(0===c)u.push(t?M(BigInt(n)):O(n));else if(t)if(1===n)u.push(N[c-1]);else{const e=1===c?B(n):O(n);u.push(e+" "+N[c-1])}else{const e=E(n,I[c-1]),t=1===c?B(n):O(n);u.push(t+" "+e)}}c--}return u.join(" ")}(e)}const k={ukUA:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(i(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const i=BigInt(e);if(i<=0n)throw new RangeError("Ordinals must be positive integers");return i}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,j),M(t)}};e.currency={ukUA:function(e){const{isNegative:n,dollars:i,cents:r}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(i,x);let u="";return n&&(u=h+" "),(i>0n||0n===r)&&(u+=R(i,"feminine"),u+=" "+E(i,y)),r>0n&&(i>0n&&(u+=" "),u+=R(r,"feminine"),u+=" "+E(r,v)),u}},e.ordinal=k,e.ukUA=function(e,o){const{isNegative:u,integerPart:c,decimalPart:f}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:r(t(e))}if("string"==typeof e)return r(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return i(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(c,$,f);const{gender:l}=function(e,n,t){const i={...n};if(void 0===e)return i;if(!function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e);const r=Object.keys(n);for(const[o,s]of Object.entries(e)){if(!Object.hasOwn(n,o))throw new TypeError(`Unknown option "${o}" — expected one of: ${r.join(", ")}`);if(void 0!==s){if(typeof s!=typeof i[o])throw new TypeError(`Option "${o}" must be a ${typeof i[o]}, got ${typeof s}`);if(void 0!==t&&Object.hasOwn(t,o)){const e=t[o];if(!e.includes(s))throw new RangeError(`Option "${o}" must be one of: ${e.join(", ")} — got ${JSON.stringify(s)}`)}i[o]=s}}return i}(o,P,T);let g="";return u&&(g=h+" "),g+=R(c,l),f&&(g+=" кома "+function(e,n){let t="",i=0;for(;i<e.length&&"0"===e[i];)t&&(t+=" "),t+=p,i++;const r=e.slice(i);return r&&(t&&(t+=" "),t+=R(BigInt(r),n)),t}(f,l)),g}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/ur-PK.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ur-PK v5.1.
|
|
1
|
+
/*! n2words/ur-PK 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=s(c.length),f=s(c.length),m=s(c.length);function b(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?g[n]+" سو":g[n]+" سو "+g[t]}function w(e){if(0n===e)return"صفر";if(e<1000n)return b(Number(e));const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;const r=[];for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(r.push(0===e?b(t):g[t]),e>0&&c[e]&&r.push(c[e]))}return r.join(" ")}function d(i){const{isNegative:s,integerPart:a,decimalPart:g}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(a,l,g);let c="";return s&&(c=u+" "),c+=w(a),g&&(c+=" اعشاریہ "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+="صفر",t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=w(BigInt(r))),n}(g)),c}function h(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return o(r,f),(i=r)>=1n&&i<=6n?a[Number(i)]:w(i)+"واں";var i}function p(e){const{isNegative:t,dollars:r,cents:s}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(r,m);let a="";return t&&(a=u+" "),(r>0n||0n===s)&&(a+=w(r),a+=" "+(1n===r?"روپیہ":"روپے")),s>0n&&(r>0n&&(a+=" "),a+=w(s),a+=" "+(1n===s?"پیسہ":"پیسے")),a}export{l as cardinalMax,m as currencyMax,f as ordinalMax,d as toCardinal,p as toCurrency,h as toOrdinal};
|
package/dist/ur-PK.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/ur-PK v5.1.
|
|
1
|
+
/*! n2words/ur-PK 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=u(f.length),d=u(f.length),b=u(f.length);function m(e){if(0===e)return"";if(e<100)return g[e];const n=Math.trunc(e/100),t=e%100;return 0===t?g[n]+" سو":g[n]+" سو "+g[t]}function h(e){if(0n===e)return"صفر";if(e<1000n)return m(Number(e));const n=[];n.push(Number(e%1000n));let t=e/1000n;for(;t>0n;)n.push(Number(t%100n)),t/=100n;const r=[];for(let e=n.length-1;e>=0;e--){const t=n[e];0!==t&&(r.push(0===e?m(t):g[t]),e>0&&f[e]&&r.push(f[e]))}return r.join(" ")}const p={urPK:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,d),(i=t)>=1n&&i<=6n?c[Number(i)]:h(i)+"واں";var i}};e.currency={urPK:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(r,b);let u="";return n&&(u=a+" "),(r>0n||0n===i)&&(u+=h(r),u+=" "+(1n===r?"روپیہ":"روپے")),i>0n&&(r>0n&&(u+=" "),u+=h(i),u+=" "+(1n===i?"پیسہ":"پیسے")),u}},e.ordinal=p,e.urPK=function(e){const{isNegative:o,integerPart:u,decimalPart:c}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,l,c);let g="";return o&&(g=a+" "),g+=h(u),c&&(g+=" اعشاریہ "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+="صفر",t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=h(BigInt(r))),n}(c)),g}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/vi-VN.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/vi-VN v5.1.
|
|
1
|
+
/*! n2words/vi-VN 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=["không","một","hai","ba","bốn","năm","sáu","bảy","tám","chín"],g=["","nghìn","triệu","tỷ","nghìn tỷ","triệu tỷ","tỷ tỷ"],c=s(g.length-1),l=s(g.length-1),a=s(g.length-1),f="không";function m(e){if(0===e)return u[0];if(e<10)return u[e];if(e<20){const n=e-10;return 0===n?"mười":5===n?"mười lăm":"mười "+u[n]}const n=e%10,t=Math.trunc(e/10),r=u[t]+" mươi";return 0===n?r:1===n?r+" mốt":5===n?r+" lăm":r+" "+u[n]}function h(e){if(0===e)return"";const n=Math.trunc(e/100),t=e%100;let r="";return n>0&&(r=u[n]+" trăm"),t>0&&(t<10?r?(r+=" lẻ ",r+=5===t?"năm":u[t]):r=u[t]:(r&&(r+=" "),r+=m(t))),r}function b(e){return 0===e?"":e<10?"lẻ "+(5===e?"năm":u[e]):"lẻ "+m(e)}function w(e){if(0n===e)return f;if(e<100n)return m(Number(e));if(e<1000n)return h(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),r=h(n)+" "+g[1];return 0===t?r:t<100?r+" "+b(t):r+" "+h(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=h(n);e&&s.push(u>0?e+" "+g[u]:e)}u--}const c=s.length;if(0===c)return f;if(1===c)return s[0];const l=r[r.length-1];if(l>0&&l<=99){let e=s[0];for(let n=1;n<c-1;n++)e+=" "+s[n];return e+" "+b(l)}let a=s[0];for(let e=1;e<c;e++)a+=" "+s[e];return a}(e)}function d(i){const{isNegative:s,integerPart:u,decimalPart:g}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"==typeof i)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(u,c,g);let l="";return s&&(l="âm "),l+=w(u),g&&(l+=" phẩy "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=f,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=w(BigInt(r))),n}(g)),l}function p(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return o(r,l),1n===(i=r)?"thứ nhất":"thứ "+w(i);var i}function N(e){const{isNegative:t,dollars:r}=function(e){const t=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"==typeof e)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);o(r,a);let s="";return t&&(s="âm "),s+=w(r),s+=" đồng",s}export{c as cardinalMax,a as currencyMax,l as ordinalMax,d as toCardinal,N as toCurrency,p as toOrdinal};
|
package/dist/vi-VN.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/vi-VN v5.1.
|
|
1
|
+
/*! n2words/vi-VN 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 c=["không","một","hai","ba","bốn","năm","sáu","bảy","tám","chín"],l=["","nghìn","triệu","tỷ","nghìn tỷ","triệu tỷ","tỷ tỷ"],f=u(l.length-1),a=u(l.length-1),g=u(l.length-1),m="không";function h(e){if(0===e)return c[0];if(e<10)return c[e];if(e<20){const n=e-10;return 0===n?"mười":5===n?"mười lăm":"mười "+c[n]}const n=e%10,t=Math.trunc(e/10),r=c[t]+" mươi";return 0===n?r:1===n?r+" mốt":5===n?r+" lăm":r+" "+c[n]}function b(e){if(0===e)return"";const n=Math.trunc(e/100),t=e%100;let r="";return n>0&&(r=c[n]+" trăm"),t>0&&(t<10?r?(r+=" lẻ ",r+=5===t?"năm":c[t]):r=c[t]:(r&&(r+=" "),r+=h(t))),r}function d(e){return 0===e?"":e<10?"lẻ "+(5===e?"năm":c[e]):"lẻ "+h(e)}function p(e){if(0n===e)return m;if(e<100n)return h(Number(e));if(e<1000n)return b(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n),r=b(n)+" "+l[1];return 0===t?r:t<100?r+" "+d(t):r+" "+b(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(n.slice(0,i))),o=i);o<t;)r.push(Number(n.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=b(n);e&&s.push(u>0?e+" "+l[u]:e)}u--}const c=s.length;if(0===c)return m;if(1===c)return s[0];const f=r[r.length-1];if(f>0&&f<=99){let e=s[0];for(let n=1;n<c-1;n++)e+=" "+s[n];return e+" "+d(f)}let a=s[0];for(let e=1;e<c;e++)a+=" "+s[e];return a}(e)}const w={viVN:function(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return s(t,a),1n===(i=t)?"thứ nhất":"thứ "+p(i);var i}};e.currency={viVN:function(e){const{isNegative:n,dollars:r}=function(e){const n=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"==typeof e)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);s(r,g);let i="";return n&&(i="âm "),i+=p(r),i+=" đồng",i}},e.ordinal=w,e.viVN=function(e){const{isNegative:o,integerPart:u,decimalPart:c}=function(e){const o=typeof e;if("bigint"==typeof e)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"==typeof e)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e);s(u,f,c);let l="";return o&&(l="âm "),l+=p(u),c&&(l+=" phẩy "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=m,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=p(BigInt(r))),n}(c)),l}},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
|
package/dist/yo-NG.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/yo-NG v5.1.
|
|
1
|
+
/*! n2words/yo-NG v5.1.1 | MIT License | github.com/forzagreen/n2words */
|
|
2
2
|
function n(n){let[e,r]=n.toLowerCase().split("e");const t=parseInt(r,10);let i="";"-"===e[0]&&(i="-",e=e.slice(1));const o=e.indexOf("."),s=-1===o?e:e.slice(0,o)+e.slice(o+1),u=(-1===o?e.length:o)+t;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function e(e){const t=e.toString();return r(t)?n(t):t}function r(n){return n.includes("e")||n.includes("E")}function t(n){const e="-"===n[0];e&&(n=n.slice(1));const r=n.indexOf(".");if(-1===r)return{isNegative:e,integerPart:BigInt(n)};const t=n.slice(0,r)||"0",i=n.slice(r+1);return{isNegative:e,integerPart:BigInt(t),decimalPart:i}}function i(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const o=t.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(t),cents:0n};const s=t.slice(0,o)||"0",u=(t.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const o=null,s=o,u=o,a=o,g=["","ọ̀kan","èjì","ẹ̀ta","ẹ̀rin","àrùn","ẹ̀fà","èje","ẹ̀jọ","ẹ̀sán","ẹ̀wá"],l=["","ọ̀kànlá","èjìlá","ẹ̀talá","ẹ̀rinlá"],c=["àrùndínlógún","ẹ̀rìndínlógún","ẹ̀tadínlógún","èjìdínlógún","ọ̀kàndínlógún"],f={20:"ogún",30:"ọgbọ̀n",40:"ogójì",50:"àádọ́ta",60:"ogóta",70:"àádọ́rin",80:"ogórin",90:"àádọ́rùn",100:"ọgọ́rùn"},d={20:"lógún",30:"lọgbọ̀n",40:"lógójì",50:"láàádọ́ta",60:"lógóta",70:"láàádọ́rin",80:"lógórin",90:"láàádọ́rùn",100:"lọ́gọ́rùn"},b={20:"dínlógún",30:"dínlọgbọ̀n",40:"dínlógójì",50:"dínláàádọ́ta",60:"dínlógóta",70:"dínláàádọ́rin",80:"dínlógórin",90:"dínláàádọ́rùn",100:"dínlọ́gọ́rùn"},m="ọgọ́rùn",w="igba",N="irinwó",p="ẹgbẹ̀rún",h="mílíọ̀nù",v="àìní",I="ó lé";function y(n){if(0===n)return"";if(n<=10)return g[n];if(n<=14)return l[n-10];if(n<=19)return c[n-15];if(n%10==0)return f[n];const e=10*Math.trunc(n/10),r=n%10;return r<=4?g[r]+" lé "+d[e]:g[10-r]+b[e+10]}function E(n){if(n<100)return y(n);const e=Math.trunc(n/100),r=n%100;let t;return 2===e&&0===r?w:4===e&&0===r?N:(t=1===e?m:2===e?w:4===e?N:g[e]+" "+m,r>0&&(t+=" ó lé "+y(r)),t)}function R(n){if(0n===n)return"òdo";if(n<100n)return y(Number(n));if(n<1000n)return E(Number(n));const e=[];let r=n;if(r>=1000000n){const n=r/1000000n;r%=1000000n,e.push(1n===n?h+" kan":h+" "+R(n))}if(r>=1000n){const n=r/1000n;r%=1000n,e.push(1n===n?p+" kan":10n===n?"ẹgbàárùn":20n===n?"ọ̀kẹ́":n<100n?p+" "+y(Number(n)):p+" "+E(Number(n)))}return r>0n&&e.push(r<100n?e.length>0?I+" "+y(Number(r)):y(Number(r)):e.length>0?I+" "+E(Number(r)):E(Number(r))),e.join(", ")}function O(i){const{isNegative:o,integerPart:s,decimalPart:u}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:t(e(i))}if("string"==typeof i)return t(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);let a="";return o&&(a=v+" "),a+=R(s),u&&(a+=" àmì "+function(n){const e=[];for(const r of n){const n=parseInt(r,10);e.push(0===n?"òdo":g[n])}return e.join(" ")}(u)),a}function B(e){const t=function(e){const t=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return 1n===(i=t)?"àkọ́kọ́":2n===i?"ìkejì":"ìkẹ"+R(i);var i}function j(n){const{isNegative:r,dollars:t,cents:o}=function(n){const r=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);let s="";return r&&(s=v+" "),(t>0n||0n===o)&&(s+=R(t)+" náírà"),o>0n&&(t>0n&&(s+=" àti "),s+=R(o)+" kọ́bọ̀"),s}export{s as cardinalMax,a as currencyMax,u as ordinalMax,O as toCardinal,j as toCurrency,B as toOrdinal};
|
package/dist/yo-NG.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/yo-NG v5.1.
|
|
1
|
+
/*! n2words/yo-NG 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,r]=n.toLowerCase().split("e");const t=parseInt(r,10);let i="";"-"===e[0]&&(i="-",e=e.slice(1));const o=e.indexOf("."),s=-1===o?e:e.slice(0,o)+e.slice(o+1),u=(-1===o?e.length:o)+t;return u>=s.length?i+s+"0".repeat(u-s.length):u<=0?i+"0."+"0".repeat(-u)+s:i+s.slice(0,u)+"."+s.slice(u)}function r(n){const r=n.toString();return t(r)?e(r):r}function t(n){return n.includes("e")||n.includes("E")}function i(n){const e="-"===n[0];e&&(n=n.slice(1));const r=n.indexOf(".");if(-1===r)return{isNegative:e,integerPart:BigInt(n)};const t=n.slice(0,r)||"0",i=n.slice(r+1);return{isNegative:e,integerPart:BigInt(t),decimalPart:i}}function o(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);t(r)&&(r=e(r));const i="-"===r[0];i&&(r=r.slice(1));const o=r.indexOf(".");if(-1===o)return{isNegative:i,dollars:BigInt(r),cents:0n};const s=r.slice(0,o)||"0",u=(r.slice(o+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(s),cents:BigInt(u)}}const s=["","ọ̀kan","èjì","ẹ̀ta","ẹ̀rin","àrùn","ẹ̀fà","èje","ẹ̀jọ","ẹ̀sán","ẹ̀wá"],u=["","ọ̀kànlá","èjìlá","ẹ̀talá","ẹ̀rinlá"],a=["àrùndínlógún","ẹ̀rìndínlógún","ẹ̀tadínlógún","èjìdínlógún","ọ̀kàndínlógún"],l={20:"ogún",30:"ọgbọ̀n",40:"ogójì",50:"àádọ́ta",60:"ogóta",70:"àádọ́rin",80:"ogórin",90:"àádọ́rùn",100:"ọgọ́rùn"},g={20:"lógún",30:"lọgbọ̀n",40:"lógójì",50:"láàádọ́ta",60:"lógóta",70:"láàádọ́rin",80:"lógórin",90:"láàádọ́rùn",100:"lọ́gọ́rùn"},c={20:"dínlógún",30:"dínlọgbọ̀n",40:"dínlógójì",50:"dínláàádọ́ta",60:"dínlógóta",70:"dínláàádọ́rin",80:"dínlógórin",90:"dínláàádọ́rùn",100:"dínlọ́gọ́rùn"},f="ọgọ́rùn",d="igba",b="irinwó",m="ẹgbẹ̀rún",w="mílíọ̀nù",p="àìní",N="ó lé";function h(n){if(0===n)return"";if(n<=10)return s[n];if(n<=14)return u[n-10];if(n<=19)return a[n-15];if(n%10==0)return l[n];const e=10*Math.trunc(n/10),r=n%10;return r<=4?s[r]+" lé "+g[e]:s[10-r]+c[e+10]}function v(n){if(n<100)return h(n);const e=Math.trunc(n/100),r=n%100;let t;return 2===e&&0===r?d:4===e&&0===r?b:(t=1===e?f:2===e?d:4===e?b:s[e]+" "+f,r>0&&(t+=" ó lé "+h(r)),t)}function y(n){if(0n===n)return"òdo";if(n<100n)return h(Number(n));if(n<1000n)return v(Number(n));const e=[];let r=n;if(r>=1000000n){const n=r/1000000n;r%=1000000n,e.push(1n===n?w+" kan":w+" "+y(n))}if(r>=1000n){const n=r/1000n;r%=1000n,e.push(1n===n?m+" kan":10n===n?"ẹgbàárùn":20n===n?"ọ̀kẹ́":n<100n?m+" "+h(Number(n)):m+" "+v(Number(n)))}return r>0n&&e.push(r<100n?e.length>0?N+" "+h(Number(r)):h(Number(r)):e.length>0?N+" "+v(Number(r)):v(Number(r))),e.join(", ")}const I={yoNG:function(n){const r=function(n){const r=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const n=BigInt(r);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return 1n===(i=r)?"àkọ́kọ́":2n===i?"ìkejì":"ìkẹ"+y(i);var i}};n.currency={yoNG:function(n){const{isNegative:e,dollars:t,cents:i}=function(n){const e=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:o(r(n))}if("string"==typeof n)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);let s="";return e&&(s=p+" "),(t>0n||0n===i)&&(s+=y(t)+" náírà"),i>0n&&(t>0n&&(s+=" àti "),s+=y(i)+" kọ́bọ̀"),s}},n.ordinal=I,n.yoNG=function(n){const{isNegative:o,integerPart:u,decimalPart:a}=function(n){const o=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(n)?n<0?{isNegative:!0,integerPart:BigInt(-n)}:{isNegative:!1,integerPart:BigInt(n)}:i(r(n))}if("string"==typeof n)return i(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(n));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(n);let l="";return o&&(l=p+" "),l+=y(u),a&&(l+=" àmì "+function(n){const e=[];for(const r of n){const n=parseInt(r,10);e.push(0===n?"òdo":s[n])}return e.join(" ")}(a)),l}},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
|
package/dist/zh-Hans-CN.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/zh-Hans-CN v5.1.
|
|
1
|
+
/*! n2words/zh-Hans-CN 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(n)}function u(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,t))throw new TypeError(`Unknown option "${t}" — expected one of: ${i.join(", ")}`);if(void 0!==o){if(typeof o!=typeof r[t])throw new TypeError(`Option "${t}" must be a ${typeof r[t]}, got ${typeof o}`);r[t]=o}}return r}const c=["零","一","二","三","四","五","六","七","八","九"],f=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],a=s(16),l=s(16),g=s(16),b="零";function m(n,e,t,r,i){if(0n===n)return"";let o="",s=!1;const u=n/1000n,c=n%1000n;u>0n&&(o=e[Number(u)]+i,s=c>0n&&c<100n);const f=c/100n,a=c%100n;f>0n?(s&&(o+=b),o+=e[Number(f)]+r,s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(o+=b),o+=e[Number(l)]+t,s=!1):(f>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&(o+=b),o+=e[Number(g)]),o}function p(n,e,t,r,i){if(0n===n)return"";if(n>=10000n){const o=n/10000n,s=n%10000n;let u=m(o,e,t,r,i)+"万";return s>0n&&((o%10n==0n||s<1000n)&&(u+=b),u+=m(s,e,t,r,i)),u}return m(n,e,t,r,i)}function w(n,e=!0){if(0n===n)return b;const t=e?f:c,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";if(n>=100000000n){const e=n%100000000n;let s=p(n/100000000n,t,r,i,o)+"亿";return e>0n&&(e<10000000n&&(s+=b),s+=p(e,t,r,i,o)),s}return p(n,t,r,i,o)}const d={formal:!0};function N(i,s){const{isNegative:l,integerPart:g,decimalPart:b}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(e(i))}if("string"==typeof i)return r(function(e){const r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${e}"`);return t(r)?n(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(g,a);const{formal:m}=u(s,d);let p=l?"负":"";return p+=w(g,m),b&&(p+="点"+function(n,e){let t="";for(let r=0;r<n.length;r++)t+=e[Number(n[r])];return t}(b,m?f:c)),p}const h={formal:!0};function v(e,r){const i=function(e){const r=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const r=e.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const e=n(r);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(e);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const n=BigInt(r);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(e);o(i,l);const{formal:s}=u(r,h);return function(n,e){return"第"+w(n,e)}(i,s)}const y={formal:!0};function I(n,t){const{isNegative:r,dollars:s,cents:a}=function(n){const t=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);o(s,g);const{formal:l}=u(t,y),m=l?f:c,p=l?"圆":"元",d=a/10n,N=a%10n;let h="";return r&&(h="负"),s>0n&&(h+=w(s,l)+p),d>0n?h+=m[Number(d)]+"角":s>0n&&N>0n&&(h+=b),N>0n?h+=m[Number(N)]+"分":(s>0n||d>0n)&&(h+="整"),0n===s&&0n===d&&0n===N&&(h+=b+p+"整"),h}export{d as cardinalDefaults,a as cardinalMax,y as currencyDefaults,g as currencyMax,h as ordinalDefaults,l as ordinalMax,N as toCardinal,I as toCurrency,v as toOrdinal};
|
package/dist/zh-Hans-CN.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/zh-Hans-CN v5.1.
|
|
1
|
+
/*! n2words/zh-Hans-CN 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(n)}function f(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,t))throw new TypeError(`Unknown option "${t}" — expected one of: ${i.join(", ")}`);if(void 0!==o){if(typeof o!=typeof r[t])throw new TypeError(`Option "${t}" must be a ${typeof r[t]}, got ${typeof o}`);r[t]=o}}return r}const c=["零","一","二","三","四","五","六","七","八","九"],a=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],l=u(16),g=u(16),d=u(16),b="零";function m(n,e,t,r,i){if(0n===n)return"";let o="",s=!1;const u=n/1000n,f=n%1000n;u>0n&&(o=e[Number(u)]+i,s=f>0n&&f<100n);const c=f/100n,a=f%100n;c>0n?(s&&(o+=b),o+=e[Number(c)]+r,s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(o+=b),o+=e[Number(l)]+t,s=!1):(c>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&(o+=b),o+=e[Number(g)]),o}function p(n,e,t,r,i){if(0n===n)return"";if(n>=10000n){const o=n/10000n,s=n%10000n;let u=m(o,e,t,r,i)+"万";return s>0n&&((o%10n==0n||s<1000n)&&(u+=b),u+=m(s,e,t,r,i)),u}return m(n,e,t,r,i)}function w(n,e=!0){if(0n===n)return b;const t=e?a:c,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";if(n>=100000000n){const e=n%100000000n;let s=p(n/100000000n,t,r,i,o)+"亿";return e>0n&&(e<10000000n&&(s+=b),s+=p(e,t,r,i,o)),s}return p(n,t,r,i,o)}const h={formal:!0},N={formal:!0},y={formal:!0},v={zhHansCN:function(n,t){const i=function(n){const t=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const t=n.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const n=e(t);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(n);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);s(i,g);const{formal:o}=f(t,N);return function(n,e){return"第"+w(n,e)}(i,o)}};n.currency={zhHansCN:function(n,e){const{isNegative:r,dollars:i,cents:u}=function(n){const e=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:o(t(n))}if("string"==typeof n)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);s(i,d);const{formal:l}=f(e,y),g=l?a:c,m=l?"圆":"元",p=u/10n,h=u%10n;let N="";return r&&(N="负"),i>0n&&(N+=w(i,l)+m),p>0n?N+=g[Number(p)]+"角":i>0n&&h>0n&&(N+=b),h>0n?N+=g[Number(h)]+"分":(i>0n||p>0n)&&(N+="整"),0n===i&&0n===p&&0n===h&&(N+=b+m+"整"),N}},n.ordinal=v,n.zhHansCN=function(n,o){const{isNegative:u,integerPart:g,decimalPart:d}=function(n){const o=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(n)?n<0?{isNegative:!0,integerPart:BigInt(-n)}:{isNegative:!1,integerPart:BigInt(n)}:i(t(n))}if("string"==typeof n)return i(function(n){const t=n.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${n}"`);return r(t)?e(t):t}(n));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(n);s(g,l);const{formal:b}=f(o,h);let m=u?"负":"";return m+=w(g,b),d&&(m+="点"+function(n,e){let t="";for(let r=0;r<n.length;r++)t+=e[Number(n[r])];return t}(d,b?a:c)),m}},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
|
package/dist/zh-Hant-TW.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/zh-Hant-TW v5.1.
|
|
1
|
+
/*! n2words/zh-Hant-TW 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(n)}function u(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,t))throw new TypeError(`Unknown option "${t}" — expected one of: ${i.join(", ")}`);if(void 0!==o){if(typeof o!=typeof r[t])throw new TypeError(`Option "${t}" must be a ${typeof r[t]}, got ${typeof o}`);r[t]=o}}return r}const c=["零","一","二","三","四","五","六","七","八","九"],f=["零","壹","貳","參","肆","伍","陸","柒","捌","玖"],a=s(16),l=s(16),g=s(16),p="零";function b(n,e=!0){if(0n===n)return p;const t=e?f:c,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";function s(n){if(0n===n)return"";const e=[];let s=!1;const u=n/1000n,c=n%1000n;u>0n&&(e.push(t[Number(u)]+o),s=c>0n&&c<100n);const f=c/100n,a=c%100n;f>0n?(s&&e.push(p),e.push(t[Number(f)]+i),s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(e.push(p),s=!1),e.push(t[Number(l)]+r)):(f>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&e.push(p),e.push(t[Number(g)])),e.join("")}function u(n){if(0n===n)return"";const e=[];if(n>=10000n){const t=n/10000n,r=n%10000n;e.push(s(t)+"萬"),r>0n&&((t%10n==0n||r<1000n)&&e.push(p),e.push(s(r)))}else e.push(s(n));return e.join("")}const a=[];if(n>=100000000n){const e=n%100000000n,t=u(n/100000000n);a.push(t+"億"),e>0n&&(e<10000000n&&a.push(p),a.push(u(e)))}else a.push(u(n));return a.join("")}const m={formal:!0};function h(i,s){const{isNegative:l,integerPart:g,decimalPart:p}=function(i){const o=typeof i;if("bigint"==typeof i)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"==typeof i){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(e(i))}if("string"==typeof i)return r(function(e){const r=e.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${e}"`);return t(r)?n(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(i);o(g,a);const{formal:h}=u(s,m);let w="";return l&&(w="負"),w+=b(g,h),p&&(w+="點"+function(n,e=!0){const t=e?f:c,r=[];for(const e of n)r.push(t[Number(e)]);return r}(p,h).join("")),w}const w={formal:!0};function d(e,r){const i=function(e){const r=typeof e;if("bigint"==typeof e){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"==typeof e){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"==typeof e)return function(e){const r=e.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const e=n(r);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(e);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const n=BigInt(r);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`,{cause:n})}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(e);o(i,l);const{formal:s}=u(r,w);return function(n,e=!0){return"第"+b(n,e)}(i,s)}const N={formal:!0};function v(n,t){const{isNegative:r,dollars:s,cents:a}=function(n){const t=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:i(e(n))}if("string"==typeof n)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);o(s,g);const{formal:l}=u(t,N),m=l?"圓":"元",h=a/10n,w=a%10n;let d="";return r&&(d="負"),(s>0n||0n===a)&&(d+=b(s,l),d+=m),h>0n&&(d+=(l?f:c)[Number(h)]+"角"),w>0n?(s>0n&&0n===h&&(d+=p),d+=(l?f:c)[Number(w)]+"分"):d+="整",d}export{m as cardinalDefaults,a as cardinalMax,N as currencyDefaults,g as currencyMax,w as ordinalDefaults,l as ordinalMax,h as toCardinal,v as toCurrency,d as toOrdinal};
|
package/dist/zh-Hant-TW.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! n2words/zh-Hant-TW v5.1.
|
|
1
|
+
/*! n2words/zh-Hant-TW 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(n)}function c(n,e,t){const r={...e};if(void 0===n)return r;if(!function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n);const i=Object.keys(e);for(const[t,o]of Object.entries(n)){if(!Object.hasOwn(e,t))throw new TypeError(`Unknown option "${t}" — expected one of: ${i.join(", ")}`);if(void 0!==o){if(typeof o!=typeof r[t])throw new TypeError(`Option "${t}" must be a ${typeof r[t]}, got ${typeof o}`);r[t]=o}}return r}const f=["零","一","二","三","四","五","六","七","八","九"],a=["零","壹","貳","參","肆","伍","陸","柒","捌","玖"],l=u(16),g=u(16),p=u(16),d="零";function b(n,e=!0){if(0n===n)return d;const t=e?a:f,r=e?"拾":"十",i=e?"佰":"百",o=e?"仟":"千";function s(n){if(0n===n)return"";const e=[];let s=!1;const u=n/1000n,c=n%1000n;u>0n&&(e.push(t[Number(u)]+o),s=c>0n&&c<100n);const f=c/100n,a=c%100n;f>0n?(s&&e.push(d),e.push(t[Number(f)]+i),s=a>0n&&a<10n):u>0n&&a>0n&&(s=!0);const l=a/10n,g=a%10n;return l>0n?(s&&(e.push(d),s=!1),e.push(t[Number(l)]+r)):(f>0n||u>0n)&&g>0n&&(s=!0),g>0n&&(s&&e.push(d),e.push(t[Number(g)])),e.join("")}function u(n){if(0n===n)return"";const e=[];if(n>=10000n){const t=n/10000n,r=n%10000n;e.push(s(t)+"萬"),r>0n&&((t%10n==0n||r<1000n)&&e.push(d),e.push(s(r)))}else e.push(s(n));return e.join("")}const c=[];if(n>=100000000n){const e=n%100000000n,t=u(n/100000000n);c.push(t+"億"),e>0n&&(e<10000000n&&c.push(d),c.push(u(e)))}else c.push(u(n));return c.join("")}const m={formal:!0},h={formal:!0},w={formal:!0},y={zhHantTW:function(n,t){const i=function(n){const t=typeof n;if("bigint"==typeof n){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"==typeof n)return function(n){const t=n.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const n=e(t);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(n);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const n=BigInt(t);if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`,{cause:e})}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);s(i,g);const{formal:o}=c(t,h);return function(n,e=!0){return"第"+b(n,e)}(i,o)}};n.currency={zhHantTW:function(n,e){const{isNegative:r,dollars:i,cents:u}=function(n){const e=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:o(t(n))}if("string"==typeof n)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);s(i,p);const{formal:l}=c(e,w),g=l?"圓":"元",m=u/10n,h=u%10n;let y="";return r&&(y="負"),(i>0n||0n===u)&&(y+=b(i,l),y+=g),m>0n&&(y+=(l?a:f)[Number(m)]+"角"),h>0n?(i>0n&&0n===m&&(y+=d),y+=(l?a:f)[Number(h)]+"分"):y+="整",y}},n.ordinal=y,n.zhHantTW=function(n,o){const{isNegative:u,integerPart:g,decimalPart:p}=function(n){const o=typeof n;if("bigint"==typeof n)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"==typeof n){if(!Number.isFinite(n))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(n)?n<0?{isNegative:!0,integerPart:BigInt(-n)}:{isNegative:!1,integerPart:BigInt(n)}:i(t(n))}if("string"==typeof n)return i(function(n){const t=n.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${n}"`);return r(t)?e(t):t}(n));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(n);s(g,l);const{formal:d}=c(o,m);let h="";return u&&(h="負"),h+=b(g,d),p&&(h+="點"+function(n,e=!0){const t=e?a:f,r=[];for(const e of n)r.push(t[Number(e)]);return r}(p,d).join("")),h}},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n2words",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"number-to-words",
|
|
@@ -127,37 +127,37 @@
|
|
|
127
127
|
]
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
|
-
"@commitlint/cli": "^21.0
|
|
131
|
-
"@commitlint/config-conventional": "^21.0
|
|
130
|
+
"@commitlint/cli": "^21.1.0",
|
|
131
|
+
"@commitlint/config-conventional": "^21.1.0",
|
|
132
132
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
133
133
|
"@eslint/js": "^10.0.1",
|
|
134
134
|
"@rollup/plugin-terser": "^1.0.0",
|
|
135
135
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
136
136
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
137
|
-
"@types/node": "^
|
|
137
|
+
"@types/node": "^26.0.1",
|
|
138
138
|
"ava": "^8.0.1",
|
|
139
|
-
"browserslist": "^4.28.
|
|
139
|
+
"browserslist": "^4.28.4",
|
|
140
140
|
"c8": "^11.0.0",
|
|
141
141
|
"chalk": "^5.6.2",
|
|
142
142
|
"eslint": "^10.5.0",
|
|
143
143
|
"eslint-plugin-ava": "^17.0.1",
|
|
144
144
|
"eslint-plugin-compat": "^7.0.2",
|
|
145
|
-
"eslint-plugin-es-x": "^9.
|
|
146
|
-
"eslint-plugin-import-x": "^4.
|
|
147
|
-
"eslint-plugin-jsdoc": "^63.0.
|
|
148
|
-
"eslint-plugin-n": "^18.1
|
|
145
|
+
"eslint-plugin-es-x": "^9.7.0",
|
|
146
|
+
"eslint-plugin-import-x": "^4.17.0",
|
|
147
|
+
"eslint-plugin-jsdoc": "^63.0.8",
|
|
148
|
+
"eslint-plugin-n": "^18.2.1",
|
|
149
149
|
"fast-check": "^4.8.0",
|
|
150
|
-
"globals": "^17.
|
|
150
|
+
"globals": "^17.7.0",
|
|
151
151
|
"husky": "^9.1.7",
|
|
152
|
-
"lint-staged": "^17.0.
|
|
152
|
+
"lint-staged": "^17.0.8",
|
|
153
153
|
"markdownlint-cli2": "^0.22.1",
|
|
154
154
|
"rimraf": "^6.1.3",
|
|
155
|
-
"rollup": "^4.62.
|
|
155
|
+
"rollup": "^4.62.2",
|
|
156
156
|
"tinybench": "^6.0.2",
|
|
157
157
|
"typescript": "^6.0.3"
|
|
158
158
|
},
|
|
159
159
|
"engines": {
|
|
160
|
-
"node": "
|
|
160
|
+
"node": "^22 || ^24 || ^26"
|
|
161
161
|
},
|
|
162
162
|
"publishConfig": {
|
|
163
163
|
"access": "public",
|
package/src/sr-Cyrl-RS.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Key features:
|
|
7
7
|
* - Three-form pluralization (one/few/many)
|
|
8
|
-
* - Gender:
|
|
8
|
+
* - Gender by scale word: the -arda forms (hiljada, milijarda, bilijarda, ...)
|
|
9
|
+
* are feminine; the -ion forms (milion, bilion, ...) are masculine
|
|
9
10
|
* - Irregular hundreds
|
|
10
11
|
* - Long scale naming with -ard forms
|
|
11
12
|
* - Cyrillic script
|
|
@@ -236,8 +237,8 @@ function buildLargeNumberWords(n, gender) {
|
|
|
236
237
|
else {
|
|
237
238
|
const scaleForms = SCALE_FORMS[scaleIndex - 1]
|
|
238
239
|
const scaleWord = pluralize(segment, scaleForms)
|
|
239
|
-
//
|
|
240
|
-
const isFeminine = scaleIndex === 1
|
|
240
|
+
// -arda scale words (hiljada, milijarda, ...) are feminine; -ion words masculine
|
|
241
|
+
const isFeminine = scaleIndex % 2 === 1
|
|
241
242
|
const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment)
|
|
242
243
|
parts.push(segmentWord + ' ' + scaleWord)
|
|
243
244
|
}
|
|
@@ -462,7 +463,7 @@ function buildLargeOrdinal(n) {
|
|
|
462
463
|
}
|
|
463
464
|
else {
|
|
464
465
|
// Use cardinal segment + ordinal scale
|
|
465
|
-
const isFeminine = scaleIndex === 1 //
|
|
466
|
+
const isFeminine = scaleIndex % 2 === 1 // feminine at -arda scales (hiljada, milijarda, ...)
|
|
466
467
|
const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment)
|
|
467
468
|
parts.push(segmentWord + ' ' + ORDINAL_SCALES[scaleIndex - 1])
|
|
468
469
|
}
|
|
@@ -471,7 +472,7 @@ function buildLargeOrdinal(n) {
|
|
|
471
472
|
// Not the final segment: use cardinal
|
|
472
473
|
const scaleForms = SCALE_FORMS[scaleIndex - 1]
|
|
473
474
|
const scaleWord = pluralize(segment, scaleForms)
|
|
474
|
-
const isFeminine = scaleIndex === 1
|
|
475
|
+
const isFeminine = scaleIndex % 2 === 1
|
|
475
476
|
const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment)
|
|
476
477
|
parts.push(segmentWord + ' ' + scaleWord)
|
|
477
478
|
}
|
package/src/sr-Latn-RS.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Key features:
|
|
7
7
|
* - Three-form pluralization (one/few/many)
|
|
8
|
-
* - Gender:
|
|
8
|
+
* - Gender by scale word: the -arda forms (hiljada, milijarda, bilijarda, ...)
|
|
9
|
+
* are feminine; the -ion forms (milion, bilion, ...) are masculine
|
|
9
10
|
* - Irregular hundreds (dvesta, trista, etc.)
|
|
10
11
|
* - Long scale naming with -ard forms
|
|
11
12
|
* - Latin script
|
|
@@ -236,8 +237,8 @@ function buildLargeNumberWords(n, gender) {
|
|
|
236
237
|
else {
|
|
237
238
|
const scaleForms = SCALE_FORMS[scaleIndex - 1]
|
|
238
239
|
const scaleWord = pluralize(segment, scaleForms)
|
|
239
|
-
//
|
|
240
|
-
const isFeminine = scaleIndex === 1
|
|
240
|
+
// -arda scale words (hiljada, milijarda, ...) are feminine; -ion words masculine
|
|
241
|
+
const isFeminine = scaleIndex % 2 === 1
|
|
241
242
|
const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment)
|
|
242
243
|
parts.push(segmentWord + ' ' + scaleWord)
|
|
243
244
|
}
|
|
@@ -462,7 +463,7 @@ function buildLargeOrdinal(n) {
|
|
|
462
463
|
}
|
|
463
464
|
else {
|
|
464
465
|
// Use cardinal segment + ordinal scale
|
|
465
|
-
const isFeminine = scaleIndex === 1 //
|
|
466
|
+
const isFeminine = scaleIndex % 2 === 1 // feminine at -arda scales (hiljada, milijarda, ...)
|
|
466
467
|
const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment)
|
|
467
468
|
parts.push(segmentWord + ' ' + ORDINAL_SCALES[scaleIndex - 1])
|
|
468
469
|
}
|
|
@@ -471,7 +472,7 @@ function buildLargeOrdinal(n) {
|
|
|
471
472
|
// Not the final segment: use cardinal
|
|
472
473
|
const scaleForms = SCALE_FORMS[scaleIndex - 1]
|
|
473
474
|
const scaleWord = pluralize(segment, scaleForms)
|
|
474
|
-
const isFeminine = scaleIndex === 1
|
|
475
|
+
const isFeminine = scaleIndex % 2 === 1
|
|
475
476
|
const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment)
|
|
476
477
|
parts.push(segmentWord + ' ' + scaleWord)
|
|
477
478
|
}
|