@andre1502/react-utilities 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- 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/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/index-rn.cjs +33 -6
- package/dist/index-rn.cjs.map +1 -1
- package/dist/index-rn.mjs +28 -1
- package/dist/index-rn.mjs.map +1 -1
- package/dist/index.cjs +33 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +28 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/format.ts +34 -34
@@ -0,0 +1,89 @@
|
|
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
|
+
export { CurrencySymbolEnum as C, formatNumber as a, formatAccountNumber as f, getCurrencySymbol as g, parseFormatNumber as p };
|
89
|
+
//# sourceMappingURL=NumberFormat-CvvBWhHc.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NumberFormat-CvvBWhHc.js","sources":["../src/enums/CurrencySymbolEnum.ts","../src/Format/NumberParser.ts","../src/Format/NumberFormat.ts"],"sourcesContent":[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","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AAO,CAACE,eAAe;IACxCE,qBAAqB,EAAEJ,OAAO,CAACI,qBAAqB;IACpDC,qBAAqB,EAAEL,OAAO,CAACK,qBAAqB;IACpDC,mBAAmB,EAAEN,OAAO,CAACM,mBAAAA;GAC9B,CAAA;EAED,IAAIN,OAAO,CAACA,OAAO,EAAE;AACnBO,IAAAA,aAAa,GAAG;AACd,MAAA,GAAGA,aAAa;AAChB,MAAA,GAAGP,OAAO,CAACA,OAAAA;KACZ,CAAA;AACH,GAAA;EAEA,IAAIS,eAAe,GAAGhD,YAAY,CAACuC,OAAO,CAACU,IAAI,EAAEH,aAAa,CAAC,CAC5D1C,MAAM,CAACmC,OAAO,CAACxB,KAAK,CAAC,CACrBQ,OAAO,CAAC,4BAA4B,EAAE,QAAQ,CAAC,CAC/CA,OAAO,CAAC,YAAY,EAAEgB,OAAO,CAACG,SAAS,GAAG,KAAK,GAAG,WAAW,CAAC,CAC9DnB,OAAO,CACNgB,OAAO,CAACP,QAAQ,EAChBD,iBAAiB,CAACQ,OAAO,CAACP,QAAQ,EAAEO,OAAO,CAACN,YAAY,CAAC,CAC1D,CACAX,IAAI,EAAE,CAAA;AAET;AAEA,EAAA,OAAO0B,eAAe,CAAA;AACxB,EAAC;AAED,MAAME,iBAAiB,GAAGA,CAACD,IAAY,EAAElC,KAAa,KAAI;EACxD,IAAI,CAACA,KAAK,EAAE;AACV,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;EAEA,OAAO,IAAInB,YAAY,CAACqD,IAAI,CAAC,CAAC5B,KAAK,CAACN,KAAK,CAAC,CAAA;AAC5C;;;;"}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
'use strict';
|
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
|
+
|
90
|
+
exports.formatAccountNumber = formatAccountNumber;
|
91
|
+
exports.formatNumber = formatNumber;
|
92
|
+
exports.getCurrencySymbol = getCurrencySymbol;
|
93
|
+
exports.parseFormatNumber = parseFormatNumber;
|
94
|
+
//# sourceMappingURL=NumberFormat-glmpbk7E.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"NumberFormat-glmpbk7E.js","sources":["../src/enums/CurrencySymbolEnum.ts","../src/Format/NumberParser.ts","../src/Format/NumberFormat.ts"],"sourcesContent":[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"],"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,IAAI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ACN,YAAY,CAAC,CAC1D,CACAX,IAAI,EAAE,CAAA;AAET;AAEA,EAAA,OAAO0B,eAAe,CAAA;AACxB,EAAC;AAED,MAAME,iBAAiB,GAAGA,CAACD,IAAY,EAAElC,KAAa,KAAI;EACxD,IAAI,CAACA,KAAK,EAAE;AACV,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;EAEA,OAAO,IAAInB,YAAY,CAACqD,IAAI,CAAC,CAAC5B,KAAK,CAACN,KAAK,CAAC,CAAA;AAC5C;;;;;;;"}
|
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/index-rn.cjs
CHANGED
@@ -1,6 +1,33 @@
|
|
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');
|
4
31
|
var EnvironmentEnum = require('./EnvironmentEnum-BjXsfSRZ.js');
|
5
32
|
var I18n = require('./I18n-CB7SyXYJ.js');
|
6
33
|
var ReactNative = require('./ReactNative-CqUrY2ZJ.js');
|
@@ -13,12 +40,12 @@ require('./Utils-Dilye04y.js');
|
|
13
40
|
|
14
41
|
Object.defineProperty(exports, "CurrencySymbolEnum", {
|
15
42
|
enumerable: true,
|
16
|
-
get: function () { return
|
43
|
+
get: function () { return NumberFormat.CurrencySymbolEnum; }
|
17
44
|
});
|
18
|
-
exports.formatAccountNumber =
|
19
|
-
exports.formatNumber =
|
20
|
-
exports.getCurrencySymbol =
|
21
|
-
exports.parseFormatNumber =
|
45
|
+
exports.formatAccountNumber = NumberFormat.formatAccountNumber;
|
46
|
+
exports.formatNumber = NumberFormat.formatNumber;
|
47
|
+
exports.getCurrencySymbol = NumberFormat.getCurrencySymbol;
|
48
|
+
exports.parseFormatNumber = NumberFormat.parseFormatNumber;
|
22
49
|
Object.defineProperty(exports, "EnvironmentEnum", {
|
23
50
|
enumerable: true,
|
24
51
|
get: function () { return EnvironmentEnum.EnvironmentEnum; }
|
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.mjs
CHANGED
@@ -1,4 +1,31 @@
|
|
1
|
-
export { CurrencySymbolEnum, formatAccountNumber, formatNumber, getCurrencySymbol, parseFormatNumber } from './
|
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';
|
2
29
|
export { E as EnvironmentEnum } from './EnvironmentEnum-UcQ6Il1O.js';
|
3
30
|
export { g as getV, i as initI18n } from './I18n-yXLN_hDO.js';
|
4
31
|
export { i as initSentry, r as recordAdditionalSentryHttp } from './ReactNative-mNnws-b5.js';
|
package/dist/index-rn.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index-rn.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index-rn.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.cjs
CHANGED
@@ -1,6 +1,33 @@
|
|
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');
|
4
31
|
var EnvironmentEnum = require('./EnvironmentEnum-BjXsfSRZ.js');
|
5
32
|
var I18n = require('./I18n-CB7SyXYJ.js');
|
6
33
|
var React = require('./React-qUl0CBmE.js');
|
@@ -13,12 +40,12 @@ require('./Utils-Dilye04y.js');
|
|
13
40
|
|
14
41
|
Object.defineProperty(exports, "CurrencySymbolEnum", {
|
15
42
|
enumerable: true,
|
16
|
-
get: function () { return
|
43
|
+
get: function () { return NumberFormat.CurrencySymbolEnum; }
|
17
44
|
});
|
18
|
-
exports.formatAccountNumber =
|
19
|
-
exports.formatNumber =
|
20
|
-
exports.getCurrencySymbol =
|
21
|
-
exports.parseFormatNumber =
|
45
|
+
exports.formatAccountNumber = NumberFormat.formatAccountNumber;
|
46
|
+
exports.formatNumber = NumberFormat.formatNumber;
|
47
|
+
exports.getCurrencySymbol = NumberFormat.getCurrencySymbol;
|
48
|
+
exports.parseFormatNumber = NumberFormat.parseFormatNumber;
|
22
49
|
Object.defineProperty(exports, "EnvironmentEnum", {
|
23
50
|
enumerable: true,
|
24
51
|
get: function () { return EnvironmentEnum.EnvironmentEnum; }
|
package/dist/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
@@ -1,4 +1,31 @@
|
|
1
|
-
export { CurrencySymbolEnum, formatAccountNumber, formatNumber, getCurrencySymbol, parseFormatNumber } from './
|
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';
|
2
29
|
export { E as EnvironmentEnum } from './EnvironmentEnum-UcQ6Il1O.js';
|
3
30
|
export { g as getV, i as initI18n } from './I18n-yXLN_hDO.js';
|
4
31
|
export { i as initSentry, r as recordAdditionalSentryHttp } from './React-BaJ1KfGF.js';
|
package/dist/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
package/src/format.ts
CHANGED
@@ -1,39 +1,39 @@
|
|
1
1
|
import { CurrencySymbolEnum } from './enums/CurrencySymbolEnum';
|
2
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
3
|
+
import '@formatjs/intl-getcanonicallocales/polyfill';
|
4
|
+
import '@formatjs/intl-locale/polyfill';
|
5
|
+
|
6
|
+
import '@formatjs/intl-pluralrules/locale-data/en';
|
7
|
+
import '@formatjs/intl-pluralrules/locale-data/vi';
|
8
|
+
import '@formatjs/intl-pluralrules/locale-data/zh';
|
9
|
+
import '@formatjs/intl-pluralrules/polyfill';
|
10
|
+
|
11
|
+
import '@formatjs/intl-displaynames/locale-data/en';
|
12
|
+
import '@formatjs/intl-displaynames/locale-data/vi';
|
13
|
+
import '@formatjs/intl-displaynames/locale-data/zh';
|
14
|
+
import '@formatjs/intl-displaynames/polyfill';
|
15
|
+
|
16
|
+
import '@formatjs/intl-listformat/locale-data/en';
|
17
|
+
import '@formatjs/intl-listformat/locale-data/vi';
|
18
|
+
import '@formatjs/intl-listformat/locale-data/zh';
|
19
|
+
import '@formatjs/intl-listformat/polyfill';
|
20
|
+
|
21
|
+
import '@formatjs/intl-numberformat/locale-data/en';
|
22
|
+
import '@formatjs/intl-numberformat/locale-data/vi';
|
23
|
+
import '@formatjs/intl-numberformat/locale-data/zh';
|
24
|
+
import '@formatjs/intl-numberformat/polyfill';
|
25
|
+
|
26
|
+
import '@formatjs/intl-relativetimeformat/locale-data/en';
|
27
|
+
import '@formatjs/intl-relativetimeformat/locale-data/vi';
|
28
|
+
import '@formatjs/intl-relativetimeformat/locale-data/zh';
|
29
|
+
import '@formatjs/intl-relativetimeformat/polyfill';
|
30
|
+
|
31
|
+
import '@formatjs/intl-datetimeformat/locale-data/en';
|
32
|
+
import '@formatjs/intl-datetimeformat/locale-data/vi';
|
33
|
+
import '@formatjs/intl-datetimeformat/locale-data/zh';
|
34
|
+
import '@formatjs/intl-datetimeformat/polyfill';
|
35
|
+
|
36
|
+
import '@formatjs/intl-datetimeformat/add-golden-tz.js';
|
37
37
|
|
38
38
|
export * from './Format/NumberFormat';
|
39
39
|
export { CurrencySymbolEnum };
|