n2words 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +45 -78
  2. package/README.md +9 -9
  3. package/dist/am-ET.js +1 -1
  4. package/dist/am-ET.umd.js +1 -1
  5. package/dist/am-Latn-ET.js +1 -1
  6. package/dist/am-Latn-ET.umd.js +1 -1
  7. package/dist/ar-SA.js +1 -1
  8. package/dist/ar-SA.umd.js +1 -1
  9. package/dist/az-AZ.js +1 -1
  10. package/dist/az-AZ.umd.js +1 -1
  11. package/dist/bn-BD.js +1 -1
  12. package/dist/bn-BD.umd.js +1 -1
  13. package/dist/cs-CZ.js +1 -1
  14. package/dist/cs-CZ.umd.js +1 -1
  15. package/dist/da-DK.js +1 -1
  16. package/dist/da-DK.umd.js +1 -1
  17. package/dist/de-DE.js +1 -1
  18. package/dist/de-DE.umd.js +1 -1
  19. package/dist/el-GR.js +1 -1
  20. package/dist/el-GR.umd.js +1 -1
  21. package/dist/en-AU.js +1 -1
  22. package/dist/en-AU.umd.js +1 -1
  23. package/dist/en-BD.js +1 -1
  24. package/dist/en-BD.umd.js +1 -1
  25. package/dist/en-CA.js +1 -1
  26. package/dist/en-CA.umd.js +1 -1
  27. package/dist/en-GB.js +1 -1
  28. package/dist/en-GB.umd.js +1 -1
  29. package/dist/en-GH.js +1 -1
  30. package/dist/en-GH.umd.js +1 -1
  31. package/dist/en-IE.js +1 -1
  32. package/dist/en-IE.umd.js +1 -1
  33. package/dist/en-IN.js +1 -1
  34. package/dist/en-IN.umd.js +1 -1
  35. package/dist/en-KE.js +1 -1
  36. package/dist/en-KE.umd.js +1 -1
  37. package/dist/en-MY.js +1 -1
  38. package/dist/en-MY.umd.js +1 -1
  39. package/dist/en-NG.js +1 -1
  40. package/dist/en-NG.umd.js +1 -1
  41. package/dist/en-NZ.js +1 -1
  42. package/dist/en-NZ.umd.js +1 -1
  43. package/dist/en-PH.js +1 -1
  44. package/dist/en-PH.umd.js +1 -1
  45. package/dist/en-PK.js +1 -1
  46. package/dist/en-PK.umd.js +1 -1
  47. package/dist/en-SG.js +1 -1
  48. package/dist/en-SG.umd.js +1 -1
  49. package/dist/en-US.js +1 -1
  50. package/dist/en-US.umd.js +1 -1
  51. package/dist/en-ZA.js +1 -1
  52. package/dist/en-ZA.umd.js +1 -1
  53. package/dist/es-ES.js +1 -1
  54. package/dist/es-ES.umd.js +1 -1
  55. package/dist/es-MX.js +1 -1
  56. package/dist/es-MX.umd.js +1 -1
  57. package/dist/es-US.js +1 -1
  58. package/dist/es-US.umd.js +1 -1
  59. package/dist/fa-IR.js +1 -1
  60. package/dist/fa-IR.umd.js +1 -1
  61. package/dist/fi-FI.js +1 -1
  62. package/dist/fi-FI.umd.js +1 -1
  63. package/dist/fil-PH.js +1 -1
  64. package/dist/fil-PH.umd.js +1 -1
  65. package/dist/fr-BE.js +1 -1
  66. package/dist/fr-BE.umd.js +1 -1
  67. package/dist/fr-FR.js +1 -1
  68. package/dist/fr-FR.umd.js +1 -1
  69. package/dist/gu-IN.js +1 -1
  70. package/dist/gu-IN.umd.js +1 -1
  71. package/dist/ha-NG.js +1 -1
  72. package/dist/ha-NG.umd.js +1 -1
  73. package/dist/hbo-IL.js +1 -1
  74. package/dist/hbo-IL.umd.js +1 -1
  75. package/dist/he-IL.js +1 -1
  76. package/dist/he-IL.umd.js +1 -1
  77. package/dist/hi-IN.js +1 -1
  78. package/dist/hi-IN.umd.js +1 -1
  79. package/dist/hr-HR.js +1 -1
  80. package/dist/hr-HR.umd.js +1 -1
  81. package/dist/hu-HU.js +1 -1
  82. package/dist/hu-HU.umd.js +1 -1
  83. package/dist/id-ID.js +1 -1
  84. package/dist/id-ID.umd.js +1 -1
  85. package/dist/it-IT.js +1 -1
  86. package/dist/it-IT.umd.js +1 -1
  87. package/dist/ja-JP.js +1 -1
  88. package/dist/ja-JP.umd.js +1 -1
  89. package/dist/ka-GE.js +1 -1
  90. package/dist/ka-GE.umd.js +1 -1
  91. package/dist/kn-IN.js +1 -1
  92. package/dist/kn-IN.umd.js +1 -1
  93. package/dist/ko-KR.js +1 -1
  94. package/dist/ko-KR.umd.js +1 -1
  95. package/dist/lt-LT.js +1 -1
  96. package/dist/lt-LT.umd.js +1 -1
  97. package/dist/lv-LV.js +1 -1
  98. package/dist/lv-LV.umd.js +1 -1
  99. package/dist/mr-IN.js +1 -1
  100. package/dist/mr-IN.umd.js +1 -1
  101. package/dist/ms-MY.js +1 -1
  102. package/dist/ms-MY.umd.js +1 -1
  103. package/dist/nb-NO.js +1 -1
  104. package/dist/nb-NO.umd.js +1 -1
  105. package/dist/nl-NL.js +1 -1
  106. package/dist/nl-NL.umd.js +1 -1
  107. package/dist/pa-IN.js +1 -1
  108. package/dist/pa-IN.umd.js +1 -1
  109. package/dist/pl-PL.js +1 -1
  110. package/dist/pl-PL.umd.js +1 -1
  111. package/dist/pt-BR.js +2 -0
  112. package/dist/pt-BR.umd.js +2 -0
  113. package/dist/pt-PT.js +1 -1
  114. package/dist/pt-PT.umd.js +1 -1
  115. package/dist/ro-RO.js +1 -1
  116. package/dist/ro-RO.umd.js +1 -1
  117. package/dist/ru-RU.js +1 -1
  118. package/dist/ru-RU.umd.js +1 -1
  119. package/dist/sr-Cyrl-RS.js +1 -1
  120. package/dist/sr-Cyrl-RS.umd.js +1 -1
  121. package/dist/sr-Latn-RS.js +1 -1
  122. package/dist/sr-Latn-RS.umd.js +1 -1
  123. package/dist/sv-SE.js +1 -1
  124. package/dist/sv-SE.umd.js +1 -1
  125. package/dist/sw-KE.js +1 -1
  126. package/dist/sw-KE.umd.js +1 -1
  127. package/dist/ta-IN.js +1 -1
  128. package/dist/ta-IN.umd.js +1 -1
  129. package/dist/te-IN.js +1 -1
  130. package/dist/te-IN.umd.js +1 -1
  131. package/dist/th-TH.js +1 -1
  132. package/dist/th-TH.umd.js +1 -1
  133. package/dist/tr-TR.js +1 -1
  134. package/dist/tr-TR.umd.js +1 -1
  135. package/dist/uk-UA.js +1 -1
  136. package/dist/uk-UA.umd.js +1 -1
  137. package/dist/ur-PK.js +1 -1
  138. package/dist/ur-PK.umd.js +1 -1
  139. package/dist/vi-VN.js +1 -1
  140. package/dist/vi-VN.umd.js +1 -1
  141. package/dist/yo-NG.js +1 -1
  142. package/dist/yo-NG.umd.js +1 -1
  143. package/dist/zh-Hans-CN.js +1 -1
  144. package/dist/zh-Hans-CN.umd.js +1 -1
  145. package/dist/zh-Hant-TW.js +1 -1
  146. package/dist/zh-Hant-TW.umd.js +1 -1
  147. package/package.json +30 -22
  148. package/src/pt-BR.d.ts +31 -0
  149. package/src/pt-BR.js +534 -0
package/CHANGELOG.md CHANGED
@@ -1,108 +1,75 @@
1
- # Changelog
2
1
 
3
- ## [4.0.0](https://github.com/forzagreen/n2words/compare/v3.1.0...v4.0.0) (2026-03-05)
4
2
 
3
+ ### Bug Fixes
5
4
 
