n2words 1.16.4 → 1.18.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.
- package/README.md +2 -1
- package/dist/n2words.js +1 -1
- package/dist/n2words.js.map +1 -1
- package/lib/classes/AbstractLanguage.d.ts +2 -2
- package/lib/classes/AbstractLanguage.js +16 -7
- package/lib/classes/BaseLanguage.d.ts +0 -1
- package/lib/classes/BaseLanguage.js +0 -4
- package/lib/i18n/ar.d.ts +6 -5
- package/lib/i18n/ar.js +80 -42
- package/lib/i18n/az.js +4 -2
- package/lib/i18n/cz.d.ts +56 -0
- package/lib/i18n/cz.js +4 -2
- package/lib/i18n/de.js +4 -2
- package/lib/i18n/dk.js +1 -1
- package/lib/i18n/en.js +4 -2
- package/lib/i18n/fa.js +4 -2
- package/lib/i18n/fr-BE.d.ts +11 -0
- package/lib/i18n/fr-BE.js +20 -0
- package/lib/i18n/fr.js +8 -3
- package/lib/i18n/he.d.ts +33 -0
- package/lib/i18n/he.js +9 -4
- package/lib/i18n/hr.d.ts +33 -0
- package/lib/i18n/hr.js +4 -2
- package/lib/i18n/hu.js +4 -2
- package/lib/i18n/id.js +4 -2
- package/lib/i18n/it.js +4 -2
- package/lib/i18n/ko.js +4 -2
- package/lib/i18n/lt.d.ts +56 -0
- package/lib/i18n/lt.js +4 -2
- package/lib/i18n/lv.d.ts +45 -0
- package/lib/i18n/lv.js +4 -2
- package/lib/i18n/no.js +4 -2
- package/lib/i18n/pl.d.ts +56 -0
- package/lib/i18n/pl.js +4 -2
- package/lib/i18n/pt.js +4 -2
- package/lib/i18n/ru.d.ts +15 -69
- package/lib/i18n/ru.js +16 -22
- package/lib/i18n/sr.d.ts +33 -12
- package/lib/i18n/sr.js +13 -13
- package/lib/i18n/uk.d.ts +67 -0
- package/lib/n2words.js +41 -30
- package/package.json +18 -17
|
@@ -38,10 +38,10 @@ export default class _default {
|
|
|
38
38
|
get wholeNumber(): number;
|
|
39
39
|
/**
|
|
40
40
|
* Convert decimal number to a string array of cardinal numbers.
|
|
41
|
-
* @param {
|
|
41
|
+
* @param {string} decimal Decimal string to convert.
|
|
42
42
|
* @returns {string} Value in written format.
|
|
43
43
|
*/
|
|
44
|
-
decimalToCardinal(decimal:
|
|
44
|
+
decimalToCardinal(decimal: string): string;
|
|
45
45
|
/**
|
|
46
46
|
* Converts a number to written form.
|
|
47
47
|
* @param {number|string} value Number to be convert.
|
|
@@ -21,7 +21,7 @@ export default class {
|
|
|
21
21
|
options = Object.assign({
|
|
22
22
|
negativeWord: '',
|
|
23
23
|
separatorWord: undefined,
|
|
24
|
-
|
|
24
|
+
zero: undefined,
|
|
25
25
|
spaceSeparator: ' '
|
|
26
26
|
}, options);
|
|
27
27
|
|
|
@@ -69,21 +69,30 @@ export default class {
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Convert decimal number to a string array of cardinal numbers.
|
|
72
|
-
* @param {
|
|
72
|
+
* @param {string} decimal Decimal string to convert.
|
|
73
73
|
* @returns {string} Value in written format.
|
|
74
74
|
*/
|
|
75
75
|
decimalToCardinal(decimal) {
|
|
76
76
|
const words = [];
|
|
77
|
+
let allZero = true;
|
|
77
78
|
|
|
78
79
|
// Split decimal portion into an array of characters in reverse
|
|
79
|
-
const chars = decimal.split('')
|
|
80
|
+
const chars = decimal.split('');
|
|
81
|
+
|
|
82
|
+
// Loop through array (from the end) adding leading zeros to output array
|
|
83
|
+
chars.forEach(char => {
|
|
84
|
+
if (char === '0') {
|
|
85
|
+
words.push(this.zero);
|
|
86
|
+
} else {
|
|
87
|
+
allZero = false;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
80
90
|
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
words
|
|
91
|
+
// Add decimal number to word array
|
|
92
|
+
if (allZero) {
|
|
93
|
+
return words;
|
|
84
94
|
}
|
|
85
95
|
|
|
86
|
-
// Add decimal number to word array
|
|
87
96
|
return words.concat(this.toCardinal(BigInt(decimal)));
|
|
88
97
|
}
|
|
89
98
|
|
package/lib/i18n/ar.d.ts
CHANGED
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
export default function _default(value: number | string, options?: object): string;
|
|
9
9
|
export class Arabic extends AbstractLanguage {
|
|
10
10
|
constructor(options: any);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
number: any;
|
|
12
|
+
feminine: any;
|
|
13
|
+
ones: {
|
|
14
|
+
masculine: string[];
|
|
15
|
+
feminine: string[];
|
|
16
|
+
};
|
|
16
17
|
arabicTens: string[];
|
|
17
18
|
arabicHundreds: string[];
|
|
18
19
|
arabicAppendedTwos: string[];
|
package/lib/i18n/ar.js
CHANGED
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
import AbstractLanguage from '../classes/AbstractLanguage.js';
|
|
2
2
|
|
|
3
3
|
export class Arabic extends AbstractLanguage {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
number;
|
|
5
|
+
|
|
6
|
+
feminine;
|
|
7
|
+
|
|
8
|
+
ones = {
|
|
9
|
+
masculine: [
|
|
10
|
+
'واحد',
|
|
11
|
+
'اثنان',
|
|
12
|
+
'ثلاثة',
|
|
13
|
+
'أربعة',
|
|
14
|
+
'خمسة',
|
|
15
|
+
'ستة',
|
|
16
|
+
'سبعة',
|
|
17
|
+
'ثمانية',
|
|
18
|
+
'تسعة',
|
|
19
|
+
'عشرة',
|
|
20
|
+
'أحد عشر',
|
|
21
|
+
'اثنا عشر',
|
|
22
|
+
'ثلاثة عشر',
|
|
23
|
+
'أربعة عشر',
|
|
24
|
+
'خمسة عشر',
|
|
25
|
+
'ستة عشر',
|
|
26
|
+
'سبعة عشر',
|
|
27
|
+
'ثمانية عشر',
|
|
28
|
+
'تسعة عشر',
|
|
29
|
+
],
|
|
30
|
+
feminine: [
|
|
31
|
+
'إحدى',
|
|
32
|
+
'اثنتان',
|
|
33
|
+
'ثلاث',
|
|
34
|
+
'أربع',
|
|
35
|
+
'خمس',
|
|
36
|
+
'ست',
|
|
37
|
+
'سبع',
|
|
38
|
+
'ثمان',
|
|
39
|
+
'تسع',
|
|
40
|
+
'عشر',
|
|
41
|
+
'إحدى عشرة',
|
|
42
|
+
'اثنتا عشرة',
|
|
43
|
+
'ثلاث عشرة',
|
|
44
|
+
'أربع عشرة',
|
|
45
|
+
'خمس عشرة',
|
|
46
|
+
'ست عشرة',
|
|
47
|
+
'سبع عشرة',
|
|
48
|
+
'ثماني عشرة',
|
|
49
|
+
'تسع عشرة',
|
|
50
|
+
]
|
|
51
|
+
};
|
|
25
52
|
|
|
26
53
|
arabicTens = ['عشرون', 'ثلاثون', 'أربعون', 'خمسون', 'ستون', 'سبعون', 'ثمانون', 'تسعون'];
|
|
27
54
|
|
|
@@ -42,18 +69,23 @@ export class Arabic extends AbstractLanguage {
|
|
|
42
69
|
// isCurrencyNameFeminine = false
|
|
43
70
|
|
|
44
71
|
constructor(options) {
|
|
45
|
-
|
|
72
|
+
options = Object.assign({
|
|
46
73
|
negativeWord: 'ناقص',
|
|
47
74
|
separatorWord: 'فاصلة',
|
|
48
|
-
zero: 'صفر'
|
|
49
|
-
|
|
75
|
+
zero: 'صفر',
|
|
76
|
+
feminine: false,
|
|
77
|
+
}, options);
|
|
78
|
+
|
|
79
|
+
super(options);
|
|
80
|
+
|
|
81
|
+
this.feminine = options.feminine;
|
|
50
82
|
}
|
|
51
83
|
|
|
52
|
-
digitFeminineStatus(digit
|
|
84
|
+
digitFeminineStatus(digit) {
|
|
53
85
|
// if ((groupLevel == -1 && this.isCurrencyPartNameFeminine) || (groupLevel == 0 && this.isCurrencyNameFeminine)) {
|
|
54
86
|
// return this.arabicFeminineOnes[digit]
|
|
55
87
|
// }
|
|
56
|
-
return this.
|
|
88
|
+
return this.ones[this.feminine ? 'feminine' : 'masculine'][digit - 1];
|
|
57
89
|
}
|
|
58
90
|
|
|
59
91
|
processArabicGroup(groupNumber, groupLevel, remainingNumber) {
|
|
@@ -61,10 +93,8 @@ export class Arabic extends AbstractLanguage {
|
|
|
61
93
|
const hundreds = groupNumber / 100;
|
|
62
94
|
let retVal = '';
|
|
63
95
|
|
|
64
|
-
if (
|
|
65
|
-
retVal = (
|
|
66
|
-
tens == 0 && Math.trunc(hundreds) == 2
|
|
67
|
-
) ? this.arabicAppendedTwos[0] : this.arabicHundreds[Math.trunc(hundreds)];
|
|
96
|
+
if (hundreds > 0) {
|
|
97
|
+
retVal = (tens == 0 && Math.trunc(hundreds) == 2 ? this.arabicAppendedTwos[0] : this.arabicHundreds[Math.trunc(hundreds)]);
|
|
68
98
|
}
|
|
69
99
|
|
|
70
100
|
if (tens > 0) {
|
|
@@ -72,13 +102,13 @@ export class Arabic extends AbstractLanguage {
|
|
|
72
102
|
if (tens == 2 && Math.trunc(hundreds) == 0 && groupLevel > 0) {
|
|
73
103
|
retVal = ([
|
|
74
104
|
2000, 2000000, 2000000000, 2000000000000, 2000000000000000, 2000000000000000000
|
|
75
|
-
].indexOf(this.
|
|
76
|
-
Math.trunc(groupLevel)] : this.arabicTwos[Math.trunc(groupLevel)
|
|
77
|
-
];
|
|
105
|
+
].indexOf(this.number) != -1) ? this.arabicAppendedTwos[groupLevel] : this.arabicTwos[groupLevel];
|
|
78
106
|
} else {
|
|
107
|
+
// Add divider
|
|
79
108
|
if (retVal != '') {
|
|
80
109
|
retVal += ' و ';
|
|
81
110
|
}
|
|
111
|
+
|
|
82
112
|
if (tens == 1 && groupLevel > 0 && hundreds == 0) {
|
|
83
113
|
retVal += '';
|
|
84
114
|
} else if (
|
|
@@ -114,30 +144,35 @@ export class Arabic extends AbstractLanguage {
|
|
|
114
144
|
}
|
|
115
145
|
|
|
116
146
|
toCardinal(number) {
|
|
117
|
-
/** @todo Convert class to work with BigInt */
|
|
118
|
-
number = Number(number);
|
|
119
|
-
|
|
120
147
|
if (number == 0) {
|
|
121
148
|
return this.zero;
|
|
122
149
|
}
|
|
123
150
|
|
|
151
|
+
this.number = number;
|
|
124
152
|
let tempNumber = number;
|
|
125
|
-
this.integerValue = number;
|
|
126
|
-
let retVal = '';
|
|
127
153
|
let group = 0;
|
|
154
|
+
let retVal = '';
|
|
128
155
|
|
|
156
|
+
// Loop until number has been reduced to zero or less
|
|
129
157
|
while (tempNumber > 0) {
|
|
130
|
-
|
|
131
|
-
|
|
158
|
+
// Get the remaining value after dividing by 1000
|
|
159
|
+
const numberToProcess = Number(tempNumber % 1000n); // Maximum: 999
|
|
160
|
+
// Divide number by 1000
|
|
161
|
+
tempNumber = tempNumber / 1000n;
|
|
132
162
|
|
|
133
|
-
|
|
163
|
+
// Process "group"
|
|
164
|
+
const groupDescription = this.processArabicGroup(numberToProcess, group, tempNumber);
|
|
134
165
|
|
|
166
|
+
// Did the group return anything?
|
|
135
167
|
if (groupDescription != '') {
|
|
168
|
+
// Is this after the first "group"?
|
|
136
169
|
if (group > 0) {
|
|
170
|
+
// Is the return value still empty?
|
|
137
171
|
if (retVal != '') {
|
|
138
172
|
retVal = ' و ' + retVal;
|
|
139
173
|
}
|
|
140
174
|
|
|
175
|
+
// Process every number other than 2
|
|
141
176
|
if (numberToProcess != 2) {
|
|
142
177
|
if (numberToProcess % 100 != 1) {
|
|
143
178
|
if (numberToProcess >= 3 && numberToProcess <= 10) {
|
|
@@ -155,10 +190,13 @@ export class Arabic extends AbstractLanguage {
|
|
|
155
190
|
}
|
|
156
191
|
}
|
|
157
192
|
|
|
193
|
+
// Add "group" return to output variable
|
|
194
|
+
// NOTE: Language is right-to-left
|
|
158
195
|
retVal = groupDescription + ' ' + retVal;
|
|
159
196
|
}
|
|
160
197
|
|
|
161
|
-
group
|
|
198
|
+
// Increase group level/number
|
|
199
|
+
group++;
|
|
162
200
|
}
|
|
163
201
|
|
|
164
202
|
return retVal.trim();
|
package/lib/i18n/az.js
CHANGED
|
@@ -2,11 +2,13 @@ import BaseLanguage from '../classes/BaseLanguage.js';
|
|
|
2
2
|
|
|
3
3
|
export class N2WordsAZ extends BaseLanguage {
|
|
4
4
|
constructor(options) {
|
|
5
|
-
|
|
5
|
+
options = Object.assign({
|
|
6
6
|
negativeWord: 'mənfi',
|
|
7
7
|
separatorWord: 'nöqtə',
|
|
8
8
|
zero: 'sıfır'
|
|
9
|
-
}, options)
|
|
9
|
+
}, options);
|
|
10
|
+
|
|
11
|
+
super(options, [
|
|
10
12
|
[1000000000000000000n, 'kentilyon'],
|
|
11
13
|
[1000000000000000n, 'katrilyon'],
|
|
12
14
|
[1000000000000n, 'trilyon'],
|
package/lib/i18n/cz.d.ts
CHANGED
|
@@ -7,6 +7,62 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export default function _default(value: number | string, options?: object): string;
|
|
9
9
|
export class N2WordsCZ extends N2WordsRU {
|
|
10
|
+
ones: {
|
|
11
|
+
1: string;
|
|
12
|
+
2: string;
|
|
13
|
+
3: string;
|
|
14
|
+
4: string;
|
|
15
|
+
5: string;
|
|
16
|
+
6: string;
|
|
17
|
+
7: string;
|
|
18
|
+
8: string;
|
|
19
|
+
9: string;
|
|
20
|
+
};
|
|
21
|
+
tens: {
|
|
22
|
+
0: string;
|
|
23
|
+
1: string;
|
|
24
|
+
2: string;
|
|
25
|
+
3: string;
|
|
26
|
+
4: string;
|
|
27
|
+
5: string;
|
|
28
|
+
6: string;
|
|
29
|
+
7: string;
|
|
30
|
+
8: string;
|
|
31
|
+
9: string;
|
|
32
|
+
};
|
|
33
|
+
twenties: {
|
|
34
|
+
2: string;
|
|
35
|
+
3: string;
|
|
36
|
+
4: string;
|
|
37
|
+
5: string;
|
|
38
|
+
6: string;
|
|
39
|
+
7: string;
|
|
40
|
+
8: string;
|
|
41
|
+
9: string;
|
|
42
|
+
};
|
|
43
|
+
hundreds: {
|
|
44
|
+
1: string;
|
|
45
|
+
2: string;
|
|
46
|
+
3: string;
|
|
47
|
+
4: string;
|
|
48
|
+
5: string;
|
|
49
|
+
6: string;
|
|
50
|
+
7: string;
|
|
51
|
+
8: string;
|
|
52
|
+
9: string;
|
|
53
|
+
};
|
|
54
|
+
thousands: {
|
|
55
|
+
1: string[];
|
|
56
|
+
2: string[];
|
|
57
|
+
3: string[];
|
|
58
|
+
4: string[];
|
|
59
|
+
5: string[];
|
|
60
|
+
6: string[];
|
|
61
|
+
7: string[];
|
|
62
|
+
8: string[];
|
|
63
|
+
9: string[];
|
|
64
|
+
10: string[];
|
|
65
|
+
};
|
|
10
66
|
get separatorWord(): "celá" | "celé" | "celých";
|
|
11
67
|
}
|
|
12
68
|
import { N2WordsRU } from './ru.js';
|
package/lib/i18n/cz.js
CHANGED
|
@@ -63,10 +63,12 @@ export class N2WordsCZ extends N2WordsRU {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
constructor(options) {
|
|
66
|
-
|
|
66
|
+
options = Object.assign({
|
|
67
67
|
negativeWord: 'mínus',
|
|
68
68
|
zero: 'nula'
|
|
69
|
-
}, options)
|
|
69
|
+
}, options);
|
|
70
|
+
|
|
71
|
+
super(options);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
get separatorWord() {
|
package/lib/i18n/de.js
CHANGED
|
@@ -2,11 +2,13 @@ import BaseLanguage from '../classes/BaseLanguage.js';
|
|
|
2
2
|
|
|
3
3
|
export class N2WordsDE extends BaseLanguage {
|
|
4
4
|
constructor(options) {
|
|
5
|
-
|
|
5
|
+
options = Object.assign({
|
|
6
6
|
negativeWord: 'minus',
|
|
7
7
|
separatorWord: 'komma',
|
|
8
8
|
zero: 'null'
|
|
9
|
-
}, options)
|
|
9
|
+
}, options);
|
|
10
|
+
|
|
11
|
+
super(options, [
|
|
10
12
|
[1000000000000000000000000000n, 'Quadrilliarde'],
|
|
11
13
|
[1000000000000000000000000n, 'Quadrillion'],
|
|
12
14
|
[1000000000000000000000n, 'Trilliarde'],
|
package/lib/i18n/dk.js
CHANGED
|
@@ -60,7 +60,7 @@ export class N2WordsDK extends BaseLanguage {
|
|
|
60
60
|
let nText = Object.keys(next)[0];
|
|
61
61
|
const cNum = BigInt(Object.values(curr)[0]);
|
|
62
62
|
const nNum = BigInt(Object.values(next)[0]);
|
|
63
|
-
let val
|
|
63
|
+
let val;
|
|
64
64
|
if (nNum == 100 || nNum == 1000) {
|
|
65
65
|
next = { [`et${nText}`]: nNum };
|
|
66
66
|
}
|
package/lib/i18n/en.js
CHANGED
|
@@ -5,11 +5,13 @@ import BaseLanguage from '../classes/BaseLanguage.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export class English extends BaseLanguage {
|
|
7
7
|
constructor(options) {
|
|
8
|
-
|
|
8
|
+
options = Object.assign({
|
|
9
9
|
negativeWord: 'minus',
|
|
10
10
|
separatorWord: 'point',
|
|
11
11
|
zero: 'zero'
|
|
12
|
-
}, options)
|
|
12
|
+
}, options);
|
|
13
|
+
|
|
14
|
+
super(options, [
|
|
13
15
|
[1000000000000000000000000000n, 'octillion'],
|
|
14
16
|
[1000000000000000000000000n, 'septillion'],
|
|
15
17
|
[1000000000000000000000n, 'sextillion'],
|
package/lib/i18n/fa.js
CHANGED
|
@@ -44,11 +44,13 @@ export class N2WordsFA extends AbstractLanguage {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
constructor(options) {
|
|
47
|
-
|
|
47
|
+
options = Object.assign({
|
|
48
48
|
negativeWord: 'منفى',
|
|
49
49
|
separatorWord: 'ممیّز',
|
|
50
50
|
zero: 'صفر'
|
|
51
|
-
}, options)
|
|
51
|
+
}, options);
|
|
52
|
+
|
|
53
|
+
super(options);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
toCardinal(number) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a value to cardinal (written) form.
|
|
3
|
+
* @param {number|string} value Number to be convert.
|
|
4
|
+
* @param {object} [options] Options for class.
|
|
5
|
+
* @throws {Error} Value cannot be invalid.
|
|
6
|
+
* @returns {string} Value in cardinal (written) format.
|
|
7
|
+
*/
|
|
8
|
+
export default function _default(value: number | string, options?: object): string;
|
|
9
|
+
export class N2WordsFRBE extends N2WordsFR {
|
|
10
|
+
}
|
|
11
|
+
import { N2WordsFR } from './fr.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { N2WordsFR } from './fr.js';
|
|
2
|
+
|
|
3
|
+
export class N2WordsFRBE extends N2WordsFR {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
options = Object.assign({}, options, { _region: 'BE' });
|
|
6
|
+
|
|
7
|
+
super(options);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Converts a value to cardinal (written) form.
|
|
13
|
+
* @param {number|string} value Number to be convert.
|
|
14
|
+
* @param {object} [options] Options for class.
|
|
15
|
+
* @throws {Error} Value cannot be invalid.
|
|
16
|
+
* @returns {string} Value in cardinal (written) format.
|
|
17
|
+
*/
|
|
18
|
+
export default function (value, options = {}) {
|
|
19
|
+
return new N2WordsFRBE(options).floatToCardinal(value);
|
|
20
|
+
}
|
package/lib/i18n/fr.js
CHANGED
|
@@ -2,11 +2,14 @@ import BaseLanguage from '../classes/BaseLanguage.js';
|
|
|
2
2
|
|
|
3
3
|
export class N2WordsFR extends BaseLanguage {
|
|
4
4
|
constructor(options) {
|
|
5
|
-
|
|
5
|
+
options = Object.assign({
|
|
6
6
|
negativeWord: 'moins',
|
|
7
7
|
separatorWord: 'virgule',
|
|
8
|
-
zero: 'zéro'
|
|
9
|
-
|
|
8
|
+
zero: 'zéro',
|
|
9
|
+
_region: 'FR'
|
|
10
|
+
}, options);
|
|
11
|
+
|
|
12
|
+
super(options, [
|
|
10
13
|
[1000000000000000000000000000n, 'quadrilliard'],
|
|
11
14
|
[1000000000000000000000000n, 'quadrillion'],
|
|
12
15
|
[1000000000000000000000n, 'trilliard'],
|
|
@@ -17,7 +20,9 @@ export class N2WordsFR extends BaseLanguage {
|
|
|
17
20
|
[1000000n, 'million'],
|
|
18
21
|
[1000n, 'mille'],
|
|
19
22
|
[100n, 'cent'],
|
|
23
|
+
...(['BE'].includes(options._region) ? [[90n, 'nonante']] : []),
|
|
20
24
|
[80n, 'quatre-vingts'],
|
|
25
|
+
...(['BE'].includes(options._region) ? [[70n, 'septante']] : []),
|
|
21
26
|
[60n, 'soixante'],
|
|
22
27
|
[50n, 'cinquante'],
|
|
23
28
|
[40n, 'quarante'],
|
package/lib/i18n/he.d.ts
CHANGED
|
@@ -8,6 +8,39 @@
|
|
|
8
8
|
export default function _default(value: number | string, options?: object): string;
|
|
9
9
|
export class N2WordsHE extends N2WordsRU {
|
|
10
10
|
and: any;
|
|
11
|
+
ones: {
|
|
12
|
+
1: string;
|
|
13
|
+
2: string;
|
|
14
|
+
3: string;
|
|
15
|
+
4: string;
|
|
16
|
+
5: string;
|
|
17
|
+
6: string;
|
|
18
|
+
7: string;
|
|
19
|
+
8: string;
|
|
20
|
+
9: string;
|
|
21
|
+
};
|
|
22
|
+
tens: {
|
|
23
|
+
0: string;
|
|
24
|
+
1: string;
|
|
25
|
+
2: string;
|
|
26
|
+
3: string;
|
|
27
|
+
4: string;
|
|
28
|
+
5: string;
|
|
29
|
+
6: string;
|
|
30
|
+
7: string;
|
|
31
|
+
8: string;
|
|
32
|
+
9: string;
|
|
33
|
+
};
|
|
34
|
+
twenties: {
|
|
35
|
+
2: string;
|
|
36
|
+
3: string;
|
|
37
|
+
4: string;
|
|
38
|
+
5: string;
|
|
39
|
+
6: string;
|
|
40
|
+
7: string;
|
|
41
|
+
8: string;
|
|
42
|
+
9: string;
|
|
43
|
+
};
|
|
11
44
|
hundreds: {
|
|
12
45
|
1: string;
|
|
13
46
|
2: string;
|
package/lib/i18n/he.js
CHANGED
|
@@ -87,11 +87,15 @@ export class N2WordsHE extends N2WordsRU {
|
|
|
87
87
|
if (x == 0) {
|
|
88
88
|
continue;
|
|
89
89
|
}
|
|
90
|
+
|
|
90
91
|
const [n1, n2, n3] = this.getDigits(x);
|
|
92
|
+
|
|
91
93
|
if (i > 0) {
|
|
92
94
|
words.push(this.thousands[n1]);
|
|
93
95
|
continue;
|
|
94
96
|
}
|
|
97
|
+
|
|
98
|
+
|
|
95
99
|
if (n3 > 0) {
|
|
96
100
|
if (n3 <= 2) {
|
|
97
101
|
words.push(this.hundreds[n3]);
|
|
@@ -99,21 +103,22 @@ export class N2WordsHE extends N2WordsRU {
|
|
|
99
103
|
words.push(this.ones[n3] + ' ' + this.hundreds[3]);
|
|
100
104
|
}
|
|
101
105
|
}
|
|
106
|
+
|
|
102
107
|
if (n2 > 1) {
|
|
103
108
|
words.push(this.twenties[n2]);
|
|
104
109
|
}
|
|
110
|
+
|
|
105
111
|
if (n2 == 1) {
|
|
106
112
|
words.push(this.tens[n1]);
|
|
107
|
-
} else if (n1 > 0
|
|
113
|
+
} else if (n1 > 0) {
|
|
108
114
|
words.push(this.ones[n1]);
|
|
109
115
|
}
|
|
110
|
-
if (i > 0) {
|
|
111
|
-
words.push(this.thousands[i]);
|
|
112
|
-
}
|
|
113
116
|
}
|
|
117
|
+
|
|
114
118
|
if (words.length > 1) {
|
|
115
119
|
words[words.length - 1] = this.and + words[words.length - 1];
|
|
116
120
|
}
|
|
121
|
+
|
|
117
122
|
return words.join(' ');
|
|
118
123
|
}
|
|
119
124
|
}
|
package/lib/i18n/hr.d.ts
CHANGED
|
@@ -18,6 +18,39 @@ export class N2WordsHR extends N2WordsRU {
|
|
|
18
18
|
8: string[];
|
|
19
19
|
9: string[];
|
|
20
20
|
};
|
|
21
|
+
tens: {
|
|
22
|
+
0: string;
|
|
23
|
+
1: string;
|
|
24
|
+
2: string;
|
|
25
|
+
3: string;
|
|
26
|
+
4: string;
|
|
27
|
+
5: string;
|
|
28
|
+
6: string;
|
|
29
|
+
7: string;
|
|
30
|
+
8: string;
|
|
31
|
+
9: string;
|
|
32
|
+
};
|
|
33
|
+
twenties: {
|
|
34
|
+
2: string;
|
|
35
|
+
3: string;
|
|
36
|
+
4: string;
|
|
37
|
+
5: string;
|
|
38
|
+
6: string;
|
|
39
|
+
7: string;
|
|
40
|
+
8: string;
|
|
41
|
+
9: string;
|
|
42
|
+
};
|
|
43
|
+
hundreds: {
|
|
44
|
+
1: string;
|
|
45
|
+
2: string;
|
|
46
|
+
3: string;
|
|
47
|
+
4: string;
|
|
48
|
+
5: string;
|
|
49
|
+
6: string;
|
|
50
|
+
7: string;
|
|
51
|
+
8: string;
|
|
52
|
+
9: string;
|
|
53
|
+
};
|
|
21
54
|
SCALE: {
|
|
22
55
|
0: (string | boolean)[];
|
|
23
56
|
1: (string | boolean)[];
|
package/lib/i18n/hr.js
CHANGED
|
@@ -64,11 +64,13 @@ export class N2WordsHR extends N2WordsRU {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
constructor(options) {
|
|
67
|
-
|
|
67
|
+
options = Object.assign({
|
|
68
68
|
negativeWord: 'minus',
|
|
69
69
|
separatorWord: 'zarez',
|
|
70
70
|
zero: 'nula'
|
|
71
|
-
}, options)
|
|
71
|
+
}, options);
|
|
72
|
+
|
|
73
|
+
super(options);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
pluralize(n, forms) {
|
package/lib/i18n/hu.js
CHANGED
|
@@ -2,11 +2,13 @@ import BaseLanguage from '../classes/BaseLanguage.js';
|
|
|
2
2
|
|
|
3
3
|
export class N2WordsHU extends BaseLanguage {
|
|
4
4
|
constructor(options) {
|
|
5
|
-
|
|
5
|
+
options = Object.assign({
|
|
6
6
|
negativeWord: 'mínusz',
|
|
7
7
|
separatorWord: 'egész',
|
|
8
8
|
zero: 'nulla'
|
|
9
|
-
}, options)
|
|
9
|
+
}, options);
|
|
10
|
+
|
|
11
|
+
super(options, [
|
|
10
12
|
[1000000000000000000000000000n, 'quadrilliárd'],
|
|
11
13
|
[1000000000000000000000000n, 'quadrillió'],
|
|
12
14
|
[1000000000000000000000n, 'trilliárd'],
|