@yh-kit/utils 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils.js +244 -187
- package/dist/utils.umd.cjs +1 -1
- package/package.json +1 -1
- package/types/utils/lib/index.d.ts +1 -0
- package/types/utils/lib/money/index.d.ts +17 -0
package/dist/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (!
|
|
3
|
-
const
|
|
4
|
-
return
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
}),
|
|
8
|
-
},
|
|
1
|
+
const b = (t) => {
|
|
2
|
+
if (!t || !t.length) return {};
|
|
3
|
+
const e = {};
|
|
4
|
+
return t.forEach((r) => {
|
|
5
|
+
const o = Object.assign({ label: r.label, text: r.label }, r);
|
|
6
|
+
e[r == null ? void 0 : r.value] = o;
|
|
7
|
+
}), e;
|
|
8
|
+
}, y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
9
|
__proto__: null,
|
|
10
|
-
toEnumObj:
|
|
10
|
+
toEnumObj: b
|
|
11
11
|
}, Symbol.toStringTag, { value: "Module" })), A = Object.assign(
|
|
12
12
|
{
|
|
13
13
|
/**
|
|
@@ -15,8 +15,8 @@ const p = (e) => {
|
|
|
15
15
|
* @param arr 数组
|
|
16
16
|
* @returns 去重后的数组
|
|
17
17
|
*/
|
|
18
|
-
unique(
|
|
19
|
-
return
|
|
18
|
+
unique(t) {
|
|
19
|
+
return t ? Array.from(new Set(t)) : [];
|
|
20
20
|
},
|
|
21
21
|
/**
|
|
22
22
|
* 判断某元素是否在数组中
|
|
@@ -24,8 +24,8 @@ const p = (e) => {
|
|
|
24
24
|
* @param element 查询元素
|
|
25
25
|
* @returns 是否存在。true 存在;false 不存在
|
|
26
26
|
*/
|
|
27
|
-
isExist(
|
|
28
|
-
return !
|
|
27
|
+
isExist(t, e) {
|
|
28
|
+
return !t || !e ? !1 : t.indexOf(e) !== -1;
|
|
29
29
|
},
|
|
30
30
|
/**
|
|
31
31
|
* 统计数组中某元素出现的次数:对于大型数组,手动循环的性能略优于 filter 和 reduce。
|
|
@@ -33,11 +33,11 @@ const p = (e) => {
|
|
|
33
33
|
* @param target 目标元素
|
|
34
34
|
* @returns 出现次数
|
|
35
35
|
*/
|
|
36
|
-
countOfAppear(
|
|
37
|
-
let
|
|
38
|
-
for (const
|
|
39
|
-
|
|
40
|
-
return
|
|
36
|
+
countOfAppear(t, e) {
|
|
37
|
+
let r = 0;
|
|
38
|
+
for (const o of t)
|
|
39
|
+
o === e && r++;
|
|
40
|
+
return r;
|
|
41
41
|
},
|
|
42
42
|
/**
|
|
43
43
|
* 数组排序-默认升序
|
|
@@ -45,8 +45,8 @@ const p = (e) => {
|
|
|
45
45
|
* @param order 排序方式:asc 升序;desc 降序
|
|
46
46
|
* @returns 排序后的数组
|
|
47
47
|
*/
|
|
48
|
-
sort(
|
|
49
|
-
return
|
|
48
|
+
sort(t, e = "asc") {
|
|
49
|
+
return t ? t.sort((r, o) => e === "asc" ? r > o ? 1 : -1 : r < o ? 1 : -1) : [];
|
|
50
50
|
},
|
|
51
51
|
/**
|
|
52
52
|
* 数组乱序(洗牌算法)
|
|
@@ -59,18 +59,18 @@ const p = (e) => {
|
|
|
59
59
|
* @param arr 数组
|
|
60
60
|
* @returns
|
|
61
61
|
*/
|
|
62
|
-
shuffle(
|
|
63
|
-
if (!
|
|
62
|
+
shuffle(t) {
|
|
63
|
+
if (!t)
|
|
64
64
|
return [];
|
|
65
|
-
for (let
|
|
66
|
-
const
|
|
67
|
-
[e
|
|
65
|
+
for (let e = t.length - 1; e > 0; e--) {
|
|
66
|
+
const r = Math.floor(Math.random() * (e + 1));
|
|
67
|
+
[t[e], t[r]] = [t[r], t[e]];
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return t;
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
...
|
|
73
|
+
...y
|
|
74
74
|
}
|
|
75
75
|
), j = {
|
|
76
76
|
/**
|
|
@@ -82,20 +82,20 @@ const p = (e) => {
|
|
|
82
82
|
* @param sliceSize 可选参数,表示分片大小,默认为512字节。用于控制每次处理的Base64字符串长度,以优化大文件的处理。
|
|
83
83
|
* @returns 返回转换后的Blob对象,如果转换失败,则返回null。
|
|
84
84
|
*/
|
|
85
|
-
toBlob(
|
|
86
|
-
const
|
|
85
|
+
toBlob(t, e = "", r = 512) {
|
|
86
|
+
const s = (t.split(",")[1] || t).replace(/-/g, "+").replace(/_/g, "/"), l = "=".repeat((4 - s.length % 4) % 4), d = s + l;
|
|
87
87
|
try {
|
|
88
|
-
const
|
|
89
|
-
for (let
|
|
90
|
-
const
|
|
91
|
-
for (let
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
88
|
+
const i = atob(d), g = [];
|
|
89
|
+
for (let u = 0; u < i.length; u += r) {
|
|
90
|
+
const n = i.slice(u, u + r), a = new Array(n.length);
|
|
91
|
+
for (let c = 0; c < n.length; c++)
|
|
92
|
+
a[c] = n.charCodeAt(c);
|
|
93
|
+
const f = new Uint8Array(a);
|
|
94
|
+
g.push(f);
|
|
95
95
|
}
|
|
96
|
-
return new Blob(
|
|
97
|
-
} catch (
|
|
98
|
-
return console.error("Failed to convert base64 to blob:",
|
|
96
|
+
return new Blob(g, { type: e });
|
|
97
|
+
} catch (i) {
|
|
98
|
+
return console.error("Failed to convert base64 to blob:", i), null;
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
/**
|
|
@@ -108,73 +108,73 @@ const p = (e) => {
|
|
|
108
108
|
* @param mimeType MIME类型,默认为"text/plain"。
|
|
109
109
|
* @returns 返回一个File对象,包含解码后的数据。
|
|
110
110
|
*/
|
|
111
|
-
toFile(
|
|
112
|
-
const
|
|
113
|
-
for (let
|
|
114
|
-
const
|
|
115
|
-
for (let
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
toFile(t, e = "file.txt", r = "text/plain") {
|
|
112
|
+
const s = t.replace(/^data:.+;base64,/, "").replace(/-/g, "+").replace(/_/g, "/"), l = "=".repeat((4 - s.length % 4) % 4), d = s + l, i = atob(d), g = [];
|
|
113
|
+
for (let n = 0; n < i.length; n += 512) {
|
|
114
|
+
const a = i.slice(n, n + 512), f = new Array(a.length);
|
|
115
|
+
for (let c = 0; c < a.length; c++)
|
|
116
|
+
f[c] = a.charCodeAt(c);
|
|
117
|
+
g.push(new Uint8Array(f));
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
return new File([
|
|
119
|
+
const u = new Blob(g, { type: r });
|
|
120
|
+
return new File([u], e, { type: r });
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, x = {
|
|
123
123
|
/**
|
|
124
124
|
* 检查是否为空字符串
|
|
125
125
|
* @param str 要检查的字符串
|
|
126
126
|
* @returns 如果字符串为空,则返回 true,否则返回 false
|
|
127
127
|
*/
|
|
128
|
-
isEmptyString(
|
|
129
|
-
return typeof
|
|
128
|
+
isEmptyString(t) {
|
|
129
|
+
return typeof t == "string" && t.trim() === "";
|
|
130
130
|
},
|
|
131
131
|
/**
|
|
132
132
|
* 判断是否为数字
|
|
133
133
|
* @param val 要检查的值
|
|
134
134
|
* @returns 如果值是数字,则返回 true,否则返回 false
|
|
135
135
|
*/
|
|
136
|
-
isNumber(
|
|
137
|
-
return typeof
|
|
136
|
+
isNumber(t) {
|
|
137
|
+
return typeof t == "number" && !isNaN(t);
|
|
138
138
|
},
|
|
139
139
|
/**
|
|
140
140
|
* 判断是否为对象
|
|
141
141
|
* @param val 要检查的值
|
|
142
142
|
* @returns 如果值是对象,则返回 true,否则返回 false
|
|
143
143
|
*/
|
|
144
|
-
isObject(
|
|
145
|
-
return
|
|
144
|
+
isObject(t) {
|
|
145
|
+
return t !== null && typeof t == "object" && !Array.isArray(t);
|
|
146
146
|
},
|
|
147
147
|
/**
|
|
148
148
|
* 判断对象是否为空
|
|
149
149
|
* @param obj 要检查的对象
|
|
150
150
|
* @returns 如果对象为空,则返回 true,否则返回 false
|
|
151
151
|
*/
|
|
152
|
-
isEmptyObject(
|
|
153
|
-
return
|
|
152
|
+
isEmptyObject(t) {
|
|
153
|
+
return t ? Object.keys(t).length === 0 && t.constructor === Object : !0;
|
|
154
154
|
},
|
|
155
155
|
/**
|
|
156
156
|
* 判断是否为布尔值
|
|
157
157
|
* @param val 要检查的值
|
|
158
158
|
* @returns 如果值是布尔值,则返回 true,否则返回 false
|
|
159
159
|
*/
|
|
160
|
-
isBoolean(
|
|
161
|
-
return typeof
|
|
160
|
+
isBoolean(t) {
|
|
161
|
+
return typeof t == "boolean";
|
|
162
162
|
},
|
|
163
163
|
/**
|
|
164
164
|
* 判断是否为数组
|
|
165
165
|
* @param val 要检查的值
|
|
166
166
|
* @returns 如果值是数组,则返回 true,否则返回 false
|
|
167
167
|
*/
|
|
168
|
-
isArray(
|
|
169
|
-
return Array.isArray(
|
|
168
|
+
isArray(t) {
|
|
169
|
+
return Array.isArray(t);
|
|
170
170
|
},
|
|
171
171
|
/**
|
|
172
172
|
* 判断是否为函数
|
|
173
173
|
* @param val 要检查的值
|
|
174
174
|
* @returns
|
|
175
175
|
*/
|
|
176
|
-
isFunction(
|
|
177
|
-
return typeof
|
|
176
|
+
isFunction(t) {
|
|
177
|
+
return typeof t == "function";
|
|
178
178
|
},
|
|
179
179
|
/**
|
|
180
180
|
* 判断是否为 Promise 对象
|
|
@@ -182,41 +182,41 @@ const p = (e) => {
|
|
|
182
182
|
* @returns 如果对象是 Promise 对象,则返回 true,否则返回 false
|
|
183
183
|
*/
|
|
184
184
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
185
|
-
isPromise(
|
|
186
|
-
return !!
|
|
185
|
+
isPromise(t) {
|
|
186
|
+
return !!t && (typeof t == "object" || typeof t == "function") && typeof t.then == "function";
|
|
187
187
|
},
|
|
188
188
|
/**
|
|
189
189
|
* 判断是否为 DOM 元素
|
|
190
190
|
* @param obj 要检查的对象
|
|
191
191
|
* @returns 如果对象是 DOM 元素,则返回 true,否则返回 false
|
|
192
192
|
*/
|
|
193
|
-
isElement(
|
|
194
|
-
return
|
|
193
|
+
isElement(t) {
|
|
194
|
+
return t instanceof Element;
|
|
195
195
|
},
|
|
196
196
|
/**
|
|
197
197
|
* 判断手机号格式(中国)
|
|
198
198
|
* @param str 手机号字符串
|
|
199
199
|
* @returns true 表示手机号格式正确,false 表示手机号格式错误
|
|
200
200
|
*/
|
|
201
|
-
isPhone(
|
|
202
|
-
return /^1[3-9]\d{9}$/.test(
|
|
201
|
+
isPhone(t) {
|
|
202
|
+
return /^1[3-9]\d{9}$/.test(t);
|
|
203
203
|
},
|
|
204
204
|
/**
|
|
205
205
|
* 判断邮箱格式
|
|
206
206
|
* @param str 邮箱字符串
|
|
207
207
|
* @returns true 表示邮箱格式正确,false 表示邮箱格式错误
|
|
208
208
|
*/
|
|
209
|
-
isEmail(
|
|
210
|
-
return /^[\w.-]+@[\w.-]+\.\w+$/.test(
|
|
209
|
+
isEmail(t) {
|
|
210
|
+
return /^[\w.-]+@[\w.-]+\.\w+$/.test(t);
|
|
211
211
|
},
|
|
212
212
|
/**
|
|
213
213
|
* 判断字符串是否为 JSON
|
|
214
214
|
* @param str 字符串
|
|
215
215
|
* @returns true 表示是 JSON,false 表示不是 JSON
|
|
216
216
|
*/
|
|
217
|
-
isJSON(
|
|
217
|
+
isJSON(t) {
|
|
218
218
|
try {
|
|
219
|
-
return JSON.parse(
|
|
219
|
+
return JSON.parse(t), !0;
|
|
220
220
|
} catch {
|
|
221
221
|
return !1;
|
|
222
222
|
}
|
|
@@ -229,17 +229,17 @@ const p = (e) => {
|
|
|
229
229
|
* const img = new Image();
|
|
230
230
|
* img.src = "URL_ADDRESS * img.src = "https://example.com/image.jpg";
|
|
231
231
|
*/
|
|
232
|
-
isImageLoaded(
|
|
233
|
-
return
|
|
232
|
+
isImageLoaded(t) {
|
|
233
|
+
return t.complete && t.naturalWidth !== 0;
|
|
234
234
|
},
|
|
235
235
|
/**
|
|
236
236
|
* 判断元素是否在可视区域内
|
|
237
237
|
* @param el 元素对象
|
|
238
238
|
* @returns true 表示元素在可视区域内,false 表示元素不在可视区域内
|
|
239
239
|
*/
|
|
240
|
-
isInViewport(
|
|
241
|
-
const
|
|
242
|
-
return
|
|
240
|
+
isInViewport(t) {
|
|
241
|
+
const e = t.getBoundingClientRect();
|
|
242
|
+
return e.top >= 0 && e.left >= 0 && e.bottom <= window.innerHeight && e.right <= window.innerWidth;
|
|
243
243
|
},
|
|
244
244
|
/**
|
|
245
245
|
* 判断是否为闰年
|
|
@@ -253,8 +253,8 @@ const p = (e) => {
|
|
|
253
253
|
* isLeapYear(2025); // false
|
|
254
254
|
* isLeapYear(2024); // true
|
|
255
255
|
*/
|
|
256
|
-
isLeapYear(
|
|
257
|
-
return
|
|
256
|
+
isLeapYear(t) {
|
|
257
|
+
return t % 4 === 0 && t % 100 !== 0 || t % 400 === 0;
|
|
258
258
|
},
|
|
259
259
|
/**
|
|
260
260
|
* 判断是否为移动端
|
|
@@ -263,16 +263,16 @@ const p = (e) => {
|
|
|
263
263
|
isMobile() {
|
|
264
264
|
return /Mobi|Android|iPhone/i.test(navigator.userAgent);
|
|
265
265
|
}
|
|
266
|
-
},
|
|
266
|
+
}, C = {
|
|
267
267
|
/**
|
|
268
268
|
* 通过传入的name获取cookie的值
|
|
269
269
|
* @param name cookie的name
|
|
270
270
|
* @returns cookie的值
|
|
271
271
|
*/
|
|
272
|
-
getCookie(
|
|
273
|
-
if (!
|
|
274
|
-
const
|
|
275
|
-
return
|
|
272
|
+
getCookie(t) {
|
|
273
|
+
if (!t) return;
|
|
274
|
+
const e = document.cookie.match(new RegExp("(^| )" + t + "=([^;]+)"));
|
|
275
|
+
return e ? decodeURIComponent(e[2]) : null;
|
|
276
276
|
},
|
|
277
277
|
/**
|
|
278
278
|
* 设置 cookie
|
|
@@ -281,27 +281,27 @@ const p = (e) => {
|
|
|
281
281
|
* @param days cookie的过期时间,默认7天。如果为0,则表示cookie在会话结束时过期。如果为负数,则表示cookie已过期。
|
|
282
282
|
* @returns void
|
|
283
283
|
*/
|
|
284
|
-
setCookie(
|
|
285
|
-
const
|
|
286
|
-
|
|
284
|
+
setCookie(t, e, r = 7) {
|
|
285
|
+
const o = /* @__PURE__ */ new Date();
|
|
286
|
+
o.setTime(o.getTime() + r * 24 * 60 * 60 * 1e3), document.cookie = `${t}=${encodeURIComponent(e)};expires=${o.toUTCString()};path=/`;
|
|
287
287
|
},
|
|
288
288
|
/**
|
|
289
289
|
* 删除cookie
|
|
290
290
|
* @param name cookie的name
|
|
291
291
|
* @returns void
|
|
292
292
|
*/
|
|
293
|
-
deleteCookie(
|
|
294
|
-
this.setCookie(
|
|
293
|
+
deleteCookie(t) {
|
|
294
|
+
this.setCookie(t, "", -1);
|
|
295
295
|
}
|
|
296
|
-
},
|
|
296
|
+
}, _ = {
|
|
297
297
|
/**
|
|
298
298
|
* 获取当前时间字符串
|
|
299
299
|
* @param locales 区域设置。如:'zh-CN','en-US',"chinese"。默认'zh-CN'。
|
|
300
300
|
* @param hour12 是否使用12小时制。默认false,使用24小时制。
|
|
301
301
|
* @returns 当前时间的字符串。如:'2025/5/27 16:54:45'
|
|
302
302
|
*/
|
|
303
|
-
getTimeString(
|
|
304
|
-
return
|
|
303
|
+
getTimeString(t, e = !1) {
|
|
304
|
+
return e ? (/* @__PURE__ */ new Date()).toLocaleString(t, { hour12: !0 }) : (/* @__PURE__ */ new Date()).toLocaleString("chinese", { hour12: !1 });
|
|
305
305
|
},
|
|
306
306
|
/**
|
|
307
307
|
* 计算两个日期相差天数
|
|
@@ -309,9 +309,9 @@ const p = (e) => {
|
|
|
309
309
|
* @param date2 日期2
|
|
310
310
|
* @returns 相差天数
|
|
311
311
|
*/
|
|
312
|
-
diffDays(
|
|
313
|
-
const
|
|
314
|
-
return
|
|
312
|
+
diffDays(t, e) {
|
|
313
|
+
const r = new Date(t).getTime(), o = new Date(e).getTime();
|
|
314
|
+
return r > o ? Math.abs(Math.floor((r - o) / (24 * 3600 * 1e3))) : Math.abs(Math.floor((o - r) / (24 * 3600 * 1e3)));
|
|
315
315
|
},
|
|
316
316
|
/**
|
|
317
317
|
* 生成唯一ID(时间戳+随机数)
|
|
@@ -320,83 +320,139 @@ const p = (e) => {
|
|
|
320
320
|
uniqueId() {
|
|
321
321
|
return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
|
|
322
322
|
}
|
|
323
|
-
},
|
|
323
|
+
}, N = {
|
|
324
324
|
/**
|
|
325
325
|
* 将blob对象转化成文件并导出到本地
|
|
326
326
|
* @param blob blob对象
|
|
327
327
|
* @param filename 文件名
|
|
328
328
|
*/
|
|
329
|
-
saveAsBlob(
|
|
330
|
-
const
|
|
331
|
-
|
|
329
|
+
saveAsBlob(t, e) {
|
|
330
|
+
const r = document.createElement("a"), o = window.URL.createObjectURL(t);
|
|
331
|
+
r.href = o, r.download = e, document.body.appendChild(r), r.click(), URL.revokeObjectURL(o), document.body.removeChild(r);
|
|
332
332
|
}
|
|
333
|
-
},
|
|
333
|
+
}, B = {
|
|
334
334
|
/**
|
|
335
335
|
* 获取元素相对于文档顶部的偏移量(距离)
|
|
336
336
|
* 处理了SVG元素的特殊情况。
|
|
337
337
|
* @param el 元素
|
|
338
338
|
* @returns 偏移量(距离值)
|
|
339
339
|
*/
|
|
340
|
-
getOffsetTop(
|
|
341
|
-
if (!
|
|
340
|
+
getOffsetTop(t) {
|
|
341
|
+
if (!t)
|
|
342
342
|
throw new Error("Element is not provided");
|
|
343
|
-
if (
|
|
344
|
-
const
|
|
345
|
-
return
|
|
343
|
+
if (t instanceof SVGElement) {
|
|
344
|
+
const r = t.getBoundingClientRect(), o = window.pageYOffset || document.documentElement.scrollTop;
|
|
345
|
+
return r.top + o;
|
|
346
346
|
}
|
|
347
|
-
let
|
|
348
|
-
for (;
|
|
349
|
-
|
|
350
|
-
return
|
|
347
|
+
let e = 0;
|
|
348
|
+
for (; t; )
|
|
349
|
+
e += t.offsetTop, t = t.offsetParent;
|
|
350
|
+
return e;
|
|
351
351
|
}
|
|
352
|
-
},
|
|
352
|
+
}, I = {
|
|
353
353
|
/**
|
|
354
354
|
* 将选中的字母数组从A-Z排序:用于试题选择答案的排序实例
|
|
355
355
|
* @param arr 字母数组
|
|
356
356
|
* @returns
|
|
357
357
|
*/
|
|
358
|
-
sortFromA2Z(
|
|
359
|
-
return
|
|
360
|
-
const
|
|
361
|
-
return
|
|
358
|
+
sortFromA2Z(t) {
|
|
359
|
+
return t != null && t.length ? t.sort((r, o) => {
|
|
360
|
+
const s = r.toUpperCase(), l = o.toUpperCase();
|
|
361
|
+
return s < l ? -1 : s > l ? 1 : 0;
|
|
362
362
|
}) : void 0;
|
|
363
363
|
}
|
|
364
|
-
}
|
|
364
|
+
};
|
|
365
|
+
class L {
|
|
366
|
+
/**
|
|
367
|
+
* 转换为标准金额格式(带千分位和两位小数)
|
|
368
|
+
* @param num 要转换的数字
|
|
369
|
+
* @returns 格式化后的字符串
|
|
370
|
+
*/
|
|
371
|
+
static toStandardFormat(e) {
|
|
372
|
+
try {
|
|
373
|
+
const r = typeof e == "string" ? parseFloat(e) : e;
|
|
374
|
+
if (isNaN(r))
|
|
375
|
+
throw new Error("输入不是有效的数字");
|
|
376
|
+
if (!isFinite(r))
|
|
377
|
+
throw new Error("输入是无穷大");
|
|
378
|
+
return r.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
379
|
+
} catch (r) {
|
|
380
|
+
return console.error("格式化失败:", r), "格式错误";
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* 转换为中文大写金额
|
|
385
|
+
* @param num 要转换的数字
|
|
386
|
+
* @returns 中文大写金额字符串
|
|
387
|
+
*/
|
|
388
|
+
static toChineseFormat(e) {
|
|
389
|
+
try {
|
|
390
|
+
const r = typeof e == "string" ? parseFloat(e) : e;
|
|
391
|
+
if (isNaN(r))
|
|
392
|
+
throw new Error("输入不是有效的数字");
|
|
393
|
+
if (r > 9999999999999e-2 || r < -9999999999999e-2)
|
|
394
|
+
throw new Error("输入数字超出范围");
|
|
395
|
+
const o = r < 0, s = Math.abs(r), l = Math.floor(s), d = Math.round((s - l) * 100), i = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], g = ["", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟"], u = ["角", "分"];
|
|
396
|
+
let n = "", a = l;
|
|
397
|
+
if (a === 0)
|
|
398
|
+
n = i[0];
|
|
399
|
+
else {
|
|
400
|
+
let h = 0;
|
|
401
|
+
for (; a > 0; ) {
|
|
402
|
+
const p = a % 10;
|
|
403
|
+
p !== 0 ? n = i[p] + g[h] + n : n.charAt(0) !== i[0] && (n = i[p] + n), a = Math.floor(a / 10), h++;
|
|
404
|
+
}
|
|
405
|
+
n = n.replace(/零+/g, "零"), n = n.replace(/零+$/, "");
|
|
406
|
+
}
|
|
407
|
+
let f = "";
|
|
408
|
+
if (d > 0) {
|
|
409
|
+
const h = Math.floor(d / 10), p = d % 10;
|
|
410
|
+
h > 0 && (f += i[h] + u[0]), p > 0 && (f += i[p] + u[1]);
|
|
411
|
+
} else
|
|
412
|
+
f = "整";
|
|
413
|
+
let c = (o ? "负" : "") + n + "圆" + f;
|
|
414
|
+
return c === "零圆整" && (c = "零圆"), c;
|
|
415
|
+
} catch (r) {
|
|
416
|
+
return console.error("转换失败:", r), "格式错误";
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const m = (t) => t > 25 || t < 0 ? "" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t], w = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
365
421
|
__proto__: null,
|
|
366
|
-
toLetter:
|
|
367
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
422
|
+
toLetter: m
|
|
423
|
+
}, Symbol.toStringTag, { value: "Module" })), S = (t) => t.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), O = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
368
424
|
__proto__: null,
|
|
369
|
-
toMoney:
|
|
370
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
371
|
-
...y,
|
|
425
|
+
toMoney: S
|
|
426
|
+
}, Symbol.toStringTag, { value: "Module" })), T = {
|
|
372
427
|
...w,
|
|
428
|
+
...O,
|
|
373
429
|
/**
|
|
374
430
|
* 判断是否为数字
|
|
375
431
|
* @param val 待判断的值
|
|
376
432
|
* @returns 是否为数字。true 是;false 否
|
|
377
433
|
*/
|
|
378
|
-
isNumber(
|
|
379
|
-
return typeof
|
|
434
|
+
isNumber(t) {
|
|
435
|
+
return typeof t == "number" && !isNaN(t);
|
|
380
436
|
}
|
|
381
|
-
},
|
|
437
|
+
}, v = {
|
|
382
438
|
/**
|
|
383
439
|
* 判断对象是否为空
|
|
384
440
|
* @param obj 对象
|
|
385
441
|
* @returns 是否为空。true 为空;false 不为空
|
|
386
442
|
*/
|
|
387
|
-
isEmptyObject(
|
|
388
|
-
return
|
|
443
|
+
isEmptyObject(t) {
|
|
444
|
+
return t ? Object.keys(t).length === 0 && t.constructor === Object : !0;
|
|
389
445
|
}
|
|
390
|
-
},
|
|
446
|
+
}, F = {
|
|
391
447
|
/**
|
|
392
448
|
* 脱敏
|
|
393
449
|
* @param phone 电话号码/手机号码
|
|
394
450
|
* @returns 脱敏后的电话号码/手机号码
|
|
395
451
|
*/
|
|
396
|
-
desensitize(
|
|
397
|
-
return
|
|
452
|
+
desensitize(t) {
|
|
453
|
+
return t ? t.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2") || t.slice(0, 3) + "****" + t.slice(7) : "";
|
|
398
454
|
}
|
|
399
|
-
},
|
|
455
|
+
}, P = {
|
|
400
456
|
/**
|
|
401
457
|
* 生成随机颜色
|
|
402
458
|
* @returns 随机颜色值
|
|
@@ -410,8 +466,8 @@ const p = (e) => {
|
|
|
410
466
|
* @param max 最大值
|
|
411
467
|
* @returns 随机数
|
|
412
468
|
*/
|
|
413
|
-
int(
|
|
414
|
-
return Math.floor(Math.random() * (
|
|
469
|
+
int(t, e) {
|
|
470
|
+
return Math.floor(Math.random() * (e - t + 1)) + t;
|
|
415
471
|
},
|
|
416
472
|
/**
|
|
417
473
|
* 生成唯一ID(时间戳+随机数)
|
|
@@ -420,52 +476,52 @@ const p = (e) => {
|
|
|
420
476
|
uniqueId() {
|
|
421
477
|
return Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
|
|
422
478
|
}
|
|
423
|
-
},
|
|
479
|
+
}, k = {
|
|
424
480
|
/**
|
|
425
481
|
* 通过key值获取 localStorage 中存储的某个值
|
|
426
482
|
* @param key 获取的key
|
|
427
483
|
* @returns 获取的值
|
|
428
484
|
*/
|
|
429
|
-
getLocal(
|
|
430
|
-
return localStorage.getItem(
|
|
485
|
+
getLocal(t) {
|
|
486
|
+
return localStorage.getItem(t);
|
|
431
487
|
},
|
|
432
488
|
/**
|
|
433
489
|
* 设置localStorage中的某个值
|
|
434
490
|
* @param key 设置的key
|
|
435
491
|
* @param value 设置的value
|
|
436
492
|
*/
|
|
437
|
-
setLocal(
|
|
438
|
-
localStorage.setItem(
|
|
493
|
+
setLocal(t, e) {
|
|
494
|
+
localStorage.setItem(t, e);
|
|
439
495
|
},
|
|
440
496
|
/**
|
|
441
497
|
* 删除localStorage中的某个值
|
|
442
498
|
* @param key 删除的key
|
|
443
499
|
*/
|
|
444
|
-
removeLocal(
|
|
445
|
-
localStorage.removeItem(
|
|
500
|
+
removeLocal(t) {
|
|
501
|
+
localStorage.removeItem(t);
|
|
446
502
|
},
|
|
447
503
|
/**
|
|
448
504
|
* 通过key值获取 sessionStorage 中存储的某个值
|
|
449
505
|
* @param key 获取的key
|
|
450
506
|
* @returns 获取的值
|
|
451
507
|
*/
|
|
452
|
-
getSession(
|
|
453
|
-
return sessionStorage.getItem(
|
|
508
|
+
getSession(t) {
|
|
509
|
+
return sessionStorage.getItem(t);
|
|
454
510
|
},
|
|
455
511
|
/**
|
|
456
512
|
* 设置sessionStorage中的某个值
|
|
457
513
|
* @param key 设置的key
|
|
458
514
|
* @param value 设置的value
|
|
459
515
|
*/
|
|
460
|
-
setSession(
|
|
461
|
-
sessionStorage.setItem(
|
|
516
|
+
setSession(t, e) {
|
|
517
|
+
sessionStorage.setItem(t, e);
|
|
462
518
|
},
|
|
463
519
|
/**
|
|
464
520
|
* 删除sessionStorage中的某个值
|
|
465
521
|
* @param key 删除的key
|
|
466
522
|
*/
|
|
467
|
-
removeSession(
|
|
468
|
-
sessionStorage.removeItem(
|
|
523
|
+
removeSession(t) {
|
|
524
|
+
sessionStorage.removeItem(t);
|
|
469
525
|
}
|
|
470
526
|
}, R = {
|
|
471
527
|
/**
|
|
@@ -474,11 +530,11 @@ const p = (e) => {
|
|
|
474
530
|
* @param element 查询元素
|
|
475
531
|
* @returns 是否存在。true 存在;false 不存在
|
|
476
532
|
*/
|
|
477
|
-
isExist(
|
|
478
|
-
if (!
|
|
533
|
+
isExist(t, e) {
|
|
534
|
+
if (!t || !e)
|
|
479
535
|
return !1;
|
|
480
|
-
const
|
|
481
|
-
return console.log("判断某元素是否在字符串中",
|
|
536
|
+
const r = t.split(",");
|
|
537
|
+
return console.log("判断某元素是否在字符串中", r.indexOf(e) === -1), r.indexOf(e) !== -1;
|
|
482
538
|
},
|
|
483
539
|
/**
|
|
484
540
|
* 判断某元素是否在字符串中-比isExist()方法更高效。
|
|
@@ -486,34 +542,34 @@ const p = (e) => {
|
|
|
486
542
|
* @param element 查询元素
|
|
487
543
|
* @returns 是否存在。true 存在;false 不存在
|
|
488
544
|
*/
|
|
489
|
-
includes(
|
|
490
|
-
return !
|
|
545
|
+
includes(t, e) {
|
|
546
|
+
return !t || !e ? !1 : t.includes(e);
|
|
491
547
|
},
|
|
492
548
|
/**
|
|
493
549
|
* 判断字符串是否为 JSON
|
|
494
550
|
* @param str 字符串
|
|
495
551
|
* @returns
|
|
496
552
|
*/
|
|
497
|
-
isJSON(
|
|
553
|
+
isJSON(t) {
|
|
498
554
|
try {
|
|
499
|
-
return JSON.parse(
|
|
555
|
+
return JSON.parse(t), !0;
|
|
500
556
|
} catch {
|
|
501
557
|
return !1;
|
|
502
558
|
}
|
|
503
559
|
}
|
|
504
|
-
},
|
|
505
|
-
const
|
|
506
|
-
return
|
|
560
|
+
}, U = (t) => {
|
|
561
|
+
const r = new RegExp("[?&]" + t + "=([^&#]*)", "i").exec(window.location.href);
|
|
562
|
+
return r ? decodeURIComponent(r[1]) : null;
|
|
507
563
|
};
|
|
508
|
-
function
|
|
509
|
-
return new URLSearchParams(window.location.search).get(
|
|
564
|
+
function M(t) {
|
|
565
|
+
return new URLSearchParams(window.location.search).get(t);
|
|
510
566
|
}
|
|
511
|
-
const
|
|
567
|
+
const E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
512
568
|
__proto__: null,
|
|
513
|
-
getQueryInfoByName:
|
|
514
|
-
getQueryParam:
|
|
515
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
516
|
-
...
|
|
569
|
+
getQueryInfoByName: U,
|
|
570
|
+
getQueryParam: M
|
|
571
|
+
}, Symbol.toStringTag, { value: "Module" })), $ = {
|
|
572
|
+
...E,
|
|
517
573
|
/**
|
|
518
574
|
* 获取当前域名
|
|
519
575
|
* @returns 当前url链接的host信息
|
|
@@ -528,40 +584,41 @@ const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
528
584
|
getPath() {
|
|
529
585
|
return window.location.pathname;
|
|
530
586
|
}
|
|
531
|
-
},
|
|
587
|
+
}, D = {
|
|
532
588
|
/**
|
|
533
589
|
* 处理瀑布流数据,使其适合瀑布流布局展示
|
|
534
590
|
* @param list 瀑布流数据-数组
|
|
535
591
|
* @param columnsNum 需要展示的列数
|
|
536
592
|
* @returns 适合瀑布流布局的数组
|
|
537
593
|
*/
|
|
538
|
-
toList(
|
|
539
|
-
console.log(
|
|
540
|
-
const
|
|
541
|
-
for (let
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
for (const
|
|
546
|
-
|
|
547
|
-
return
|
|
594
|
+
toList(t, e = 2) {
|
|
595
|
+
console.log(t, e);
|
|
596
|
+
const r = {};
|
|
597
|
+
for (let s = 0; s < e; s++)
|
|
598
|
+
r[s] = [];
|
|
599
|
+
t.forEach((s, l) => r[l % e].push(s));
|
|
600
|
+
const o = [];
|
|
601
|
+
for (const s in r)
|
|
602
|
+
o.push(...r[s]);
|
|
603
|
+
return o;
|
|
548
604
|
}
|
|
549
605
|
};
|
|
550
606
|
export {
|
|
607
|
+
L as MoneyFormatter,
|
|
551
608
|
A as arrayUtils,
|
|
552
609
|
j as base64Utils,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
610
|
+
x as booleanUtils,
|
|
611
|
+
C as cookieUtils,
|
|
612
|
+
_ as dateUtils,
|
|
613
|
+
N as downloadUtils,
|
|
614
|
+
B as elementUtils,
|
|
615
|
+
I as letterUtils,
|
|
616
|
+
T as numberUtils,
|
|
617
|
+
v as objectUtils,
|
|
618
|
+
F as phoneUtils,
|
|
619
|
+
P as randomUtils,
|
|
620
|
+
k as storageUtils,
|
|
564
621
|
R as stringUtils,
|
|
565
|
-
|
|
566
|
-
|
|
622
|
+
$ as urlUtils,
|
|
623
|
+
D as waterfallUtils
|
|
567
624
|
};
|
package/dist/utils.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(o,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(o=typeof globalThis<"u"?globalThis:o||self,p(o.yhkitUtils={}))})(this,function(o){"use strict";const m=Object.assign({unique(t){return t?Array.from(new Set(t)):[]},isExist(t,e){return!t||!e?!1:t.indexOf(e)!==-1},countOfAppear(t,e){let r=0;for(const n of t)n===e&&r++;return r},sort(t,e="asc"){return t?t.sort((r,n)=>e==="asc"?r>n?1:-1:r<n?1:-1):[]},shuffle(t){if(!t)return[];for(let e=t.length-1;e>0;e--){const r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}return t}},{...Object.freeze(Object.defineProperty({__proto__:null,toEnumObj:t=>{if(!t||!t.length)return{};const e={};return t.forEach(r=>{const n=Object.assign({label:r.label,text:r.label},r);e[r==null?void 0:r.value]=n}),e}},Symbol.toStringTag,{value:"Module"}))}),w={toBlob(t,e="",r=512){const i=(t.split(",")[1]||t).replace(/-/g,"+").replace(/_/g,"/"),u="=".repeat((4-i.length%4)%4),g=i+u;try{const c=atob(g),h=[];for(let f=0;f<c.length;f+=r){const s=c.slice(f,f+r),a=new Array(s.length);for(let l=0;l<s.length;l++)a[l]=s.charCodeAt(l);const d=new Uint8Array(a);h.push(d)}return new Blob(h,{type:e})}catch(c){return console.error("Failed to convert base64 to blob:",c),null}},toFile(t,e="file.txt",r="text/plain"){const i=t.replace(/^data:.+;base64,/,"").replace(/-/g,"+").replace(/_/g,"/"),u="=".repeat((4-i.length%4)%4),g=i+u,c=atob(g),h=[];for(let s=0;s<c.length;s+=512){const a=c.slice(s,s+512),d=new Array(a.length);for(let l=0;l<a.length;l++)d[l]=a.charCodeAt(l);h.push(new Uint8Array(d))}const f=new Blob(h,{type:r});return new File([f],e,{type:r})}},U={isEmptyString(t){return typeof t=="string"&&t.trim()===""},isNumber(t){return typeof t=="number"&&!isNaN(t)},isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)},isEmptyObject(t){return t?Object.keys(t).length===0&&t.constructor===Object:!0},isBoolean(t){return typeof t=="boolean"},isArray(t){return Array.isArray(t)},isFunction(t){return typeof t=="function"},isPromise(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"},isElement(t){return t instanceof Element},isPhone(t){return/^1[3-9]\d{9}$/.test(t)},isEmail(t){return/^[\w.-]+@[\w.-]+\.\w+$/.test(t)},isJSON(t){try{return JSON.parse(t),!0}catch{return!1}},isImageLoaded(t){return t.complete&&t.naturalWidth!==0},isInViewport(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=window.innerHeight&&e.right<=window.innerWidth},isLeapYear(t){return t%4===0&&t%100!==0||t%400===0},isMobile(){return/Mobi|Android|iPhone/i.test(navigator.userAgent)}},S={getCookie(t){if(!t)return;const e=document.cookie.match(new RegExp("(^| )"+t+"=([^;]+)"));return e?decodeURIComponent(e[2]):null},setCookie(t,e,r=7){const n=new Date;n.setTime(n.getTime()+r*24*60*60*1e3),document.cookie=`${t}=${encodeURIComponent(e)};expires=${n.toUTCString()};path=/`},deleteCookie(t){this.setCookie(t,"",-1)}},O={getTimeString(t,e=!1){return e?new Date().toLocaleString(t,{hour12:!0}):new Date().toLocaleString("chinese",{hour12:!1})},diffDays(t,e){const r=new Date(t).getTime(),n=new Date(e).getTime();return r>n?Math.abs(Math.floor((r-n)/(24*3600*1e3))):Math.abs(Math.floor((n-r)/(24*3600*1e3)))},uniqueId(){return Date.now().toString(36)+Math.random().toString(36).substr(2,5)}},M={saveAsBlob(t,e){const r=document.createElement("a"),n=window.URL.createObjectURL(t);r.href=n,r.download=e,document.body.appendChild(r),r.click(),URL.revokeObjectURL(n),document.body.removeChild(r)}},j={getOffsetTop(t){if(!t)throw new Error("Element is not provided");if(t instanceof SVGElement){const r=t.getBoundingClientRect(),n=window.pageYOffset||document.documentElement.scrollTop;return r.top+n}let e=0;for(;t;)e+=t.offsetTop,t=t.offsetParent;return e}},E={sortFromA2Z(t){return t!=null&&t.length?t.sort((r,n)=>{const i=r.toUpperCase(),u=n.toUpperCase();return i<u?-1:i>u?1:0}):void 0}};class A{static toStandardFormat(e){try{const r=typeof e=="string"?parseFloat(e):e;if(isNaN(r))throw new Error("输入不是有效的数字");if(!isFinite(r))throw new Error("输入是无穷大");return r.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}catch(r){return console.error("格式化失败:",r),"格式错误"}}static toChineseFormat(e){try{const r=typeof e=="string"?parseFloat(e):e;if(isNaN(r))throw new Error("输入不是有效的数字");if(r>9999999999999e-2||r<-9999999999999e-2)throw new Error("输入数字超出范围");const n=r<0,i=Math.abs(r),u=Math.floor(i),g=Math.round((i-u)*100),c=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],h=["","拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟"],f=["角","分"];let s="",a=u;if(a===0)s=c[0];else{let y=0;for(;a>0;){const b=a%10;b!==0?s=c[b]+h[y]+s:s.charAt(0)!==c[0]&&(s=c[b]+s),a=Math.floor(a/10),y++}s=s.replace(/零+/g,"零"),s=s.replace(/零+$/,"")}let d="";if(g>0){const y=Math.floor(g/10),b=g%10;y>0&&(d+=c[y]+f[0]),b>0&&(d+=c[b]+f[1])}else d="整";let l=(n?"负":"")+s+"圆"+d;return l==="零圆整"&&(l="零圆"),l}catch(r){return console.error("转换失败:",r),"格式错误"}}}const C={...Object.freeze(Object.defineProperty({__proto__:null,toLetter:t=>t>25||t<0?"":"ABCDEFGHIJKLMNOPQRSTUVWXYZ"[t]},Symbol.toStringTag,{value:"Module"})),...Object.freeze(Object.defineProperty({__proto__:null,toMoney:t=>t.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},Symbol.toStringTag,{value:"Module"})),isNumber(t){return typeof t=="number"&&!isNaN(t)}},_={isEmptyObject(t){return t?Object.keys(t).length===0&&t.constructor===Object:!0}},N={desensitize(t){return t?t.replace(/^(\d{3})\d{4}(\d{4})$/,"$1****$2")||t.slice(0,3)+"****"+t.slice(7):""}},T={color:function(){return`#${Math.random().toString(16).slice(2,8)}`},int(t,e){return Math.floor(Math.random()*(e-t+1))+t},uniqueId(){return Date.now().toString(36)+Math.random().toString(36).substr(2,5)}},B={getLocal(t){return localStorage.getItem(t)},setLocal(t,e){localStorage.setItem(t,e)},removeLocal(t){localStorage.removeItem(t)},getSession(t){return sessionStorage.getItem(t)},setSession(t,e){sessionStorage.setItem(t,e)},removeSession(t){sessionStorage.removeItem(t)}},I={isExist(t,e){if(!t||!e)return!1;const r=t.split(",");return console.log("判断某元素是否在字符串中",r.indexOf(e)===-1),r.indexOf(e)!==-1},includes(t,e){return!t||!e?!1:t.includes(e)},isJSON(t){try{return JSON.parse(t),!0}catch{return!1}}},L=t=>{const r=new RegExp("[?&]"+t+"=([^&#]*)","i").exec(window.location.href);return r?decodeURIComponent(r[1]):null};function k(t){return new URLSearchParams(window.location.search).get(t)}const v={...Object.freeze(Object.defineProperty({__proto__:null,getQueryInfoByName:L,getQueryParam:k},Symbol.toStringTag,{value:"Module"})),getHost(){return window.location.host},getPath(){return window.location.pathname}},F={toList(t,e=2){console.log(t,e);const r={};for(let i=0;i<e;i++)r[i]=[];t.forEach((i,u)=>r[u%e].push(i));const n=[];for(const i in r)n.push(...r[i]);return n}};o.MoneyFormatter=A,o.arrayUtils=m,o.base64Utils=w,o.booleanUtils=U,o.cookieUtils=S,o.dateUtils=O,o.downloadUtils=M,o.elementUtils=j,o.letterUtils=E,o.numberUtils=C,o.objectUtils=_,o.phoneUtils=N,o.randomUtils=T,o.storageUtils=B,o.stringUtils=I,o.urlUtils=v,o.waterfallUtils=F,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 金额格式化工具类
|
|
3
|
+
*/
|
|
4
|
+
export declare class MoneyFormatter {
|
|
5
|
+
/**
|
|
6
|
+
* 转换为标准金额格式(带千分位和两位小数)
|
|
7
|
+
* @param num 要转换的数字
|
|
8
|
+
* @returns 格式化后的字符串
|
|
9
|
+
*/
|
|
10
|
+
static toStandardFormat(num: number | string): string;
|
|
11
|
+
/**
|
|
12
|
+
* 转换为中文大写金额
|
|
13
|
+
* @param num 要转换的数字
|
|
14
|
+
* @returns 中文大写金额字符串
|
|
15
|
+
*/
|
|
16
|
+
static toChineseFormat(num: number | string): string;
|
|
17
|
+
}
|