6
- ### BREAKING CHANGES
7
-
8
- * rename all generic language codes to BCP 47 locale-specific codes ([#242](https://github.com/forzagreen/n2words/issues/242))
9
- * **es:** split Spanish into locale-specific variants ([#241](https://github.com/forzagreen/n2words/issues/241))
10
- * remove index.js barrel, use subpath exports only ([#235](https://github.com/forzagreen/n2words/issues/235))
11
- * rename toWords to toCardinal, form-agnostic architecture ([#234](https://github.com/forzagreen/n2words/issues/234))
12
- * **lang:** split English into en-GB and en-US with extended scales and options ([#232](https://github.com/forzagreen/n2words/issues/232))
13
- * ESM-first browser bundles ([#225](https://github.com/forzagreen/n2words/issues/225))
14
-
15
- ### Features
16
-
17
- * add 14 English locale variants ([#255](https://github.com/forzagreen/n2words/issues/255)) ([1b87dd9](https://github.com/forzagreen/n2words/commit/1b87dd949e531f23e3865e318469c58dd24ae811))
18
- * add toOrdinal and toCurrency to 44 languages ([#256](https://github.com/forzagreen/n2words/issues/256)) ([35bdc9b](https://github.com/forzagreen/n2words/commit/35bdc9bfd17d783221252a6a8ab3d7a3652dda12))
19
- * **de-DE:** add toOrdinal and toCurrency functions ([#245](https://github.com/forzagreen/n2words/issues/245)) ([59d13fb](https://github.com/forzagreen/n2words/commit/59d13fbe0f68e5902e008611d1edd0bffba17243))
20
- * **en-GB:** add toOrdinal and toCurrency functions ([#243](https://github.com/forzagreen/n2words/issues/243)) ([c651780](https://github.com/forzagreen/n2words/commit/c651780d1d17c0efe238cc1d1d86fb6ad1d8e115))
21
- * **en-US:** add toCurrency function for currency words ([#237](https://github.com/forzagreen/n2words/issues/237)) ([44243b7](https://github.com/forzagreen/n2words/commit/44243b7e0dc69ad5c6075fca9ff9f25ab4e84ce6))
22
- * **en-US:** add toOrdinal function for ordinal number words ([#233](https://github.com/forzagreen/n2words/issues/233)) ([4db67bf](https://github.com/forzagreen/n2words/commit/4db67bffe89607c5142420f9e137364b471b6fcb))
23
- * ESM-first browser bundles ([#225](https://github.com/forzagreen/n2words/issues/225)) ([e97d895](https://github.com/forzagreen/n2words/commit/e97d89594c5cd516751d186e92f37fb06bb0d4bd))
24
- * **es:** split Spanish into locale-specific variants ([#241](https://github.com/forzagreen/n2words/issues/241)) ([d301733](https://github.com/forzagreen/n2words/commit/d30173371f560967259235e3bc21595a72e53847))
25
- * **fr-FR:** add toOrdinal and toCurrency functions ([#246](https://github.com/forzagreen/n2words/issues/246)) ([b95e513](https://github.com/forzagreen/n2words/commit/b95e5130259209af5c453c17402542500e7bf911))
26
- * **it-IT:** add toOrdinal and toCurrency functions ([#247](https://github.com/forzagreen/n2words/issues/247)) ([93ea3eb](https://github.com/forzagreen/n2words/commit/93ea3eb76b7c8056f36f924b4c08639158ff469c))
27
- * **lang:** split English into en-GB and en-US with extended scales and options ([#232](https://github.com/forzagreen/n2words/issues/232)) ([8e4a0df](https://github.com/forzagreen/n2words/commit/8e4a0dfc3cdd46dd3c7a9ced5419177c86dbf77a))
28
- * **nl-NL:** add toOrdinal and toCurrency functions ([#249](https://github.com/forzagreen/n2words/issues/249)) ([abcac65](https://github.com/forzagreen/n2words/commit/abcac65fce57481e8c3827afc3f439958bdec717))
29
- * **pt-PT:** add toOrdinal and toCurrency functions ([#248](https://github.com/forzagreen/n2words/issues/248)) ([0d7d972](https://github.com/forzagreen/n2words/commit/0d7d97218a904d2408eba56b08db4dc41a96407a))
30
- * **ru-RU:** add toOrdinal and toCurrency functions ([#244](https://github.com/forzagreen/n2words/issues/244)) ([86ad7a3](https://github.com/forzagreen/n2words/commit/86ad7a3858e42580b12177d9d507929c15cba475))
31
-
5
+ - Add typesVersions to support CommonJS imports in TypeScript (#301)
6
+ - Sync package.json version to v4.0.0 (#279)
32
7
 
33
8
  ### Bug Fixes
34
9
 
35
- * **core:** pre-v4 audit fixes for parsers and exports ([#262](https://github.com/forzagreen/n2words/issues/262)) ([33d257b](https://github.com/forzagreen/n2words/commit/33d257be6cd3d62b3ae4e62a0551fb5d12ad637e))
36
- * **core:** pre-v4 audit fixes for parsers and exports ([#264](https://github.com/forzagreen/n2words/issues/264)) ([0268988](https://github.com/forzagreen/n2words/commit/0268988871154133f8cb88ab8e399d1d4a9a64f3))
37
- * **deps-dev:** update dependencies to resolve tar vulnerability ([#230](https://github.com/forzagreen/n2words/issues/230)) ([1f86240](https://github.com/forzagreen/n2words/commit/1f862409abc42a3393187b0380eb3dc52f12e681))
38
- * **es-MX,fa-IR:** correct number scale implementations ([#250](https://github.com/forzagreen/n2words/issues/250)) ([ab05310](https://github.com/forzagreen/n2words/commit/ab05310d1fa847c86da493a0ea09ea31e51781ae))
10
+ - Pre-v4 audit fixes for parsers and exports (#264)
11
+ - Pre-v4 audit fixes for parsers and exports (#262)
12
+ - Correct number scale implementations (#250)
13
+ - Update dependencies to resolve tar vulnerability (#230)
39
14
 
15
+ ### Features
40
16
 
41
- ### Code Refactoring
42
-
43
- * remove index.js barrel, use subpath exports only ([#235](https://github.com/forzagreen/n2words/issues/235)) ([782768b](https://github.com/forzagreen/n2words/commit/782768b29b27c0b0932e88408187c76c378baa44))
44
- * rename all generic language codes to BCP 47 locale-specific codes ([#242](https://github.com/forzagreen/n2words/issues/242)) ([8a8328d](https://github.com/forzagreen/n2words/commit/8a8328dea0d3bc09789192e2092c388f4878e6d3))
45
- * rename toWords to toCardinal, form-agnostic architecture ([#234](https://github.com/forzagreen/n2words/issues/234)) ([1648e1a](https://github.com/forzagreen/n2words/commit/1648e1a423621be183cd92b68a485c0bc2e2a684))
17
+ - Add toOrdinal and toCurrency to 44 languages (#256)
18
+ - Add 14 English locale variants (#255)
19
+ - Add toOrdinal and toCurrency functions (#249)
20
+ - Add toOrdinal and toCurrency functions (#248)
21
+ - Add toOrdinal and toCurrency functions (#247)
22
+ - Add toOrdinal and toCurrency functions (#246)
23
+ - Add toOrdinal and toCurrency functions (#245)
24
+ - Add toOrdinal and toCurrency functions (#244)
25
+ - Add toOrdinal and toCurrency functions (#243)
26
+ - Split Spanish into locale-specific variants (#241)
27
+ - Add toCurrency function for currency words (#237)
28
+ - Add toOrdinal function for ordinal number words (#233)
29
+ - Split English into en-GB and en-US with extended scales and options (#232)
30
+ - ESM-first browser bundles (#225)
46
31
 
47
- ## [3.1.0](https://github.com/forzagreen/n2words/compare/v3.0.0...v3.1.0) (2026-01-08)
32
+ ### Bug Fixes
48
33
 
34
+ - Remove precomputed lookup tables from all languages (#224)
49
35
 
50
36
  ### Features
51
37
 
52
- * **ka:** add Georgian language support ([#218](https://github.com/forzagreen/n2words/issues/218)) ([a7c5142](https://github.com/forzagreen/n2words/commit/a7c5142f6cc08a237e6e3f803f1b8298621c70f1))
53
- * **yo:** add Yoruba language support ([#221](https://github.com/forzagreen/n2words/issues/221)) ([60680b0](https://github.com/forzagreen/n2words/commit/60680b09aebe8a04cb841eff9a874a08bc955c67))
38
+ - Add Yoruba language support (#221)
39
+ - Add Georgian language support (#218)
54
40
 
41
+ ### Performance Improvements
55
42
 
56
- ### Bug Fixes
57
-
58
- * **lang:** remove precomputed lookup tables from all languages ([#224](https://github.com/forzagreen/n2words/issues/224)) ([fbe0c7b](https://github.com/forzagreen/n2words/commit/fbe0c7b7115e5a3e63a92945e865b75ff919ebb0))
59
-
60
- ## 3.0.0 - Functional Architecture
43
+ - Optimize South Asian languages with precomputed lookup tables (#223)
61
44
 
62
- Complete rewrite from class-based to functional architecture with major performance improvements.
45
+ ### Bug Fixes
63
46
 
64
- ### BREAKING CHANGES
47
+ - Remove duplicate Node 24 test run (#210)
65
48
 
66
- **Migration required** - API has changed:
49
+ ### Features
67
50
 
68
- #### From v1.x (default export)
51
+ - V3.0.0 - functional architecture with major performance gains (#206)
52
+ - Add Hausa language support (ha) (#199)
53
+ - Add Amharic language support (am, am-Latn) (#198)
54
+ - Add Finnish language support (#197)
69
55
 
70
- > **Note:** v1 bundled all languages into a single wrapper function with runtime language selection via `{ lang: 'es' }`. v3 requires explicit language imports for tree-shaking—only the languages you import are included in your bundle.
56
+ ### Performance Improvements
71
57
 
72
- | Context | v1 | v3 |
73
- |---------|----|----|
74
- | **Import (all)** | `import n2words from 'n2words'` | `import { en, es } from 'n2words'` |
75
- | **Import (single)** | `import es from 'n2words/languages/es'` | `import { toWords } from 'n2words/es'` |
76
- | **Usage** | `n2words(42, { lang: 'es' })` | `es(42)` or `toWords(42)` |
77
- | **Browser** | `n2words(42, { lang: 'es' })` | `n2words.es(42)` |
78
- | **CDN (single)** | `.../dist/languages/es.js` | `.../dist/languages/es.js` (unchanged) |
58
+ - Add segment-based ScaleLanguage for 10x faster conversion (#205)
79
59
 
80
- #### From v2.x (class-based)
60
+ ### Bug Fixes
81
61
 
82
- | Context | v2 | v3 |
83
- |---------|----|----|
84
- | **Import (all)** | `import { EnglishConverter } from 'n2words'` | `import { en } from 'n2words'` |
85
- | **Import (single)** | `import { EnglishConverter } from 'n2words/en'` | `import { toWords } from 'n2words/en'` |
86
- | **Usage** | `EnglishConverter(42)` | `en(42)` or `toWords(42)` |
87
- | **Browser** | `n2words.EnglishConverter(42)` | `n2words.en(42)` |
88
- | **CDN (single)** | `.../dist/EnglishConverter.js` | `.../dist/languages/en.js` |
62
+ - Refactor input handling and validation in language converters (#192)
89
63
 
90
- ### Highlights
64
+ ### Features
91
65
 
92
- - **3x-85x faster** conversion across languages
93
- - **70-96% less memory** per conversion
94
- - **75-92% smaller** per-language bundles
95
- - **52 languages** - all self-contained, tree-shakeable modules
66
+ - Add support for fr-BE (#126)
96
67
 
97
- ### New Languages
68
+ ### Bug Fixes
98
69
 
99
- `am` (Amharic), `am-Latn` (Amharic Latin), `fi` (Finnish), `ha` (Hausa), `hbo` (Biblical Hebrew), `sr-Cyrl` (Serbian Cyrillic), `zh-Hant` (Traditional Chinese)
70
+ - Update Polish translation (#49)
100
71
 
101
- ### Performance Improvements
72
+ ### Bug Fixes
102
73
 
103
- - Precomputed lookup tables (en, pt, he, hbo)
104
- - BigInt modulo instead of string slicing (ja, sw)
105
- - Eliminated class instantiation overhead
74
+ - Remove console.log
106
75
 
107
- ---
108
- See [#206](https://github.com/forzagreen/n2words/pull/206) for full details.
package/README.md CHANGED
@@ -7,15 +7,15 @@
7
7
  [![npm downloads](https://img.shields.io/npm/dw/n2words)](https://npmjs.com/package/n2words)
8
8
  [![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/n2words)](https://www.jsdelivr.com/package/npm/n2words)
9
9
 
10
- **Numbers to words. 71 languages. Zero dependencies.**
10
+ **Numbers to words. 70+ languages. Zero dependencies.**
11
11
 
12
12
  ## Why n2words?
13
13
 
14
14
  - **Pure Functions** — Each language exports standalone functions. No classes, no configuration, no side effects.
15
15
  - **Tree-Shakeable** — Import only what you need. Unused exports are eliminated by modern bundlers.
16
- - **Tiny Bundles** — ~2.4 KB gzipped per language (with all forms). No bloat.
16
+ - **Tiny Bundles** — ~2 KB gzipped per language (with all forms). No bloat.
17
17
  - **Multiple Forms** — Cardinal ("forty-two"), ordinal ("forty-second"), and currency ("forty-two dollars")
18
- - **71 Languages** — European, Asian, Middle Eastern, African, and regional variants
18
+ - **70+ Languages** — European, Asian, Middle Eastern, African, and regional variants
19
19
  - **Zero Dependencies** — Works everywhere: Node.js, browsers, Deno, Bun
20
20
  - **BigInt Support** — Handle arbitrarily large numbers without precision loss
21
21
  - **Type-Safe** — Full TypeScript support with generated `.d.ts` declarations
@@ -52,7 +52,7 @@ toOrdinal(1234) // 'one thousand two hundred thirty-fourth'
52
52
  toCurrency(1234.56) // 'one thousand two hundred thirty-four dollars and fifty-six cents'
53
53
  ```
54
54
 
55
- All 71 languages support all three forms. See [LANGUAGES.md](LANGUAGES.md) for details.
55
+ All languages support all three forms. See [LANGUAGES.md](LANGUAGES.md) for details.
56
56
 
57
57
  ## Usage
58
58
 
@@ -84,16 +84,16 @@ import { toCardinal as fr } from 'n2words/fr-FR' // Aliased import
84
84
 
85
85
  See [LANGUAGES.md](LANGUAGES.md) for all language codes and available forms.
86
86
 
87
- ## Supported Languages (71)
87
+ ## Supported Languages
88
88
 
89
89
  See **[LANGUAGES.md](LANGUAGES.md)** for the complete list with codes and options.
90
90
 
91
- Highlights: Arabic, Chinese (Simplified/Traditional), English, French, German, Hindi, Japanese, Korean, Portuguese, Russian, Spanish, and [60 more](LANGUAGES.md).
91
+ Highlights: Arabic, Chinese (Simplified/Traditional), English, French, German, Hindi, Japanese, Korean, Portuguese, Russian, Spanish, and [many more](LANGUAGES.md).
92
92
 
93
93
  ## Compatibility
94
94
 
95
- - **Node.js**: 20+
96
- - **Browsers**: Chrome 67+, Firefox 68+, Safari 14+, Edge 79+ (~87% global coverage)
95
+ - **Node.js**: 22+
96
+ - **Browsers**: Chrome 67+, Firefox 68+, Safari 14+, Edge 79+ any browser with BigInt support
97
97
  - **Runtimes**: Deno, Bun, Cloudflare Workers
98
98
 
99
99
  Requires BigInt support (cannot be polyfilled).
@@ -102,7 +102,7 @@ Requires BigInt support (cannot be polyfilled).
102
102
 
103
103
  n2words is optimized for both size and speed:
104
104
 
105
- - ~2.4 KB gzipped per language (includes all forms)
105
+ - ~2 KB gzipped per language (includes all forms)
106
106
  - Individual language imports enable tree-shaking
107
107
  - No runtime dependencies
108
108
  - BigInt modulo operations (no string manipulation)
package/dist/am-ET.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/am-ET v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/am-ET v5.0.0 | 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=["","አንድ","ሁለት","ሶስት","አራት","አምስት","ስድስት","ሰባት","ስምንት","ዘጠኝ"],o=["አስር","አስራ አንድ","አስራ ሁለት","አስራ ሶስት","አስራ አራት","አስራ አምስት","አስራ ስድስት","አስራ ሰባት","አስራ ስምንት","አስራ ዘጠኝ"],u=["","","ሃያ","ሰላሳ","አርባ","ሃምሳ","ስልሳ","ሰባ","ሰማንያ","ዘጠና"],a="አሉታዊ",c=["","ሺ","ሚሊዮን","ቢሊዮን"];function g(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(s[r]+" መቶ"),1===t?i.push(o[n]):(t>1&&i.push(u[t]),n>0&&i.push(s[n])),i.join(" ")}function l(e){return 0n===e?"ዜሮ":e<1000n?g(Number(e)):function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=c[u]||"";o.push(0===u?g(n):g(n)+" "+e)}u--}return o.join(" ")}(e)}function f(i){const{isNegative:o,integerPart:u,decimalPart:c}=function(i){const s=typeof i;if("bigint"===s)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===s){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===s)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let g="";return o&&(g=a+" "),g+=l(u),c&&(g+=" ነጥብ "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?"ዜሮ":s[e])}return n.join(" ")}(c)),g}function m(n){const r=function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return 1n===(i=r)?"አንደኛ":l(i)+"ኛ";var i}function b(e){const{isNegative:t,dollars:r,cents:s}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);let o="";return t&&(o=a+" "),(r>0n||0n===s)&&(o+=l(r),o+=" ብር"),s>0n&&(r>0n&&(o+=" "),o+=l(s),o+=" ሳንቲም"),o}export{f as toCardinal,b as toCurrency,m as toOrdinal};
package/dist/am-ET.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/am-ET v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/am-ET v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),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 t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function s(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const s=t.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(t),cents:0n};const o=t.slice(0,s)||"0",u=(t.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const o=["","አንድ","ሁለት","ሶስት","አራት","አምስት","ስድስት","ሰባት","ስምንት","ዘጠኝ"],u=["አስር","አስራ አንድ","አስራ ሁለት","አስራ ሶስት","አስራ አራት","አስራ አምስት","አስራ ስድስት","አስራ ሰባት","አስራ ስምንት","አስራ ዘጠኝ"],a=["","","ሃያ","ሰላሳ","አርባ","ሃምሳ","ስልሳ","ሰባ","ሰማንያ","ዘጠና"],c="አሉታዊ",g=["","ሺ","ሚሊዮን","ቢሊዮን"];function l(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(o[r]+" መቶ"),1===t?i.push(u[n]):(t>1&&i.push(a[t]),n>0&&i.push(o[n])),i.join(" ")}function f(e){return 0n===e?"ዜሮ":e<1000n?l(Number(e)):function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=g[u]||"";o.push(0===u?l(n):l(n)+" "+e)}u--}return o.join(" ")}(e)}const d={amET:function(e){const t=function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return 1n===(i=t)?"አንደኛ":f(i)+"ኛ";var i}},m={amET:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:s(t(e))}if("string"===n)return s(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);let o="";return n&&(o=c+" "),(r>0n||0n===i)&&(o+=f(r),o+=" ብር"),i>0n&&(r>0n&&(o+=" "),o+=f(i),o+=" ሳንቲም"),o}};e.amET=function(e){const{isNegative:s,integerPart:u,decimalPart:a}=function(e){const s=typeof e;if("bigint"===s)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===s){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"===s)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(e);let g="";return s&&(g=c+" "),g+=f(u),a&&(g+=" ነጥብ "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?"ዜሮ":o[e])}return n.join(" ")}(a)),g},e.currency=m,e.ordinal=d},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
@@ -1,2 +1,2 @@
1
- /*! n2words/am-Latn-ET v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/am-Latn-ET v5.0.0 | 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("."),a=-1===s?n:n.slice(0,s)+n.slice(s+1),o=(-1===s?n.length:s)+r;return o>=a.length?i+a+"0".repeat(o-a.length):o<=0?i+"0."+"0".repeat(-o)+a:i+a.slice(0,o)+"."+a.slice(o)}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 a=r.slice(0,s)||"0",o=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(a),cents:BigInt(o)}}const s=["","and","hulet","sost","arat","amist","siddist","sebat","siment","zeteny"],a=["asir","asra and","asra hulet","asra sost","asra arat","asra amist","asra siddist","asra sebat","asra siment","asra zeteny"],o=["","","haya","selasa","arba","hamsa","silsa","seba","semanya","zetena"],u="zero",c="asitegna",g=["","shi","miliyon","billiyon"];function l(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(s[r]+" meto"),1===t?i.push(a[n]):(t>1&&i.push(o[t]),n>0&&i.push(s[n])),i.join(" ")}function f(e){return 0n===e?u:e<1000n?l(Number(e)):function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const a=[];let o=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=g[o]||"";a.push(0===o?l(n):l(n)+" "+e)}o--}return a.join(" ")}(e)}function m(i){const{isNegative:a,integerPart:o,decimalPart:g}=function(i){const s=typeof i;if("bigint"===s)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===s){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===s)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let l="";return a&&(l=c+" "),l+=f(o),g&&(l+=" netib "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?u:s[e])}return n.join(" ")}(g)),l}function b(n){const r=function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return 1n===(i=r)?"andenya":f(i)+"nya";var i}function d(e){const{isNegative:t,dollars:r,cents:s}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);let a="";return t&&(a=c+" "),(r>0n||0n===s)&&(a+=f(r),a+=" birr"),s>0n&&(r>0n&&(a+=" "),a+=f(s),a+=" santim"),a}export{m as toCardinal,d as toCurrency,b as toOrdinal};
@@ -1,2 +1,2 @@
1
- /*! n2words/am-Latn-ET v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/am-Latn-ET v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const s=n.indexOf("."),a=-1===s?n:n.slice(0,s)+n.slice(s+1),o=(-1===s?n.length:s)+r;return o>=a.length?i+a+"0".repeat(o-a.length):o<=0?i+"0."+"0".repeat(-o)+a:i+a.slice(0,o)+"."+a.slice(o)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function s(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const s=t.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(t),cents:0n};const a=t.slice(0,s)||"0",o=(t.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(a),cents:BigInt(o)}}const a=["","and","hulet","sost","arat","amist","siddist","sebat","siment","zeteny"],o=["asir","asra and","asra hulet","asra sost","asra arat","asra amist","asra siddist","asra sebat","asra siment","asra zeteny"],u=["","","haya","selasa","arba","hamsa","silsa","seba","semanya","zetena"],c="zero",l="asitegna",g=["","shi","miliyon","billiyon"];function f(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];return r>0&&i.push(a[r]+" meto"),1===t?i.push(o[n]):(t>1&&i.push(u[t]),n>0&&i.push(a[n])),i.join(" ")}function d(e){return 0n===e?c:e<1000n?f(Number(e)):function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const a=[];let o=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=g[o]||"";a.push(0===o?f(n):f(n)+" "+e)}o--}return a.join(" ")}(e)}const m={amLatnET:function(e){const t=function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return 1n===(i=t)?"andenya":d(i)+"nya";var i}},b={amLatnET:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:s(t(e))}if("string"===n)return s(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);let a="";return n&&(a=l+" "),(r>0n||0n===i)&&(a+=d(r),a+=" birr"),i>0n&&(r>0n&&(a+=" "),a+=d(i),a+=" santim"),a}};e.amLatnET=function(e){const{isNegative:s,integerPart:o,decimalPart:u}=function(e){const s=typeof e;if("bigint"===s)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===s){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"===s)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(e);let g="";return s&&(g=l+" "),g+=d(o),u&&(g+=" netib "+function(e){const n=[];for(const t of e){const e=parseInt(t,10);n.push(0===e?c:a[e])}return n.join(" ")}(u)),g},e.currency=b,e.ordinal=m},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/ar-SA.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/ar-SA v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/ar-SA v5.0.0 | 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){if(void 0===n)return{};if(function(n){if(null===n||"object"!=typeof n)return!1;const e=Object.getPrototypeOf(n);return null===e||e===Object.prototype}(n))return n;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof n)}const s=["عشرون","ثلاثون","أربعون","خمسون","ستون","سبعون","ثمانون","تسعون"],u=["","مائة","مئتان","ثلاثمائة","أربعمائة","خمسمائة","ستمائة","سبعمائة","ثمانمائة","تسعمائة"],c=["مائة","ألف","مليون","مليار","تريليون","كوادريليون","كوينتليون","سكستيليون"],a=["","ألفاً","مليوناً","ملياراً","تريليوناً","كوادريليوناً","كوينتليوناً","سكستيليوناً"],l=["","آلاف","ملايين","مليارات","تريليونات","كوادريليونات","كوينتليونات","سكستيليونات"],g=["مئتان","ألفان","مليونان","ملياران","تريليونان","كوادريليونان","كوينتليونان","سكستيليونان"],f=["مئتا","ألفا","مليونا","مليارا","تريليونا","كوادريليونا","كوينتليونا","سكستيليونا"],m=["واحد","اثنان","ثلاثة","أربعة","خمسة","ستة","سبعة","ثمانية","تسعة","عشرة","أحد عشر","اثنا عشر","ثلاثة عشر","أربعة عشر","خمسة عشر","ستة عشر","سبعة عشر","ثمانية عشر","تسعة عشر"],d=["واحدة","اثنتان","ثلاث","أربع","خمس","ست","سبع","ثمان","تسع","عشر","إحدى عشرة","اثنتا عشرة","ثلاث عشرة","أربع عشرة","خمس عشرة","ست عشرة","سبع عشرة","ثماني عشرة","تسع عشرة"],b="ناقص",h=["الأول","الثاني","الثالث","الرابع","الخامس","السادس","السابع","الثامن","التاسع","العاشر"],w=["الأولى","الثانية","الثالثة","الرابعة","الخامسة","السادسة","السابعة","الثامنة","التاسعة","العاشرة"],p="ريال",v="ريالان",N="هللة",I="هللتان";function E(n,e,t,r){const i=n%100,o=Math.trunc(n/100);let a="";if(o>0)if(0===i&&2===o)a=g[0];else{const n=u[o];n&&(a=n,0!==i&&(a+=" و"))}if(i>0)if(i<20)if(2===i&&0===o&&e>0){const r=Number(t),i=Math.trunc(Math.log10(r));i%3==0&&t===BigInt(2*Math.pow(10,i))?a+=2===n?g[e]:f[e]:a+=g[e]}else a+=1===i&&e>0?c[e]:r[i-1];else{const n=i%10,e=Math.trunc(i/10)-2;n>0&&(a+=r[n-1]+" و"),a+=s[e]}return a}function y(n,e){if(0n===n)return"صفر";const t="feminine"===e?d:m;let r=n,i=0;const o=[];for(;r>0n;){const e=Number(r%1000n);if(r/=1000n,e>0){const r=E(e,i,n,t);if(r){let n=r;i>0&&e>2&&(n+=1==e%100?" "+c[i]:e>=3&&e<=10?" "+l[i]:" "+(o.length>0?a[i]:c[i])),o.unshift(n)}}i++}if(1===o.length)return o[0];let s=o[0];for(let n=1;n<o.length;n++)s+=" و"+o[n];return s}function O(i,s){s=o(s);const{isNegative:u,integerPart:c,decimalPart:a}=function(i){const o=typeof i;if("bigint"===o)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===o){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(e(i))}if("string"===o)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),{gender:l="masculine",negativeWord:g=b}=s,f=[];return u&&f.push(g),f.push(y(c,l)),a&&(f.push("فاصلة"),f.push(function(n,e){const t=[];let r=0;for(;r<n.length&&"0"===n[r];)t.push("صفر"),r++;const i=n.slice(r);return i&&t.push(y(BigInt(i),e)),t.join(" ")}(a,l))),f.join(" ")}function R(e,r){r=o(r);const i=function(e){const r=typeof e;if("bigint"===r){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===r){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"===r)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}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(e),{gender:s="masculine"}=r;return function(n,e){return n>=1n&&n<=10n?("feminine"===e?w:h)[Number(n)-1]:"ال"+y(n,e)}(i,s)}function B(n){const{isNegative:t,dollars:r,cents:o}=function(n){const t=typeof n;if("bigint"===t)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"===t){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"===t)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);let s="";var u;return t&&(s=b+" "),(r>0n||0n===o)&&(s+=1n===r?p+" "+m[0]:2n===r?v:y(r,"masculine")+" "+(1n===(u=r)?p:2n===u?v:u>=3n&&u<=10n?"ريالات":"ريالاً")),o>0n&&(r>0n&&(s+=" و"),s+=1n===o?N+" "+d[0]:2n===o?I:y(o,"feminine")+" "+function(n){return 1n===n?N:2n===n?I:n>=3n&&n<=10n?"هللات":"هللة"}(o)),s}export{O as toCardinal,B as toCurrency,R as toOrdinal};
package/dist/ar-SA.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/ar-SA v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/ar-SA v5.0.0 | 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){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}const u=["عشرون","ثلاثون","أربعون","خمسون","ستون","سبعون","ثمانون","تسعون"],c=["","مائة","مئتان","ثلاثمائة","أربعمائة","خمسمائة","ستمائة","سبعمائة","ثمانمائة","تسعمائة"],a=["مائة","ألف","مليون","مليار","تريليون","كوادريليون","كوينتليون","سكستيليون"],f=["","ألفاً","مليوناً","ملياراً","تريليوناً","كوادريليوناً","كوينتليوناً","سكستيليوناً"],l=["","آلاف","ملايين","مليارات","تريليونات","كوادريليونات","كوينتليونات","سكستيليونات"],g=["مئتان","ألفان","مليونان","ملياران","تريليونان","كوادريليونان","كوينتليونان","سكستيليونان"],d=["مئتا","ألفا","مليونا","مليارا","تريليونا","كوادريليونا","كوينتليونا","سكستيليونا"],m=["واحد","اثنان","ثلاثة","أربعة","خمسة","ستة","سبعة","ثمانية","تسعة","عشرة","أحد عشر","اثنا عشر","ثلاثة عشر","أربعة عشر","خمسة عشر","ستة عشر","سبعة عشر","ثمانية عشر","تسعة عشر"],b=["واحدة","اثنتان","ثلاث","أربع","خمس","ست","سبع","ثمان","تسع","عشر","إحدى عشرة","اثنتا عشرة","ثلاث عشرة","أربع عشرة","خمس عشرة","ست عشرة","سبع عشرة","ثماني عشرة","تسع عشرة"],h="ناقص",p=["الأول","الثاني","الثالث","الرابع","الخامس","السادس","السابع","الثامن","التاسع","العاشر"],w=["الأولى","الثانية","الثالثة","الرابعة","الخامسة","السادسة","السابعة","الثامنة","التاسعة","العاشرة"],v="ريال",N="ريالان",I="هللة",y="هللتان";function E(e,n,t,r){const i=e%100,o=Math.trunc(e/100);let s="";if(o>0)if(0===i&&2===o)s=g[0];else{const e=c[o];e&&(s=e,0!==i&&(s+=" و"))}if(i>0)if(i<20)if(2===i&&0===o&&n>0){const r=Number(t),i=Math.trunc(Math.log10(r));i%3==0&&t===BigInt(2*Math.pow(10,i))?s+=2===e?g[n]:d[n]:s+=g[n]}else s+=1===i&&n>0?a[n]:r[i-1];else{const e=i%10,n=Math.trunc(i/10)-2;e>0&&(s+=r[e-1]+" و"),s+=u[n]}return s}function O(e,n){if(0n===e)return"صفر";const t="feminine"===n?b:m;let r=e,i=0;const o=[];for(;r>0n;){const n=Number(r%1000n);if(r/=1000n,n>0){const r=E(n,i,e,t);if(r){let e=r;i>0&&n>2&&(e+=1==n%100?" "+a[i]:n>=3&&n<=10?" "+l[i]:" "+(o.length>0?f[i]:a[i])),o.unshift(e)}}i++}if(1===o.length)return o[0];let s=o[0];for(let e=1;e<o.length;e++)s+=" و"+o[e];return s}const R={arSA:function(e,t){t=s(t);const i=function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e),{gender:o="masculine"}=t;return function(e,n){return e>=1n&&e<=10n?("feminine"===n?w:p)[Number(e)-1]:"ال"+O(e,n)}(i,o)}},B={arSA:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:o(t(e))}if("string"===n)return o(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);let s="";var u;return n&&(s=h+" "),(r>0n||0n===i)&&(s+=1n===r?v+" "+m[0]:2n===r?N:O(r,"masculine")+" "+(1n===(u=r)?v:2n===u?N:u>=3n&&u<=10n?"ريالات":"ريالاً")),i>0n&&(r>0n&&(s+=" و"),s+=1n===i?I+" "+b[0]:2n===i?y:O(i,"feminine")+" "+function(e){return 1n===e?I:2n===e?y:e>=3n&&e<=10n?"هللات":"هللة"}(i)),s}};e.arSA=function(e,o){o=s(o);const{isNegative:u,integerPart:c,decimalPart:a}=function(e){const o=typeof e;if("bigint"===o)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===o){if(!Number.isFinite(e))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(e)?e<0?{isNegative:!0,integerPart:BigInt(-e)}:{isNegative:!1,integerPart:BigInt(e)}:i(t(e))}if("string"===o)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${o}`)}(e),{gender:f="masculine",negativeWord:l=h}=o,g=[];return u&&g.push(l),g.push(O(c,f)),a&&(g.push("فاصلة"),g.push(function(e,n){const t=[];let r=0;for(;r<e.length&&"0"===e[r];)t.push("صفر"),r++;const i=e.slice(r);return i&&t.push(O(BigInt(i),n)),t.join(" ")}(a,f))),g.join(" ")},e.currency=B,e.ordinal=R},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/az-AZ.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/az-AZ v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/az-AZ v5.0.0 | 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=["","bir","iki","üç","dörd","beş","altı","yeddi","səkkiz","doqquz"],s=["on","on bir","on iki","on üç","on dörd","on beş","on altı","on yeddi","on səkkiz","on doqquz"],u=["","","iyirmi","otuz","qırx","əlli","altmış","yetmiş","səksən","doxsan"],c="sıfır",a="mənfi",l=["","min","milyon","milyar","trilyon","katrilyon","kentilyon"],g={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yeddinci",8:"səkkizinci",9:"doqquzuncu",10:"onuncu"};function f(n){if(0===n)return"";const e=n%10,r=Math.trunc(n/10)%10,t=Math.trunc(n/100),i=[];return t>0&&i.push(1===t?"yüz":o[t]+" yüz"),1===r?i.push(s[e]):(r>1&&i.push(u[r]),e>0&&i.push(o[e])),i.join(" ")}function d(n){return 0n===n?c:n<1000n?f(Number(n)):function(n){const e=n.toString(),r=e.length,t=[],i=r%3;let o=0;for(i>0&&(t.push(Number(e.slice(0,i))),o=i);o<r;)t.push(Number(e.slice(o,o+3))),o+=3;const s=[];let u=t.length-1;for(let n=0;n<t.length;n++){const e=t[n];if(0!==e){const n=l[u]||"";s.push(0===u?f(e):1===u&&1===e?n:f(e)+" "+n)}u--}return s.join(" ")}(n)}function m(i){const{isNegative:o,integerPart:s,decimalPart:u}=function(i){const o=typeof i;if("bigint"===o)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===o){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:t(e(i))}if("string"===o)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 l="";return o&&(l=a+" "),l+=d(s),u&&(l+=" nöqtə "+function(n){let e="",r=0;for(;r<n.length&&"0"===n[r];)e&&(e+=" "),e+=c,r++;const t=n.slice(r);return t&&(e&&(e+=" "),e+=d(BigInt(t))),e}(u)),l}function b(e){return function(n){if(n>=1n&&n<=10n)return g[Number(n)];const e=d(n).replace(/ /g,"");return e+function(n){for(let e=n.length-1;e>=0;e--){const r=n[e];if("aıou".includes(r))return"ou".includes(r)?"uncu":"ıncı";if("əeiöü".includes(r))return"öü".includes(r)?"üncü":"inci"}return"inci"}(e)}(function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const 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}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e))}function h(n){const{isNegative:r,dollars:t,cents:o}=function(n){const r=typeof n;if("bigint"===r)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"===r){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"===r)return i(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);let s="";return r&&(s=a+" "),(t>0n||0n===o)&&(s+=d(t)+" manat"),o>0n&&(t>0n&&(s+=" "),s+=d(o)+" qəpik"),s}export{m as toCardinal,h as toCurrency,b as toOrdinal};
package/dist/az-AZ.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/az-AZ v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/az-AZ v5.0.0 | 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)}}const s=["","bir","iki","üç","dörd","beş","altı","yeddi","səkkiz","doqquz"],u=["on","on bir","on iki","on üç","on dörd","on beş","on altı","on yeddi","on səkkiz","on doqquz"],c=["","","iyirmi","otuz","qırx","əlli","altmış","yetmiş","səksən","doxsan"],a="sıfır",l="mənfi",g=["","min","milyon","milyar","trilyon","katrilyon","kentilyon"],f={1:"birinci",2:"ikinci",3:"üçüncü",4:"dördüncü",5:"beşinci",6:"altıncı",7:"yeddinci",8:"səkkizinci",9:"doqquzuncu",10:"onuncu"};function d(n){if(0===n)return"";const e=n%10,t=Math.trunc(n/10)%10,r=Math.trunc(n/100),i=[];return r>0&&i.push(1===r?"yüz":s[r]+" yüz"),1===t?i.push(u[e]):(t>1&&i.push(c[t]),e>0&&i.push(s[e])),i.join(" ")}function m(n){return 0n===n?a:n<1000n?d(Number(n)):function(n){const e=n.toString(),t=e.length,r=[],i=t%3;let o=0;for(i>0&&(r.push(Number(e.slice(0,i))),o=i);o<t;)r.push(Number(e.slice(o,o+3))),o+=3;const s=[];let u=r.length-1;for(let n=0;n<r.length;n++){const e=r[n];if(0!==e){const n=g[u]||"";s.push(0===u?d(e):1===u&&1===e?n:d(e)+" "+n)}u--}return s.join(" ")}(n)}const b={azAZ:function(n){return function(n){if(n>=1n&&n<=10n)return f[Number(n)];const e=m(n).replace(/ /g,"");return e+function(n){for(let e=n.length-1;e>=0;e--){const t=n[e];if("aıou".includes(t))return"ou".includes(t)?"uncu":"ıncı";if("əeiöü".includes(t))return"öü".includes(t)?"üncü":"inci"}return"inci"}(e)}(function(n){const t=typeof n;if("bigint"===t){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===t){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"===t)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}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n))}},h={azAZ:function(n){const{isNegative:e,dollars:r,cents:i}=function(n){const e=typeof n;if("bigint"===e)return n<0n?{isNegative:!0,dollars:-n,cents:0n}:{isNegative:!1,dollars:n,cents:0n};if("number"===e){if(!Number.isFinite(n))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(n)?n<0?{isNegative:!0,dollars:BigInt(-n),cents:0n}:{isNegative:!1,dollars:BigInt(n),cents:0n}:o(t(n))}if("string"===e)return o(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(n);let s="";return e&&(s=l+" "),(r>0n||0n===i)&&(s+=m(r)+" manat"),i>0n&&(r>0n&&(s+=" "),s+=m(i)+" qəpik"),s}};n.azAZ=function(n){const{isNegative:o,integerPart:s,decimalPart:u}=function(n){const o=typeof n;if("bigint"===o)return n<0n?{isNegative:!0,integerPart:-n}:{isNegative:!1,integerPart:n};if("number"===o){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"===o)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);let c="";return o&&(c=l+" "),c+=m(s),u&&(c+=" nöqtə "+function(n){let e="",t=0;for(;t<n.length&&"0"===n[t];)e&&(e+=" "),e+=a,t++;const r=n.slice(t);return r&&(e&&(e+=" "),e+=m(BigInt(r))),e}(u)),c},n.currency=h,n.ordinal=b},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).n2words=n.n2words||{});
package/dist/bn-BD.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/bn-BD v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/bn-BD v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  function e(e){let[n,r]=e.toLowerCase().split("e");const t=parseInt(r,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)+t;return u>=o.length?i+o+"0".repeat(u-o.length):u<=0?i+"0."+"0".repeat(-u)+o:i+o.slice(0,u)+"."+o.slice(u)}function n(n){const t=n.toString();return r(t)?e(t):t}function r(e){return e.includes("e")||e.includes("E")}function t(e){const n="-"===e[0];n&&(e=e.slice(1));const r=e.indexOf(".");if(-1===r)return{isNegative:n,integerPart:BigInt(e)};const t=e.slice(0,r)||"0",i=e.slice(r+1);return{isNegative:n,integerPart:BigInt(t),decimalPart:i}}function i(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 s=t.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(t),cents:0n};const o=t.slice(0,s)||"0",u=(t.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const s="শূন্য",o="মাইনাস",u=["","প্রথম","দ্বিতীয়","তৃতীয়","চতুর্থ","পঞ্চম","ষষ্ঠ"],a=["শূন্য","এক","দুই","তিন","চার","পাঁচ","ছয়","সাত","আট","নয়","দশ","এগারো","বারো","তেরো","চৌদ্দ","পনেরো","ষোল","সতেরো","আঠারো","উনিশ","বিশ","একুশ","বাইশ","তেইশ","চব্বিশ","পঁচিশ","ছাব্বিশ","সাতাশ","আঠাশ","উনত্রিশ","ত্রিশ","একত্রিশ","বত্রিশ","তেত্রিশ","চৌত্রিশ","পঁয়ত্রিশ","ছত্রিশ","সাঁইত্রিশ","আটত্রিশ","উনচল্লিশ","চল্লিশ","একচল্লিশ","বেয়াল্লিশ","তেতাল্লিশ","চুয়াল্লিশ","পঁয়তাল্লিশ","ছেচল্লিশ","সাতচল্লিশ","আটচল্লিশ","উনপঞ্চাশ","পঞ্চাশ","একান্ন","বাহান্ন","তিপ্পান্ন","চুয়ান্ন","পঞ্চান্ন","ছাপ্পান্ন","সাতান্ন","আটান্ন","উনষাট","ষাট","একষট্টি","বাষট্টি","তেষট্টি","চৌষট্টি","পঁয়ষট্টি","ছেষট্টি","সাতষট্টি","আটষট্টি","ঊনসত্তর","সত্তর","একাত্তর","বাহাত্তর","তেহাত্তর","চুয়াত্তর","পঁচাত্তর","ছিয়াত্তর","সাতাত্তর","আটাত্তর","উনআশি","আশি","একাশি","বিরাশি","তিরাশি","চুরাশি","পঁচাশি","ছিয়াশি","সাতাশি","আটাশি","উননব্বই","নব্বই","একানব্বই","বিরানব্বই","তিরানব্বই","চুরানব্বই","পঁচানব্বই","ছিয়ানব্বই","সাতানব্বই","আটানব্বই","নিরানব্বই"],c=["","হাজার","লাখ","কোটি","আরব","খরব","নীল","পদ্ম","শঙ্খ"];function g(e){if(0===e)return"";if(e<100)return a[e];const n=Math.trunc(e/100),r=e%100;return 0===r?a[n]+" শত":a[n]+" শত "+a[r]}function l(e){if(0n===e)return s;if(e<1000n)return g(Number(e));const n=[];n.push(Number(e%1000n));let r=e/1000n;for(;r>0n;)n.push(Number(r%100n)),r/=100n;const t=[];for(let e=n.length-1;e>=0;e--){const r=n[e];0!==r&&(t.push(0===e?g(r):a[r]),e>0&&c[e]&&t.push(c[e]))}return t.join(" ")}function f(i){const{isNegative:u,integerPart:a,decimalPart:c}=function(i){const s=typeof i;if("bigint"===s)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===s){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:t(n(i))}if("string"===s)return t(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}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let g="";return u&&(g=o+" "),g+=l(a),c&&(g+=" দশমিক "+function(e){let n="",r=0;for(;r<e.length&&"0"===e[r];)n&&(n+=" "),n+=s,r++;const t=e.slice(r);return t&&(n&&(n+=" "),n+=l(BigInt(t))),n}(c)),g}function m(n){const t=function(n){const t=typeof n;if("bigint"===t){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===t){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"===t)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 e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(n);return(i=t)>=1n&&i<=6n?u[Number(i)]:l(i)+"তম";var i}function b(e){const{isNegative:r,dollars:t,cents:s}=function(e){const r=typeof e;if("bigint"===r)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===r){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"===r)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(e);let u="";return r&&(u=o+" "),(t>0n||0n===s)&&(u+=l(t)+" টাকা"),s>0n&&(t>0n&&(u+=" "),u+=l(s)+" পয়সা"),u}export{f as toCardinal,b as toCurrency,m as toOrdinal};
package/dist/bn-BD.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/bn-BD v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/bn-BD v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  var e,n;e=this,n=function(e){"use strict";function n(e){let[n,r]=e.toLowerCase().split("e");const t=parseInt(r,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)+t;return u>=o.length?i+o+"0".repeat(u-o.length):u<=0?i+"0."+"0".repeat(-u)+o:i+o.slice(0,u)+"."+o.slice(u)}function r(e){const r=e.toString();return t(r)?n(r):r}function t(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const r=e.indexOf(".");if(-1===r)return{isNegative:n,integerPart:BigInt(e)};const t=e.slice(0,r)||"0",i=e.slice(r+1);return{isNegative:n,integerPart:BigInt(t),decimalPart:i}}function s(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 s=r.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(r),cents:0n};const o=r.slice(0,s)||"0",u=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const o="শূন্য",u="মাইনাস",a=["","প্রথম","দ্বিতীয়","তৃতীয়","চতুর্থ","পঞ্চম","ষষ্ঠ"],c=["শূন্য","এক","দুই","তিন","চার","পাঁচ","ছয়","সাত","আট","নয়","দশ","এগারো","বারো","তেরো","চৌদ্দ","পনেরো","ষোল","সতেরো","আঠারো","উনিশ","বিশ","একুশ","বাইশ","তেইশ","চব্বিশ","পঁচিশ","ছাব্বিশ","সাতাশ","আঠাশ","উনত্রিশ","ত্রিশ","একত্রিশ","বত্রিশ","তেত্রিশ","চৌত্রিশ","পঁয়ত্রিশ","ছত্রিশ","সাঁইত্রিশ","আটত্রিশ","উনচল্লিশ","চল্লিশ","একচল্লিশ","বেয়াল্লিশ","তেতাল্লিশ","চুয়াল্লিশ","পঁয়তাল্লিশ","ছেচল্লিশ","সাতচল্লিশ","আটচল্লিশ","উনপঞ্চাশ","পঞ্চাশ","একান্ন","বাহান্ন","তিপ্পান্ন","চুয়ান্ন","পঞ্চান্ন","ছাপ্পান্ন","সাতান্ন","আটান্ন","উনষাট","ষাট","একষট্টি","বাষট্টি","তেষট্টি","চৌষট্টি","পঁয়ষট্টি","ছেষট্টি","সাতষট্টি","আটষট্টি","ঊনসত্তর","সত্তর","একাত্তর","বাহাত্তর","তেহাত্তর","চুয়াত্তর","পঁচাত্তর","ছিয়াত্তর","সাতাত্তর","আটাত্তর","উনআশি","আশি","একাশি","বিরাশি","তিরাশি","চুরাশি","পঁচাশি","ছিয়াশি","সাতাশি","আটাশি","উননব্বই","নব্বই","একানব্বই","বিরানব্বই","তিরানব্বই","চুরানব্বই","পঁচানব্বই","ছিয়ানব্বই","সাতানব্বই","আটানব্বই","নিরানব্বই"],g=["","হাজার","লাখ","কোটি","আরব","খরব","নীল","পদ্ম","শঙ্খ"];function l(e){if(0===e)return"";if(e<100)return c[e];const n=Math.trunc(e/100),r=e%100;return 0===r?c[n]+" শত":c[n]+" শত "+c[r]}function f(e){if(0n===e)return o;if(e<1000n)return l(Number(e));const n=[];n.push(Number(e%1000n));let r=e/1000n;for(;r>0n;)n.push(Number(r%100n)),r/=100n;const t=[];for(let e=n.length-1;e>=0;e--){const r=n[e];0!==r&&(t.push(0===e?l(r):c[r]),e>0&&g[e]&&t.push(g[e]))}return t.join(" ")}const d={bnBD:function(e){const r=function(e){const r=typeof e;if("bigint"===r){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===r){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"===r)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 e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(e);return(i=r)>=1n&&i<=6n?a[Number(i)]:f(i)+"তম";var i}},b={bnBD:function(e){const{isNegative:n,dollars:t,cents:i}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:s(r(e))}if("string"===n)return s(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);let o="";return n&&(o=u+" "),(t>0n||0n===i)&&(o+=f(t)+" টাকা"),i>0n&&(t>0n&&(o+=" "),o+=f(i)+" পয়সা"),o}};e.bnBD=function(e){const{isNegative:s,integerPart:a,decimalPart:c}=function(e){const s=typeof e;if("bigint"===s)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===s){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(r(e))}if("string"===s)return i(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}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(e);let g="";return s&&(g=u+" "),g+=f(a),c&&(g+=" দশমিক "+function(e){let n="",r=0;for(;r<e.length&&"0"===e[r];)n&&(n+=" "),n+=o,r++;const t=e.slice(r);return t&&(n&&(n+=" "),n+=f(BigInt(t))),n}(c)),g},e.currency=b,e.ordinal=d},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/cs-CZ.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/cs-CZ v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/cs-CZ v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  function t(t){let[n,e]=t.toLowerCase().split("e");const r=parseInt(e,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),u=(-1===s?n.length:s)+r;return u>=o.length?i+o+"0".repeat(u-o.length):u<=0?i+"0."+"0".repeat(-u)+o:i+o.slice(0,u)+"."+o.slice(u)}function n(n){const r=n.toString();return e(r)?t(r):r}function e(t){return t.includes("e")||t.includes("E")}function r(t){const n="-"===t[0];n&&(t=t.slice(1));const e=t.indexOf(".");if(-1===e)return{isNegative:n,integerPart:BigInt(t)};const r=t.slice(0,e)||"0",i=t.slice(e+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function i(n){let r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid currency format: "${n}"`);e(r)&&(r=t(r));const i="-"===r[0];i&&(r=r.slice(1));const s=r.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(r),cents:0n};const o=r.slice(0,s)||"0",u=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const s=["","jedna","dva","tři","čtyři","pět","šest","sedm","osm","devět"],o=["deset","jedenáct","dvanáct","třináct","čtrnáct","patnáct","šestnáct","sedmnáct","osmnáct","devatenáct"],u=["","","dvacet","třicet","čtyřicet","padesát","šedesát","sedmdesát","osmdesát","devadesát"],c=["","sto","dvě stě","tři sta","čtyři sta","pět set","šest set","sedm set","osm set","devět set"],a={1:["tisíc","tisíce","tisíc"],2:["milion","miliony","milionů"],3:["miliarda","miliardy","miliard"],4:["bilion","biliony","bilionů"],5:["biliarda","biliardy","biliard"],6:["trilion","triliony","trilionů"],7:["triliarda","triliardy","triliard"],8:["kvadrilion","kvadriliony","kvadrilionů"],9:["kvadriliarda","kvadriliardy","kvadriliard"]},l="nula",d="mínus",f=["","první","druhý","třetí","čtvrtý","pátý","šestý","sedmý","osmý","devátý"],g=["desátý","jedenáctý","dvanáctý","třináctý","čtrnáctý","patnáctý","šestnáctý","sedmnáctý","osmnáctý","devatenáctý"],m=["","","dvacátý","třicátý","čtyřicátý","padesátý","šedesátý","sedmdesátý","osmdesátý","devadesátý"],b=["","stý","dvoustý","třístý","čtyřstý","pětistý","šestistý","sedmistý","osmistý","devítistý"],h=["tisící","miliontý","miliardtý","biliontý"],v=["koruna","koruny","korun"],p=["haléř","haléře","haléřů"];function N(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(c[r]),1===e?i.push(o[n]):e>=2?(i.push(u[e]),n>0&&i.push(s[n])):n>0&&i.push(s[n]),i.join(" ")}function w(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(c[r]),1===e?i.push(o[n]):e>=2?(i.push(u[e]),n>0&&i.push(s[n])):n>0&&i.push(s[n]),i.join(" ")}function y(t,n){if(1n===t)return n[0];const e=t%10n,r=t%100n;return e>=2n&&e<=4n&&(r<10n||r>20n)?n[1]:n[2]}function I(t){if(0n===t)return l;if(t<1000n)return N(Number(t));if(t<1000000n){const n=t/1000n,e=Number(t%1000n),r=y(n,a[1]);let i;return i=1n===n?r:N(Number(n))+" "+r,e>0&&(i+=" "+w(e)),i}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r="";for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n!==e)if(r&&(r+=" "),0===t)r+=w(Number(e));else{const n=a[t];if(n){const t=y(e,n);r+=1n===e?t:N(Number(e))+" "+t}else r+=N(Number(e))}}return r}(t)}function E(i){const{isNegative:s,integerPart:o,decimalPart:u}=function(i){const s=typeof i;if("bigint"===s)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===s){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===s)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return e(r)?t(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let c="";if(s&&(c=d+" "),c+=I(o),u){const t=function(t){return 0n===t||1n===t?"celá":t>=2n&&t<=4n?"celé":"celých"}(o);c+=" "+t+" "+function(t){let n="",e=0;for(;e<t.length&&"0"===t[e];)n&&(n+=" "),n+=l,e++;const r=t.slice(e);return r&&(n&&(n+=" "),n+=I(BigInt(r))),n}(u)}return c}function R(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10);return 0===e?f[n]:1===e?g[n]:0===n?m[e]:u[e]+" "+f[n]}function B(t){if(t<100n)return R(Number(t));if(t<1000n){const n=Number(t),e=Math.trunc(n/100),r=n%100;return 0===r?b[e]:c[e]+" "+R(r)}if(t<1000000n){const n=Number(t/1000n),e=Number(t%1000n);if(0===e)return 1===n?h[0]:N(n)+" "+h[0];const r=y(BigInt(n),a[1]),i=1===n?"":N(n)+" ";return(1===n?"tisíc":i+r)+" "+B(BigInt(e))}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r=0;for(let t=0;t<n.length;t++)0n!==n[t]&&(r=t);const i=[];for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n===e)continue;const s=t===r;if(0===t)i.push(s?B(e):w(Number(e)));else if(s)i.push(1n===e?h[t-1]||a[t][0]:N(Number(e))+" "+(h[t-1]||a[t][0]));else{const n=a[t];if(n){const t=y(e,n);i.push(1n===e?t:N(Number(e))+" "+t)}}}return i.join(" ")}(t)}function O(n){return B(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(e(r)){const n=t(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const e=BigInt(n);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}try{const t=BigInt(r);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}catch(t){if(t instanceof RangeError)throw t;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}function k(t){const{isNegative:e,dollars:r,cents:s}=function(t){const e=typeof t;if("bigint"===e)return t<0n?{isNegative:!0,dollars:-t,cents:0n}:{isNegative:!1,dollars:t,cents:0n};if("number"===e){if(!Number.isFinite(t))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(t)?t<0?{isNegative:!0,dollars:BigInt(-t),cents:0n}:{isNegative:!1,dollars:BigInt(t),cents:0n}:i(n(t))}if("string"===e)return i(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(t);let o="";return e&&(o=d+" "),(r>0n||0n===s)&&(o+=I(r),o+=" "+y(r,v)),s>0n&&(r>0n&&(o+=" "),o+=I(s),o+=" "+y(s,p)),o}export{E as toCardinal,k as toCurrency,O as toOrdinal};
package/dist/cs-CZ.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/cs-CZ v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/cs-CZ v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  var t,n;t=this,n=function(t){"use strict";function n(t){let[n,e]=t.toLowerCase().split("e");const r=parseInt(e,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),u=(-1===s?n.length:s)+r;return u>=o.length?i+o+"0".repeat(u-o.length):u<=0?i+"0."+"0".repeat(-u)+o:i+o.slice(0,u)+"."+o.slice(u)}function e(t){const e=t.toString();return r(e)?n(e):e}function r(t){return t.includes("e")||t.includes("E")}function i(t){const n="-"===t[0];n&&(t=t.slice(1));const e=t.indexOf(".");if(-1===e)return{isNegative:n,integerPart:BigInt(t)};const r=t.slice(0,e)||"0",i=t.slice(e+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function s(t){let e=t.trim();if(0===e.length||Number.isNaN(Number(e)))throw new RangeError(`Invalid currency format: "${t}"`);r(e)&&(e=n(e));const i="-"===e[0];i&&(e=e.slice(1));const s=e.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(e),cents:0n};const o=e.slice(0,s)||"0",u=(e.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const o=["","jedna","dva","tři","čtyři","pět","šest","sedm","osm","devět"],u=["deset","jedenáct","dvanáct","třináct","čtrnáct","patnáct","šestnáct","sedmnáct","osmnáct","devatenáct"],c=["","","dvacet","třicet","čtyřicet","padesát","šedesát","sedmdesát","osmdesát","devadesát"],a=["","sto","dvě stě","tři sta","čtyři sta","pět set","šest set","sedm set","osm set","devět set"],l={1:["tisíc","tisíce","tisíc"],2:["milion","miliony","milionů"],3:["miliarda","miliardy","miliard"],4:["bilion","biliony","bilionů"],5:["biliarda","biliardy","biliard"],6:["trilion","triliony","trilionů"],7:["triliarda","triliardy","triliard"],8:["kvadrilion","kvadriliony","kvadrilionů"],9:["kvadriliarda","kvadriliardy","kvadriliard"]},d="nula",f="mínus",g=["","první","druhý","třetí","čtvrtý","pátý","šestý","sedmý","osmý","devátý"],m=["desátý","jedenáctý","dvanáctý","třináctý","čtrnáctý","patnáctý","šestnáctý","sedmnáctý","osmnáctý","devatenáctý"],b=["","","dvacátý","třicátý","čtyřicátý","padesátý","šedesátý","sedmdesátý","osmdesátý","devadesátý"],h=["","stý","dvoustý","třístý","čtyřstý","pětistý","šestistý","sedmistý","osmistý","devítistý"],v=["tisící","miliontý","miliardtý","biliontý"],p=["koruna","koruny","korun"],N=["haléř","haléře","haléřů"];function w(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(a[r]),1===e?i.push(u[n]):e>=2?(i.push(c[e]),n>0&&i.push(o[n])):n>0&&i.push(o[n]),i.join(" ")}function y(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10)%10,r=Math.trunc(t/100),i=[];return r>0&&i.push(a[r]),1===e?i.push(u[n]):e>=2?(i.push(c[e]),n>0&&i.push(o[n])):n>0&&i.push(o[n]),i.join(" ")}function I(t,n){if(1n===t)return n[0];const e=t%10n,r=t%100n;return e>=2n&&e<=4n&&(r<10n||r>20n)?n[1]:n[2]}function E(t){if(0n===t)return d;if(t<1000n)return w(Number(t));if(t<1000000n){const n=t/1000n,e=Number(t%1000n),r=I(n,l[1]);let i;return i=1n===n?r:w(Number(n))+" "+r,e>0&&(i+=" "+y(e)),i}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r="";for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n!==e)if(r&&(r+=" "),0===t)r+=y(Number(e));else{const n=l[t];if(n){const t=I(e,n);r+=1n===e?t:w(Number(e))+" "+t}else r+=w(Number(e))}}return r}(t)}function R(t){if(0===t)return"";const n=t%10,e=Math.trunc(t/10);return 0===e?g[n]:1===e?m[n]:0===n?b[e]:c[e]+" "+g[n]}function B(t){if(t<100n)return R(Number(t));if(t<1000n){const n=Number(t),e=Math.trunc(n/100),r=n%100;return 0===r?h[e]:a[e]+" "+R(r)}if(t<1000000n){const n=Number(t/1000n),e=Number(t%1000n);if(0===e)return 1===n?v[0]:w(n)+" "+v[0];const r=I(BigInt(n),l[1]),i=1===n?"":w(n)+" ";return(1===n?"tisíc":i+r)+" "+B(BigInt(e))}return function(t){const n=[];let e=t;for(;e>0n;)n.push(e%1000n),e/=1000n;let r=0;for(let t=0;t<n.length;t++)0n!==n[t]&&(r=t);const i=[];for(let t=n.length-1;t>=0;t--){const e=n[t];if(0n===e)continue;const s=t===r;if(0===t)i.push(s?B(e):y(Number(e)));else if(s)i.push(1n===e?v[t-1]||l[t][0]:w(Number(e))+" "+(v[t-1]||l[t][0]));else{const n=l[t];if(n){const t=I(e,n);i.push(1n===e?t:w(Number(e))+" "+t)}}}return i.join(" ")}(t)}const O={csCZ:function(t){return B(function(t){const e=typeof t;if("bigint"===e){if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}if("number"===e){if(!Number.isFinite(t))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(t))throw new RangeError("Ordinals must be whole numbers");if(t<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(t)}if("string"===e)return function(t){const e=t.trim();if(0===e.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===e[0])throw new RangeError("Ordinals cannot be negative");if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(e)){const t=n(e);if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(t);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const t=BigInt(e);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${t}"`)}}(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${e}`)}(t))}},k={csCZ:function(t){const{isNegative:n,dollars:r,cents:i}=function(t){const n=typeof t;if("bigint"===n)return t<0n?{isNegative:!0,dollars:-t,cents:0n}:{isNegative:!1,dollars:t,cents:0n};if("number"===n){if(!Number.isFinite(t))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(t)?t<0?{isNegative:!0,dollars:BigInt(-t),cents:0n}:{isNegative:!1,dollars:BigInt(t),cents:0n}:s(e(t))}if("string"===n)return s(t);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(t);let o="";return n&&(o=f+" "),(r>0n||0n===i)&&(o+=E(r),o+=" "+I(r,p)),i>0n&&(r>0n&&(o+=" "),o+=E(i),o+=" "+I(i,N)),o}};t.csCZ=function(t){const{isNegative:s,integerPart:o,decimalPart:u}=function(t){const s=typeof t;if("bigint"===s)return t<0n?{isNegative:!0,integerPart:-t}:{isNegative:!1,integerPart:t};if("number"===s){if(!Number.isFinite(t))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(t)?t<0?{isNegative:!0,integerPart:BigInt(-t)}:{isNegative:!1,integerPart:BigInt(t)}:i(e(t))}if("string"===s)return i(function(t){const e=t.trim();if(0===e.length||Number.isNaN(Number(e)))throw new RangeError(`Invalid number format: "${t}"`);return r(e)?n(e):e}(t));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(t);let c="";if(s&&(c=f+" "),c+=E(o),u){const t=function(t){return 0n===t||1n===t?"celá":t>=2n&&t<=4n?"celé":"celých"}(o);c+=" "+t+" "+function(t){let n="",e=0;for(;e<t.length&&"0"===t[e];)n&&(n+=" "),n+=d,e++;const r=t.slice(e);return r&&(n&&(n+=" "),n+=E(BigInt(r))),n}(u)}return c},t.currency=k,t.ordinal=O},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).n2words=t.n2words||{});
package/dist/da-DK.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/da-DK v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/da-DK v5.0.0 | 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=["","et","to","tre","fire","fem","seks","syv","otte","ni"],o=["","en","to","tre","fire","fem","seks","syv","otte","ni"],u=["ti","elleve","tolv","tretten","fjorten","femten","seksten","sytten","atten","nitten"],l=["","","tyve","tredive","fyrre","halvtreds","treds","halvfjerds","firs","halvfems"],a="tusind",g="nul",c="minus",f=["millioner","millarder","billioner","billarder","trillioner","trillarder","quadrillioner","quadrillarder"],d={1:"første",2:"anden",3:"tredje",4:"fjerde",5:"femte",6:"sjette",7:"syvende",8:"ottende",9:"niende",10:"tiende",11:"ellevte",12:"tolvte"};function h(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];r>0&&i.push(s[r]+"hundrede");const a=e%100;return 0===a||i.push(a<10?s[n]:a<20?u[n]:0===n?l[t]:o[n]+"og"+l[t]),2===i.length?i[0]+" og "+i[1]:i[0]||""}function m(e){if(0n===e)return g;if(e<1000n)return h(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);let r=h(n)+a;return t>0&&(r+="e og "+h(t)),r}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=h(n);if(0===u)o.push({word:e,type:"units"});else if(1===u)o.push({word:e+a,type:"thousand"});else{let t=e;1===n&&(t="en"),o.push({word:t+" "+f[u-2],type:"million"})}}u--}return function(e){if(0===e.length)return g;if(1===e.length)return e[0].word;const n=[];for(let t=0;t<e.length;t++){const r=e[t],i=e[t+1];"thousand"===r.type&&i&&"units"===i.type?(n.push(r.word+"e og "+i.word),t++):"million"===r.type?(n.length>0&&n.push(" "),n.push(r.word),i&&n.push(" ")):(n.length>0&&!n[n.length-1].endsWith(" ")&&n.push(" "),n.push(r.word))}return n.join("")}(o)}(e)}function b(i){const{isNegative:s,integerPart:o,decimalPart:u}=function(i){const s=typeof i;if("bigint"===s)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===s){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===s)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let l="";return s&&(l=c+" "),l+=m(o),u&&(l+=" komma "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=g,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=m(BigInt(r))),n}(u)),l}function w(n){const r=function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n);return(i=r)>=1n&&i<=12n?d[Number(i)]:m(i)+"de";var i}function v(e){const{isNegative:t,dollars:r,cents:s}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);let o="";return t&&(o=c+" "),(r>0n||0n===s)&&(o+=1n===r?"en krone":m(r)+" kroner"),s>0n&&(r>0n&&(o+=" og "),o+=m(s)+" øre"),o}export{b as toCardinal,v as toCurrency,w as toOrdinal};
package/dist/da-DK.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/da-DK v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/da-DK v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),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 t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function s(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const s=t.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(t),cents:0n};const o=t.slice(0,s)||"0",u=(t.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(u)}}const o=["","et","to","tre","fire","fem","seks","syv","otte","ni"],u=["","en","to","tre","fire","fem","seks","syv","otte","ni"],l=["ti","elleve","tolv","tretten","fjorten","femten","seksten","sytten","atten","nitten"],a=["","","tyve","tredive","fyrre","halvtreds","treds","halvfjerds","firs","halvfems"],c="tusind",f="nul",g="minus",d=["millioner","millarder","billioner","billarder","trillioner","trillarder","quadrillioner","quadrillarder"],h={1:"første",2:"anden",3:"tredje",4:"fjerde",5:"femte",6:"sjette",7:"syvende",8:"ottende",9:"niende",10:"tiende",11:"ellevte",12:"tolvte"};function m(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100),i=[];r>0&&i.push(o[r]+"hundrede");const s=e%100;return 0===s||i.push(s<10?o[n]:s<20?l[n]:0===n?a[t]:u[n]+"og"+a[t]),2===i.length?i[0]+" og "+i[1]:i[0]||""}function b(e){if(0n===e)return f;if(e<1000n)return m(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);let r=m(n)+c;return t>0&&(r+="e og "+m(t)),r}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n){const e=m(n);if(0===u)o.push({word:e,type:"units"});else if(1===u)o.push({word:e+c,type:"thousand"});else{let t=e;1===n&&(t="en"),o.push({word:t+" "+d[u-2],type:"million"})}}u--}return function(e){if(0===e.length)return f;if(1===e.length)return e[0].word;const n=[];for(let t=0;t<e.length;t++){const r=e[t],i=e[t+1];"thousand"===r.type&&i&&"units"===i.type?(n.push(r.word+"e og "+i.word),t++):"million"===r.type?(n.length>0&&n.push(" "),n.push(r.word),i&&n.push(" ")):(n.length>0&&!n[n.length-1].endsWith(" ")&&n.push(" "),n.push(r.word))}return n.join("")}(o)}(e)}const w={daDK:function(e){const t=function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e);return(i=t)>=1n&&i<=12n?h[Number(i)]:b(i)+"de";var i}};e.currency={daDK:function(e){const{isNegative:n,dollars:r,cents:i}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:s(t(e))}if("string"===n)return s(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e);let o="";return n&&(o=g+" "),(r>0n||0n===i)&&(o+=1n===r?"en krone":b(r)+" kroner"),i>0n&&(r>0n&&(o+=" og "),o+=b(i)+" øre"),o}},e.daDK=function(e){const{isNegative:s,integerPart:o,decimalPart:u}=function(e){const s=typeof e;if("bigint"===s)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===s){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"===s)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(e);let l="";return s&&(l=g+" "),l+=b(o),u&&(l+=" komma "+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+=b(BigInt(r))),n}(u)),l},e.ordinal=w},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});
package/dist/de-DE.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/de-DE v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/de-DE v5.0.0 | 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("."),l=-1===s?n:n.slice(0,s)+n.slice(s+1),o=(-1===s?n.length:s)+r;return o>=l.length?i+l+"0".repeat(o-l.length):o<=0?i+"0."+"0".repeat(-o)+l:i+l.slice(0,o)+"."+l.slice(o)}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 l=r.slice(0,s)||"0",o=(r.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(l),cents:BigInt(o)}}const s=["","eins","zwei","drei","vier","fünf","sechs","sieben","acht","neun"],l="ein",o=["zehn","elf","zwölf","dreizehn","vierzehn","fünfzehn","sechzehn","siebzehn","achtzehn","neunzehn"],u=["","","zwanzig","dreißig","vierzig","fünfzig","sechzig","siebzig","achtzig","neunzig"],c=["tausend","Million","Milliarde","Billion","Billiarde","Trillion","Trilliarde","Quadrillion","Quadrilliarde"],a=["tausend","Millionen","Milliarden","Billionen","Billiarden","Trillionen","Trilliarden","Quadrillionen","Quadrilliarden"],f="hundert",g="null",h="minus",d=["","erste","zweite","dritte","vierte","fünfte","sechste","siebte","achte","neunte"],b=["zehnte","elfte","zwölfte","dreizehnte","vierzehnte","fünfzehnte","sechzehnte","siebzehnte","achtzehnte","neunzehnte"],w=["","","zwanzigste","dreißigste","vierzigste","fünfzigste","sechzigste","siebzigste","achtzigste","neunzigste"],m="ste";function v(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?l:s[r])+f),1===t?i+=o[n]:t>=2&&n>0?i+=(1===n?l:s[n])+"und"+u[t]:t>=2?i+=u[t]:n>0&&(i+=s[n]),i}function p(e){if(0===e)return"";if(1===e)return l;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?l:s[r])+f),1===t?i+=o[n]:t>=2&&n>0?i+=(1===n?l:s[n])+"und"+u[t]:t>=2?i+=u[t]:(n>0&&r>0||n>0)&&(i+=s[n]),i}function N(e){if(0n===e)return g;if(e<1000n)return v(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);let r=p(n)+c[0];return t>0&&(r+=v(t)),r}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const l=[];let o=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n)if(0===o)l.push({words:v(n),isScale:!1,scaleLevel:0});else if(1===o){const e=p(n);l.push({words:e+c[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":v(n);const t=1===n?c[o-1]:a[o-1];l.push({words:e,isScale:!1,scaleLevel:o}),l.push({words:t,isScale:!0,scaleLevel:o})}o--}return z(l)}(e)}function z(e){if(0===e.length)return g;let n="";for(let t=0;t<e.length;t++){const r=e[t],i=t>0?e[t-1]:null;t>0&&(r.isScale||i&&i.isScale)&&(n+=" "),n+=r.words}return n}function I(i){const{isNegative:s,integerPart:l,decimalPart:o}=function(i){const s=typeof i;if("bigint"===s)return i<0n?{isNegative:!0,integerPart:-i}:{isNegative:!1,integerPart:i};if("number"===s){if(!Number.isFinite(i))throw new RangeError("Number must be finite (NaN and Infinity are not supported)");return Number.isSafeInteger(i)?i<0?{isNegative:!0,integerPart:BigInt(-i)}:{isNegative:!1,integerPart:BigInt(i)}:r(n(i))}if("string"===s)return r(function(n){const r=n.trim();if(0===r.length||Number.isNaN(Number(r)))throw new RangeError(`Invalid number format: "${n}"`);return t(r)?e(r):r}(i));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(i);let u="";return s&&(u=h+" "),u+=N(l),o&&(u+=" komma "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=g,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=N(BigInt(r))),n}(o)),u}function E(e,n){if(0===e)return"";const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let o="";return i>0&&(o+=(1===i?l:s[i])+f),1===r?o+=b[t]:r>=2&&t>0?o+=(1===t?l:s[t])+"und"+w[r]:r>=2?o+=w[r]:t>0&&(o+=d[t]),i>0&&0===r&&0===t&&(o+=m),o}function y(n){return function(e){if(e<1000n)return E(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?p(n)+c[0]+m:p(n)+c[0]+E(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;let l=0;for(let e=r.length-1;e>=0;e--)if(0!==r[e]){l=e;break}const o=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e],t=e===l;if(0!==n)if(0===u)o.push({words:E(n),isScale:!1,scaleLevel:0});else if(1===u){const e=p(n);o.push(t?{words:e+c[0]+m,isScale:!1,scaleLevel:1}:{words:e+c[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":v(n);const r=1===n?c[u-1]:a[u-1];o.push({words:e,isScale:!1,scaleLevel:u}),o.push(t?{words:r+m,isScale:!0,scaleLevel:u}:{words:r,isScale:!0,scaleLevel:u})}u--}return z(o)}(e)}(function(n){const r=typeof n;if("bigint"===r){if(n<=0n)throw new RangeError("Ordinals must be positive integers");return n}if("number"===r){if(!Number.isFinite(n))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(n))throw new RangeError("Ordinals must be whole numbers");if(n<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(n)}if("string"===r)return function(n){const r=n.trim();if(0===r.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===r[0])throw new RangeError("Ordinals cannot be negative");if(r.includes("."))throw new RangeError("Ordinals must be whole numbers");if(t(r)){const n=e(r);if(n.includes("."))throw new RangeError("Ordinals must be whole numbers");const t=BigInt(n);if(t<=0n)throw new RangeError("Ordinals must be positive integers");return t}try{const e=BigInt(r);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(e){if(e instanceof RangeError)throw e;throw new RangeError(`Invalid ordinal format: "${n}"`)}}(n);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${r}`)}(n))}function B(e,t){t=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(t);const{isNegative:r,dollars:s,cents:o}=function(e){const t=typeof e;if("bigint"===t)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===t){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:i(n(e))}if("string"===t)return i(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e),{and:u=!0}=t;let c="";return r&&(c=h+" "),(s>0n||0n===o)&&(c+=1n===s?l:N(s),c+=" Euro"),o>0n&&(s>0n&&(c+=u?" und ":" "),c+=1n===o?l:N(o),c+=" Cent"),c}export{I as toCardinal,B as toCurrency,y as toOrdinal};
package/dist/de-DE.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! n2words/de-DE v4.0.0 | MIT License | github.com/forzagreen/n2words */
1
+ /*! n2words/de-DE v5.0.0 | MIT License | github.com/forzagreen/n2words */
2
2
  var e,n;e=this,n=function(e){"use strict";function n(e){let[n,t]=e.toLowerCase().split("e");const r=parseInt(t,10);let i="";"-"===n[0]&&(i="-",n=n.slice(1));const s=n.indexOf("."),o=-1===s?n:n.slice(0,s)+n.slice(s+1),l=(-1===s?n.length:s)+r;return l>=o.length?i+o+"0".repeat(l-o.length):l<=0?i+"0."+"0".repeat(-l)+o:i+o.slice(0,l)+"."+o.slice(l)}function t(e){const t=e.toString();return r(t)?n(t):t}function r(e){return e.includes("e")||e.includes("E")}function i(e){const n="-"===e[0];n&&(e=e.slice(1));const t=e.indexOf(".");if(-1===t)return{isNegative:n,integerPart:BigInt(e)};const r=e.slice(0,t)||"0",i=e.slice(t+1);return{isNegative:n,integerPart:BigInt(r),decimalPart:i}}function s(e){let t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid currency format: "${e}"`);r(t)&&(t=n(t));const i="-"===t[0];i&&(t=t.slice(1));const s=t.indexOf(".");if(-1===s)return{isNegative:i,dollars:BigInt(t),cents:0n};const o=t.slice(0,s)||"0",l=(t.slice(s+1)+"00").slice(0,2);return{isNegative:i,dollars:BigInt(o),cents:BigInt(l)}}const o=["","eins","zwei","drei","vier","fünf","sechs","sieben","acht","neun"],l="ein",u=["zehn","elf","zwölf","dreizehn","vierzehn","fünfzehn","sechzehn","siebzehn","achtzehn","neunzehn"],c=["","","zwanzig","dreißig","vierzig","fünfzig","sechzig","siebzig","achtzig","neunzig"],a=["tausend","Million","Milliarde","Billion","Billiarde","Trillion","Trilliarde","Quadrillion","Quadrilliarde"],f=["tausend","Millionen","Milliarden","Billionen","Billiarden","Trillionen","Trilliarden","Quadrillionen","Quadrilliarden"],g="hundert",d="null",h="minus",b=["","erste","zweite","dritte","vierte","fünfte","sechste","siebte","achte","neunte"],w=["zehnte","elfte","zwölfte","dreizehnte","vierzehnte","fünfzehnte","sechzehnte","siebzehnte","achtzehnte","neunzehnte"],m=["","","zwanzigste","dreißigste","vierzigste","fünfzigste","sechzigste","siebzigste","achtzigste","neunzigste"],p="ste";function v(e){if(0===e)return"";const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?l:o[r])+g),1===t?i+=u[n]:t>=2&&n>0?i+=(1===n?l:o[n])+"und"+c[t]:t>=2?i+=c[t]:n>0&&(i+=o[n]),i}function N(e){if(0===e)return"";if(1===e)return l;const n=e%10,t=Math.trunc(e/10)%10,r=Math.trunc(e/100);let i="";return r>0&&(i+=(1===r?l:o[r])+g),1===t?i+=u[n]:t>=2&&n>0?i+=(1===n?l:o[n])+"und"+c[t]:t>=2?i+=c[t]:(n>0&&r>0||n>0)&&(i+=o[n]),i}function z(e){if(0n===e)return d;if(e<1000n)return v(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);let r=N(n)+a[0];return t>0&&(r+=v(t)),r}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;const o=[];let l=r.length-1;for(let e=0;e<r.length;e++){const n=r[e];if(0!==n)if(0===l)o.push({words:v(n),isScale:!1,scaleLevel:0});else if(1===l){const e=N(n);o.push({words:e+a[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":v(n);const t=1===n?a[l-1]:f[l-1];o.push({words:e,isScale:!1,scaleLevel:l}),o.push({words:t,isScale:!0,scaleLevel:l})}l--}return E(o)}(e)}function E(e){if(0===e.length)return d;let n="";for(let t=0;t<e.length;t++){const r=e[t],i=t>0?e[t-1]:null;t>0&&(r.isScale||i&&i.isScale)&&(n+=" "),n+=r.words}return n}function I(e,n){if(0===e)return"";const t=e%10,r=Math.trunc(e/10)%10,i=Math.trunc(e/100);let s="";return i>0&&(s+=(1===i?l:o[i])+g),1===r?s+=w[t]:r>=2&&t>0?s+=(1===t?l:o[t])+"und"+m[r]:r>=2?s+=m[r]:t>0&&(s+=b[t]),i>0&&0===r&&0===t&&(s+=p),s}const y={deDE:function(e){return function(e){if(e<1000n)return I(Number(e));if(e<1000000n){const n=Number(e/1000n),t=Number(e%1000n);return 0===t?N(n)+a[0]+p:N(n)+a[0]+I(t)}return function(e){const n=e.toString(),t=n.length,r=[],i=t%3;let s=0;for(i>0&&(r.push(Number(n.slice(0,i))),s=i);s<t;)r.push(Number(n.slice(s,s+3))),s+=3;let o=0;for(let e=r.length-1;e>=0;e--)if(0!==r[e]){o=e;break}const l=[];let u=r.length-1;for(let e=0;e<r.length;e++){const n=r[e],t=e===o;if(0!==n)if(0===u)l.push({words:I(n),isScale:!1,scaleLevel:0});else if(1===u){const e=N(n);l.push(t?{words:e+a[0]+p,isScale:!1,scaleLevel:1}:{words:e+a[0],isScale:!1,scaleLevel:1})}else{let e;e=1===n?"eine":v(n);const r=1===n?a[u-1]:f[u-1];l.push({words:e,isScale:!1,scaleLevel:u}),l.push(t?{words:r+p,isScale:!0,scaleLevel:u}:{words:r,isScale:!0,scaleLevel:u})}u--}return E(l)}(e)}(function(e){const t=typeof e;if("bigint"===t){if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}if("number"===t){if(!Number.isFinite(e))throw new RangeError("Ordinals must be finite numbers");if(!Number.isInteger(e))throw new RangeError("Ordinals must be whole numbers");if(e<=0)throw new RangeError("Ordinals must be positive integers");return BigInt(e)}if("string"===t)return function(e){const t=e.trim();if(0===t.length)throw new RangeError("Ordinals cannot be empty strings");if("-"===t[0])throw new RangeError("Ordinals cannot be negative");if(t.includes("."))throw new RangeError("Ordinals must be whole numbers");if(r(t)){const e=n(t);if(e.includes("."))throw new RangeError("Ordinals must be whole numbers");const r=BigInt(e);if(r<=0n)throw new RangeError("Ordinals must be positive integers");return r}try{const e=BigInt(t);if(e<=0n)throw new RangeError("Ordinals must be positive integers");return e}catch(n){if(n instanceof RangeError)throw n;throw new RangeError(`Invalid ordinal format: "${e}"`)}}(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${t}`)}(e))}};e.currency={deDE:function(e,n){n=function(e){if(void 0===e)return{};if(function(e){if(null===e||"object"!=typeof e)return!1;const n=Object.getPrototypeOf(e);return null===n||n===Object.prototype}(e))return e;throw new TypeError("Invalid options: expected plain object or undefined, got "+typeof e)}(n);const{isNegative:r,dollars:i,cents:o}=function(e){const n=typeof e;if("bigint"===n)return e<0n?{isNegative:!0,dollars:-e,cents:0n}:{isNegative:!1,dollars:e,cents:0n};if("number"===n){if(!Number.isFinite(e))throw new RangeError("Currency must be a finite number");return Number.isSafeInteger(e)?e<0?{isNegative:!0,dollars:BigInt(-e),cents:0n}:{isNegative:!1,dollars:BigInt(e),cents:0n}:s(t(e))}if("string"===n)return s(e);throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${n}`)}(e),{and:u=!0}=n;let c="";return r&&(c=h+" "),(i>0n||0n===o)&&(c+=1n===i?l:z(i),c+=" Euro"),o>0n&&(i>0n&&(c+=u?" und ":" "),c+=1n===o?l:z(o),c+=" Cent"),c}},e.deDE=function(e){const{isNegative:s,integerPart:o,decimalPart:l}=function(e){const s=typeof e;if("bigint"===s)return e<0n?{isNegative:!0,integerPart:-e}:{isNegative:!1,integerPart:e};if("number"===s){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"===s)return i(function(e){const t=e.trim();if(0===t.length||Number.isNaN(Number(t)))throw new RangeError(`Invalid number format: "${e}"`);return r(t)?n(t):t}(e));throw new TypeError(`Invalid value type: expected number, string, or bigint, received ${s}`)}(e);let u="";return s&&(u=h+" "),u+=z(o),l&&(u+=" komma "+function(e){let n="",t=0;for(;t<e.length&&"0"===e[t];)n&&(n+=" "),n+=d,t++;const r=e.slice(t);return r&&(n&&(n+=" "),n+=z(BigInt(r))),n}(l)),u},e.ordinal=y},"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).n2words=e.n2words||{});