@andre1502/react-utilities 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +61 -12
- package/dist/Config/Config.js +4 -3
- package/dist/Config/Config.js.map +1 -1
- package/dist/EnvironmentEnum-BjXsfSRZ.js +9 -0
- package/dist/EnvironmentEnum-BjXsfSRZ.js.map +1 -0
- package/dist/EnvironmentEnum-UcQ6Il1O.js +9 -0
- package/dist/EnvironmentEnum-UcQ6Il1O.js.map +1 -0
- package/dist/I18n/I18n.d.ts +6 -0
- package/dist/I18n/I18n.js +104 -0
- package/dist/I18n/I18n.js.map +1 -0
- package/dist/I18n-CB7SyXYJ.js +3291 -0
- package/dist/I18n-CB7SyXYJ.js.map +1 -0
- package/dist/I18n-yXLN_hDO.js +3288 -0
- package/dist/I18n-yXLN_hDO.js.map +1 -0
- package/dist/NumberFormat-CvvBWhHc.js +89 -0
- package/dist/NumberFormat-CvvBWhHc.js.map +1 -0
- package/dist/NumberFormat-glmpbk7E.js +94 -0
- package/dist/NumberFormat-glmpbk7E.js.map +1 -0
- package/dist/config-cli.cjs +8 -3
- package/dist/config-cli.cjs.map +1 -1
- package/dist/config-cli.d.ts +2 -0
- package/dist/config-cli.js +8 -0
- package/dist/config-cli.js.map +1 -1
- package/dist/config-cli.mjs +5 -4
- package/dist/config-cli.mjs.map +1 -1
- package/dist/enums/EnvironmentEnum.d.ts +5 -0
- package/dist/enums/EnvironmentEnum.js +13 -0
- package/dist/enums/EnvironmentEnum.js.map +1 -0
- package/dist/format.cjs +18 -97
- package/dist/format.cjs.map +1 -1
- package/dist/format.d.ts +27 -0
- package/dist/format.js +27 -27
- package/dist/format.js.map +1 -1
- package/dist/format.mjs +29 -116
- package/dist/format.mjs.map +1 -1
- package/dist/i18n.cjs +15 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.ts +3 -0
- package/dist/i18n.js +28 -0
- package/dist/i18n.js.map +1 -0
- package/dist/i18n.mjs +4 -0
- package/dist/i18n.mjs.map +1 -0
- package/dist/index-cli.cjs +5 -0
- package/dist/index-cli.cjs.map +1 -1
- package/dist/index-cli.mjs +1 -0
- package/dist/index-cli.mjs.map +1 -1
- package/dist/index-rn.cjs +42 -6
- package/dist/index-rn.cjs.map +1 -1
- package/dist/index-rn.d.ts +1 -0
- package/dist/index-rn.js +11 -0
- package/dist/index-rn.js.map +1 -1
- package/dist/index-rn.mjs +31 -1
- package/dist/index-rn.mjs.map +1 -1
- package/dist/index.cjs +42 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -6
- package/src/Config/Config.ts +4 -3
- package/src/I18n/I18n.ts +117 -0
- package/src/config-cli.ts +2 -0
- package/src/enums/EnvironmentEnum.ts +5 -0
- package/src/format.ts +34 -34
- package/src/i18n.ts +4 -0
- package/src/index-rn.ts +1 -0
- package/src/index.ts +1 -0
- package/dist/index-fmt.cjs +0 -16
- package/dist/index-fmt.cjs.map +0 -1
- package/dist/index-fmt.d.ts +0 -1
- package/dist/index-fmt.js +0 -17
- package/dist/index-fmt.js.map +0 -1
- package/dist/index-fmt.mjs +0 -3
- package/dist/index-fmt.mjs.map +0 -1
- package/src/index-fmt.ts +0 -1
package/dist/format.cjs
CHANGED
@@ -1,122 +1,43 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var
|
4
|
-
|
5
|
-
exports.CurrencySymbolEnum = void 0;
|
6
|
-
(function (CurrencySymbolEnum) {
|
7
|
-
CurrencySymbolEnum["TWD"] = "NT$";
|
8
|
-
CurrencySymbolEnum["USD"] = "US$";
|
9
|
-
CurrencySymbolEnum["VND"] = "\u20AB";
|
10
|
-
})(exports.CurrencySymbolEnum || (exports.CurrencySymbolEnum = {}));
|
11
|
-
|
12
|
-
class NumberParser {
|
13
|
-
constructor(locale) {
|
14
|
-
const parts = new intlNumberformat.NumberFormat(locale).formatToParts(12345.6);
|
15
|
-
const numerals = [...new intlNumberformat.NumberFormat(locale, {
|
16
|
-
useGrouping: false
|
17
|
-
}).format(9876543210)].reverse();
|
18
|
-
const index = new Map(numerals.map((d, i) => [d, i]));
|
19
|
-
this._group = new RegExp(`[${parts.find(d => d.type === 'group')?.value}]`, 'g');
|
20
|
-
this._decimal = new RegExp(`[${parts.find(d => d.type === 'decimal')?.value}]`);
|
21
|
-
this._numeral = new RegExp(`[${numerals.join('')}]`, 'g');
|
22
|
-
this._index = d => index.get(d);
|
23
|
-
}
|
24
|
-
parse(value) {
|
25
|
-
value = value?.trim()?.replace(this._group, '')?.replace(this._decimal, '.')?.replace(this._numeral, this._index);
|
26
|
-
return value ? +value : NaN;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
const formatAccountNumber = function (accountNumber) {
|
31
|
-
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
|
32
|
-
return accountNumber?.replace(/\s?/g, '').replace(/(\d{4})/g, `$1${separator}`).trim();
|
33
|
-
};
|
34
|
-
const getCurrencySymbol = function (currency) {
|
35
|
-
let showCurrency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
36
|
-
let symbol;
|
37
|
-
switch (currency) {
|
38
|
-
case 'TWD':
|
39
|
-
symbol = exports.CurrencySymbolEnum.TWD;
|
40
|
-
break;
|
41
|
-
case 'USD':
|
42
|
-
symbol = exports.CurrencySymbolEnum.USD;
|
43
|
-
break;
|
44
|
-
case 'VND':
|
45
|
-
symbol = exports.CurrencySymbolEnum.VND;
|
46
|
-
break;
|
47
|
-
default:
|
48
|
-
symbol = '';
|
49
|
-
}
|
50
|
-
if (!showCurrency) {
|
51
|
-
symbol = '';
|
52
|
-
}
|
53
|
-
return symbol;
|
54
|
-
};
|
55
|
-
const formatNumber = options => {
|
56
|
-
options.value = options.value ?? 0;
|
57
|
-
options.styleCurrency = options.styleCurrency ?? 'currency';
|
58
|
-
options.currencyDisplay = options.currencyDisplay ?? 'code';
|
59
|
-
options.showValue = options.showValue ?? true;
|
60
|
-
options.showCurrency = options.showCurrency ?? true;
|
61
|
-
options.minimumFractionDigits = options.minimumFractionDigits ?? 0;
|
62
|
-
options.maximumFractionDigits = options.maximumFractionDigits ?? 0;
|
63
|
-
options.trailingZeroDisplay = options.trailingZeroDisplay ?? 'stripIfInteger';
|
64
|
-
// console.log(`options: ${JSON.stringify(options)}.`);
|
65
|
-
let formatOptions = {
|
66
|
-
style: options.styleCurrency,
|
67
|
-
currency: options.currency,
|
68
|
-
currencyDisplay: options.currencyDisplay,
|
69
|
-
minimumFractionDigits: options.minimumFractionDigits,
|
70
|
-
maximumFractionDigits: options.maximumFractionDigits,
|
71
|
-
trailingZeroDisplay: options.trailingZeroDisplay
|
72
|
-
};
|
73
|
-
if (options.options) {
|
74
|
-
formatOptions = {
|
75
|
-
...formatOptions,
|
76
|
-
...options.options
|
77
|
-
};
|
78
|
-
}
|
79
|
-
let localizedNumber = intlNumberformat.NumberFormat(options.lang, formatOptions).format(options.value).replace(/^([\d,.]+)(\s*)([A-Z]{3})$/, '$3$2$1').replace(/([\d,.]+)$/, options.showValue ? ' $1' : ' ********').replace(options.currency, getCurrencySymbol(options.currency, options.showCurrency)).trim();
|
80
|
-
// console.log(`localizedNumber: ${localizedNumber}.`);
|
81
|
-
return localizedNumber;
|
82
|
-
};
|
83
|
-
const parseFormatNumber = (lang, value) => {
|
84
|
-
if (!value) {
|
85
|
-
return null;
|
86
|
-
}
|
87
|
-
return new NumberParser(lang).parse(value);
|
88
|
-
};
|
89
|
-
|
3
|
+
var NumberFormat = require('./NumberFormat-glmpbk7E.js');
|
90
4
|
require('@formatjs/intl-getcanonicallocales/polyfill');
|
91
5
|
require('@formatjs/intl-locale/polyfill');
|
92
|
-
require('@formatjs/intl-pluralrules/polyfill');
|
93
6
|
require('@formatjs/intl-pluralrules/locale-data/en');
|
94
7
|
require('@formatjs/intl-pluralrules/locale-data/vi');
|
95
8
|
require('@formatjs/intl-pluralrules/locale-data/zh');
|
96
|
-
require('@formatjs/intl-
|
9
|
+
require('@formatjs/intl-pluralrules/polyfill');
|
97
10
|
require('@formatjs/intl-displaynames/locale-data/en');
|
98
11
|
require('@formatjs/intl-displaynames/locale-data/vi');
|
99
12
|
require('@formatjs/intl-displaynames/locale-data/zh');
|
100
|
-
require('@formatjs/intl-
|
13
|
+
require('@formatjs/intl-displaynames/polyfill');
|
101
14
|
require('@formatjs/intl-listformat/locale-data/en');
|
102
15
|
require('@formatjs/intl-listformat/locale-data/vi');
|
103
16
|
require('@formatjs/intl-listformat/locale-data/zh');
|
104
|
-
require('@formatjs/intl-
|
17
|
+
require('@formatjs/intl-listformat/polyfill');
|
105
18
|
require('@formatjs/intl-numberformat/locale-data/en');
|
106
19
|
require('@formatjs/intl-numberformat/locale-data/vi');
|
107
20
|
require('@formatjs/intl-numberformat/locale-data/zh');
|
108
|
-
require('@formatjs/intl-
|
21
|
+
require('@formatjs/intl-numberformat/polyfill');
|
109
22
|
require('@formatjs/intl-relativetimeformat/locale-data/en');
|
110
23
|
require('@formatjs/intl-relativetimeformat/locale-data/vi');
|
111
24
|
require('@formatjs/intl-relativetimeformat/locale-data/zh');
|
112
|
-
require('@formatjs/intl-
|
25
|
+
require('@formatjs/intl-relativetimeformat/polyfill');
|
113
26
|
require('@formatjs/intl-datetimeformat/locale-data/en');
|
114
27
|
require('@formatjs/intl-datetimeformat/locale-data/vi');
|
115
28
|
require('@formatjs/intl-datetimeformat/locale-data/zh');
|
29
|
+
require('@formatjs/intl-datetimeformat/polyfill');
|
116
30
|
require('@formatjs/intl-datetimeformat/add-golden-tz.js');
|
31
|
+
require('@formatjs/intl-numberformat');
|
32
|
+
|
33
|
+
|
117
34
|
|
118
|
-
exports
|
119
|
-
|
120
|
-
|
121
|
-
|
35
|
+
Object.defineProperty(exports, "CurrencySymbolEnum", {
|
36
|
+
enumerable: true,
|
37
|
+
get: function () { return NumberFormat.CurrencySymbolEnum; }
|
38
|
+
});
|
39
|
+
exports.formatAccountNumber = NumberFormat.formatAccountNumber;
|
40
|
+
exports.formatNumber = NumberFormat.formatNumber;
|
41
|
+
exports.getCurrencySymbol = NumberFormat.getCurrencySymbol;
|
42
|
+
exports.parseFormatNumber = NumberFormat.parseFormatNumber;
|
122
43
|
//# sourceMappingURL=format.cjs.map
|
package/dist/format.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"format.cjs","sources":[
|
1
|
+
{"version":3,"file":"format.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/format.d.ts
CHANGED
@@ -1,3 +1,30 @@
|
|
1
1
|
import { CurrencySymbolEnum } from './enums/CurrencySymbolEnum';
|
2
|
+
import '@formatjs/intl-getcanonicallocales/polyfill';
|
3
|
+
import '@formatjs/intl-locale/polyfill';
|
4
|
+
import '@formatjs/intl-pluralrules/locale-data/en';
|
5
|
+
import '@formatjs/intl-pluralrules/locale-data/vi';
|
6
|
+
import '@formatjs/intl-pluralrules/locale-data/zh';
|
7
|
+
import '@formatjs/intl-pluralrules/polyfill';
|
8
|
+
import '@formatjs/intl-displaynames/locale-data/en';
|
9
|
+
import '@formatjs/intl-displaynames/locale-data/vi';
|
10
|
+
import '@formatjs/intl-displaynames/locale-data/zh';
|
11
|
+
import '@formatjs/intl-displaynames/polyfill';
|
12
|
+
import '@formatjs/intl-listformat/locale-data/en';
|
13
|
+
import '@formatjs/intl-listformat/locale-data/vi';
|
14
|
+
import '@formatjs/intl-listformat/locale-data/zh';
|
15
|
+
import '@formatjs/intl-listformat/polyfill';
|
16
|
+
import '@formatjs/intl-numberformat/locale-data/en';
|
17
|
+
import '@formatjs/intl-numberformat/locale-data/vi';
|
18
|
+
import '@formatjs/intl-numberformat/locale-data/zh';
|
19
|
+
import '@formatjs/intl-numberformat/polyfill';
|
20
|
+
import '@formatjs/intl-relativetimeformat/locale-data/en';
|
21
|
+
import '@formatjs/intl-relativetimeformat/locale-data/vi';
|
22
|
+
import '@formatjs/intl-relativetimeformat/locale-data/zh';
|
23
|
+
import '@formatjs/intl-relativetimeformat/polyfill';
|
24
|
+
import '@formatjs/intl-datetimeformat/locale-data/en';
|
25
|
+
import '@formatjs/intl-datetimeformat/locale-data/vi';
|
26
|
+
import '@formatjs/intl-datetimeformat/locale-data/zh';
|
27
|
+
import '@formatjs/intl-datetimeformat/polyfill';
|
28
|
+
import '@formatjs/intl-datetimeformat/add-golden-tz.js';
|
2
29
|
export * from './Format/NumberFormat';
|
3
30
|
export { CurrencySymbolEnum };
|
package/dist/format.js
CHANGED
@@ -13,6 +13,33 @@ Object.defineProperty(exports, "CurrencySymbolEnum", {
|
|
13
13
|
}
|
14
14
|
});
|
15
15
|
var _CurrencySymbolEnum = require("./enums/CurrencySymbolEnum");
|
16
|
+
require("@formatjs/intl-getcanonicallocales/polyfill");
|
17
|
+
require("@formatjs/intl-locale/polyfill");
|
18
|
+
require("@formatjs/intl-pluralrules/locale-data/en");
|
19
|
+
require("@formatjs/intl-pluralrules/locale-data/vi");
|
20
|
+
require("@formatjs/intl-pluralrules/locale-data/zh");
|
21
|
+
require("@formatjs/intl-pluralrules/polyfill");
|
22
|
+
require("@formatjs/intl-displaynames/locale-data/en");
|
23
|
+
require("@formatjs/intl-displaynames/locale-data/vi");
|
24
|
+
require("@formatjs/intl-displaynames/locale-data/zh");
|
25
|
+
require("@formatjs/intl-displaynames/polyfill");
|
26
|
+
require("@formatjs/intl-listformat/locale-data/en");
|
27
|
+
require("@formatjs/intl-listformat/locale-data/vi");
|
28
|
+
require("@formatjs/intl-listformat/locale-data/zh");
|
29
|
+
require("@formatjs/intl-listformat/polyfill");
|
30
|
+
require("@formatjs/intl-numberformat/locale-data/en");
|
31
|
+
require("@formatjs/intl-numberformat/locale-data/vi");
|
32
|
+
require("@formatjs/intl-numberformat/locale-data/zh");
|
33
|
+
require("@formatjs/intl-numberformat/polyfill");
|
34
|
+
require("@formatjs/intl-relativetimeformat/locale-data/en");
|
35
|
+
require("@formatjs/intl-relativetimeformat/locale-data/vi");
|
36
|
+
require("@formatjs/intl-relativetimeformat/locale-data/zh");
|
37
|
+
require("@formatjs/intl-relativetimeformat/polyfill");
|
38
|
+
require("@formatjs/intl-datetimeformat/locale-data/en");
|
39
|
+
require("@formatjs/intl-datetimeformat/locale-data/vi");
|
40
|
+
require("@formatjs/intl-datetimeformat/locale-data/zh");
|
41
|
+
require("@formatjs/intl-datetimeformat/polyfill");
|
42
|
+
require("@formatjs/intl-datetimeformat/add-golden-tz.js");
|
16
43
|
var _NumberFormat = require("./Format/NumberFormat");
|
17
44
|
Object.keys(_NumberFormat).forEach(function (key) {
|
18
45
|
if (key === "default" || key === "__esModule") return;
|
@@ -25,31 +52,4 @@ Object.keys(_NumberFormat).forEach(function (key) {
|
|
25
52
|
}
|
26
53
|
});
|
27
54
|
});
|
28
|
-
require('@formatjs/intl-getcanonicallocales/polyfill');
|
29
|
-
require('@formatjs/intl-locale/polyfill');
|
30
|
-
require('@formatjs/intl-pluralrules/polyfill');
|
31
|
-
require('@formatjs/intl-pluralrules/locale-data/en');
|
32
|
-
require('@formatjs/intl-pluralrules/locale-data/vi');
|
33
|
-
require('@formatjs/intl-pluralrules/locale-data/zh');
|
34
|
-
require('@formatjs/intl-displaynames/polyfill');
|
35
|
-
require('@formatjs/intl-displaynames/locale-data/en');
|
36
|
-
require('@formatjs/intl-displaynames/locale-data/vi');
|
37
|
-
require('@formatjs/intl-displaynames/locale-data/zh');
|
38
|
-
require('@formatjs/intl-listformat/polyfill');
|
39
|
-
require('@formatjs/intl-listformat/locale-data/en');
|
40
|
-
require('@formatjs/intl-listformat/locale-data/vi');
|
41
|
-
require('@formatjs/intl-listformat/locale-data/zh');
|
42
|
-
require('@formatjs/intl-numberformat/polyfill');
|
43
|
-
require('@formatjs/intl-numberformat/locale-data/en');
|
44
|
-
require('@formatjs/intl-numberformat/locale-data/vi');
|
45
|
-
require('@formatjs/intl-numberformat/locale-data/zh');
|
46
|
-
require('@formatjs/intl-relativetimeformat/polyfill');
|
47
|
-
require('@formatjs/intl-relativetimeformat/locale-data/en');
|
48
|
-
require('@formatjs/intl-relativetimeformat/locale-data/vi');
|
49
|
-
require('@formatjs/intl-relativetimeformat/locale-data/zh');
|
50
|
-
require('@formatjs/intl-datetimeformat/polyfill');
|
51
|
-
require('@formatjs/intl-datetimeformat/locale-data/en');
|
52
|
-
require('@formatjs/intl-datetimeformat/locale-data/vi');
|
53
|
-
require('@formatjs/intl-datetimeformat/locale-data/zh');
|
54
|
-
require('@formatjs/intl-datetimeformat/add-golden-tz.js');
|
55
55
|
//# sourceMappingURL=format.js.map
|
package/dist/format.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"format.js","names":["_CurrencySymbolEnum","require","_NumberFormat","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../src/format.ts"],"sourcesContent":["import { CurrencySymbolEnum } from './enums/CurrencySymbolEnum';\n\
|
1
|
+
{"version":3,"file":"format.js","names":["_CurrencySymbolEnum","require","_NumberFormat","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../src/format.ts"],"sourcesContent":["import { CurrencySymbolEnum } from './enums/CurrencySymbolEnum';\n\nimport '@formatjs/intl-getcanonicallocales/polyfill';\nimport '@formatjs/intl-locale/polyfill';\n\nimport '@formatjs/intl-pluralrules/locale-data/en';\nimport '@formatjs/intl-pluralrules/locale-data/vi';\nimport '@formatjs/intl-pluralrules/locale-data/zh';\nimport '@formatjs/intl-pluralrules/polyfill';\n\nimport '@formatjs/intl-displaynames/locale-data/en';\nimport '@formatjs/intl-displaynames/locale-data/vi';\nimport '@formatjs/intl-displaynames/locale-data/zh';\nimport '@formatjs/intl-displaynames/polyfill';\n\nimport '@formatjs/intl-listformat/locale-data/en';\nimport '@formatjs/intl-listformat/locale-data/vi';\nimport '@formatjs/intl-listformat/locale-data/zh';\nimport '@formatjs/intl-listformat/polyfill';\n\nimport '@formatjs/intl-numberformat/locale-data/en';\nimport '@formatjs/intl-numberformat/locale-data/vi';\nimport '@formatjs/intl-numberformat/locale-data/zh';\nimport '@formatjs/intl-numberformat/polyfill';\n\nimport '@formatjs/intl-relativetimeformat/locale-data/en';\nimport '@formatjs/intl-relativetimeformat/locale-data/vi';\nimport '@formatjs/intl-relativetimeformat/locale-data/zh';\nimport '@formatjs/intl-relativetimeformat/polyfill';\n\nimport '@formatjs/intl-datetimeformat/locale-data/en';\nimport '@formatjs/intl-datetimeformat/locale-data/vi';\nimport '@formatjs/intl-datetimeformat/locale-data/zh';\nimport '@formatjs/intl-datetimeformat/polyfill';\n\nimport '@formatjs/intl-datetimeformat/add-golden-tz.js';\n\nexport * from './Format/NumberFormat';\nexport { CurrencySymbolEnum };\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAEAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEAA,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,aAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,aAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAZ,aAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/dist/format.mjs
CHANGED
@@ -1,117 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
return accountNumber?.replace(/\s?/g, '').replace(/(\d{4})/g, `$1${separator}`).trim();
|
31
|
-
};
|
32
|
-
const getCurrencySymbol = function (currency) {
|
33
|
-
let showCurrency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
34
|
-
let symbol;
|
35
|
-
switch (currency) {
|
36
|
-
case 'TWD':
|
37
|
-
symbol = CurrencySymbolEnum.TWD;
|
38
|
-
break;
|
39
|
-
case 'USD':
|
40
|
-
symbol = CurrencySymbolEnum.USD;
|
41
|
-
break;
|
42
|
-
case 'VND':
|
43
|
-
symbol = CurrencySymbolEnum.VND;
|
44
|
-
break;
|
45
|
-
default:
|
46
|
-
symbol = '';
|
47
|
-
}
|
48
|
-
if (!showCurrency) {
|
49
|
-
symbol = '';
|
50
|
-
}
|
51
|
-
return symbol;
|
52
|
-
};
|
53
|
-
const formatNumber = options => {
|
54
|
-
options.value = options.value ?? 0;
|
55
|
-
options.styleCurrency = options.styleCurrency ?? 'currency';
|
56
|
-
options.currencyDisplay = options.currencyDisplay ?? 'code';
|
57
|
-
options.showValue = options.showValue ?? true;
|
58
|
-
options.showCurrency = options.showCurrency ?? true;
|
59
|
-
options.minimumFractionDigits = options.minimumFractionDigits ?? 0;
|
60
|
-
options.maximumFractionDigits = options.maximumFractionDigits ?? 0;
|
61
|
-
options.trailingZeroDisplay = options.trailingZeroDisplay ?? 'stripIfInteger';
|
62
|
-
// console.log(`options: ${JSON.stringify(options)}.`);
|
63
|
-
let formatOptions = {
|
64
|
-
style: options.styleCurrency,
|
65
|
-
currency: options.currency,
|
66
|
-
currencyDisplay: options.currencyDisplay,
|
67
|
-
minimumFractionDigits: options.minimumFractionDigits,
|
68
|
-
maximumFractionDigits: options.maximumFractionDigits,
|
69
|
-
trailingZeroDisplay: options.trailingZeroDisplay
|
70
|
-
};
|
71
|
-
if (options.options) {
|
72
|
-
formatOptions = {
|
73
|
-
...formatOptions,
|
74
|
-
...options.options
|
75
|
-
};
|
76
|
-
}
|
77
|
-
let localizedNumber = NumberFormat(options.lang, formatOptions).format(options.value).replace(/^([\d,.]+)(\s*)([A-Z]{3})$/, '$3$2$1').replace(/([\d,.]+)$/, options.showValue ? ' $1' : ' ********').replace(options.currency, getCurrencySymbol(options.currency, options.showCurrency)).trim();
|
78
|
-
// console.log(`localizedNumber: ${localizedNumber}.`);
|
79
|
-
return localizedNumber;
|
80
|
-
};
|
81
|
-
const parseFormatNumber = (lang, value) => {
|
82
|
-
if (!value) {
|
83
|
-
return null;
|
84
|
-
}
|
85
|
-
return new NumberParser(lang).parse(value);
|
86
|
-
};
|
87
|
-
|
88
|
-
require('@formatjs/intl-getcanonicallocales/polyfill');
|
89
|
-
require('@formatjs/intl-locale/polyfill');
|
90
|
-
require('@formatjs/intl-pluralrules/polyfill');
|
91
|
-
require('@formatjs/intl-pluralrules/locale-data/en');
|
92
|
-
require('@formatjs/intl-pluralrules/locale-data/vi');
|
93
|
-
require('@formatjs/intl-pluralrules/locale-data/zh');
|
94
|
-
require('@formatjs/intl-displaynames/polyfill');
|
95
|
-
require('@formatjs/intl-displaynames/locale-data/en');
|
96
|
-
require('@formatjs/intl-displaynames/locale-data/vi');
|
97
|
-
require('@formatjs/intl-displaynames/locale-data/zh');
|
98
|
-
require('@formatjs/intl-listformat/polyfill');
|
99
|
-
require('@formatjs/intl-listformat/locale-data/en');
|
100
|
-
require('@formatjs/intl-listformat/locale-data/vi');
|
101
|
-
require('@formatjs/intl-listformat/locale-data/zh');
|
102
|
-
require('@formatjs/intl-numberformat/polyfill');
|
103
|
-
require('@formatjs/intl-numberformat/locale-data/en');
|
104
|
-
require('@formatjs/intl-numberformat/locale-data/vi');
|
105
|
-
require('@formatjs/intl-numberformat/locale-data/zh');
|
106
|
-
require('@formatjs/intl-relativetimeformat/polyfill');
|
107
|
-
require('@formatjs/intl-relativetimeformat/locale-data/en');
|
108
|
-
require('@formatjs/intl-relativetimeformat/locale-data/vi');
|
109
|
-
require('@formatjs/intl-relativetimeformat/locale-data/zh');
|
110
|
-
require('@formatjs/intl-datetimeformat/polyfill');
|
111
|
-
require('@formatjs/intl-datetimeformat/locale-data/en');
|
112
|
-
require('@formatjs/intl-datetimeformat/locale-data/vi');
|
113
|
-
require('@formatjs/intl-datetimeformat/locale-data/zh');
|
114
|
-
require('@formatjs/intl-datetimeformat/add-golden-tz.js');
|
115
|
-
|
116
|
-
export { CurrencySymbolEnum, formatAccountNumber, formatNumber, getCurrencySymbol, parseFormatNumber };
|
1
|
+
export { C as CurrencySymbolEnum, f as formatAccountNumber, a as formatNumber, g as getCurrencySymbol, p as parseFormatNumber } from './NumberFormat-CvvBWhHc.js';
|
2
|
+
import '@formatjs/intl-getcanonicallocales/polyfill';
|
3
|
+
import '@formatjs/intl-locale/polyfill';
|
4
|
+
import '@formatjs/intl-pluralrules/locale-data/en';
|
5
|
+
import '@formatjs/intl-pluralrules/locale-data/vi';
|
6
|
+
import '@formatjs/intl-pluralrules/locale-data/zh';
|
7
|
+
import '@formatjs/intl-pluralrules/polyfill';
|
8
|
+
import '@formatjs/intl-displaynames/locale-data/en';
|
9
|
+
import '@formatjs/intl-displaynames/locale-data/vi';
|
10
|
+
import '@formatjs/intl-displaynames/locale-data/zh';
|
11
|
+
import '@formatjs/intl-displaynames/polyfill';
|
12
|
+
import '@formatjs/intl-listformat/locale-data/en';
|
13
|
+
import '@formatjs/intl-listformat/locale-data/vi';
|
14
|
+
import '@formatjs/intl-listformat/locale-data/zh';
|
15
|
+
import '@formatjs/intl-listformat/polyfill';
|
16
|
+
import '@formatjs/intl-numberformat/locale-data/en';
|
17
|
+
import '@formatjs/intl-numberformat/locale-data/vi';
|
18
|
+
import '@formatjs/intl-numberformat/locale-data/zh';
|
19
|
+
import '@formatjs/intl-numberformat/polyfill';
|
20
|
+
import '@formatjs/intl-relativetimeformat/locale-data/en';
|
21
|
+
import '@formatjs/intl-relativetimeformat/locale-data/vi';
|
22
|
+
import '@formatjs/intl-relativetimeformat/locale-data/zh';
|
23
|
+
import '@formatjs/intl-relativetimeformat/polyfill';
|
24
|
+
import '@formatjs/intl-datetimeformat/locale-data/en';
|
25
|
+
import '@formatjs/intl-datetimeformat/locale-data/vi';
|
26
|
+
import '@formatjs/intl-datetimeformat/locale-data/zh';
|
27
|
+
import '@formatjs/intl-datetimeformat/polyfill';
|
28
|
+
import '@formatjs/intl-datetimeformat/add-golden-tz.js';
|
29
|
+
import '@formatjs/intl-numberformat';
|
117
30
|
//# sourceMappingURL=format.mjs.map
|
package/dist/format.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"format.mjs","sources":[
|
1
|
+
{"version":3,"file":"format.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/i18n.cjs
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var EnvironmentEnum = require('./EnvironmentEnum-BjXsfSRZ.js');
|
4
|
+
var I18n = require('./I18n-CB7SyXYJ.js');
|
5
|
+
require('cross-fetch');
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
Object.defineProperty(exports, "EnvironmentEnum", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function () { return EnvironmentEnum.EnvironmentEnum; }
|
12
|
+
});
|
13
|
+
exports.getV = I18n.getV;
|
14
|
+
exports.initI18n = I18n.initI18n;
|
15
|
+
//# sourceMappingURL=i18n.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"i18n.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/dist/i18n.d.ts
ADDED
package/dist/i18n.js
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _exportNames = {
|
7
|
+
EnvironmentEnum: true
|
8
|
+
};
|
9
|
+
Object.defineProperty(exports, "EnvironmentEnum", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function get() {
|
12
|
+
return _EnvironmentEnum.EnvironmentEnum;
|
13
|
+
}
|
14
|
+
});
|
15
|
+
var _EnvironmentEnum = require("./enums/EnvironmentEnum");
|
16
|
+
var _I18n = require("./I18n/I18n");
|
17
|
+
Object.keys(_I18n).forEach(function (key) {
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
20
|
+
if (key in exports && exports[key] === _I18n[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function get() {
|
24
|
+
return _I18n[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["_EnvironmentEnum","require","_I18n","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../src/i18n.ts"],"sourcesContent":["import { EnvironmentEnum } from './enums/EnvironmentEnum';\n\nexport * from './I18n/I18n';\nexport { EnvironmentEnum };\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/dist/i18n.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"i18n.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/index-cli.cjs
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
var configCli = require('./config-cli.cjs');
|
4
4
|
var sentryCli = require('./sentry-cli.cjs');
|
5
|
+
var EnvironmentEnum = require('./EnvironmentEnum-BjXsfSRZ.js');
|
5
6
|
require('lodash');
|
6
7
|
require('fs');
|
7
8
|
require('google-auth-library');
|
@@ -21,4 +22,8 @@ exports.fetchRawValue = configCli.fetchRawValue;
|
|
21
22
|
exports.transformConfig = configCli.transformConfig;
|
22
23
|
exports.transformSitemap = configCli.transformSitemap;
|
23
24
|
exports.releaseSentrySourceMap = sentryCli.releaseSentrySourceMap;
|
25
|
+
Object.defineProperty(exports, "EnvironmentEnum", {
|
26
|
+
enumerable: true,
|
27
|
+
get: function () { return EnvironmentEnum.EnvironmentEnum; }
|
28
|
+
});
|
24
29
|
//# sourceMappingURL=index-cli.cjs.map
|
package/dist/index-cli.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index-cli.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index-cli.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index-cli.mjs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
export { fetchAll, fetchConfig, fetchLocales, fetchRawValue, transformConfig, transformSitemap } from './config-cli.mjs';
|
2
2
|
export { releaseSentrySourceMap } from './sentry-cli.mjs';
|
3
|
+
export { E as EnvironmentEnum } from './EnvironmentEnum-UcQ6Il1O.js';
|
3
4
|
import 'lodash';
|
4
5
|
import 'fs';
|
5
6
|
import 'google-auth-library';
|
package/dist/index-cli.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index-cli.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index-cli.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/dist/index-rn.cjs
CHANGED
@@ -1,8 +1,38 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var
|
3
|
+
var NumberFormat = require('./NumberFormat-glmpbk7E.js');
|
4
|
+
require('@formatjs/intl-getcanonicallocales/polyfill');
|
5
|
+
require('@formatjs/intl-locale/polyfill');
|
6
|
+
require('@formatjs/intl-pluralrules/locale-data/en');
|
7
|
+
require('@formatjs/intl-pluralrules/locale-data/vi');
|
8
|
+
require('@formatjs/intl-pluralrules/locale-data/zh');
|
9
|
+
require('@formatjs/intl-pluralrules/polyfill');
|
10
|
+
require('@formatjs/intl-displaynames/locale-data/en');
|
11
|
+
require('@formatjs/intl-displaynames/locale-data/vi');
|
12
|
+
require('@formatjs/intl-displaynames/locale-data/zh');
|
13
|
+
require('@formatjs/intl-displaynames/polyfill');
|
14
|
+
require('@formatjs/intl-listformat/locale-data/en');
|
15
|
+
require('@formatjs/intl-listformat/locale-data/vi');
|
16
|
+
require('@formatjs/intl-listformat/locale-data/zh');
|
17
|
+
require('@formatjs/intl-listformat/polyfill');
|
18
|
+
require('@formatjs/intl-numberformat/locale-data/en');
|
19
|
+
require('@formatjs/intl-numberformat/locale-data/vi');
|
20
|
+
require('@formatjs/intl-numberformat/locale-data/zh');
|
21
|
+
require('@formatjs/intl-numberformat/polyfill');
|
22
|
+
require('@formatjs/intl-relativetimeformat/locale-data/en');
|
23
|
+
require('@formatjs/intl-relativetimeformat/locale-data/vi');
|
24
|
+
require('@formatjs/intl-relativetimeformat/locale-data/zh');
|
25
|
+
require('@formatjs/intl-relativetimeformat/polyfill');
|
26
|
+
require('@formatjs/intl-datetimeformat/locale-data/en');
|
27
|
+
require('@formatjs/intl-datetimeformat/locale-data/vi');
|
28
|
+
require('@formatjs/intl-datetimeformat/locale-data/zh');
|
29
|
+
require('@formatjs/intl-datetimeformat/polyfill');
|
30
|
+
require('@formatjs/intl-datetimeformat/add-golden-tz.js');
|
31
|
+
var EnvironmentEnum = require('./EnvironmentEnum-BjXsfSRZ.js');
|
32
|
+
var I18n = require('./I18n-CB7SyXYJ.js');
|
4
33
|
var ReactNative = require('./ReactNative-CqUrY2ZJ.js');
|
5
34
|
require('@formatjs/intl-numberformat');
|
35
|
+
require('cross-fetch');
|
6
36
|
require('@sentry/react-native');
|
7
37
|
require('./Utils-Dilye04y.js');
|
8
38
|
|
@@ -10,12 +40,18 @@ require('./Utils-Dilye04y.js');
|
|
10
40
|
|
11
41
|
Object.defineProperty(exports, "CurrencySymbolEnum", {
|
12
42
|
enumerable: true,
|
13
|
-
get: function () { return
|
43
|
+
get: function () { return NumberFormat.CurrencySymbolEnum; }
|
14
44
|
});
|
15
|
-
exports.formatAccountNumber =
|
16
|
-
exports.formatNumber =
|
17
|
-
exports.getCurrencySymbol =
|
18
|
-
exports.parseFormatNumber =
|
45
|
+
exports.formatAccountNumber = NumberFormat.formatAccountNumber;
|
46
|
+
exports.formatNumber = NumberFormat.formatNumber;
|
47
|
+
exports.getCurrencySymbol = NumberFormat.getCurrencySymbol;
|
48
|
+
exports.parseFormatNumber = NumberFormat.parseFormatNumber;
|
49
|
+
Object.defineProperty(exports, "EnvironmentEnum", {
|
50
|
+
enumerable: true,
|
51
|
+
get: function () { return EnvironmentEnum.EnvironmentEnum; }
|
52
|
+
});
|
53
|
+
exports.getV = I18n.getV;
|
54
|
+
exports.initI18n = I18n.initI18n;
|
19
55
|
exports.initSentry = ReactNative.initSentry;
|
20
56
|
exports.recordAdditionalSentryHttp = ReactNative.recordAdditionalSentryHttp;
|
21
57
|
//# sourceMappingURL=index-rn.cjs.map
|
package/dist/index-rn.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index-rn.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index-rn.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index-rn.d.ts
CHANGED