@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.
Files changed (77) hide show
  1. package/README.md +61 -12
  2. package/dist/Config/Config.js +4 -3
  3. package/dist/Config/Config.js.map +1 -1
  4. package/dist/EnvironmentEnum-BjXsfSRZ.js +9 -0
  5. package/dist/EnvironmentEnum-BjXsfSRZ.js.map +1 -0
  6. package/dist/EnvironmentEnum-UcQ6Il1O.js +9 -0
  7. package/dist/EnvironmentEnum-UcQ6Il1O.js.map +1 -0
  8. package/dist/I18n/I18n.d.ts +6 -0
  9. package/dist/I18n/I18n.js +104 -0
  10. package/dist/I18n/I18n.js.map +1 -0
  11. package/dist/I18n-CB7SyXYJ.js +3291 -0
  12. package/dist/I18n-CB7SyXYJ.js.map +1 -0
  13. package/dist/I18n-yXLN_hDO.js +3288 -0
  14. package/dist/I18n-yXLN_hDO.js.map +1 -0
  15. package/dist/NumberFormat-CvvBWhHc.js +89 -0
  16. package/dist/NumberFormat-CvvBWhHc.js.map +1 -0
  17. package/dist/NumberFormat-glmpbk7E.js +94 -0
  18. package/dist/NumberFormat-glmpbk7E.js.map +1 -0
  19. package/dist/config-cli.cjs +8 -3
  20. package/dist/config-cli.cjs.map +1 -1
  21. package/dist/config-cli.d.ts +2 -0
  22. package/dist/config-cli.js +8 -0
  23. package/dist/config-cli.js.map +1 -1
  24. package/dist/config-cli.mjs +5 -4
  25. package/dist/config-cli.mjs.map +1 -1
  26. package/dist/enums/EnvironmentEnum.d.ts +5 -0
  27. package/dist/enums/EnvironmentEnum.js +13 -0
  28. package/dist/enums/EnvironmentEnum.js.map +1 -0
  29. package/dist/format.cjs +18 -97
  30. package/dist/format.cjs.map +1 -1
  31. package/dist/format.d.ts +27 -0
  32. package/dist/format.js +27 -27
  33. package/dist/format.js.map +1 -1
  34. package/dist/format.mjs +29 -116
  35. package/dist/format.mjs.map +1 -1
  36. package/dist/i18n.cjs +15 -0
  37. package/dist/i18n.cjs.map +1 -0
  38. package/dist/i18n.d.ts +3 -0
  39. package/dist/i18n.js +28 -0
  40. package/dist/i18n.js.map +1 -0
  41. package/dist/i18n.mjs +4 -0
  42. package/dist/i18n.mjs.map +1 -0
  43. package/dist/index-cli.cjs +5 -0
  44. package/dist/index-cli.cjs.map +1 -1
  45. package/dist/index-cli.mjs +1 -0
  46. package/dist/index-cli.mjs.map +1 -1
  47. package/dist/index-rn.cjs +42 -6
  48. package/dist/index-rn.cjs.map +1 -1
  49. package/dist/index-rn.d.ts +1 -0
  50. package/dist/index-rn.js +11 -0
  51. package/dist/index-rn.js.map +1 -1
  52. package/dist/index-rn.mjs +31 -1
  53. package/dist/index-rn.mjs.map +1 -1
  54. package/dist/index.cjs +42 -6
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +11 -0
  58. package/dist/index.js.map +1 -1
  59. package/dist/index.mjs +31 -1
  60. package/dist/index.mjs.map +1 -1
  61. package/package.json +11 -6
  62. package/src/Config/Config.ts +4 -3
  63. package/src/I18n/I18n.ts +117 -0
  64. package/src/config-cli.ts +2 -0
  65. package/src/enums/EnvironmentEnum.ts +5 -0
  66. package/src/format.ts +34 -34
  67. package/src/i18n.ts +4 -0
  68. package/src/index-rn.ts +1 -0
  69. package/src/index.ts +1 -0
  70. package/dist/index-fmt.cjs +0 -16
  71. package/dist/index-fmt.cjs.map +0 -1
  72. package/dist/index-fmt.d.ts +0 -1
  73. package/dist/index-fmt.js +0 -17
  74. package/dist/index-fmt.js.map +0 -1
  75. package/dist/index-fmt.mjs +0 -3
  76. package/dist/index-fmt.mjs.map +0 -1
  77. package/src/index-fmt.ts +0 -1
