@silexpert/core 1.1.52 → 1.1.54
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/es/api/resources/Fusion.d.ts +5 -0
- package/es/api/resources/Fusion.d.ts.map +1 -0
- package/es/api/resources/Fusion.js +18 -0
- package/es/api/resources/Fusion.js.map +1 -0
- package/es/api/resources/VisualizedInformation.d.ts +8 -0
- package/es/api/resources/VisualizedInformation.d.ts.map +1 -0
- package/es/api/resources/VisualizedInformation.js +13 -0
- package/es/api/resources/VisualizedInformation.js.map +1 -0
- package/es/api/resources.d.ts +4 -0
- package/es/api/resources.d.ts.map +1 -1
- package/es/api/resources.js +4 -0
- package/es/api/resources.js.map +1 -1
- package/es/types/Enum/BrandClementine.d.ts.map +1 -1
- package/es/types/Enum/BrandClementine.js +31 -0
- package/es/types/Enum/BrandClementine.js.map +1 -1
- package/es/types/Enum/FiscalRegime.d.ts +5 -0
- package/es/types/Enum/FiscalRegime.d.ts.map +1 -1
- package/es/types/Enum/FiscalRegime.js +17 -0
- package/es/types/Enum/FiscalRegime.js.map +1 -1
- package/es/types/Enum/ProfitsType.d.ts +5 -0
- package/es/types/Enum/ProfitsType.d.ts.map +1 -1
- package/es/types/Enum/ProfitsType.js +12 -0
- package/es/types/Enum/ProfitsType.js.map +1 -1
- package/es/types/Enum/TaxSystem.d.ts +5 -2
- package/es/types/Enum/TaxSystem.d.ts.map +1 -1
- package/es/types/Enum/TaxSystem.js +3 -0
- package/es/types/Enum/TaxSystem.js.map +1 -1
- package/es/types/Enum/VisualizedInformation.d.ts +5 -0
- package/es/types/Enum/VisualizedInformation.d.ts.map +1 -0
- package/es/types/Enum/VisualizedInformation.js +6 -0
- package/es/types/Enum/VisualizedInformation.js.map +1 -0
- package/es/types/Interface/api/fusion/FusionSocieties.d.ts +5 -0
- package/es/types/Interface/api/fusion/FusionSocieties.d.ts.map +1 -0
- package/es/types/Interface/api/fusion/FusionSocieties.js +24 -0
- package/es/types/Interface/api/fusion/FusionSocieties.js.map +1 -0
- package/es/types/Interface/api/visualizedInformation/Query.d.ts +6 -0
- package/es/types/Interface/api/visualizedInformation/Query.d.ts.map +1 -0
- package/es/types/Interface/api/visualizedInformation/Query.js +26 -0
- package/es/types/Interface/api/visualizedInformation/Query.js.map +1 -0
- package/es/types/Interface/api/visualizedInformation/Update.d.ts +6 -0
- package/es/types/Interface/api/visualizedInformation/Update.d.ts.map +1 -0
- package/es/types/Interface/api/visualizedInformation/Update.js +25 -0
- package/es/types/Interface/api/visualizedInformation/Update.js.map +1 -0
- package/es/types/Interface/models/ISociety.d.ts +1 -0
- package/es/types/Interface/models/ISociety.d.ts.map +1 -1
- package/es/types/Interface/models/ISociety.js.map +1 -1
- package/es/types/Interface/models/IVisualizedInformation.d.ts +12 -0
- package/es/types/Interface/models/IVisualizedInformation.d.ts.map +1 -0
- package/es/types/Interface/models/IVisualizedInformation.js +2 -0
- package/es/types/Interface/models/IVisualizedInformation.js.map +1 -0
- package/es/types/index.d.ts +5 -0
- package/es/types/index.d.ts.map +1 -1
- package/es/types/index.js +5 -0
- package/es/types/index.js.map +1 -1
- package/es/utils/amount.d.ts.map +1 -1
- package/es/utils/amount.js +74 -293
- package/es/utils/amount.js.map +1 -1
- package/js/api/resources/Fusion.js +46 -0
- package/js/api/resources/Fusion.js.map +1 -0
- package/js/api/resources/VisualizedInformation.js +22 -0
- package/js/api/resources/VisualizedInformation.js.map +1 -0
- package/js/api/resources.js +5 -1
- package/js/api/resources.js.map +1 -1
- package/js/types/Enum/BrandClementine.js +30 -0
- package/js/types/Enum/BrandClementine.js.map +1 -1
- package/js/types/Enum/FiscalRegime.js +13 -0
- package/js/types/Enum/FiscalRegime.js.map +1 -1
- package/js/types/Enum/ProfitsType.js +9 -0
- package/js/types/Enum/ProfitsType.js.map +1 -1
- package/js/types/Enum/TaxSystem.js +6 -3
- package/js/types/Enum/TaxSystem.js.map +1 -1
- package/js/types/Enum/VisualizedInformation.js +11 -0
- package/js/types/Enum/VisualizedInformation.js.map +1 -0
- package/js/types/Interface/api/fusion/FusionSocieties.js +23 -0
- package/js/types/Interface/api/fusion/FusionSocieties.js.map +1 -0
- package/js/types/Interface/api/visualizedInformation/Query.js +24 -0
- package/js/types/Interface/api/visualizedInformation/Query.js.map +1 -0
- package/js/types/Interface/api/visualizedInformation/Update.js +24 -0
- package/js/types/Interface/api/visualizedInformation/Update.js.map +1 -0
- package/js/types/Interface/models/ISociety.js.map +1 -1
- package/js/types/Interface/models/IVisualizedInformation.js +6 -0
- package/js/types/Interface/models/IVisualizedInformation.js.map +1 -0
- package/js/types/index.js +53 -3
- package/js/types/index.js.map +1 -1
- package/js/utils/amount.js +65 -230
- package/js/utils/amount.js.map +1 -1
- package/package.json +1 -1
- package/ts/api/resources/Fusion.ts +7 -0
- package/ts/api/resources/VisualizedInformation.ts +16 -0
- package/ts/api/resources.ts +4 -0
- package/ts/types/Enum/BrandClementine.ts +31 -0
- package/ts/types/Enum/FiscalRegime.ts +19 -1
- package/ts/types/Enum/ProfitsType.ts +14 -1
- package/ts/types/Enum/TaxSystem.ts +5 -4
- package/ts/types/Enum/VisualizedInformation.ts +4 -0
- package/ts/types/Interface/api/fusion/FusionSocieties.ts +12 -0
- package/ts/types/Interface/api/visualizedInformation/Query.ts +14 -0
- package/ts/types/Interface/api/visualizedInformation/Update.ts +13 -0
- package/ts/types/Interface/models/ISociety.ts +1 -0
- package/ts/types/Interface/models/IVisualizedInformation.ts +14 -0
- package/ts/types/index.ts +6 -0
- package/ts/utils/amount.ts +86 -161
package/es/utils/amount.js
CHANGED
|
@@ -33,303 +33,84 @@ export function integerToFormattedAmountObject(value, options = {
|
|
|
33
33
|
return Object.assign(Object.assign({}, result), { formattedValue: `${result.sign !== MathematicalSign.EQUAL ? `${result.sign} ` : ''}${result.integerValue},${result.centValue}` });
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Convertit
|
|
36
|
+
* Convertit les nombres à virgule de 0 à 100 000 000 (100 millions) *
|
|
37
37
|
* @param nombre
|
|
38
38
|
* @returns {string}
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
break;
|
|
74
|
-
} // fin switch
|
|
75
|
-
return unite;
|
|
76
|
-
}
|
|
77
|
-
function getDizaine(nombre) {
|
|
78
|
-
let dizaine;
|
|
79
|
-
switch (nombre) {
|
|
80
|
-
// case 10: dizaine = 'dix'; break;
|
|
81
|
-
case 11:
|
|
82
|
-
dizaine = 'onze';
|
|
83
|
-
break;
|
|
84
|
-
case 12:
|
|
85
|
-
dizaine = 'douze';
|
|
86
|
-
break;
|
|
87
|
-
case 13:
|
|
88
|
-
dizaine = 'treize';
|
|
89
|
-
break;
|
|
90
|
-
case 14:
|
|
91
|
-
dizaine = 'quatorze';
|
|
92
|
-
break;
|
|
93
|
-
case 15:
|
|
94
|
-
dizaine = 'quinze';
|
|
95
|
-
break;
|
|
96
|
-
case 16:
|
|
97
|
-
dizaine = 'seize';
|
|
98
|
-
break;
|
|
99
|
-
case 17:
|
|
100
|
-
dizaine = 'dix-sept';
|
|
101
|
-
break;
|
|
102
|
-
case 18:
|
|
103
|
-
dizaine = 'dix-huit';
|
|
104
|
-
break;
|
|
105
|
-
case 19:
|
|
106
|
-
dizaine = 'dix-neuf';
|
|
107
|
-
break;
|
|
108
|
-
case 20:
|
|
109
|
-
dizaine = 'vingt';
|
|
110
|
-
break;
|
|
111
|
-
case 30:
|
|
112
|
-
dizaine = 'trente';
|
|
113
|
-
break;
|
|
114
|
-
case 40:
|
|
115
|
-
dizaine = 'quarante';
|
|
116
|
-
break;
|
|
117
|
-
case 50:
|
|
118
|
-
dizaine = 'cinquante';
|
|
119
|
-
break;
|
|
120
|
-
case 60:
|
|
121
|
-
dizaine = 'soixante';
|
|
122
|
-
break;
|
|
123
|
-
case 70:
|
|
124
|
-
dizaine = 'soixante-dix';
|
|
125
|
-
break;
|
|
126
|
-
case 80:
|
|
127
|
-
dizaine = 'quatre-vingt';
|
|
128
|
-
break;
|
|
129
|
-
case 90:
|
|
130
|
-
dizaine = 'quatre-vingt-dix';
|
|
131
|
-
break;
|
|
132
|
-
default:
|
|
133
|
-
dizaine = 'dix';
|
|
134
|
-
break;
|
|
135
|
-
} // fin switch
|
|
136
|
-
return dizaine;
|
|
137
|
-
} //-----------------------------------------------------------------------
|
|
138
|
-
export function convertNumberToLetter(nombre) {
|
|
139
|
-
let quotient;
|
|
140
|
-
let reste;
|
|
141
|
-
let numberToLetter = '';
|
|
142
|
-
if (nombre.toString().replace(/ /gi, '').length > 15)
|
|
143
|
-
return 'dépassement de capacité';
|
|
144
|
-
if (Number.isNaN(nombre.toString().replace(/ /gi, '')))
|
|
145
|
-
return 'Nombre non valide';
|
|
146
|
-
const nb = parseFloat(nombre.toString().replace(/ /gi, ''));
|
|
147
|
-
if (Math.ceil(nb) !== nb)
|
|
148
|
-
return 'Nombre avec virgule non géré.';
|
|
149
|
-
const n = nb.toString().length;
|
|
150
|
-
switch (n) {
|
|
151
|
-
// case 1: numberToLetter = getUnite(nb); break;
|
|
152
|
-
case 2:
|
|
153
|
-
if (nb > 19) {
|
|
154
|
-
quotient = Math.floor(nb / 10);
|
|
155
|
-
reste = nb % 10;
|
|
156
|
-
if (nb < 71 || (nb > 79 && nb < 91)) {
|
|
157
|
-
if (reste === 0)
|
|
158
|
-
numberToLetter = getDizaine(quotient * 10);
|
|
159
|
-
if (reste === 1)
|
|
160
|
-
numberToLetter = `${getDizaine(quotient * 10)}-et-${getUnite(reste)}`;
|
|
161
|
-
if (reste > 1)
|
|
162
|
-
numberToLetter = `${getDizaine(quotient * 10)}-${getUnite(reste)}`;
|
|
40
|
+
const unites = [
|
|
41
|
+
'', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix',
|
|
42
|
+
'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf',
|
|
43
|
+
];
|
|
44
|
+
const dizaines = [
|
|
45
|
+
'', '', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante',
|
|
46
|
+
'quatre-vingt', 'quatre-vingt',
|
|
47
|
+
];
|
|
48
|
+
const groupes = ['', 'mille', 'million'];
|
|
49
|
+
function convertirGroupeEnLettres(groupe) {
|
|
50
|
+
let groupeEnLettres = '';
|
|
51
|
+
const centaines = Math.floor(groupe / 100);
|
|
52
|
+
const dizainesEtUnites = groupe % 100;
|
|
53
|
+
if (centaines > 0) {
|
|
54
|
+
groupeEnLettres += `${unites[centaines] === 'un' ? '' : unites[centaines]} cent `;
|
|
55
|
+
}
|
|
56
|
+
if (dizainesEtUnites > 0) {
|
|
57
|
+
if (dizainesEtUnites <= 19) {
|
|
58
|
+
groupeEnLettres += unites[dizainesEtUnites];
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const unite = dizainesEtUnites % 10;
|
|
62
|
+
const dizaine = Math.floor(dizainesEtUnites / 10);
|
|
63
|
+
groupeEnLettres += dizaines[dizaine];
|
|
64
|
+
if (unite > 0) {
|
|
65
|
+
if (dizaine === 7 || dizaine === 9) {
|
|
66
|
+
/* const dizaineTexte = */ dizaines[dizaine].slice(0, -1);
|
|
67
|
+
const uniteTexte = unites[unite];
|
|
68
|
+
groupeEnLettres += `-${uniteTexte}`;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const uniteTexte = unites[unite];
|
|
72
|
+
groupeEnLettres += `-${uniteTexte}`;
|
|
163
73
|
}
|
|
164
|
-
else
|
|
165
|
-
numberToLetter = `${getDizaine((quotient - 1) * 10)}-${getDizaine(10 + reste)}`;
|
|
166
74
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
quotient = Math.floor(nb / 1000);
|
|
208
|
-
reste = nb - quotient * 1000;
|
|
209
|
-
if (quotient === 1 && reste === 0)
|
|
210
|
-
numberToLetter = 'mille';
|
|
211
|
-
if (quotient === 1 && reste !== 0)
|
|
212
|
-
numberToLetter = `${'mille '}${convertNumberToLetter(reste)}`;
|
|
213
|
-
if (quotient > 1 && reste === 0)
|
|
214
|
-
numberToLetter = `${convertNumberToLetter(quotient)} mille`;
|
|
215
|
-
if (quotient > 1 && reste !== 0)
|
|
216
|
-
numberToLetter = `${convertNumberToLetter(quotient)} mille ${convertNumberToLetter(reste)}`;
|
|
217
|
-
break;
|
|
218
|
-
case 7:
|
|
219
|
-
quotient = Math.floor(nb / 1000000);
|
|
220
|
-
reste = nb % 1000000;
|
|
221
|
-
if (quotient === 1 && reste === 0)
|
|
222
|
-
numberToLetter = 'un million';
|
|
223
|
-
if (quotient === 1 && reste !== 0)
|
|
224
|
-
numberToLetter = `${'un million '}${convertNumberToLetter(reste)}`;
|
|
225
|
-
if (quotient > 1 && reste === 0)
|
|
226
|
-
numberToLetter = `${convertNumberToLetter(quotient)} millions`;
|
|
227
|
-
if (quotient > 1 && reste !== 0)
|
|
228
|
-
numberToLetter = `${convertNumberToLetter(quotient)} millions ${convertNumberToLetter(reste)}`;
|
|
229
|
-
break;
|
|
230
|
-
case 8:
|
|
231
|
-
quotient = Math.floor(nb / 1000000);
|
|
232
|
-
reste = nb % 1000000;
|
|
233
|
-
if (quotient === 1 && reste === 0)
|
|
234
|
-
numberToLetter = 'un million';
|
|
235
|
-
if (quotient === 1 && reste !== 0)
|
|
236
|
-
numberToLetter = `${'un million '}${convertNumberToLetter(reste)}`;
|
|
237
|
-
if (quotient > 1 && reste === 0)
|
|
238
|
-
numberToLetter = `${convertNumberToLetter(quotient)} millions`;
|
|
239
|
-
if (quotient > 1 && reste !== 0)
|
|
240
|
-
numberToLetter = `${convertNumberToLetter(quotient)} millions ${convertNumberToLetter(reste)}`;
|
|
241
|
-
break;
|
|
242
|
-
case 9:
|
|
243
|
-
quotient = Math.floor(nb / 1000000);
|
|
244
|
-
reste = nb % 1000000;
|
|
245
|
-
if (quotient === 1 && reste === 0)
|
|
246
|
-
numberToLetter = 'un million';
|
|
247
|
-
if (quotient === 1 && reste !== 0)
|
|
248
|
-
numberToLetter = `${'un million '}${convertNumberToLetter(reste)}`;
|
|
249
|
-
if (quotient > 1 && reste === 0)
|
|
250
|
-
numberToLetter = `${convertNumberToLetter(quotient)} millions`;
|
|
251
|
-
if (quotient > 1 && reste !== 0)
|
|
252
|
-
numberToLetter = `${convertNumberToLetter(quotient)} millions ${convertNumberToLetter(reste)}`;
|
|
253
|
-
break;
|
|
254
|
-
case 10:
|
|
255
|
-
quotient = Math.floor(nb / 1000000000);
|
|
256
|
-
reste = nb - quotient * 1000000000;
|
|
257
|
-
if (quotient === 1 && reste === 0)
|
|
258
|
-
numberToLetter = 'un milliard';
|
|
259
|
-
if (quotient === 1 && reste !== 0)
|
|
260
|
-
numberToLetter = `${'un milliard '}${convertNumberToLetter(reste)}`;
|
|
261
|
-
if (quotient > 1 && reste === 0)
|
|
262
|
-
numberToLetter = `${convertNumberToLetter(quotient)} milliards`;
|
|
263
|
-
if (quotient > 1 && reste !== 0)
|
|
264
|
-
numberToLetter = `${convertNumberToLetter(quotient)} milliards ${convertNumberToLetter(reste)}`;
|
|
265
|
-
break;
|
|
266
|
-
case 11:
|
|
267
|
-
quotient = Math.floor(nb / 1000000000);
|
|
268
|
-
reste = nb - quotient * 1000000000;
|
|
269
|
-
if (quotient === 1 && reste === 0)
|
|
270
|
-
numberToLetter = 'un milliard';
|
|
271
|
-
if (quotient === 1 && reste !== 0)
|
|
272
|
-
numberToLetter = `${'un milliard '}${convertNumberToLetter(reste)}`;
|
|
273
|
-
if (quotient > 1 && reste === 0)
|
|
274
|
-
numberToLetter = `${convertNumberToLetter(quotient)} milliards`;
|
|
275
|
-
if (quotient > 1 && reste !== 0)
|
|
276
|
-
numberToLetter = `${convertNumberToLetter(quotient)} milliards ${convertNumberToLetter(reste)}`;
|
|
277
|
-
break;
|
|
278
|
-
case 12:
|
|
279
|
-
quotient = Math.floor(nb / 1000000000);
|
|
280
|
-
reste = nb - quotient * 1000000000;
|
|
281
|
-
if (quotient === 1 && reste === 0)
|
|
282
|
-
numberToLetter = 'un milliard';
|
|
283
|
-
if (quotient === 1 && reste !== 0)
|
|
284
|
-
numberToLetter = `${'un milliard '}${convertNumberToLetter(reste)}`;
|
|
285
|
-
if (quotient > 1 && reste === 0)
|
|
286
|
-
numberToLetter = `${convertNumberToLetter(quotient)} milliards`;
|
|
287
|
-
if (quotient > 1 && reste !== 0)
|
|
288
|
-
numberToLetter = `${convertNumberToLetter(quotient)} milliards ${convertNumberToLetter(reste)}`;
|
|
289
|
-
break;
|
|
290
|
-
case 13:
|
|
291
|
-
quotient = Math.floor(nb / 1000000000000);
|
|
292
|
-
reste = nb - quotient * 1000000000000;
|
|
293
|
-
if (quotient === 1 && reste === 0)
|
|
294
|
-
numberToLetter = 'un billion';
|
|
295
|
-
if (quotient === 1 && reste !== 0)
|
|
296
|
-
numberToLetter = `${'un billion '}${convertNumberToLetter(reste)}`;
|
|
297
|
-
if (quotient > 1 && reste === 0)
|
|
298
|
-
numberToLetter = `${convertNumberToLetter(quotient)} billions`;
|
|
299
|
-
if (quotient > 1 && reste !== 0)
|
|
300
|
-
numberToLetter = `${convertNumberToLetter(quotient)} billions ${convertNumberToLetter(reste)}`;
|
|
301
|
-
break;
|
|
302
|
-
case 14:
|
|
303
|
-
quotient = Math.floor(nb / 1000000000000);
|
|
304
|
-
reste = nb - quotient * 1000000000000;
|
|
305
|
-
if (quotient === 1 && reste === 0)
|
|
306
|
-
numberToLetter = 'un billion';
|
|
307
|
-
if (quotient === 1 && reste !== 0)
|
|
308
|
-
numberToLetter = `${'un billion '}${convertNumberToLetter(reste)}`;
|
|
309
|
-
if (quotient > 1 && reste === 0)
|
|
310
|
-
numberToLetter = `${convertNumberToLetter(quotient)} billions`;
|
|
311
|
-
if (quotient > 1 && reste !== 0)
|
|
312
|
-
numberToLetter = `${convertNumberToLetter(quotient)} billions ${convertNumberToLetter(reste)}`;
|
|
313
|
-
break;
|
|
314
|
-
case 15:
|
|
315
|
-
quotient = Math.floor(nb / 1000000000000);
|
|
316
|
-
reste = nb - quotient * 1000000000000;
|
|
317
|
-
if (quotient === 1 && reste === 0)
|
|
318
|
-
numberToLetter = 'un billion';
|
|
319
|
-
if (quotient === 1 && reste !== 0)
|
|
320
|
-
numberToLetter = `${'un billion '}${convertNumberToLetter(reste)}`;
|
|
321
|
-
if (quotient > 1 && reste === 0)
|
|
322
|
-
numberToLetter = `${convertNumberToLetter(quotient)} billions`;
|
|
323
|
-
if (quotient > 1 && reste !== 0)
|
|
324
|
-
numberToLetter = `${convertNumberToLetter(quotient)} billions ${convertNumberToLetter(reste)}`;
|
|
325
|
-
break;
|
|
326
|
-
default:
|
|
327
|
-
numberToLetter = getUnite(nb);
|
|
328
|
-
break;
|
|
329
|
-
} // fin switch
|
|
330
|
-
/* respect de l'accord de quatre-vingt */
|
|
331
|
-
if (numberToLetter.substr(numberToLetter.length - 'quatre-vingt'.length, 'quatre-vingt'.length) === 'quatre-vingt')
|
|
332
|
-
numberToLetter += 's';
|
|
333
|
-
return numberToLetter;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return groupeEnLettres.trim();
|
|
78
|
+
}
|
|
79
|
+
function convertirNombreEntierEnLettres(ent) {
|
|
80
|
+
let entier = ent;
|
|
81
|
+
if (entier === 0) {
|
|
82
|
+
return 'zéro';
|
|
83
|
+
}
|
|
84
|
+
let resultat = '';
|
|
85
|
+
let groupeIndex = 0;
|
|
86
|
+
while (entier > 0) {
|
|
87
|
+
const groupe = entier % 1000;
|
|
88
|
+
const groupeEnLettres = convertirGroupeEnLettres(groupe);
|
|
89
|
+
if (groupeEnLettres !== '') {
|
|
90
|
+
resultat = `${groupeEnLettres === 'un' && ['mille', 'cent'].includes(groupes[groupeIndex]) ? '' : groupeEnLettres} ${groupes[groupeIndex]}${groupeIndex === 2 && groupeEnLettres !== 'un' ? 's' : ''} ${resultat}`;
|
|
91
|
+
}
|
|
92
|
+
entier = Math.floor(entier / 1000);
|
|
93
|
+
groupeIndex += 1;
|
|
94
|
+
}
|
|
95
|
+
return resultat.trim();
|
|
96
|
+
}
|
|
97
|
+
function convertirNombreDecimalEnLettres(decimal) {
|
|
98
|
+
const decimalArrondi = Math.round(decimal * 100);
|
|
99
|
+
return `virgule ${convertirNombreEntierEnLettres(decimalArrondi)}`;
|
|
100
|
+
}
|
|
101
|
+
export function convertNumberToLetter(nombre) {
|
|
102
|
+
const partieEntiere = Math.floor(nombre);
|
|
103
|
+
const partieDecimale = nombre - partieEntiere;
|
|
104
|
+
let resultat = '';
|
|
105
|
+
if (partieEntiere === 0) {
|
|
106
|
+
resultat = 'zéro';
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
resultat = convertirNombreEntierEnLettres(partieEntiere);
|
|
110
|
+
}
|
|
111
|
+
if (partieDecimale > 0) {
|
|
112
|
+
resultat += ` ${convertirNombreDecimalEnLettres(partieDecimale)}`;
|
|
113
|
+
}
|
|
114
|
+
return resultat;
|
|
334
115
|
}
|
|
335
116
|
//# sourceMappingURL=amount.js.map
|
package/es/utils/amount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../ts/utils/amount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,UAAU,8BAA8B,CAAC,KAAa;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAClC,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,GAAG,CAAC,CAAC;IAElD,OAAO,KAAK,IAAI,GAAG,EAAE;QACnB,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC,CAAC;KACd;IAED,MAAM,eAAe,GAAG,GAAG,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/J,OAAO,GAAG,KAAK,GAAG,CAAC,CAA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B,CAAC,KAAK,CAAC,EAAE,CAAC;YAChI,MAAM;QACR;YAAS,cAAc,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;YAAC,MAAM;KAC/C,CAAC,aAAa;IACf,yCAAyC;IACzC,IAAI,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,cAAc;QAAE,cAAc,IAAI,GAAG,CAAC;IAE1I,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { MathematicalSign } from '../types/Enum/Util';\nimport { FormattedAmount } from '../types/Interface/api/amount/FormattedAmount';\n\nexport function integerToFormattedAmountString(value: number): string {\n const abs = Math.abs(value / 100);\n let integer = Math.trunc(abs);\n let cents = Math.round(abs * 100 - integer * 100);\n\n while (cents >= 100) {\n cents = Math.max(0, cents - 100);\n integer += 1;\n }\n\n const integerWithMask = `${integer}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim();\n return `${value < 0 ? '- ' : ''}${integerWithMask},${cents < 10 ? '0' : ''}${cents}`;\n}\n\nexport function integerToFormattedAmountObject(\n value: number,\n options: {\n thousandSeparator?: string;\n } = {\n thousandSeparator: ' ',\n },\n): FormattedAmount {\n const { thousandSeparator } = options;\n const abs = Math.abs(value / 100);\n let integer = Math.trunc(abs);\n let cents = Math.round(abs * 100 - integer * 100);\n\n while (cents >= 100) {\n cents = Math.max(0, cents - 100);\n integer += 1;\n }\n\n const result = {\n value,\n sign: value > 0 ? MathematicalSign.PLUS : value < 0 ? MathematicalSign.LESS : MathematicalSign.EQUAL,\n integerValue: `${integer}`\n .split('')\n .reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? thousandSeparator : ''}${acc}`, '')\n .trim(),\n centValue: `${cents < 10 ? '0' : ''}${cents}`,\n };\n\n return {\n ...result,\n formattedValue: `${result.sign !== MathematicalSign.EQUAL ? `${result.sign} ` : ''}${result.integerValue},${result.centValue}`,\n };\n}\n\n/**\n * Convertit jusqu'à 999 999 999 999 999 (billion) *\n * @param nombre\n * @returns {string}\n */\nfunction getUnite(nombre: number):string {\n let unite;\n switch (nombre) {\n // case 0: unite = 'zéro'; break;\n case 1: unite = 'un'; break;\n case 2: unite = 'deux'; break;\n case 3: unite = 'trois'; break;\n case 4: unite = 'quatre'; break;\n case 5: unite = 'cinq'; break;\n case 6: unite = 'six'; break;\n case 7: unite = 'sept'; break;\n case 8: unite = 'huit'; break;\n case 9: unite = 'neuf'; break;\n default: unite = 'zéro'; break;\n }// fin switch\n return unite;\n}\n\nfunction getDizaine(nombre: number):string {\n let dizaine;\n switch (nombre) {\n // case 10: dizaine = 'dix'; break;\n case 11: dizaine = 'onze'; break;\n case 12: dizaine = 'douze'; break;\n case 13: dizaine = 'treize'; break;\n case 14: dizaine = 'quatorze'; break;\n case 15: dizaine = 'quinze'; break;\n case 16: dizaine = 'seize'; break;\n case 17: dizaine = 'dix-sept'; break;\n case 18: dizaine = 'dix-huit'; break;\n case 19: dizaine = 'dix-neuf'; break;\n case 20: dizaine = 'vingt'; break;\n case 30: dizaine = 'trente'; break;\n case 40: dizaine = 'quarante'; break;\n case 50: dizaine = 'cinquante'; break;\n case 60: dizaine = 'soixante'; break;\n case 70: dizaine = 'soixante-dix'; break;\n case 80: dizaine = 'quatre-vingt'; break;\n case 90: dizaine = 'quatre-vingt-dix'; break;\n default: dizaine = 'dix'; break;\n }// fin switch\n return dizaine;\n}//-----------------------------------------------------------------------\n\nexport function convertNumberToLetter(nombre: number): string {\n let quotient: number; let reste: number;\n let numberToLetter = '';\n\n if (nombre.toString().replace(/ /gi, '').length > 15) return 'dépassement de capacité';\n if (Number.isNaN(nombre.toString().replace(/ /gi, ''))) return 'Nombre non valide';\n\n const nb = parseFloat(nombre.toString().replace(/ /gi, ''));\n if (Math.ceil(nb) !== nb) return 'Nombre avec virgule non géré.';\n\n const n = nb.toString().length;\n switch (n) {\n // case 1: numberToLetter = getUnite(nb); break;\n case 2: if (nb > 19) {\n quotient = Math.floor(nb / 10);\n reste = nb % 10;\n if (nb < 71 || (nb > 79 && nb < 91)) {\n if (reste === 0) numberToLetter = getDizaine(quotient * 10);\n if (reste === 1) numberToLetter = `${getDizaine(quotient * 10)}-et-${getUnite(reste)}`;\n if (reste > 1) numberToLetter = `${getDizaine(quotient * 10)}-${getUnite(reste)}`;\n } else numberToLetter = `${getDizaine((quotient - 1) * 10)}-${getDizaine(10 + reste)}`;\n } else numberToLetter = getDizaine(nb);\n break;\n case 3: quotient = Math.floor(nb / 100);\n reste = nb % 100;\n if (quotient === 1 && reste === 0) numberToLetter = 'cent';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'cent '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${getUnite(quotient)} cents`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${getUnite(quotient)} cent ${convertNumberToLetter(reste)}`;\n break;\n case 4: quotient = Math.floor(nb / 1000);\n reste = nb - quotient * 1000;\n if (quotient === 1 && reste === 0) numberToLetter = 'mille';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'mille '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} mille`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} mille ${convertNumberToLetter(reste)}`;\n break;\n case 5: quotient = Math.floor(nb / 1000);\n reste = nb - quotient * 1000;\n if (quotient === 1 && reste === 0) numberToLetter = 'mille';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'mille '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} mille`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} mille ${convertNumberToLetter(reste)}`;\n break;\n case 6: quotient = Math.floor(nb / 1000);\n reste = nb - quotient * 1000;\n if (quotient === 1 && reste === 0) numberToLetter = 'mille';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'mille '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} mille`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} mille ${convertNumberToLetter(reste)}`;\n break;\n case 7: quotient = Math.floor(nb / 1000000);\n reste = nb % 1000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un million';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un million '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} millions`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} millions ${convertNumberToLetter(reste)}`;\n break;\n case 8: quotient = Math.floor(nb / 1000000);\n reste = nb % 1000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un million';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un million '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} millions`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} millions ${convertNumberToLetter(reste)}`;\n break;\n case 9: quotient = Math.floor(nb / 1000000);\n reste = nb % 1000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un million';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un million '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} millions`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} millions ${convertNumberToLetter(reste)}`;\n break;\n case 10: quotient = Math.floor(nb / 1000000000);\n reste = nb - quotient * 1000000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un milliard';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un milliard '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} milliards`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} milliards ${convertNumberToLetter(reste)}`;\n break;\n case 11: quotient = Math.floor(nb / 1000000000);\n reste = nb - quotient * 1000000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un milliard';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un milliard '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} milliards`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} milliards ${convertNumberToLetter(reste)}`;\n break;\n case 12: quotient = Math.floor(nb / 1000000000);\n reste = nb - quotient * 1000000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un milliard';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un milliard '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} milliards`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} milliards ${convertNumberToLetter(reste)}`;\n break;\n case 13: quotient = Math.floor(nb / 1000000000000);\n reste = nb - quotient * 1000000000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un billion';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un billion '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} billions`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} billions ${convertNumberToLetter(reste)}`;\n break;\n case 14: quotient = Math.floor(nb / 1000000000000);\n reste = nb - quotient * 1000000000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un billion';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un billion '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} billions`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} billions ${convertNumberToLetter(reste)}`;\n break;\n case 15: quotient = Math.floor(nb / 1000000000000);\n reste = nb - quotient * 1000000000000;\n if (quotient === 1 && reste === 0) numberToLetter = 'un billion';\n if (quotient === 1 && reste !== 0) numberToLetter = `${'un billion '}${convertNumberToLetter(reste)}`;\n if (quotient > 1 && reste === 0) numberToLetter = `${convertNumberToLetter(quotient)} billions`;\n if (quotient > 1 && reste !== 0) numberToLetter = `${convertNumberToLetter(quotient)} billions ${convertNumberToLetter(reste)}`;\n break;\n default: numberToLetter = getUnite(nb); break;\n } // fin switch\n /* respect de l'accord de quatre-vingt */\n if (numberToLetter.substr(numberToLetter.length - 'quatre-vingt'.length, 'quatre-vingt'.length) === 'quatre-vingt') numberToLetter += 's';\n\n return numberToLetter;\n}"]}
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../ts/utils/amount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,UAAU,8BAA8B,CAAC,KAAa;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;IAClC,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,GAAG,CAAC,CAAC;IAElD,OAAO,KAAK,IAAI,GAAG,EAAE;QACnB,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC,CAAC;KACd;IAED,MAAM,eAAe,GAAG,GAAG,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,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QACL,QAAQ,GAAG,8BAA8B,CAAC,aAAa,CAAC,CAAC;KAC1D;IAED,IAAI,cAAc,GAAG,CAAC,EAAE;QACtB,QAAQ,IAAI,IAAI,+BAA+B,CAAC,cAAc,CAAC,EAAE,CAAC;KACnE;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { MathematicalSign } from '../types/Enum/Util';\nimport { FormattedAmount } from '../types/Interface/api/amount/FormattedAmount';\n\nexport function integerToFormattedAmountString(value: number): string {\n const abs = Math.abs(value / 100);\n let integer = Math.trunc(abs);\n let cents = Math.round(abs * 100 - integer * 100);\n\n while (cents >= 100) {\n cents = Math.max(0, cents - 100);\n integer += 1;\n }\n\n const integerWithMask = `${integer}`.split('').reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? ' ' : ''}${acc}`, '').trim();\n return `${value < 0 ? '- ' : ''}${integerWithMask},${cents < 10 ? '0' : ''}${cents}`;\n}\n\nexport function integerToFormattedAmountObject(\n value: number,\n options: {\n thousandSeparator?: string;\n } = {\n thousandSeparator: ' ',\n },\n): FormattedAmount {\n const { thousandSeparator } = options;\n const abs = Math.abs(value / 100);\n let integer = Math.trunc(abs);\n let cents = Math.round(abs * 100 - integer * 100);\n\n while (cents >= 100) {\n cents = Math.max(0, cents - 100);\n integer += 1;\n }\n\n const result = {\n value,\n sign: value > 0 ? MathematicalSign.PLUS : value < 0 ? MathematicalSign.LESS : MathematicalSign.EQUAL,\n integerValue: `${integer}`\n .split('')\n .reduceRight((acc, char, i, { length }) => `${char}${(length - (i + 1)) % 3 === 0 ? thousandSeparator : ''}${acc}`, '')\n .trim(),\n centValue: `${cents < 10 ? '0' : ''}${cents}`,\n };\n\n return {\n ...result,\n formattedValue: `${result.sign !== MathematicalSign.EQUAL ? `${result.sign} ` : ''}${result.integerValue},${result.centValue}`,\n };\n}\n\n/**\n * Convertit les nombres à virgule de 0 à 100 000 000 (100 millions) *\n * @param nombre\n * @returns {string}\n */\nconst unites: string[] = [\n '', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix',\n 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix-sept', 'dix-huit', 'dix-neuf',\n];\n\nconst dizaines: string[] = [\n '', '', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante',\n 'quatre-vingt', 'quatre-vingt',\n];\n\nconst groupes: string[] = ['', 'mille', 'million'];\n\nfunction convertirGroupeEnLettres(groupe: number): string {\n let groupeEnLettres = '';\n\n const centaines = Math.floor(groupe / 100);\n const dizainesEtUnites = groupe % 100;\n\n if (centaines > 0) {\n groupeEnLettres += `${unites[centaines] === 'un' ? '' : unites[centaines]} cent `;\n }\n\n if (dizainesEtUnites > 0) {\n if (dizainesEtUnites <= 19) {\n groupeEnLettres += unites[dizainesEtUnites];\n } else {\n const unite = dizainesEtUnites % 10;\n const dizaine = Math.floor(dizainesEtUnites / 10);\n groupeEnLettres += dizaines[dizaine];\n\n if (unite > 0) {\n if (dizaine === 7 || dizaine === 9) {\n /* const dizaineTexte = */dizaines[dizaine].slice(0, -1);\n const uniteTexte = unites[unite];\n groupeEnLettres += `-${uniteTexte}`;\n } else {\n const uniteTexte = unites[unite];\n groupeEnLettres += `-${uniteTexte}`;\n }\n }\n }\n }\n\n return groupeEnLettres.trim();\n}\nfunction convertirNombreEntierEnLettres(ent: number): string {\n let entier = ent;\n if (entier === 0) {\n return 'zéro';\n }\n\n let resultat = '';\n\n let groupeIndex = 0;\n while (entier > 0) {\n const groupe = entier % 1000;\n const groupeEnLettres = convertirGroupeEnLettres(groupe);\n\n if (groupeEnLettres !== '') {\n resultat = `${groupeEnLettres === 'un' && ['mille', 'cent'].includes(groupes[groupeIndex]) ? '' : groupeEnLettres} ${groupes[groupeIndex]}${groupeIndex === 2 && groupeEnLettres !== 'un' ? 's' : ''} ${resultat}`;\n }\n\n entier = Math.floor(entier / 1000);\n groupeIndex += 1;\n }\n\n return resultat.trim();\n}\nfunction convertirNombreDecimalEnLettres(decimal: number): string {\n const decimalArrondi = Math.round(decimal * 100);\n return `virgule ${convertirNombreEntierEnLettres(decimalArrondi)}`;\n}\nexport function convertNumberToLetter(nombre: number): string {\n const partieEntiere = Math.floor(nombre);\n const partieDecimale = nombre - partieEntiere;\n\n let resultat = '';\n\n if (partieEntiere === 0) {\n resultat = 'zéro';\n } else {\n resultat = convertirNombreEntierEnLettres(partieEntiere);\n }\n\n if (partieDecimale > 0) {\n resultat += ` ${convertirNombreDecimalEnLettres(partieDecimale)}`;\n }\n\n return resultat;\n}"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Fusion = undefined;
|
|
7
|
+
var _Resource = require("../Resource");
|
|
8
|
+
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) {
|
|
10
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) {
|
|
16
|
+
try {
|
|
17
|
+
step(generator.next(value));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
reject(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function rejected(value) {
|
|
23
|
+
try {
|
|
24
|
+
step(generator["throw"](value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function step(result) {
|
|
30
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
31
|
+
}
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
class Fusion extends _Resource.Resource {
|
|
36
|
+
fusion(idSocietySource, idSocietyTarget) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return this.axios.$post('/fusion', {
|
|
39
|
+
idSocietySource,
|
|
40
|
+
idSocietyTarget
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Fusion = Fusion;
|
|
46
|
+
//# sourceMappingURL=Fusion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fusion.js","names":["_Resource","require","Fusion","Resource","fusion","idSocietySource","idSocietyTarget","axios","$post","exports"],"sources":["../../../ts/api/resources/Fusion.ts"],"sourcesContent":["import { Resource } from '../Resource';\n\nexport class Fusion extends Resource {\n async fusion(idSocietySource: number, idSocietyTarget: number) {\n return this.axios.$post('/fusion', { idSocietySource, idSocietyTarget });\n }\n}"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEM,MAAOC,MAAO,SAAQC,kBAAQ;EAC5BC,MAAMA,CAACC,eAAuB,EAAEC,eAAuB;;MAC3D,OAAO,IAAI,CAACC,KAAK,CAACC,KAAK,CAAC,SAAS,EAAE;QAAEH,eAAe;QAAEC;MAAe,CAAE,CAAC;IAC1E,CAAC;;;AACFG,OAAA,CAJYP,MAAO,GAAPA,MAAO"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VisualizedInformation = undefined;
|
|
7
|
+
var _Resource = require("../Resource");
|
|
8
|
+
class VisualizedInformation extends _Resource.Resource {
|
|
9
|
+
get(idSociety, params) {
|
|
10
|
+
return this.axios.$get(`societies/${idSociety}/visualized-informations`, {
|
|
11
|
+
params
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
getAll(idSociety) {
|
|
15
|
+
return this.axios.$get(`societies/${idSociety}/all-visualized-informations`);
|
|
16
|
+
}
|
|
17
|
+
updateOrCreate(idSociety, payload) {
|
|
18
|
+
return this.axios.$post(`societies/${idSociety}/visualized-informations`, payload);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.VisualizedInformation = VisualizedInformation;
|
|
22
|
+
//# sourceMappingURL=VisualizedInformation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisualizedInformation.js","names":["_Resource","require","VisualizedInformation","Resource","get","idSociety","params","axios","$get","getAll","updateOrCreate","payload","$post","exports"],"sources":["../../../ts/api/resources/VisualizedInformation.ts"],"sourcesContent":["import { IVisualizedInformation, QuerySocietyVisualizedInformation, UpdateOrCreateVisualizedInformation } from '../../types';\nimport { Resource } from '../Resource';\n\nexport class VisualizedInformation extends Resource {\n get(idSociety: number, params: QuerySocietyVisualizedInformation): Promise<IVisualizedInformation> {\n return this.axios.$get(`societies/${idSociety}/visualized-informations`, { params });\n }\n\n getAll(idSociety: number): Promise<IVisualizedInformation[]> {\n return this.axios.$get(`societies/${idSociety}/all-visualized-informations`);\n }\n\n updateOrCreate(idSociety: number, payload: UpdateOrCreateVisualizedInformation): Promise<IVisualizedInformation> {\n return this.axios.$post(`societies/${idSociety}/visualized-informations`, payload);\n }\n}"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEM,MAAOC,qBAAsB,SAAQC,kBAAQ;EACjDC,GAAGA,CAACC,SAAiB,EAAEC,MAAyC;IAC9D,OAAO,IAAI,CAACC,KAAK,CAACC,IAAI,CAAC,aAAaH,SAAS,0BAA0B,EAAE;MAAEC;IAAM,CAAE,CAAC;EACtF;EAEAG,MAAMA,CAACJ,SAAiB;IACtB,OAAO,IAAI,CAACE,KAAK,CAACC,IAAI,CAAC,aAAaH,SAAS,8BAA8B,CAAC;EAC9E;EAEAK,cAAcA,CAACL,SAAiB,EAAEM,OAA4C;IAC5E,OAAO,IAAI,CAACJ,KAAK,CAACK,KAAK,CAAC,aAAaP,SAAS,0BAA0B,EAAEM,OAAO,CAAC;EACpF;;AACDE,OAAA,CAZYX,qBAAsB,GAAtBA,qBAAsB"}
|
package/js/api/resources.js
CHANGED
|
@@ -134,6 +134,8 @@ var _CashAndExpense = require("./resources/CashAndExpense");
|
|
|
134
134
|
var _Archive = require("./resources/Archive");
|
|
135
135
|
var _AccountsSectors = require("./resources/AccountsSectors");
|
|
136
136
|
var _BusinessSector = require("./resources/BusinessSector");
|
|
137
|
+
var _VisualizedInformation = require("./resources/VisualizedInformation");
|
|
138
|
+
var _Fusion = require("./resources/Fusion");
|
|
137
139
|
const resources = exports.resources = {
|
|
138
140
|
simulation: _Simulation.Simulation,
|
|
139
141
|
budgetInsight: _BudgetInsight.BudgetInsight,
|
|
@@ -264,6 +266,8 @@ const resources = exports.resources = {
|
|
|
264
266
|
cashAndExpense: _CashAndExpense.CashAndExpense,
|
|
265
267
|
archive: _Archive.Archive,
|
|
266
268
|
accountsSector: _AccountsSectors.AccountsSector,
|
|
267
|
-
businessSector: _BusinessSector.BusinessSector
|
|
269
|
+
businessSector: _BusinessSector.BusinessSector,
|
|
270
|
+
visualizedInformation: _VisualizedInformation.VisualizedInformation,
|
|
271
|
+
fusion: _Fusion.Fusion
|
|
268
272
|
};
|
|
269
273
|
//# sourceMappingURL=resources.js.map
|