@yelon/util 12.0.13 → 12.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/array/array-type.service.d.ts +68 -68
- package/array/array.service.d.ts +75 -75
- package/array/index.d.ts +2 -2
- package/array/yelon-util-array.d.ts +4 -4
- package/array/yelon-util-array.metadata.json +1 -1
- package/browser/browser.d.ts +4 -4
- package/browser/cookie.service.d.ts +64 -64
- package/browser/copy.d.ts +6 -6
- package/browser/index.d.ts +5 -5
- package/browser/is-empty.d.ts +6 -6
- package/browser/scroll.service.d.ts +34 -34
- package/browser/style.d.ts +21 -21
- package/bundles/browser.umd.js +275 -275
- package/bundles/yelon-util-array.umd.js +606 -606
- package/bundles/yelon-util-array.umd.js.map +1 -1
- package/bundles/yelon-util-config.umd.js +366 -366
- package/bundles/yelon-util-date-time.umd.js +216 -216
- package/bundles/yelon-util-decorator.umd.js +437 -437
- package/bundles/yelon-util-form.umd.js +116 -116
- package/bundles/yelon-util-format.umd.js +726 -726
- package/bundles/yelon-util-math.umd.js +83 -83
- package/bundles/yelon-util-other.umd.js +652 -656
- package/bundles/yelon-util-other.umd.js.map +1 -1
- package/bundles/yelon-util-pipes-currency.umd.js +83 -83
- package/bundles/yelon-util-pipes-filter.umd.js +353 -353
- package/bundles/yelon-util-pipes-format.umd.js +47 -47
- package/bundles/yelon-util-pipes.umd.js +7 -7
- package/bundles/yelon-util-token.umd.js +30 -30
- package/bundles/yelon-util.umd.js +7 -7
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +16 -16
- package/config/abc/loading.type.d.ts +31 -31
- package/config/abc/lodop.type.d.ts +33 -33
- package/config/abc/media.type.d.ts +11 -11
- package/config/abc/onboarding.type.d.ts +4 -4
- package/config/abc/page-header.type.d.ts +39 -39
- package/config/abc/pdf.type.d.ts +35 -35
- package/config/abc/qr.type.d.ts +25 -25
- package/config/abc/se.type.d.ts +32 -32
- package/config/abc/sg.type.d.ts +10 -10
- package/config/abc/st.type.d.ts +427 -431
- package/config/abc/sv.type.d.ts +14 -14
- package/config/abc/xlsx.type.d.ts +12 -12
- package/config/abc/zip.type.d.ts +10 -10
- package/config/acl/acl.type.d.ts +32 -32
- package/config/auth/auth.type.d.ts +55 -55
- package/config/bis/bis.type.d.ts +7 -7
- package/config/cache/cache.type.d.ts +40 -40
- package/config/chart/chart.type.d.ts +33 -33
- package/config/config.service.d.ts +10 -10
- package/config/config.types.d.ts +49 -49
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/sf/sf.type.d.ts +127 -127
- package/config/stomp/stomp.type.d.ts +2 -2
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +8 -8
- package/config/theme/index.d.ts +3 -3
- package/config/theme/responsive.type.d.ts +12 -12
- package/config/util/array.type.d.ts +22 -22
- package/config/util/currency.type.d.ts +39 -39
- package/config/yelon-util-config.d.ts +4 -4
- package/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +26 -26
- package/date-time/yelon-util-date-time.d.ts +4 -4
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/yelon-util-decorator.d.ts +4 -4
- package/decorator/zone-outside.d.ts +35 -35
- package/esm2015/array/array-type.service.js +1 -1
- package/esm2015/array/array.service.js +250 -250
- package/esm2015/array/index.js +2 -2
- package/esm2015/array/yelon-util-array.js +4 -4
- package/esm2015/browser/browser.js +4 -4
- package/esm2015/browser/cookie.service.js +103 -103
- package/esm2015/browser/copy.js +26 -26
- package/esm2015/browser/index.js +5 -5
- package/esm2015/browser/is-empty.js +18 -18
- package/esm2015/browser/scroll.service.js +88 -88
- package/esm2015/browser/style.js +37 -37
- package/esm2015/config/abc/date-picker.type.js +1 -1
- package/esm2015/config/abc/error-collect.type.js +1 -1
- package/esm2015/config/abc/image.type.js +1 -1
- package/esm2015/config/abc/index.js +16 -16
- package/esm2015/config/abc/loading.type.js +1 -1
- package/esm2015/config/abc/lodop.type.js +1 -1
- package/esm2015/config/abc/media.type.js +1 -1
- package/esm2015/config/abc/onboarding.type.js +1 -1
- package/esm2015/config/abc/page-header.type.js +1 -1
- package/esm2015/config/abc/pdf.type.js +1 -1
- package/esm2015/config/abc/qr.type.js +1 -1
- package/esm2015/config/abc/se.type.js +1 -1
- package/esm2015/config/abc/sg.type.js +1 -1
- package/esm2015/config/abc/st.type.js +2 -2
- package/esm2015/config/abc/sv.type.js +2 -2
- package/esm2015/config/abc/xlsx.type.js +1 -1
- package/esm2015/config/abc/zip.type.js +1 -1
- package/esm2015/config/acl/acl.type.js +1 -1
- package/esm2015/config/auth/auth.type.js +1 -1
- package/esm2015/config/bis/bis.type.js +1 -1
- package/esm2015/config/cache/cache.type.js +1 -1
- package/esm2015/config/chart/chart.type.js +1 -1
- package/esm2015/config/config.service.js +33 -33
- package/esm2015/config/config.types.js +8 -8
- package/esm2015/config/index.js +14 -14
- package/esm2015/config/mock/mock.type.js +1 -1
- package/esm2015/config/sf/sf.type.js +1 -1
- package/esm2015/config/stomp/stomp.type.js +1 -1
- package/esm2015/config/theme/http.type.js +1 -1
- package/esm2015/config/theme/i18n.type.js +1 -1
- package/esm2015/config/theme/index.js +3 -3
- package/esm2015/config/theme/responsive.type.js +1 -1
- package/esm2015/config/util/array.type.js +1 -1
- package/esm2015/config/util/currency.type.js +1 -1
- package/esm2015/config/yelon-util-config.js +4 -4
- package/esm2015/date-time/index.js +2 -2
- package/esm2015/date-time/picker.js +115 -115
- package/esm2015/date-time/time.js +83 -83
- package/esm2015/date-time/yelon-util-date-time.js +4 -4
- package/esm2015/decorator/convert.js +55 -55
- package/esm2015/decorator/index.js +2 -2
- package/esm2015/decorator/yelon-util-decorator.js +4 -4
- package/esm2015/decorator/zone-outside.js +54 -54
- package/esm2015/form/index.js +2 -2
- package/esm2015/form/match-control.js +29 -29
- package/esm2015/form/validators.js +80 -80
- package/esm2015/form/yelon-util-form.js +4 -4
- package/esm2015/format/currency.service.js +224 -224
- package/esm2015/format/currency.types.js +7 -7
- package/esm2015/format/index.js +4 -4
- package/esm2015/format/string.js +75 -75
- package/esm2015/format/validate.js +93 -93
- package/esm2015/format/yelon-util-format.js +4 -4
- package/esm2015/index.js +11 -11
- package/esm2015/math/in-range.js +24 -24
- package/esm2015/math/index.js +2 -2
- package/esm2015/math/round.js +52 -52
- package/esm2015/math/yelon-util-math.js +4 -4
- package/esm2015/other/assert.js +66 -66
- package/esm2015/other/deep.js +76 -76
- package/esm2015/other/index.js +4 -4
- package/esm2015/other/lazy.service.js +118 -118
- package/esm2015/other/logger.js +33 -36
- package/esm2015/other/yelon-util-other.js +4 -4
- package/esm2015/pipes/currency/cny.pipe.js +21 -21
- package/esm2015/pipes/currency/index.js +3 -3
- package/esm2015/pipes/currency/mega.pipe.js +25 -25
- package/esm2015/pipes/currency/module.js +13 -13
- package/esm2015/pipes/currency/price.pipe.js +25 -25
- package/esm2015/pipes/currency/yelon-util-pipes-currency.js +5 -5
- package/esm2015/pipes/filter/filter.pipe.js +14 -14
- package/esm2015/pipes/filter/index.js +2 -2
- package/esm2015/pipes/filter/module.js +11 -11
- package/esm2015/pipes/filter/yelon-util-pipes-filter.js +4 -4
- package/esm2015/pipes/format/index.js +2 -2
- package/esm2015/pipes/format/mask.pipe.js +29 -29
- package/esm2015/pipes/format/module.js +11 -11
- package/esm2015/pipes/format/yelon-util-pipes-format.js +4 -4
- package/esm2015/pipes/index.js +3 -3
- package/esm2015/pipes/yelon-util-pipes.js +4 -4
- package/esm2015/token/index.js +2 -2
- package/esm2015/token/page-visibility.js +15 -15
- package/esm2015/token/window.js +16 -16
- package/esm2015/token/yelon-util-token.js +4 -4
- package/esm2015/yelon-util.js +4 -4
- package/fesm2015/browser.js +257 -257
- package/fesm2015/yelon-util-array.js +246 -246
- package/fesm2015/yelon-util-array.js.map +1 -1
- package/fesm2015/yelon-util-config.js +36 -36
- package/fesm2015/yelon-util-date-time.js +196 -196
- package/fesm2015/yelon-util-decorator.js +107 -107
- package/fesm2015/yelon-util-form.js +108 -108
- package/fesm2015/yelon-util-format.js +390 -390
- package/fesm2015/yelon-util-math.js +75 -75
- package/fesm2015/yelon-util-other.js +281 -284
- package/fesm2015/yelon-util-other.js.map +1 -1
- package/fesm2015/yelon-util-pipes-currency.js +72 -72
- package/fesm2015/yelon-util-pipes-filter.js +22 -22
- package/fesm2015/yelon-util-pipes-format.js +36 -36
- package/fesm2015/yelon-util-pipes.js +2 -2
- package/fesm2015/yelon-util-token.js +25 -25
- package/fesm2015/yelon-util.js +2 -2
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/form/yelon-util-form.d.ts +4 -4
- package/format/currency.service.d.ts +34 -34
- package/format/currency.types.d.ts +77 -77
- package/format/index.d.ts +4 -4
- package/format/string.d.ts +44 -44
- package/format/validate.d.ts +72 -72
- package/format/yelon-util-format.d.ts +4 -4
- package/index.d.ts +11 -11
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/math/yelon-util-math.d.ts +4 -4
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +33 -33
- package/other/index.d.ts +4 -4
- package/other/lazy.service.d.ts +22 -22
- package/other/logger.d.ts +5 -6
- package/other/yelon-util-other.d.ts +4 -4
- package/other/yelon-util-other.metadata.json +1 -1
- package/package.json +1 -1
- package/pipes/currency/cny.pipe.d.ts +12 -12
- package/pipes/currency/index.d.ts +3 -3
- package/pipes/currency/mega.pipe.d.ts +13 -13
- package/pipes/currency/module.d.ts +2 -2
- package/pipes/currency/price.pipe.d.ts +16 -16
- package/pipes/currency/yelon-util-pipes-currency.d.ts +5 -5
- package/pipes/filter/filter.pipe.d.ts +10 -10
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +2 -2
- package/pipes/filter/yelon-util-pipes-filter.d.ts +4 -4
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +24 -24
- package/pipes/format/module.d.ts +2 -2
- package/pipes/format/yelon-util-pipes-format.d.ts +4 -4
- package/pipes/index.d.ts +3 -3
- package/pipes/yelon-util-pipes.d.ts +4 -4
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
- package/token/yelon-util-token.d.ts +4 -4
- package/yelon-util.d.ts +4 -4
@@ -1,225 +1,225 @@
|
|
1
|
-
import { CurrencyPipe, formatNumber } from '@angular/common';
|
2
|
-
import { DEFAULT_CURRENCY_CODE, Inject, Injectable, LOCALE_ID } from '@angular/core';
|
3
|
-
import { YunzaiConfigService } from '@yelon/util/config';
|
4
|
-
import { CurrencyMega_Powers } from './currency.types';
|
5
|
-
import * as i0 from "@angular/core";
|
6
|
-
import * as i1 from "@yelon/util/config";
|
7
|
-
export class CurrencyService {
|
8
|
-
constructor(cog, locale, _defaultCurrencyCode = 'USD') {
|
9
|
-
this.locale = locale;
|
10
|
-
this.currencyPipe = new CurrencyPipe(locale, _defaultCurrencyCode);
|
11
|
-
this.c = cog.merge('utilCurrency', {
|
12
|
-
startingUnit: 'yuan',
|
13
|
-
megaUnit: { Q: '京', T: '兆', B: '亿', M: '万', K: '千' },
|
14
|
-
precision: 2,
|
15
|
-
ignoreZeroPrecision: true
|
16
|
-
});
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* Format a number with commas as thousands separators
|
20
|
-
*
|
21
|
-
* 格式化货币,用逗号将数字格式化为千位分隔符
|
22
|
-
* ```ts
|
23
|
-
* 10000 => `10,000`
|
24
|
-
* 10000.567 => `10,000.57`
|
25
|
-
* ```
|
26
|
-
*/
|
27
|
-
format(value, options) {
|
28
|
-
options = Object.assign({ startingUnit: this.c.startingUnit, precision: this.c.precision, ignoreZeroPrecision: this.c.ignoreZeroPrecision, ngCurrency: this.c.ngCurrency }, options);
|
29
|
-
let truthValue = Number(value);
|
30
|
-
if (value == null || isNaN(truthValue)) {
|
31
|
-
return '';
|
32
|
-
}
|
33
|
-
if (options.startingUnit === 'cent') {
|
34
|
-
truthValue = truthValue / 100;
|
35
|
-
}
|
36
|
-
if (options.ngCurrency != null) {
|
37
|
-
const cur = options.ngCurrency;
|
38
|
-
return this.currencyPipe.transform(truthValue, cur.currencyCode, cur.display, cur.digitsInfo, cur.locale || this.locale);
|
39
|
-
}
|
40
|
-
const res = formatNumber(truthValue, this.locale, `.${options.ignoreZeroPrecision ? 1 : options.precision}-${options.precision}`);
|
41
|
-
return options.ignoreZeroPrecision ? res.replace(/(?:\.[0]+)$/g, '') : res;
|
42
|
-
}
|
43
|
-
/**
|
44
|
-
* Large number format filter
|
45
|
-
*
|
46
|
-
* 大数据格式化
|
47
|
-
* ```ts
|
48
|
-
* 1000 => { value: '1', unit: 'K', unitI18n: '千' }
|
49
|
-
* 12456 => { value: '12.46', unit: 'K', unitI18n: '千' }
|
50
|
-
* ```
|
51
|
-
*/
|
52
|
-
mega(value, options) {
|
53
|
-
options = Object.assign({ precision: this.c.precision, unitI18n: this.c.megaUnit, startingUnit: this.c.startingUnit }, options);
|
54
|
-
let num = Number(value);
|
55
|
-
const res = { raw: value, value: '', unit: '', unitI18n: '' };
|
56
|
-
if (isNaN(num) || num === 0) {
|
57
|
-
res.value = value.toString();
|
58
|
-
return res;
|
59
|
-
}
|
60
|
-
if (options.startingUnit === 'cent') {
|
61
|
-
num = num / 100;
|
62
|
-
}
|
63
|
-
let abs = Math.abs(+num);
|
64
|
-
const rounder = Math.pow(10, options.precision);
|
65
|
-
const isNegative = num < 0;
|
66
|
-
for (const p of CurrencyMega_Powers) {
|
67
|
-
let reduced = abs / p.value;
|
68
|
-
reduced = Math.round(reduced * rounder) / rounder;
|
69
|
-
if (reduced >= 1) {
|
70
|
-
abs = reduced;
|
71
|
-
res.unit = p.unit;
|
72
|
-
break;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
res.value = (isNegative ? '-' : '') + abs;
|
76
|
-
res.unitI18n = options.unitI18n[res.unit];
|
77
|
-
return res;
|
78
|
-
}
|
79
|
-
/**
|
80
|
-
* Converted into RMB notation.
|
81
|
-
*
|
82
|
-
* 转化成人民币表示法
|
83
|
-
*/
|
84
|
-
cny(value, options) {
|
85
|
-
options = Object.assign({ inWords: true, minusSymbol: '负', startingUnit: this.c.startingUnit }, options);
|
86
|
-
value = Number(value);
|
87
|
-
if (isNaN(value)) {
|
88
|
-
return '';
|
89
|
-
}
|
90
|
-
if (options.startingUnit === 'cent') {
|
91
|
-
value = value / 100;
|
92
|
-
}
|
93
|
-
value = value.toString();
|
94
|
-
let integer;
|
95
|
-
let decimal;
|
96
|
-
[integer, decimal] = value.split('.');
|
97
|
-
let symbol = '';
|
98
|
-
if (integer.startsWith('-')) {
|
99
|
-
symbol = options.minusSymbol;
|
100
|
-
integer = integer.substr(1);
|
101
|
-
}
|
102
|
-
if (/^-?\d+$/.test(value)) {
|
103
|
-
decimal = null;
|
104
|
-
}
|
105
|
-
integer = (+integer).toString();
|
106
|
-
const inWords = options.inWords;
|
107
|
-
const unit = {
|
108
|
-
num: inWords
|
109
|
-
? ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '点']
|
110
|
-
: ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '点'],
|
111
|
-
radice: inWords
|
112
|
-
? [
|
113
|
-
'',
|
114
|
-
'拾',
|
115
|
-
'佰',
|
116
|
-
'仟',
|
117
|
-
'万',
|
118
|
-
'拾',
|
119
|
-
'佰',
|
120
|
-
'仟',
|
121
|
-
'亿',
|
122
|
-
'拾',
|
123
|
-
'佰',
|
124
|
-
'仟',
|
125
|
-
'万亿',
|
126
|
-
'拾',
|
127
|
-
'佰',
|
128
|
-
'仟',
|
129
|
-
'兆',
|
130
|
-
'拾',
|
131
|
-
'佰',
|
132
|
-
'仟'
|
133
|
-
]
|
134
|
-
: [
|
135
|
-
'',
|
136
|
-
'十',
|
137
|
-
'百',
|
138
|
-
'千',
|
139
|
-
'万',
|
140
|
-
'十',
|
141
|
-
'百',
|
142
|
-
'千',
|
143
|
-
'亿',
|
144
|
-
'十',
|
145
|
-
'百',
|
146
|
-
'千',
|
147
|
-
'万亿',
|
148
|
-
'十',
|
149
|
-
'百',
|
150
|
-
'千',
|
151
|
-
'兆',
|
152
|
-
'十',
|
153
|
-
'百',
|
154
|
-
'千'
|
155
|
-
],
|
156
|
-
dec: ['角', '分', '厘', '毫']
|
157
|
-
};
|
158
|
-
if (inWords) {
|
159
|
-
value = (+value).toFixed(5).toString();
|
160
|
-
}
|
161
|
-
let integerRes = '';
|
162
|
-
const integerCount = integer.length;
|
163
|
-
if (integer === '0' || integerCount === 0) {
|
164
|
-
integerRes = '零';
|
165
|
-
}
|
166
|
-
else {
|
167
|
-
let cnDesc = '';
|
168
|
-
for (let i = 0; i < integerCount; i++) {
|
169
|
-
const n = +integer[i];
|
170
|
-
const j = integerCount - i - 1;
|
171
|
-
const isZero = i > 1 && n !== 0 && integer[i - 1] === '0';
|
172
|
-
const cnZero = isZero ? '零' : '';
|
173
|
-
const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substr(i - 3, 4) === '0000';
|
174
|
-
const descMark = cnDesc;
|
175
|
-
let cnNum = unit.num[n];
|
176
|
-
cnDesc = isEmpptyUnit ? '' : unit.radice[j];
|
177
|
-
// 第一位是一十
|
178
|
-
if (i === 0 && cnNum === '一' && cnDesc === '十')
|
179
|
-
cnNum = '';
|
180
|
-
const isChangeEr = n > 1 &&
|
181
|
-
cnNum === '二' && // 去除首位
|
182
|
-
['', '十', '百'].indexOf(cnDesc) === -1 && // 不读两\两十\两百
|
183
|
-
descMark !== '十'; // 不读十两
|
184
|
-
if (isChangeEr)
|
185
|
-
cnNum = '两';
|
186
|
-
integerRes += cnZero + cnNum + cnDesc;
|
187
|
-
}
|
188
|
-
}
|
189
|
-
// 小数部分拼接
|
190
|
-
let decimalRes = '';
|
191
|
-
const decimalCount = decimal ? decimal.toString().length : 0;
|
192
|
-
if (decimal === null) {
|
193
|
-
decimalRes = inWords ? '整' : '';
|
194
|
-
}
|
195
|
-
else if (decimal === '0') {
|
196
|
-
decimalRes = '零';
|
197
|
-
}
|
198
|
-
else {
|
199
|
-
for (let i = 0; i < decimalCount; i++) {
|
200
|
-
if (inWords && i > unit.dec.length - 1)
|
201
|
-
break;
|
202
|
-
const n = decimal[i];
|
203
|
-
const cnZero = n === '0' ? '零' : '';
|
204
|
-
const cnNum = unit.num[+n];
|
205
|
-
const cnDesc = inWords ? unit.dec[i] : '';
|
206
|
-
decimalRes += cnZero + cnNum + cnDesc;
|
207
|
-
}
|
208
|
-
}
|
209
|
-
const ret = symbol +
|
210
|
-
(inWords
|
211
|
-
? integerRes + (decimalRes === '零' ? '元整' : `元${decimalRes}`)
|
212
|
-
: integerRes + (decimalRes === '' ? '' : `点${decimalRes}`));
|
213
|
-
return ret;
|
214
|
-
}
|
215
|
-
}
|
216
|
-
CurrencyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(i0.ɵɵinject(i1.YunzaiConfigService), i0.ɵɵinject(i0.LOCALE_ID), i0.ɵɵinject(i0.DEFAULT_CURRENCY_CODE)); }, token: CurrencyService, providedIn: "root" });
|
217
|
-
CurrencyService.decorators = [
|
218
|
-
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
219
|
-
];
|
220
|
-
CurrencyService.ctorParameters = () => [
|
221
|
-
{ type: YunzaiConfigService },
|
222
|
-
{ type: String, decorators: [{ type: Inject, args: [LOCALE_ID,] }] },
|
223
|
-
{ type: String, decorators: [{ type: Inject, args: [DEFAULT_CURRENCY_CODE,] }] }
|
224
|
-
];
|
1
|
+
import { CurrencyPipe, formatNumber } from '@angular/common';
|
2
|
+
import { DEFAULT_CURRENCY_CODE, Inject, Injectable, LOCALE_ID } from '@angular/core';
|
3
|
+
import { YunzaiConfigService } from '@yelon/util/config';
|
4
|
+
import { CurrencyMega_Powers } from './currency.types';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
import * as i1 from "@yelon/util/config";
|
7
|
+
export class CurrencyService {
|
8
|
+
constructor(cog, locale, _defaultCurrencyCode = 'USD') {
|
9
|
+
this.locale = locale;
|
10
|
+
this.currencyPipe = new CurrencyPipe(locale, _defaultCurrencyCode);
|
11
|
+
this.c = cog.merge('utilCurrency', {
|
12
|
+
startingUnit: 'yuan',
|
13
|
+
megaUnit: { Q: '京', T: '兆', B: '亿', M: '万', K: '千' },
|
14
|
+
precision: 2,
|
15
|
+
ignoreZeroPrecision: true
|
16
|
+
});
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Format a number with commas as thousands separators
|
20
|
+
*
|
21
|
+
* 格式化货币,用逗号将数字格式化为千位分隔符
|
22
|
+
* ```ts
|
23
|
+
* 10000 => `10,000`
|
24
|
+
* 10000.567 => `10,000.57`
|
25
|
+
* ```
|
26
|
+
*/
|
27
|
+
format(value, options) {
|
28
|
+
options = Object.assign({ startingUnit: this.c.startingUnit, precision: this.c.precision, ignoreZeroPrecision: this.c.ignoreZeroPrecision, ngCurrency: this.c.ngCurrency }, options);
|
29
|
+
let truthValue = Number(value);
|
30
|
+
if (value == null || isNaN(truthValue)) {
|
31
|
+
return '';
|
32
|
+
}
|
33
|
+
if (options.startingUnit === 'cent') {
|
34
|
+
truthValue = truthValue / 100;
|
35
|
+
}
|
36
|
+
if (options.ngCurrency != null) {
|
37
|
+
const cur = options.ngCurrency;
|
38
|
+
return this.currencyPipe.transform(truthValue, cur.currencyCode, cur.display, cur.digitsInfo, cur.locale || this.locale);
|
39
|
+
}
|
40
|
+
const res = formatNumber(truthValue, this.locale, `.${options.ignoreZeroPrecision ? 1 : options.precision}-${options.precision}`);
|
41
|
+
return options.ignoreZeroPrecision ? res.replace(/(?:\.[0]+)$/g, '') : res;
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Large number format filter
|
45
|
+
*
|
46
|
+
* 大数据格式化
|
47
|
+
* ```ts
|
48
|
+
* 1000 => { value: '1', unit: 'K', unitI18n: '千' }
|
49
|
+
* 12456 => { value: '12.46', unit: 'K', unitI18n: '千' }
|
50
|
+
* ```
|
51
|
+
*/
|
52
|
+
mega(value, options) {
|
53
|
+
options = Object.assign({ precision: this.c.precision, unitI18n: this.c.megaUnit, startingUnit: this.c.startingUnit }, options);
|
54
|
+
let num = Number(value);
|
55
|
+
const res = { raw: value, value: '', unit: '', unitI18n: '' };
|
56
|
+
if (isNaN(num) || num === 0) {
|
57
|
+
res.value = value.toString();
|
58
|
+
return res;
|
59
|
+
}
|
60
|
+
if (options.startingUnit === 'cent') {
|
61
|
+
num = num / 100;
|
62
|
+
}
|
63
|
+
let abs = Math.abs(+num);
|
64
|
+
const rounder = Math.pow(10, options.precision);
|
65
|
+
const isNegative = num < 0;
|
66
|
+
for (const p of CurrencyMega_Powers) {
|
67
|
+
let reduced = abs / p.value;
|
68
|
+
reduced = Math.round(reduced * rounder) / rounder;
|
69
|
+
if (reduced >= 1) {
|
70
|
+
abs = reduced;
|
71
|
+
res.unit = p.unit;
|
72
|
+
break;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
res.value = (isNegative ? '-' : '') + abs;
|
76
|
+
res.unitI18n = options.unitI18n[res.unit];
|
77
|
+
return res;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Converted into RMB notation.
|
81
|
+
*
|
82
|
+
* 转化成人民币表示法
|
83
|
+
*/
|
84
|
+
cny(value, options) {
|
85
|
+
options = Object.assign({ inWords: true, minusSymbol: '负', startingUnit: this.c.startingUnit }, options);
|
86
|
+
value = Number(value);
|
87
|
+
if (isNaN(value)) {
|
88
|
+
return '';
|
89
|
+
}
|
90
|
+
if (options.startingUnit === 'cent') {
|
91
|
+
value = value / 100;
|
92
|
+
}
|
93
|
+
value = value.toString();
|
94
|
+
let integer;
|
95
|
+
let decimal;
|
96
|
+
[integer, decimal] = value.split('.');
|
97
|
+
let symbol = '';
|
98
|
+
if (integer.startsWith('-')) {
|
99
|
+
symbol = options.minusSymbol;
|
100
|
+
integer = integer.substr(1);
|
101
|
+
}
|
102
|
+
if (/^-?\d+$/.test(value)) {
|
103
|
+
decimal = null;
|
104
|
+
}
|
105
|
+
integer = (+integer).toString();
|
106
|
+
const inWords = options.inWords;
|
107
|
+
const unit = {
|
108
|
+
num: inWords
|
109
|
+
? ['', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '点']
|
110
|
+
: ['', '一', '二', '三', '四', '五', '六', '七', '八', '九', '点'],
|
111
|
+
radice: inWords
|
112
|
+
? [
|
113
|
+
'',
|
114
|
+
'拾',
|
115
|
+
'佰',
|
116
|
+
'仟',
|
117
|
+
'万',
|
118
|
+
'拾',
|
119
|
+
'佰',
|
120
|
+
'仟',
|
121
|
+
'亿',
|
122
|
+
'拾',
|
123
|
+
'佰',
|
124
|
+
'仟',
|
125
|
+
'万亿',
|
126
|
+
'拾',
|
127
|
+
'佰',
|
128
|
+
'仟',
|
129
|
+
'兆',
|
130
|
+
'拾',
|
131
|
+
'佰',
|
132
|
+
'仟'
|
133
|
+
]
|
134
|
+
: [
|
135
|
+
'',
|
136
|
+
'十',
|
137
|
+
'百',
|
138
|
+
'千',
|
139
|
+
'万',
|
140
|
+
'十',
|
141
|
+
'百',
|
142
|
+
'千',
|
143
|
+
'亿',
|
144
|
+
'十',
|
145
|
+
'百',
|
146
|
+
'千',
|
147
|
+
'万亿',
|
148
|
+
'十',
|
149
|
+
'百',
|
150
|
+
'千',
|
151
|
+
'兆',
|
152
|
+
'十',
|
153
|
+
'百',
|
154
|
+
'千'
|
155
|
+
],
|
156
|
+
dec: ['角', '分', '厘', '毫']
|
157
|
+
};
|
158
|
+
if (inWords) {
|
159
|
+
value = (+value).toFixed(5).toString();
|
160
|
+
}
|
161
|
+
let integerRes = '';
|
162
|
+
const integerCount = integer.length;
|
163
|
+
if (integer === '0' || integerCount === 0) {
|
164
|
+
integerRes = '零';
|
165
|
+
}
|
166
|
+
else {
|
167
|
+
let cnDesc = '';
|
168
|
+
for (let i = 0; i < integerCount; i++) {
|
169
|
+
const n = +integer[i];
|
170
|
+
const j = integerCount - i - 1;
|
171
|
+
const isZero = i > 1 && n !== 0 && integer[i - 1] === '0';
|
172
|
+
const cnZero = isZero ? '零' : '';
|
173
|
+
const isEmpptyUnit = (n === 0 && j % 4 !== 0) || integer.substr(i - 3, 4) === '0000';
|
174
|
+
const descMark = cnDesc;
|
175
|
+
let cnNum = unit.num[n];
|
176
|
+
cnDesc = isEmpptyUnit ? '' : unit.radice[j];
|
177
|
+
// 第一位是一十
|
178
|
+
if (i === 0 && cnNum === '一' && cnDesc === '十')
|
179
|
+
cnNum = '';
|
180
|
+
const isChangeEr = n > 1 &&
|
181
|
+
cnNum === '二' && // 去除首位
|
182
|
+
['', '十', '百'].indexOf(cnDesc) === -1 && // 不读两\两十\两百
|
183
|
+
descMark !== '十'; // 不读十两
|
184
|
+
if (isChangeEr)
|
185
|
+
cnNum = '两';
|
186
|
+
integerRes += cnZero + cnNum + cnDesc;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
// 小数部分拼接
|
190
|
+
let decimalRes = '';
|
191
|
+
const decimalCount = decimal ? decimal.toString().length : 0;
|
192
|
+
if (decimal === null) {
|
193
|
+
decimalRes = inWords ? '整' : '';
|
194
|
+
}
|
195
|
+
else if (decimal === '0') {
|
196
|
+
decimalRes = '零';
|
197
|
+
}
|
198
|
+
else {
|
199
|
+
for (let i = 0; i < decimalCount; i++) {
|
200
|
+
if (inWords && i > unit.dec.length - 1)
|
201
|
+
break;
|
202
|
+
const n = decimal[i];
|
203
|
+
const cnZero = n === '0' ? '零' : '';
|
204
|
+
const cnNum = unit.num[+n];
|
205
|
+
const cnDesc = inWords ? unit.dec[i] : '';
|
206
|
+
decimalRes += cnZero + cnNum + cnDesc;
|
207
|
+
}
|
208
|
+
}
|
209
|
+
const ret = symbol +
|
210
|
+
(inWords
|
211
|
+
? integerRes + (decimalRes === '零' ? '元整' : `元${decimalRes}`)
|
212
|
+
: integerRes + (decimalRes === '' ? '' : `点${decimalRes}`));
|
213
|
+
return ret;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
CurrencyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CurrencyService_Factory() { return new CurrencyService(i0.ɵɵinject(i1.YunzaiConfigService), i0.ɵɵinject(i0.LOCALE_ID), i0.ɵɵinject(i0.DEFAULT_CURRENCY_CODE)); }, token: CurrencyService, providedIn: "root" });
|
217
|
+
CurrencyService.decorators = [
|
218
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
219
|
+
];
|
220
|
+
CurrencyService.ctorParameters = () => [
|
221
|
+
{ type: YunzaiConfigService },
|
222
|
+
{ type: String, decorators: [{ type: Inject, args: [LOCALE_ID,] }] },
|
223
|
+
{ type: String, decorators: [{ type: Inject, args: [DEFAULT_CURRENCY_CODE,] }] }
|
224
|
+
];
|
225
225
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVuY3kuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvZm9ybWF0L2N1cnJlbmN5LnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUM3RCxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxTQUFTLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFJckYsT0FBTyxFQUFFLG1CQUFtQixFQUE0QixNQUFNLG9CQUFvQixDQUFDO0FBRW5GLE9BQU8sRUFLTCxtQkFBbUIsRUFDcEIsTUFBTSxrQkFBa0IsQ0FBQzs7O0FBRzFCLE1BQU0sT0FBTyxlQUFlO0lBSTFCLFlBQ0UsR0FBd0IsRUFDRyxNQUFjLEVBQ1YsdUJ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ctJykpIHtcbiAgICAgIHN5bWJvbCA9IG9wdGlvbnMubWludXNTeW1ib2whO1xuICAgICAgaW50ZWdlciA9IGludGVnZXIuc3Vic3RyKDEpO1xuICAgIH1cbiAgICBpZiAoL14tP1xcZCskLy50ZXN0KHZhbHVlKSkge1xuICAgICAgZGVjaW1hbCA9IG51bGw7XG4gICAgfVxuICAgIGludGVnZXIgPSAoK2ludGVnZXIpLnRvU3RyaW5nKCk7XG4gICAgY29uc3QgaW5Xb3JkcyA9IG9wdGlvbnMuaW5Xb3JkcztcbiAgICBjb25zdCB1bml0OiB7IFtrZXk6IHN0cmluZ106IHN0cmluZ1tdIH0gPSB7XG4gICAgICBudW06IGluV29yZHNcbiAgICAgICAgPyBbJycsICflo7knLCAn6LSwJywgJ+WPgScsICfogoYnLCAn5LyNJywgJ+mZhicsICfmn5InLCAn5o2MJywgJ+eOlicsICfngrknXVxuICAgICAgICA6IFsnJywgJ+S4gCcsICfkuownLCAn5LiJJywgJ+WbmycsICfkupQnLCAn5YWtJywgJ+S4gycsICflhasnLCAn5LmdJywgJ+eCuSddLFxuICAgICAgcmFkaWNlOiBpbldvcmRzXG4gICAgICAgID8gW1xuICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAn5ou+JyxcbiAgICAgICAgICAgICfkvbAnLFxuICAgICAgICAgICAgJ+S7nycsXG4gICAgICAgICAgICAn5LiHJyxcbiAgICAgICAgICAgICfmi74nLFxuICAgICAgICAgICAgJ+S9sCcsXG4gICAgICAgICAgICAn5LufJyxcbiAgICAgICAgICAgICfkur8nLFxuICAgICAgICAgICAgJ+aLvicsXG4gICAgICAgICAgICAn5L2wJyxcbiAgICAgICAgICAgICfku58nLFxuICAgICAgICAgICAgJ+S4h+S6vycsXG4gICAgICAgICAgICAn5ou+JyxcbiAgICAgICAgICAgICfkvbAnLFxuICAgICAgICAgICAgJ+S7nycsXG4gICAgICAgICAgICAn5YWGJyxcbiAgICAgICAgICAgICfmi74nLFxuICAgICAgICAgICAgJ+S9sCcsXG4gICAgICAgICAgICAn5LufJ1xuICAgICAgICAgIF1cbiAgICAgICAgOiBbXG4gICAgICAgICAgICAnJyxcbiAgICAgICAgICAgICfljYEnLFxuICAgICAgICAgICAgJ+eZvicsXG4gICAgICAgICAgICAn5Y2DJyxcbiAgICAgICAgICAgICfkuIcnLFxuICAgICAgICAgICAgJ+WNgScsXG4gICAgICAgICAgICAn55m+JyxcbiAgICAgICAgICAgICfljYMnLFxuICAgICAgICAgICAgJ+S6vycsXG4gICAgICAgICAgICAn5Y2BJyxcbiAgICAgICAgICAgICfnmb4nLFxuICAgICAgICAgICAgJ+WNgycsXG4gICAgICAgICAgICAn5LiH5Lq/JyxcbiAgICAgICAgICAgICfljYEnLFxuICAgICAgICAgICAgJ+eZvicsXG4gICAgICAgICAgICAn5Y2DJyxcbiAgICAgICAgICAgICflhYYnLFxuICAgICAgICAgICAgJ+WNgScsXG4gICAgICAgICAgICAn55m+JyxcbiAgICAgICAgICAgICfljYMnXG4gICAgICAgICAgXSxcbiAgICAgIGRlYzogWyfop5InLCAn5YiGJywgJ+WOmCcsICfmr6snXVxuICAgIH07XG4gICAgaWYgKGluV29yZHMpIHtcbiAgICAgIHZhbHVlID0gKCt2YWx1ZSkudG9GaXhlZCg1KS50b1N0cmluZygpO1xuICAgIH1cbiAgICBsZXQgaW50ZWdlclJlcyA9ICcnO1xuICAgIGNvbnN0IGludGVnZXJDb3VudCA9IGludGVnZXIubGVuZ3RoO1xuICAgIGlmIChpbnRlZ2VyID09PSAnMCcgfHwgaW50ZWdlckNvdW50ID09PSAwKSB7XG4gICAgICBpbnRlZ2VyUmVzID0gJ+mbtic7XG4gICAgfSBlbHNlIHtcbiAgICAgIGxldCBjbkRlc2MgPSAnJztcbiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgaW50ZWdlckNvdW50OyBpKyspIHtcbiAgICAgICAgY29uc3QgbiA9ICtpbnRlZ2VyW2ldO1xuICAgICAgICBjb25zdCBqID0gaW50ZWdlckNvdW50IC0gaSAtIDE7XG4gICAgICAgIGNvbnN0IGlzWmVybyA9IGkgPiAxICYmIG4gIT09IDAgJiYgaW50ZWdlcltpIC0gMV0gPT09ICcwJztcbiAgICAgICAgY29uc3QgY25aZXJvID0gaXNaZXJvID8gJ+mbticgOiAnJztcbiAgICAgICAgY29uc3QgaXNFbXBwdHlVbml0ID0gKG4gPT09IDAgJiYgaiAlIDQgIT09IDApIHx8IGludGVnZXIuc3Vic3RyKGkgLSAzLCA0KSA9PT0gJzAwMDAnO1xuICAgICAgICBjb25zdCBkZXNjTWFyayA9IGNuRGVzYztcbiAgICAgICAgbGV0IGNuTnVtID0gdW5pdC5udW1bbl07XG5cbiAgICAgICAgY25EZXNjID0gaXNFbXBwdHlVbml0ID8gJycgOiB1bml0LnJhZGljZVtqXTtcbiAgICAgICAgLy8g56ys5LiA5L2N5piv5LiA5Y2BXG4gICAgICAgIGlmIChpID09PSAwICYmIGNuTnVtID09PSAn5LiAJyAmJiBjbkRlc2MgPT09ICfljYEnKSBjbk51bSA9ICcnO1xuICAgICAgICBjb25zdCBpc0NoYW5nZUVyID1cbiAgICAgICAgICBuID4gMSAmJlxuICAgICAgICAgIGNuTnVtID09PSAn5LqMJyAmJiAvLyDljrvpmaTpppbkvY1cbiAgICAgICAgICBbJycsICfljYEnLCAn55m+J10uaW5kZXhPZihjbkRlc2MpID09PSAtMSAmJiAvLyDkuI3or7vkuKRcXOS4pOWNgVxc5Lik55m+XG4gICAgICAgICAgZGVzY01hcmsgIT09ICfljYEnOyAvLyDkuI3or7vljYHkuKRcbiAgICAgICAgaWYgKGlzQ2hhbmdlRXIpIGNuTnVtID0gJ+S4pCc7XG4gICAgICAgIGludGVnZXJSZXMgKz0gY25aZXJvICsgY25OdW0gKyBjbkRlc2M7XG4gICAgICB9XG4gICAgfVxuXG4gICAgLy8g5bCP5pWw6YOo5YiG5ou85o6lXG4gICAgbGV0IGRlY2ltYWxSZXMgPSAnJztcbiAgICBjb25zdCBkZWNpbWFsQ291bnQgPSBkZWNpbWFsID8gZGVjaW1hbC50b1N0cmluZygpLmxlbmd0aCA6IDA7XG4gICAgaWYgKGRlY2ltYWwgPT09IG51bGwpIHtcbiAgICAgIGRlY2ltYWxSZXMgPSBpbldvcmRzID8gJ+aVtCcgOiAnJztcbiAgICB9IGVsc2UgaWYgKGRlY2ltYWwgPT09ICcwJykge1xuICAgICAgZGVjaW1hbFJlcyA9ICfpm7YnO1xuICAgIH0gZWxzZSB7XG4gICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGRlY2ltYWxDb3VudDsgaSsrKSB7XG4gICAgICAgIGlmIChpbldvcmRzICYmIGkgPiB1bml0LmRlYy5sZW5ndGggLSAxKSBicmVhaztcbiAgICAgICAgY29uc3QgbiA9IGRlY2ltYWxbaV07XG4gICAgICAgIGNvbnN0IGNuWmVybyA9IG4gPT09ICcwJyA/ICfpm7YnIDogJyc7XG4gICAgICAgIGNvbnN0IGNuTnVtID0gdW5pdC5udW1bK25dO1xuICAgICAgICBjb25zdCBjbkRlc2MgPSBpbldvcmRzID8gdW5pdC5kZWNbaV0gOiAnJztcbiAgICAgICAgZGVjaW1hbFJlcyArPSBjblplcm8gKyBjbk51bSArIGNuRGVzYztcbiAgICAgIH1cbiAgICB9XG4gICAgY29uc3QgcmV0ID1cbiAgICAgIHN5bWJvbCArXG4gICAgICAoaW5Xb3Jkc1xuICAgICAgICA/IGludGVnZXJSZXMgKyAoZGVjaW1hbFJlcyA9PT0gJ+mbticgPyAn5YWD5pW0JyA6IGDlhYMke2RlY2ltYWxSZXN9YClcbiAgICAgICAgOiBpbnRlZ2VyUmVzICsgKGRlY2ltYWxSZXMgPT09ICcnID8gJycgOiBg54K5JHtkZWNpbWFsUmVzfWApKTtcbiAgICByZXR1cm4gcmV0O1xuICB9XG59XG4iXX0=
|
@@ -1,8 +1,8 @@
|
|
1
|
-
export const CurrencyMega_Powers = [
|
2
|
-
{ unit: 'Q', value: Math.pow(10, 15) },
|
3
|
-
{ unit: 'T', value: Math.pow(10, 12) },
|
4
|
-
{ unit: 'B', value: Math.pow(10, 9) },
|
5
|
-
{ unit: 'M', value: Math.pow(10, 6) },
|
6
|
-
{ unit: 'K', value: 1000 }
|
7
|
-
];
|
1
|
+
export const CurrencyMega_Powers = [
|
2
|
+
{ unit: 'Q', value: Math.pow(10, 15) },
|
3
|
+
{ unit: 'T', value: Math.pow(10, 12) },
|
4
|
+
{ unit: 'B', value: Math.pow(10, 9) },
|
5
|
+
{ unit: 'M', value: Math.pow(10, 6) },
|
6
|
+
{ unit: 'K', value: 1000 }
|
7
|
+
];
|
8
8
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVuY3kudHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Zvcm1hdC9jdXJyZW5jeS50eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEyREEsTUFBTSxDQUFDLE1BQU0sbUJBQW1CLEdBQUc7SUFDakMsRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLEtBQUssRUFBRSxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsRUFBRSxFQUFFLENBQUMsRUFBRTtJQUN0QyxFQUFFLElBQUksRUFBRSxHQUFHLEVBQUUsS0FBSyxFQUFFLElBQUksQ0FBQyxHQUFHLENBQUMsRUFBRSxFQUFFLEVBQUUsQ0FBQyxFQUFFO0lBQ3RDLEVBQUUsSUFBSSxFQUFFLEdBQUcsRUFBRSxLQUFLLEVBQUUsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEVBQUU7SUFDckMsRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLEtBQUssRUFBRSxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMsRUFBRTtJQUNyQyxFQUFFLElB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validate';
|
3
|
-
export * from './currency.service';
|
4
|
-
export * from './currency.types';
|
1
|
+
export * from './string';
|
2
|
+
export * from './validate';
|
3
|
+
export * from './currency.service';
|
4
|
+
export * from './currency.types';
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Zvcm1hdC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFVBQVUsQ0FBQztBQUN6QixjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsa0JBQWtCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3N0cmluZyc7XG5leHBvcnQgKiBmcm9tICcuL3ZhbGlkYXRlJztcbmV4cG9ydCAqIGZyb20gJy4vY3VycmVuY3kuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2N1cnJlbmN5LnR5cGVzJztcbiJdfQ==
|