package/dist/format.cjs CHANGED
@@ -1,122 +1,43 @@
1
1
  'use strict';
2
2
 
3
- var intlNumberformat = require('@formatjs/intl-numberformat');
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-displaynames/polyfill');
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-listformat/polyfill');
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-numberformat/polyfill');
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-relativetimeformat/polyfill');
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-datetimeformat/polyfill');
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.formatAccountNumber = formatAccountNumber;
119
- exports.formatNumber = formatNumber;
120
- exports.getCurrencySymbol = getCurrencySymbol;
121
- exports.parseFormatNumber = parseFormatNumber;
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
@@ -1 +1 @@
1
- {"version":3,"file":"format.cjs","sources":["../src/enums/CurrencySymbolEnum.ts","../src/Format/NumberParser.ts","../src/Format/NumberFormat.ts","../src/format.ts"],"sourcesContent":[null,null,null,null],"names":["CurrencySymbolEnum","NumberParser","constructor","locale","parts","NumberFormat","formatToParts","numerals","useGrouping","format","reverse","index","Map","map","d","i","_group","RegExp","find","type","value","_decimal","_numeral","join","_index","get","parse","trim","replace","NaN","formatAccountNumber","accountNumber","separator","arguments","length","undefined","getCurrencySymbol","currency","showCurrency","symbol","TWD","USD","VND","formatNumber","options","styleCurrency","currencyDisplay","showValue","minimumFractionDigits","maximumFractionDigits","trailingZeroDisplay","formatOptions","style","localizedNumber","lang","parseFormatNumber","require"],"mappings":";;;;AAAYA,oCAIX;AAJD,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACXA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACXA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,QAAS,CAAA;AACX,CAAC,EAJWA,0BAAkB,KAAlBA,0BAAkB,GAI7B,EAAA,CAAA,CAAA;;ACFD,MAAMC,YAAY,CAAA;EAMhBC,WAAAA,CAAYC,MAAc,EAAA;IACxB,MAAMC,KAAK,GAAG,IAAIC,6BAAY,CAACF,MAAM,CAAC,CAACG,aAAa,CAAC,OAAO,CAAC,CAAA;IAE7D,MAAMC,QAAQ,GAAG,CACf,GAAG,IAAIF,6BAAY,CAACF,MAAM,EAAE;AAAEK,MAAAA,WAAW,EAAE,KAAA;KAAO,CAAC,CAACC,MAAM,CAAC,UAAU,CAAC,CACvE,CAACC,OAAO,EAAE,CAAA;IAEX,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAACL,QAAQ,CAACM,GAAG,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK,CAACD,CAAC,EAAEC,CAAC,CAAC,CAAC,CAAC,CAAA;IAErD,IAAI,CAACC,MAAM,GAAG,IAAIC,MAAM,CACtB,CAAIb,CAAAA,EAAAA,KAAK,CAACc,IAAI,CAAEJ,CAAC,IAAKA,CAAC,CAACK,IAAI,KAAK,OAAO,CAAC,EAAEC,KAAK,CAAA,CAA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.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
@@ -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\nrequire('@formatjs/intl-getcanonicallocales/polyfill');\nrequire('@formatjs/intl-locale/polyfill');\n\nrequire('@formatjs/intl-pluralrules/polyfill');\nrequire('@formatjs/intl-pluralrules/locale-data/en');\nrequire('@formatjs/intl-pluralrules/locale-data/vi');\nrequire('@formatjs/intl-pluralrules/locale-data/zh');\n\nrequire('@formatjs/intl-displaynames/polyfill');\nrequire('@formatjs/intl-displaynames/locale-data/en');\nrequire('@formatjs/intl-displaynames/locale-data/vi');\nrequire('@formatjs/intl-displaynames/locale-data/zh');\n\nrequire('@formatjs/intl-listformat/polyfill');\nrequire('@formatjs/intl-listformat/locale-data/en');\nrequire('@formatjs/intl-listformat/locale-data/vi');\nrequire('@formatjs/intl-listformat/locale-data/zh');\n\nrequire('@formatjs/intl-numberformat/polyfill');\nrequire('@formatjs/intl-numberformat/locale-data/en');\nrequire('@formatjs/intl-numberformat/locale-data/vi');\nrequire('@formatjs/intl-numberformat/locale-data/zh');\n\nrequire('@formatjs/intl-relativetimeformat/polyfill');\nrequire('@formatjs/intl-relativetimeformat/locale-data/en');\nrequire('@formatjs/intl-relativetimeformat/locale-data/vi');\nrequire('@formatjs/intl-relativetimeformat/locale-data/zh');\n\nrequire('@formatjs/intl-datetimeformat/polyfill');\nrequire('@formatjs/intl-datetimeformat/locale-data/en');\nrequire('@formatjs/intl-datetimeformat/locale-data/vi');\nrequire('@formatjs/intl-datetimeformat/locale-data/zh');\n\nrequire('@formatjs/intl-datetimeformat/add-golden-tz.js');\n\nexport * from './Format/NumberFormat';\nexport { CurrencySymbolEnum };\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAqCA,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;AAnCAL,OAAO,CAAC,6CAA6C,CAAC;AACtDA,OAAO,CAAC,gCAAgC,CAAC;AAEzCA,OAAO,CAAC,qCAAqC,CAAC;AAC9CA,OAAO,CAAC,2CAA2C,CAAC;AACpDA,OAAO,CAAC,2CAA2C,CAAC;AACpDA,OAAO,CAAC,2CAA2C,CAAC;AAEpDA,OAAO,CAAC,sCAAsC,CAAC;AAC/CA,OAAO,CAAC,4CAA4C,CAAC;AACrDA,OAAO,CAAC,4CAA4C,CAAC;AACrDA,OAAO,CAAC,4CAA4C,CAAC;AAErDA,OAAO,CAAC,oCAAoC,CAAC;AAC7CA,OAAO,CAAC,0CAA0C,CAAC;AACnDA,OAAO,CAAC,0CAA0C,CAAC;AACnDA,OAAO,CAAC,0CAA0C,CAAC;AAEnDA,OAAO,CAAC,sCAAsC,CAAC;AAC/CA,OAAO,CAAC,4CAA4C,CAAC;AACrDA,OAAO,CAAC,4CAA4C,CAAC;AACrDA,OAAO,CAAC,4CAA4C,CAAC;AAErDA,OAAO,CAAC,4CAA4C,CAAC;AACrDA,OAAO,CAAC,kDAAkD,CAAC;AAC3DA,OAAO,CAAC,kDAAkD,CAAC;AAC3DA,OAAO,CAAC,kDAAkD,CAAC;AAE3DA,OAAO,CAAC,wCAAwC,CAAC;AACjDA,OAAO,CAAC,8CAA8C,CAAC;AACvDA,OAAO,CAAC,8CAA8C,CAAC;AACvDA,OAAO,CAAC,8CAA8C,CAAC;AAEvDA,OAAO,CAAC,gDAAgD,CAAC","ignoreList":[]}
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
- import { NumberFormat } from '@formatjs/intl-numberformat';
2
-
3
- var CurrencySymbolEnum;
4
- (function (CurrencySymbolEnum) {
5
- CurrencySymbolEnum["TWD"] = "NT$";
6
- CurrencySymbolEnum["USD"] = "US$";
7
- CurrencySymbolEnum["VND"] = "\u20AB";
8
- })(CurrencySymbolEnum || (CurrencySymbolEnum = {}));
9
-
10
- class NumberParser {
11
- constructor(locale) {
12
- const parts = new NumberFormat(locale).formatToParts(12345.6);
13
- const numerals = [...new NumberFormat(locale, {
14
- useGrouping: false
15
- }).format(9876543210)].reverse();
16
- const index = new Map(numerals.map((d, i) => [d, i]));
17
- this._group = new RegExp(`[${parts.find(d => d.type === 'group')?.value}]`, 'g');
18
- this._decimal = new RegExp(`[${parts.find(d => d.type === 'decimal')?.value}]`);
19
- this._numeral = new RegExp(`[${numerals.join('')}]`, 'g');
20
- this._index = d => index.get(d);
21
- }
22
- parse(value) {
23
- value = value?.trim()?.replace(this._group, '')?.replace(this._decimal, '.')?.replace(this._numeral, this._index);
24
- return value ? +value : NaN;
25
- }
26
- }
27
-
28
- const formatAccountNumber = function (accountNumber) {
29
- let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
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
@@ -1 +1 @@
1
- {"version":3,"file":"format.mjs","sources":["../src/enums/CurrencySymbolEnum.ts","../src/Format/NumberParser.ts","../src/Format/NumberFormat.ts","../src/format.ts"],"sourcesContent":[null,null,null,null],"names":["CurrencySymbolEnum","NumberParser","constructor","locale","parts","NumberFormat","formatToParts","numerals","useGrouping","format","reverse","index","Map","map","d","i","_group","RegExp","find","type","value","_decimal","_numeral","join","_index","get","parse","trim","replace","NaN","formatAccountNumber","accountNumber","separator","arguments","length","undefined","getCurrencySymbol","currency","showCurrency","symbol","TWD","USD","VND","formatNumber","options","styleCurrency","currencyDisplay","showValue","minimumFractionDigits","maximumFraction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A,OAAO,CAAC,2CAA2C,CAAC,CAAA;AAEpDA,OAAO,CAAC,sCAAsC,CAAC,CAAA;AAC/CA,OAAO,CAAC,4CAA4C,CAAC,CAAA;AACrDA,OAAO,CAAC,4CAA4C,CAAC,CAAA;AACrDA,OAAO,CAAC,4CAA4C,CAAC,CAAA;AAErDA,OAAO,CAAC,oCAAoC,CAAC,CAAA;AAC7CA,OAAO,CAAC,0CAA0C,CAAC,CAAA;AACnDA,OAAO,CAAC,0CAA0C,CAAC,CAAA;AACnDA,OAAO,CAAC,0CAA0C,CAAC,CAAA;AAEnDA,OAAO,CAAC,sCAAsC,CAAC,CAAA;AAC/CA,OAAO,CAAC,4CAA4C,CAAC,CAAA;AACrDA,OAAO,CAAC,4CAA4C,CAAC,CAAA;AACrDA,OAAO,CAAC,4CAA4C,CAAC,CAAA;AAErDA,OAAO,CAAC,4CAA4C,CAAC,CAAA;AACrDA,OAAO,CAAC,kDAAkD,CAAC,CAAA;AAC3DA,OAAO,CAAC,kDAAkD,CAAC,CAAA;AAC3DA,OAAO,CAAC,kDAAkD,CAAC,CAAA;AAE3DA,OAAO,CAAC,wCAAwC,CAAC,CAAA;AACjDA,OAAO,CAAC,8CAA8C,CAAC,CAAA;AACvDA,OAAO,CAAC,8CAA8C,CAAC,CAAA;AACvDA,OAAO,CAAC,8CAA8C,CAAC,CAAA;AAEvDA,OAAO,CAAC,gDAAgD,CAAC;;;;"}
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
@@ -0,0 +1,3 @@
1
+ import { EnvironmentEnum } from './enums/EnvironmentEnum';
2
+ export * from './I18n/I18n';
3
+ export { EnvironmentEnum };
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
@@ -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,4 @@
1
+ export { E as EnvironmentEnum } from './EnvironmentEnum-UcQ6Il1O.js';
2
+ export { g as getV, i as initI18n } from './I18n-yXLN_hDO.js';
3
+ import 'cross-fetch';
4
+ //# sourceMappingURL=i18n.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"index-cli.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index-cli.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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';
@@ -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 format = require('./format.cjs');
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 format.CurrencySymbolEnum; }
43
+ get: function () { return NumberFormat.CurrencySymbolEnum; }
14
44
  });
15
- exports.formatAccountNumber = format.formatAccountNumber;
16
- exports.formatNumber = format.formatNumber;
17
- exports.getCurrencySymbol = format.getCurrencySymbol;
18
- exports.parseFormatNumber = format.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
@@ -1 +1 @@
1
- {"version":3,"file":"index-rn.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index-rn.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,3 @@
1
1
  export * from './format';
2
+ export * from './i18n';
2
3
  export * from './sentry-rn';