@tolki/num 2.2.4 → 2.2.6

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.
@@ -1,96 +1,87 @@
1
- import { isString as i, toLower as e } from "@tolki/utils";
2
- import { format as l } from "../num.js";
3
- async function d(t, o = null, a = null, n = null) {
4
- const r = i(t) ? parseFloat(t) : t;
5
- if (a !== null && r <= a)
6
- return l(r, null, null, o);
7
- if (n !== null && r >= n)
8
- return l(r, null, null, o);
9
- const s = await u(o ?? "en-US");
10
- return e(s.convert(r));
1
+ import { format as e } from "../num.js";
2
+ import { isString as t, toLower as n } from "@tolki/utils";
3
+ // src/speller/index.ts
4
+ /* @__NO_SIDE_EFFECTS__ */
5
+ async function r(r, i = null, o = null, s = null) {
6
+ let c = t(r) ? parseFloat(r) : r;
7
+ if (o !== null && c <= o || s !== null && c >= s) return /* @__PURE__ */ e(c, null, null, i);
8
+ let l = await a(i ?? "en-US");
9
+ return n(l.convert(c));
11
10
  }
12
- async function h(t, o = null) {
13
- const a = i(t) ? parseFloat(t) : t, n = await u(o ?? "en-US");
14
- return e(n.toOrdinal(Math.floor(a)));
11
+ /* @__NO_SIDE_EFFECTS__ */
12
+ async function i(e, r = null) {
13
+ let i = t(e) ? parseFloat(e) : e, o = await a(r ?? "en-US");
14
+ return n(o.toOrdinal(Math.floor(i)));
15
15
  }
16
- async function u(t) {
17
- try {
18
- const s = await import(`to-words/${t}`);
19
- return new s.ToWords();
20
- } catch {
21
- }
22
- const o = String(t.split("-")[0]).toLowerCase(), n = {
23
- af: "af-ZA",
24
- am: "am-ET",
25
- ar: "ar-SA",
26
- az: "az-AZ",
27
- be: "be-BY",
28
- bg: "bg-BG",
29
- bn: "bn-IN",
30
- ca: "ca-ES",
31
- cs: "cs-CZ",
32
- da: "da-DK",
33
- de: "de-DE",
34
- ee: "ee-EE",
35
- el: "el-GR",
36
- en: "en-US",
37
- es: "es-ES",
38
- fa: "fa-IR",
39
- fi: "fi-FI",
40
- fil: "fil-PH",
41
- fr: "fr-FR",
42
- gu: "gu-IN",
43
- ha: "ha-NG",
44
- hbo: "hbo-IL",
45
- he: "he-IL",
46
- hi: "hi-IN",
47
- hr: "hr-HR",
48
- hu: "hu-HU",
49
- id: "id-ID",
50
- is: "is-IS",
51
- it: "it-IT",
52
- ja: "ja-JP",
53
- ka: "ka-GE",
54
- kn: "kn-IN",
55
- ko: "ko-KR",
56
- lt: "lt-LT",
57
- lv: "lv-LV",
58
- mr: "mr-IN",
59
- ms: "ms-MY",
60
- nb: "nb-NO",
61
- nl: "nl-NL",
62
- np: "np-NP",
63
- pa: "pa-IN",
64
- pl: "pl-PL",
65
- pt: "pt-BR",
66
- ro: "ro-RO",
67
- ru: "ru-RU",
68
- sk: "sk-SK",
69
- sl: "sl-SI",
70
- sq: "sq-AL",
71
- sr: "sr-RS",
72
- sv: "sv-SE",
73
- sw: "sw-KE",
74
- ta: "ta-IN",
75
- te: "te-IN",
76
- th: "th-TH",
77
- tr: "tr-TR",
78
- uk: "uk-UA",
79
- ur: "ur-PK",
80
- vi: "vi-VN",
81
- yo: "yo-NG",
82
- zh: "zh-CN"
83
- }[o];
84
- if (n && n !== t)
85
- try {
86
- const s = await import(`to-words/${n}`);
87
- return new s.ToWords();
88
- } catch {
89
- }
90
- const r = await import("../en-US-Ct0OKCam.js");
91
- return new r.ToWords();
16
+ async function a(e) {
17
+ try {
18
+ return new (await (import(`to-words/${e}`))).ToWords();
19
+ } catch {}
20
+ let t = {
21
+ af: "af-ZA",
22
+ am: "am-ET",
23
+ ar: "ar-SA",
24
+ az: "az-AZ",
25
+ be: "be-BY",
26
+ bg: "bg-BG",
27
+ bn: "bn-IN",
28
+ ca: "ca-ES",
29
+ cs: "cs-CZ",
30
+ da: "da-DK",
31
+ de: "de-DE",
32
+ ee: "ee-EE",
33
+ el: "el-GR",
34
+ en: "en-US",
35
+ es: "es-ES",
36
+ fa: "fa-IR",
37
+ fi: "fi-FI",
38
+ fil: "fil-PH",
39
+ fr: "fr-FR",
40
+ gu: "gu-IN",
41
+ ha: "ha-NG",
42
+ hbo: "hbo-IL",
43
+ he: "he-IL",
44
+ hi: "hi-IN",
45
+ hr: "hr-HR",
46
+ hu: "hu-HU",
47
+ id: "id-ID",
48
+ is: "is-IS",
49
+ it: "it-IT",
50
+ ja: "ja-JP",
51
+ ka: "ka-GE",
52
+ kn: "kn-IN",
53
+ ko: "ko-KR",
54
+ lt: "lt-LT",
55
+ lv: "lv-LV",
56
+ mr: "mr-IN",
57
+ ms: "ms-MY",
58
+ nb: "nb-NO",
59
+ nl: "nl-NL",
60
+ np: "np-NP",
61
+ pa: "pa-IN",
62
+ pl: "pl-PL",
63
+ pt: "pt-BR",
64
+ ro: "ro-RO",
65
+ ru: "ru-RU",
66
+ sk: "sk-SK",
67
+ sl: "sl-SI",
68
+ sq: "sq-AL",
69
+ sr: "sr-RS",
70
+ sv: "sv-SE",
71
+ sw: "sw-KE",
72
+ ta: "ta-IN",
73
+ te: "te-IN",
74
+ th: "th-TH",
75
+ tr: "tr-TR",
76
+ uk: "uk-UA",
77
+ ur: "ur-PK",
78
+ vi: "vi-VN",
79
+ yo: "yo-NG",
80
+ zh: "zh-CN"
81
+ }[String(e.split("-")[0]).toLowerCase()];
82
+ if (t && t !== e) try {
83
+ return new (await (import(`to-words/${t}`))).ToWords();
84
+ } catch {}
85
+ return new (await (import("to-words/en-US"))).ToWords();
92
86
  }
93
- export {
94
- d as spell,
95
- h as spellOrdinal
96
- };
87
+ export { r as spell, i as spellOrdinal };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/num",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "Utilities for working with numbers similar to Laravel's Num class facade.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "sideEffects": false,
27
27
  "dependencies": {
28
28
  "to-words": "^5.0.0",
29
- "@tolki/utils": "^1.6.0"
29
+ "@tolki/utils": "^1.6.4"
30
30
  },
31
31
  "files": [
32
32
  "dist"
@@ -54,12 +54,14 @@
54
54
  "types": "./dist/*"
55
55
  },
56
56
  "./num": {
57
+ "types": "./dist/num.d.ts",
57
58
  "import": "./dist/num.js",
58
- "types": "./dist/num.d.ts"
59
+ "default": "./dist/num.js"
59
60
  },
60
61
  "./speller": {
62
+ "types": "./dist/speller/index.d.ts",
61
63
  "import": "./dist/speller/index.js",
62
- "types": "./dist/speller/index.d.ts"
64
+ "default": "./dist/speller/index.js"
63
65
  }
64
66
  }
65
67
  }
@@ -1,431 +0,0 @@
1
- const x = {
2
- currency: !1,
3
- ignoreDecimal: !1,
4
- ignoreZeroCurrency: !1,
5
- doNotAddOnly: !1
6
- }, F = {
7
- localeCode: "en-IN",
8
- converterOptions: x
9
- }, M = /* @__PURE__ */ new WeakMap(), I = 0n, S = 1n, C = 2n, w = 10n, O = 11n, W = 100n, A = 1000n, L = BigInt(Number.MAX_SAFE_INTEGER);
10
- class E {
11
- options = {};
12
- locale = void 0;
13
- localeClass = void 0;
14
- constructor(e = {}) {
15
- this.options = Object.assign({}, F, e);
16
- }
17
- /**
18
- * Set a locale class directly.
19
- * @internal Used by per-locale entry points
20
- */
21
- setLocale(e) {
22
- return this.localeClass = e, this.locale = void 0, this;
23
- }
24
- /**
25
- * Get the locale class. Must be set via setLocale() or overridden in subclass.
26
- */
27
- getLocaleClass() {
28
- if (this.localeClass)
29
- return this.localeClass;
30
- throw new Error('No locale set. Use setLocale() or import from a locale-specific entry point (e.g., "to-words/en-IN")');
31
- }
32
- getLocale() {
33
- if (this.locale === void 0) {
34
- const e = this.getLocaleClass();
35
- this.locale = new e(), this.initLocaleCache(this.locale);
36
- }
37
- return this.locale;
38
- }
39
- initLocaleCache(e) {
40
- if (M.has(e))
41
- return;
42
- const r = e.config, l = r.numberWordsMapping.map((o) => ({
43
- ...o,
44
- numberBigInt: BigInt(o.number),
45
- resolvedValue: Array.isArray(o.value) ? o.value[0] : o.value
46
- })), n = /* @__PURE__ */ new Map();
47
- if (r.exactWordsMapping)
48
- for (const o of r.exactWordsMapping) {
49
- const f = {
50
- ...o,
51
- numberBigInt: BigInt(o.number),
52
- resolvedValue: Array.isArray(o.value) ? o.value[0] : o.value
53
- };
54
- n.set(f.numberBigInt, f);
55
- }
56
- const i = /* @__PURE__ */ new Map();
57
- let t = I;
58
- for (const o of l)
59
- o.numberBigInt <= W && (i.set(o.numberBigInt, o), o.numberBigInt > t && (t = o.numberBigInt));
60
- const a = l.filter((o) => o.numberBigInt >= W), m = new Set(r.pluralWords ?? []), s = new Set(r.pluralWordsOnlyWhenTrailing ?? []), d = new Set(r.ignoreOneForWords ?? []), u = new Set(r.noSplitWordAfter ?? []);
61
- M.set(e, {
62
- numberWordsMappingBigInt: l,
63
- exactWordsMap: n,
64
- smallNumbersMap: i,
65
- unitMappings: a,
66
- smallNumbersBoundary: t,
67
- pluralWordsSet: m,
68
- pluralWordsOnlyWhenTrailingSet: s,
69
- ignoreOneForWordsSet: d,
70
- noSplitWordAfterSet: u
71
- });
72
- }
73
- getLocaleCache(e) {
74
- let r = M.get(e);
75
- return r || (this.initLocaleCache(e), r = M.get(e)), r;
76
- }
77
- convert(e, r = {}) {
78
- const l = this.options.converterOptions, n = Object.keys(r).length === 0 ? l ?? {} : {
79
- currency: r.currency ?? l?.currency ?? !1,
80
- ignoreDecimal: r.ignoreDecimal ?? l?.ignoreDecimal ?? !1,
81
- ignoreZeroCurrency: r.ignoreZeroCurrency ?? l?.ignoreZeroCurrency ?? !1,
82
- doNotAddOnly: r.doNotAddOnly ?? l?.doNotAddOnly ?? !1,
83
- currencyOptions: r.currencyOptions ?? l?.currencyOptions
84
- };
85
- if (!this.isValidNumber(e))
86
- throw new Error(`Invalid Number "${e}"`);
87
- const i = typeof e == "bigint";
88
- let t = i ? e : Number(e);
89
- n.ignoreDecimal && !i && (t = Math.trunc(t));
90
- let a = [];
91
- return n.currency ? a = this.convertCurrency(t, n) : a = this.convertNumber(t), this.locale?.config.trim ? a.join("") : a.join(" ");
92
- }
93
- toOrdinal(e, r = {}) {
94
- if (!this.isValidNumber(e))
95
- throw new Error(`Invalid Number "${e}"`);
96
- const l = this.getLocale(), n = l.config, i = Number(e);
97
- if (!Number.isInteger(i) || i < 0)
98
- throw new Error(`Ordinal numbers must be non-negative integers, got "${e}"`);
99
- if (!n.ordinalWordsMapping && !n.ordinalSuffix)
100
- throw new Error(`Ordinal conversion not supported for locale "${this.options.localeCode}"`);
101
- const t = this.convertOrdinal(i, r, l);
102
- return n.trim ? t.join("") : t.join(" ");
103
- }
104
- convertOrdinal(e, r, l) {
105
- const n = l.config;
106
- if (n.ordinalExactWordsMapping) {
107
- const t = n.ordinalExactWordsMapping.find((a) => a.number === e);
108
- if (t)
109
- return [t.value];
110
- }
111
- if (e <= 20 && n.ordinalWordsMapping) {
112
- const t = n.ordinalWordsMapping.find((a) => a.number === e);
113
- if (t)
114
- return [t.value];
115
- }
116
- const i = this.convertInternal(BigInt(e), !0, void 0, l);
117
- if (i.length > 0) {
118
- const t = i.length - 1, a = i[t], m = this.getLastNumberComponent(e, n);
119
- if (n.ordinalWordsMapping) {
120
- const s = n.ordinalWordsMapping.find((d) => d.number === m);
121
- if (s)
122
- return i[t] = s.value, i;
123
- }
124
- n.ordinalSuffix && (i[t] = a + n.ordinalSuffix);
125
- }
126
- return i;
127
- }
128
- getLastNumberComponent(e, r) {
129
- if (e <= 20)
130
- return e;
131
- const l = r.numberWordsMapping.filter((i) => Number(i.number) >= 100).sort((i, t) => Number(t.number) - Number(i.number));
132
- for (const i of l) {
133
- const t = Number(i.number);
134
- if (e % t === 0)
135
- return t;
136
- }
137
- const n = e % 100;
138
- return n >= 1 && n <= 99 && r.numberWordsMapping.some((t) => Number(t.number) === n) || n % 10 === 0 ? n : e % 10;
139
- }
140
- convertNumber(e) {
141
- const r = this.getLocale(), l = r.config, n = e < 0 || typeof e == "bigint" && e < 0n;
142
- n && (e = typeof e == "bigint" ? -e : Math.abs(e));
143
- const i = typeof e == "bigint", t = !i && this.isFloat(e);
144
- let a, m = "";
145
- if (i)
146
- a = e;
147
- else if (t) {
148
- const f = e.toString().split(".");
149
- a = BigInt(f[0]), m = f[1] ?? "";
150
- } else
151
- a = BigInt(Math.trunc(e));
152
- const s = this.isNumberZero(e) && l.ignoreZeroInDecimals;
153
- let d = this.convertInternal(a, !0, void 0, r);
154
- t && s && (d = []);
155
- const u = [];
156
- if (t) {
157
- if (s || u.push(l.texts.point), m.startsWith("0") && !l?.decimalLengthWordMapping) {
158
- const f = [];
159
- for (const h of m)
160
- f.push(...this.convertInternal(BigInt(h), !0, void 0, r));
161
- u.push(...f);
162
- } else if (m.length) {
163
- u.push(...this.convertInternal(BigInt(m), !0, void 0, r));
164
- const f = l?.decimalLengthWordMapping?.[m.length];
165
- f && u.push(f);
166
- }
167
- }
168
- return !(d.length <= 0) && n && d.unshift(l.texts.minus), d.push(...u), d;
169
- }
170
- convertCurrency(e, r = {}) {
171
- const l = this.getLocale(), n = l.config, i = r.currencyOptions ?? n.currency, t = e < 0 || typeof e == "bigint" && e < 0n;
172
- t && (e = typeof e == "bigint" ? -e : Math.abs(e));
173
- const a = typeof e == "bigint";
174
- a || (e = this.toFixed(e));
175
- const m = !a && this.isFloat(e);
176
- let s, d = "";
177
- if (a)
178
- s = e;
179
- else if (m) {
180
- const v = e.toString().split(".");
181
- s = BigInt(v[0]), d = v[1] ?? "";
182
- } else
183
- s = BigInt(Math.trunc(e));
184
- let u = [];
185
- const o = s <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(s) : -1;
186
- if (o !== -1 && i.numberSpecificForms?.[o])
187
- u = [i.numberSpecificForms[o]];
188
- else {
189
- const v = n.useTrailingForCurrency ?? !1;
190
- u = [...this.convertInternal(s, v, void 0, l)], s === 1n && i.singular ? u.push(i.singular) : i.plural && u.push(i.plural);
191
- }
192
- const f = this.isNumberZero(e) && (r.ignoreZeroCurrency || n?.ignoreZeroInDecimals && e !== 0 && e !== 0n);
193
- f && (u = []);
194
- const h = [];
195
- if (m) {
196
- f || h.push(n.texts.and);
197
- const v = !n.decimalLengthWordMapping && d.length ? Math.pow(10, Math.max(0, 2 - d.length)) : 1, p = Number(d || "0") * v, N = n?.decimalLengthWordMapping?.[d.length];
198
- i.fractionalUnit.numberSpecificForms?.[p] ? h.push(i.fractionalUnit.numberSpecificForms[p]) : (h.push(...this.convertInternal(BigInt(p), !1, void 0, l)), N?.length && h.push(N), p === 1 && i.fractionalUnit.singular ? h.push(i.fractionalUnit.singular) : h.push(i.fractionalUnit.plural));
199
- } else n.decimalLengthWordMapping && u.length && h.push(i.fractionalUnit.plural);
200
- const b = u.length <= 0 && h.length <= 0;
201
- return !b && t && u.unshift(n.texts.minus), !b && n.texts.only && !r.doNotAddOnly && !n.onlyInFront && h.push(n.texts.only), h.length && u.push(...h), !b && !r.doNotAddOnly && n.onlyInFront && u.splice(0, 0, n.texts.only), u;
202
- }
203
- convertInternal(e, r = !1, l = void 0, n) {
204
- const i = n ?? this.getLocale(), t = i.config, a = this.getLocaleCache(i);
205
- if (l) {
206
- const c = e <= L ? Number(e) : -1;
207
- if (c !== -1 && l[c])
208
- return [l[c]];
209
- }
210
- const m = a.exactWordsMap.get(e);
211
- if (m)
212
- return [r && Array.isArray(m.value) ? m.value[1] : m.resolvedValue];
213
- let s;
214
- if (e <= W) {
215
- const c = a.smallNumbersMap.get(e);
216
- if (c)
217
- return [r && Array.isArray(c.value) ? c.value[1] : c.resolvedValue];
218
- s = this.binarySearchDescending(a.numberWordsMappingBigInt, e);
219
- } else
220
- s = this.binarySearchDescending(a.numberWordsMappingBigInt, e);
221
- const d = s.numberBigInt, u = [];
222
- if (e <= W || e < A && t.namedLessThan1000) {
223
- u.push(s.resolvedValue);
224
- const c = e - d;
225
- if (c > I) {
226
- t.splitWord && u.push(t.splitWord);
227
- const g = this.convertInternal(c, r, l, i);
228
- for (let y = 0; y < g.length; y++)
229
- u.push(g[y]);
230
- }
231
- return u;
232
- }
233
- const o = e / d, f = e % d;
234
- let h = s.resolvedValue;
235
- const b = s.resolvedValue, v = Number(d), p = t.pluralForms?.[v];
236
- let N = !1;
237
- const T = a.ignoreOneForWordsSet.has(b);
238
- if (p) {
239
- const c = Number(o % W), g = o >= O && c >= 3 && c <= 10;
240
- o === C && p.dual ? (h = p.dual, N = !0) : o >= BigInt(t.paucalConfig?.min ?? 3) && o <= BigInt(t.paucalConfig?.max ?? 10) || g ? p.paucal && (h = p.paucal) : o >= O && p.plural && (h = p.plural);
241
- } else {
242
- const c = s.value, g = a.pluralWordsSet.has(c), y = a.pluralWordsOnlyWhenTrailingSet.has(c);
243
- o > S && t.pluralMark && (g || y && f === I) && (h += t.pluralMark), o % w === S && !T && (h = s.singularValue || (Array.isArray(h) ? h[0] : h));
244
- }
245
- if (o === S && T || N) {
246
- const c = o === S && s.singularValue ? s.singularValue : h;
247
- u.push(c);
248
- } else {
249
- const c = this.convertInternal(o, !1, l, i);
250
- for (let g = 0; g < c.length; g++)
251
- u.push(c[g]);
252
- u.push(h);
253
- }
254
- if (f > I) {
255
- t.splitWord && (a.noSplitWordAfterSet.has(s.resolvedValue) || u.push(t.splitWord));
256
- const c = this.convertInternal(f, r, l, i);
257
- for (let g = 0; g < c.length; g++)
258
- u.push(c[g]);
259
- }
260
- return u;
261
- }
262
- /**
263
- * Binary search on a descending-sorted array of CachedNumberWordMap.
264
- * Finds the first element where numberBigInt <= target.
265
- */
266
- binarySearchDescending(e, r) {
267
- let l = 0, n = e.length - 1, i = e[n];
268
- for (; l <= n; ) {
269
- const t = l + n >> 1;
270
- e[t].numberBigInt <= r ? (i = e[t], n = t - 1) : l = t + 1;
271
- }
272
- return i;
273
- }
274
- toFixed(e, r = 2) {
275
- return Number(Number(e).toFixed(r));
276
- }
277
- isFloat(e) {
278
- return Number(e) === e && e % 1 !== 0;
279
- }
280
- isValidNumber(e) {
281
- const r = typeof e;
282
- if (r === "bigint")
283
- return !0;
284
- if (r === "number")
285
- return !Number.isNaN(e) && Number.isFinite(e);
286
- const l = e;
287
- if (l.trim() === "")
288
- return !1;
289
- const n = Number(l);
290
- return !Number.isNaN(n) && Number.isFinite(n);
291
- }
292
- isNumberZero(e) {
293
- return typeof e == "bigint" ? e === I : e >= 0 && e < 1;
294
- }
295
- }
296
- class D {
297
- config = {
298
- currency: {
299
- name: "Dollar",
300
- plural: "Dollars",
301
- singular: "Dollar",
302
- symbol: "$",
303
- fractionalUnit: {
304
- name: "Cent",
305
- plural: "Cents",
306
- singular: "Cent",
307
- symbol: "¢"
308
- }
309
- },
310
- texts: {
311
- and: "And",
312
- minus: "Minus",
313
- only: "Only",
314
- point: "Point"
315
- },
316
- numberWordsMapping: [
317
- { number: 1000000000000000000000000000000000000000000000000000000000000000n, value: "Vigintillion" },
318
- { number: 1000000000000000000000000000000000000000000000000000000000000n, value: "Novemdecillion" },
319
- { number: 1000000000000000000000000000000000000000000000000000000000n, value: "Octodecillion" },
320
- { number: 1000000000000000000000000000000000000000000000000000000n, value: "Septendecillion" },
321
- { number: 1000000000000000000000000000000000000000000000000000n, value: "Sexdecillion" },
322
- { number: 1000000000000000000000000000000000000000000000000n, value: "Quindecillion" },
323
- { number: 1000000000000000000000000000000000000000000000n, value: "Quattuordecillion" },
324
- { number: 1000000000000000000000000000000000000000000n, value: "Tredecillion" },
325
- { number: 1000000000000000000000000000000000000000n, value: "Duodecillion" },
326
- { number: 1000000000000000000000000000000000000n, value: "Undecillion" },
327
- { number: 1000000000000000000000000000000000n, value: "Decillion" },
328
- { number: 1000000000000000000000000000000n, value: "Nonillion" },
329
- { number: 1000000000000000000000000000n, value: "Octillion" },
330
- { number: 1000000000000000000000000n, value: "Septillion" },
331
- { number: 1000000000000000000000n, value: "Sextillion" },
332
- { number: 1000000000000000000n, value: "Quintillion" },
333
- { number: 1e15, value: "Quadrillion" },
334
- { number: 1e12, value: "Trillion" },
335
- { number: 1e9, value: "Billion" },
336
- { number: 1e6, value: "Million" },
337
- { number: 1e3, value: "Thousand" },
338
- { number: 100, value: "Hundred" },
339
- { number: 90, value: "Ninety" },
340
- { number: 80, value: "Eighty" },
341
- { number: 70, value: "Seventy" },
342
- { number: 60, value: "Sixty" },
343
- { number: 50, value: "Fifty" },
344
- { number: 40, value: "Forty" },
345
- { number: 30, value: "Thirty" },
346
- { number: 20, value: "Twenty" },
347
- { number: 19, value: "Nineteen" },
348
- { number: 18, value: "Eighteen" },
349
- { number: 17, value: "Seventeen" },
350
- { number: 16, value: "Sixteen" },
351
- { number: 15, value: "Fifteen" },
352
- { number: 14, value: "Fourteen" },
353
- { number: 13, value: "Thirteen" },
354
- { number: 12, value: "Twelve" },
355
- { number: 11, value: "Eleven" },
356
- { number: 10, value: "Ten" },
357
- { number: 9, value: "Nine" },
358
- { number: 8, value: "Eight" },
359
- { number: 7, value: "Seven" },
360
- { number: 6, value: "Six" },
361
- { number: 5, value: "Five" },
362
- { number: 4, value: "Four" },
363
- { number: 3, value: "Three" },
364
- { number: 2, value: "Two" },
365
- { number: 1, value: "One" },
366
- { number: 0, value: "Zero" }
367
- ],
368
- exactWordsMapping: [{ number: 100, value: "One Hundred" }],
369
- ordinalWordsMapping: [
370
- { number: 1000000000000000000000000000000000000000000000000000000000000000n, value: "Vigintillionth" },
371
- { number: 1000000000000000000000000000000000000000000000000000000000000n, value: "Novemdecillionth" },
372
- { number: 1000000000000000000000000000000000000000000000000000000000n, value: "Octodecillionth" },
373
- { number: 1000000000000000000000000000000000000000000000000000000n, value: "Septendecillionth" },
374
- { number: 1000000000000000000000000000000000000000000000000000n, value: "Sexdecillionth" },
375
- { number: 1000000000000000000000000000000000000000000000000n, value: "Quindecillionth" },
376
- { number: 1000000000000000000000000000000000000000000000n, value: "Quattuordecillionth" },
377
- { number: 1000000000000000000000000000000000000000000n, value: "Tredecillionth" },
378
- { number: 1000000000000000000000000000000000000000n, value: "Duodecillionth" },
379
- { number: 1000000000000000000000000000000000000n, value: "Undecillionth" },
380
- { number: 1000000000000000000000000000000000n, value: "Decillionth" },
381
- { number: 1000000000000000000000000000000n, value: "Nonillionth" },
382
- { number: 1000000000000000000000000000n, value: "Octillionth" },
383
- { number: 1000000000000000000000000n, value: "Septillionth" },
384
- { number: 1000000000000000000000n, value: "Sextillionth" },
385
- { number: 1000000000000000000n, value: "Quintillionth" },
386
- { number: 1e15, value: "Quadrillionth" },
387
- { number: 1e12, value: "Trillionth" },
388
- { number: 1e9, value: "Billionth" },
389
- { number: 1e6, value: "Millionth" },
390
- { number: 1e3, value: "Thousandth" },
391
- { number: 100, value: "Hundredth" },
392
- { number: 90, value: "Ninetieth" },
393
- { number: 80, value: "Eightieth" },
394
- { number: 70, value: "Seventieth" },
395
- { number: 60, value: "Sixtieth" },
396
- { number: 50, value: "Fiftieth" },
397
- { number: 40, value: "Fortieth" },
398
- { number: 30, value: "Thirtieth" },
399
- { number: 20, value: "Twentieth" },
400
- { number: 19, value: "Nineteenth" },
401
- { number: 18, value: "Eighteenth" },
402
- { number: 17, value: "Seventeenth" },
403
- { number: 16, value: "Sixteenth" },
404
- { number: 15, value: "Fifteenth" },
405
- { number: 14, value: "Fourteenth" },
406
- { number: 13, value: "Thirteenth" },
407
- { number: 12, value: "Twelfth" },
408
- { number: 11, value: "Eleventh" },
409
- { number: 10, value: "Tenth" },
410
- { number: 9, value: "Ninth" },
411
- { number: 8, value: "Eighth" },
412
- { number: 7, value: "Seventh" },
413
- { number: 6, value: "Sixth" },
414
- { number: 5, value: "Fifth" },
415
- { number: 4, value: "Fourth" },
416
- { number: 3, value: "Third" },
417
- { number: 2, value: "Second" },
418
- { number: 1, value: "First" },
419
- { number: 0, value: "Zeroth" }
420
- ],
421
- ordinalExactWordsMapping: [{ number: 100, value: "One Hundredth" }]
422
- };
423
- }
424
- class V extends E {
425
- constructor(e = {}) {
426
- super(e), this.setLocale(D);
427
- }
428
- }
429
- export {
430
- V as ToWords
431
- };