@jhqn/utils-core 0.0.3-beta.7 → 0.0.3
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/index.cjs +138 -135
- package/dist/index.d.cts +270 -170
- package/dist/index.d.mts +270 -170
- package/dist/index.d.ts +270 -170
- package/dist/index.mjs +125 -131
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -7,6 +7,90 @@ import { ConfigType } from 'dayjs';
|
|
|
7
7
|
export { Dayjs, default as dayjs } from 'dayjs';
|
|
8
8
|
export { detect } from 'detect-browser';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 数字或字符串
|
|
12
|
+
*/
|
|
13
|
+
type Numeric = number | string;
|
|
14
|
+
/**
|
|
15
|
+
* 可 Null
|
|
16
|
+
*/
|
|
17
|
+
type Nullable<T> = T | null;
|
|
18
|
+
/**
|
|
19
|
+
* 可 Undefined
|
|
20
|
+
*/
|
|
21
|
+
type Undefinable<T> = T | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* 可 Null 或 Undefined
|
|
24
|
+
*/
|
|
25
|
+
type NullOrUndefinable<T> = Nullable<Undefinable<T>>;
|
|
26
|
+
/**
|
|
27
|
+
* alias for NullOrUndefinable
|
|
28
|
+
*/
|
|
29
|
+
type UnDef<T> = NullOrUndefinable<T>;
|
|
30
|
+
/**
|
|
31
|
+
* 请求结果
|
|
32
|
+
*/
|
|
33
|
+
type Res<T = any> = Service.Response<T>;
|
|
34
|
+
/**
|
|
35
|
+
* 分页请求结果数据
|
|
36
|
+
*/
|
|
37
|
+
type PageResData<T = any> = Service.PageResponseData<T>;
|
|
38
|
+
/**
|
|
39
|
+
* 分页请求结果
|
|
40
|
+
*/
|
|
41
|
+
type PageRes<T = any> = Service.PageResponse<T>;
|
|
42
|
+
/**
|
|
43
|
+
* 分页请求参数
|
|
44
|
+
*/
|
|
45
|
+
type PageReq<T extends Record<string, any> = NonNullable<unknown>> = Service.PageRequestParams<T>;
|
|
46
|
+
/**
|
|
47
|
+
* 可能是数组
|
|
48
|
+
*/
|
|
49
|
+
type MaybeArray<T = any> = T | Array<T>;
|
|
50
|
+
/**
|
|
51
|
+
* 枚举键值对
|
|
52
|
+
*/
|
|
53
|
+
type VK<T = string> = Record<string | number, T>;
|
|
54
|
+
/**
|
|
55
|
+
* 字典
|
|
56
|
+
*/
|
|
57
|
+
type Dict<T = string> = Record<string, T>;
|
|
58
|
+
/**
|
|
59
|
+
* 使某键可选
|
|
60
|
+
*/
|
|
61
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
62
|
+
|
|
63
|
+
interface HostEnv {
|
|
64
|
+
/**
|
|
65
|
+
* 是否是浙里办
|
|
66
|
+
*/
|
|
67
|
+
readonly zlb: boolean
|
|
68
|
+
/**
|
|
69
|
+
* 是否是专有钉
|
|
70
|
+
*/
|
|
71
|
+
readonly zyd: boolean
|
|
72
|
+
/**
|
|
73
|
+
* 是否是浙政钉
|
|
74
|
+
*/
|
|
75
|
+
readonly zzd: boolean
|
|
76
|
+
/**
|
|
77
|
+
* 是否是钉钉/专有钉/浙政钉
|
|
78
|
+
*/
|
|
79
|
+
readonly dd: boolean
|
|
80
|
+
/**
|
|
81
|
+
* 是否是微信
|
|
82
|
+
*/
|
|
83
|
+
readonly wx: boolean
|
|
84
|
+
/**
|
|
85
|
+
* 是否是支付宝
|
|
86
|
+
*/
|
|
87
|
+
readonly zfb: boolean
|
|
88
|
+
/**
|
|
89
|
+
* 是否是小程序
|
|
90
|
+
*/
|
|
91
|
+
readonly mini: boolean
|
|
92
|
+
}
|
|
93
|
+
|
|
10
94
|
/**
|
|
11
95
|
* snake2Kebab
|
|
12
96
|
* @param {string} str 字符串
|
|
@@ -217,150 +301,129 @@ declare const jLogDedupe: (...args: any[]) => void;
|
|
|
217
301
|
*/
|
|
218
302
|
declare const jLogOnce: (...args: any[]) => void;
|
|
219
303
|
|
|
220
|
-
/**
|
|
221
|
-
* 数字或字符串
|
|
222
|
-
*/
|
|
223
|
-
type Numeric = number | string;
|
|
224
|
-
/**
|
|
225
|
-
* 可 Null
|
|
226
|
-
*/
|
|
227
|
-
type Nullable<T> = T | null;
|
|
228
|
-
/**
|
|
229
|
-
* 可 Undefined
|
|
230
|
-
*/
|
|
231
|
-
type Undefinable<T> = T | undefined;
|
|
232
|
-
/**
|
|
233
|
-
* 可 Null 或 Undefined
|
|
234
|
-
*/
|
|
235
|
-
type NullOrUndefinable<T> = Nullable<Undefinable<T>>;
|
|
236
|
-
/**
|
|
237
|
-
* alias for NullOrUndefinable
|
|
238
|
-
*/
|
|
239
|
-
type UnDef<T> = NullOrUndefinable<T>;
|
|
240
|
-
/**
|
|
241
|
-
* 请求结果
|
|
242
|
-
*/
|
|
243
|
-
type Res<T = any> = Service.Response<T>;
|
|
244
|
-
/**
|
|
245
|
-
* 分页请求结果数据
|
|
246
|
-
*/
|
|
247
|
-
type PageResData<T = any> = Service.PageResponseData<T>;
|
|
248
|
-
/**
|
|
249
|
-
* 分页请求结果
|
|
250
|
-
*/
|
|
251
|
-
type PageRes<T = any> = Service.PageResponse<T>;
|
|
252
|
-
/**
|
|
253
|
-
* 分页请求参数
|
|
254
|
-
*/
|
|
255
|
-
type PageReq<T extends Record<string, any> = NonNullable<unknown>> = Service.PageRequestParams<T>;
|
|
256
|
-
/**
|
|
257
|
-
* 可能是数组
|
|
258
|
-
*/
|
|
259
|
-
type MaybeArray<T = any> = T | Array<T>;
|
|
260
|
-
/**
|
|
261
|
-
* 枚举键值对
|
|
262
|
-
*/
|
|
263
|
-
type VK<T = string> = Record<string | number, T>;
|
|
264
|
-
/**
|
|
265
|
-
* 字典
|
|
266
|
-
*/
|
|
267
|
-
type Dict<T = string> = Record<string, T>;
|
|
268
|
-
/**
|
|
269
|
-
* 使某键可选
|
|
270
|
-
*/
|
|
271
|
-
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
272
|
-
|
|
273
304
|
/**
|
|
274
305
|
* 隐藏中间部分
|
|
275
306
|
* @param {string} str 需要隐藏的字符串
|
|
307
|
+
* @returns {string} 隐藏后的字符串
|
|
308
|
+
* @example
|
|
309
|
+
* ```ts
|
|
310
|
+
* hideMiddle('A') // '*'
|
|
311
|
+
* hideMiddle('AB') // '**'
|
|
312
|
+
* hideMiddle('ABC') // 'A*C'
|
|
313
|
+
* hideMiddle('ABCD') // 'A**D'
|
|
314
|
+
* hideMiddle('ABCDE') // 'A***E'
|
|
315
|
+
* ```
|
|
276
316
|
*/
|
|
277
317
|
declare const hideMiddle: (str: UnDef<string>) => string;
|
|
278
318
|
/**
|
|
279
319
|
* 隐藏首尾仅保留中间3分之1
|
|
280
320
|
* @param {string} str 需要隐藏的字符串
|
|
321
|
+
* @returns {string} 隐藏后的字符串
|
|
322
|
+
* @example
|
|
323
|
+
* ```ts
|
|
324
|
+
* hideThird('A') // '*'
|
|
325
|
+
* hideThird('AB') // '**'
|
|
326
|
+
* hideThird('ABC') // 'A*C'
|
|
327
|
+
* hideThird('ABCD') // 'A**D'
|
|
328
|
+
* hideThird('ABCDE') // 'AB*DE'
|
|
329
|
+
* ```
|
|
281
330
|
*/
|
|
282
331
|
declare const hideThird: (str: UnDef<string>) => string;
|
|
283
332
|
/**
|
|
284
333
|
* 隐藏首部
|
|
285
334
|
* @param {string} str 需要隐藏的字符串
|
|
286
335
|
* @param {number} count 隐藏的字符数
|
|
336
|
+
* @returns {string} 隐藏后的字符串
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* hideHead('A') // '*'
|
|
340
|
+
* hideHead('AB') // '*B'
|
|
341
|
+
* hideHead('ABC') // '**C'
|
|
342
|
+
* hideHead('ABC', 1) // '*BC'
|
|
343
|
+
* ```
|
|
287
344
|
*/
|
|
288
345
|
declare const hideHead: (str: UnDef<string>, count?: number) => string;
|
|
289
346
|
/**
|
|
290
347
|
* 隐藏尾部
|
|
291
348
|
* @param {string} str 需要隐藏的字符串
|
|
292
349
|
* @param {number} count 隐藏的字符数
|
|
350
|
+
* @returns {string} 隐藏后的字符串
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* hideTail('A') // '*'
|
|
354
|
+
* hideTail('AB') // 'A*'
|
|
355
|
+
* hideTail('ABC') // 'A**'
|
|
356
|
+
* hideTail('ABC', 1) // 'AB*'
|
|
357
|
+
* ```
|
|
293
358
|
*/
|
|
294
359
|
declare const hideTail: (str: UnDef<string>, count?: number) => string;
|
|
295
360
|
/**
|
|
296
|
-
*
|
|
297
|
-
* @param {string} phone
|
|
361
|
+
* 隐藏手机号/座机号
|
|
362
|
+
* @param {string} phone 手机号/座机号
|
|
363
|
+
* @returns {string} 隐藏后的手机号/座机号
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* hidePhone('13800138000') // '138****8000'
|
|
367
|
+
* hidePhone('010-12345678') // '010****5678'
|
|
368
|
+
* hidePhone('(010)12345678') // '(010)****5678'
|
|
369
|
+
* ```
|
|
298
370
|
*/
|
|
299
371
|
declare const hidePhone: (phone: UnDef<string>) => string;
|
|
300
372
|
/**
|
|
301
373
|
* 隐藏身份证号
|
|
302
374
|
* @param {string} cardNo 身份证号
|
|
303
375
|
* @param {boolean} strong 是否强化隐藏
|
|
376
|
+
* @returns {string} 隐藏后的身份证号
|
|
377
|
+
* @example
|
|
378
|
+
* ```ts
|
|
379
|
+
* hideCardNo('33072319641008384x') // '3****************x'
|
|
380
|
+
* hideCardNo('33072319641008384x', false) // '3***23196410*****x'
|
|
381
|
+
* ```
|
|
304
382
|
*/
|
|
305
383
|
declare const hideCardNo: (cardNo: UnDef<string>, strong?: boolean) => string;
|
|
306
|
-
/**
|
|
307
|
-
* 隐藏姓名第一个字
|
|
308
|
-
* @param {string} name 姓名
|
|
309
|
-
* @deprecated 请使用 hideSurname
|
|
310
|
-
*/
|
|
311
|
-
declare const hideName: (name: UnDef<string>) => string;
|
|
312
384
|
/**
|
|
313
385
|
* 隐藏姓氏
|
|
314
386
|
* @param {string} name 姓名
|
|
387
|
+
* @returns {string} 隐藏后的姓名
|
|
388
|
+
* @example
|
|
389
|
+
* ```ts
|
|
390
|
+
* hideSurname('张三') // '*三'
|
|
391
|
+
* hideSurname('司马懿') // '*马懿'
|
|
392
|
+
* ```
|
|
315
393
|
*/
|
|
316
394
|
declare const hideSurname: (name: UnDef<string>) => string;
|
|
317
395
|
/**
|
|
318
396
|
* 隐藏名字
|
|
319
397
|
* @param {string} name 姓名
|
|
398
|
+
* @returns {string} 隐藏后的姓名
|
|
399
|
+
* @example
|
|
400
|
+
* ```ts
|
|
401
|
+
* hideFirstName('张三') // '张*'
|
|
402
|
+
* hideFirstName('司马懿') // '司马*'
|
|
403
|
+
* ```
|
|
320
404
|
*/
|
|
321
405
|
declare const hideFirstName: (name: UnDef<string>) => string;
|
|
322
406
|
/**
|
|
323
407
|
* 隐藏邮箱
|
|
324
408
|
* @param {string} email 邮箱
|
|
409
|
+
* @returns {string} 隐藏后的邮箱
|
|
410
|
+
* @example
|
|
411
|
+
* ```ts
|
|
412
|
+
* hideEmail('example@hotmail.com') // 'exam***@hotmail.com'
|
|
413
|
+
* ```
|
|
325
414
|
*/
|
|
326
415
|
declare const hideEmail: (email: UnDef<string>) => string;
|
|
327
416
|
/**
|
|
328
417
|
* 隐藏银行卡号
|
|
329
418
|
* @param {string} bankCard 银行卡号
|
|
419
|
+
* @returns {string} 隐藏后的银行卡号
|
|
420
|
+
* @example
|
|
421
|
+
* ```ts
|
|
422
|
+
* hideBankCard('6222021001123456789') // '622202********6789'
|
|
423
|
+
* ```
|
|
330
424
|
*/
|
|
331
425
|
declare const hideBankCard: (bankCard: UnDef<string>) => string;
|
|
332
426
|
|
|
333
|
-
interface HostEnv {
|
|
334
|
-
/**
|
|
335
|
-
* 是否是浙里办
|
|
336
|
-
*/
|
|
337
|
-
readonly zlb: boolean
|
|
338
|
-
/**
|
|
339
|
-
* 是否是专有钉
|
|
340
|
-
*/
|
|
341
|
-
readonly zyd: boolean
|
|
342
|
-
/**
|
|
343
|
-
* 是否是浙政钉
|
|
344
|
-
*/
|
|
345
|
-
readonly zzd: boolean
|
|
346
|
-
/**
|
|
347
|
-
* 是否是钉钉/专有钉/浙政钉
|
|
348
|
-
*/
|
|
349
|
-
readonly dd: boolean
|
|
350
|
-
/**
|
|
351
|
-
* 是否是微信
|
|
352
|
-
*/
|
|
353
|
-
readonly wx: boolean
|
|
354
|
-
/**
|
|
355
|
-
* 是否是支付宝
|
|
356
|
-
*/
|
|
357
|
-
readonly zfb: boolean
|
|
358
|
-
/**
|
|
359
|
-
* 是否是小程序
|
|
360
|
-
*/
|
|
361
|
-
readonly mini: boolean
|
|
362
|
-
}
|
|
363
|
-
|
|
364
427
|
/**
|
|
365
428
|
* 判断是否是浏览器环境
|
|
366
429
|
*/
|
|
@@ -409,23 +472,52 @@ declare const getCodeOfDate: () => number;
|
|
|
409
472
|
declare const getCodeOfMonth: () => number;
|
|
410
473
|
|
|
411
474
|
/**
|
|
412
|
-
*
|
|
413
|
-
* @param
|
|
414
|
-
|
|
475
|
+
* 设置文件基本路径
|
|
476
|
+
* @param baseUrl
|
|
477
|
+
*/
|
|
478
|
+
declare function setBaseAttachUrl(baseUrl: string): void;
|
|
479
|
+
/**
|
|
480
|
+
* 获取文件基本路径
|
|
415
481
|
*/
|
|
416
|
-
declare
|
|
482
|
+
declare function getBaseAttachUrl(): string;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* JSON 字符串转对象
|
|
486
|
+
* @template T - 解析数据类型
|
|
487
|
+
* @param {string} str - JSON字符串
|
|
488
|
+
* @param {(this: any, key: string, value: any) => any} reviverFn - 解析函数
|
|
489
|
+
* @returns {Nullable<T>} 解析后的对象
|
|
490
|
+
* @deprecated 请使用 `parseJSON`
|
|
491
|
+
*/
|
|
492
|
+
declare function parseToJSON<T = any>(str: string, reviverFn?: (this: any, key: string, value: any) => any): Nullable<T>;
|
|
493
|
+
/**
|
|
494
|
+
* JSON 字符串转对象
|
|
495
|
+
* @alias parseToJSON
|
|
496
|
+
* @template T - 解析数据类型
|
|
497
|
+
* @param {string} str - JSON字符串
|
|
498
|
+
* @param {(this: any, key: string, value: any) => any} reviverFn - 解析函数
|
|
499
|
+
* @returns {Nullable<T>} 解析后的对象
|
|
500
|
+
*/
|
|
501
|
+
declare function parseJSON<T = any>(str: string, reviverFn?: (this: any, key: string, value: any) => any): Nullable<T>;
|
|
502
|
+
/**
|
|
503
|
+
* 对象转 JSON 字符串
|
|
504
|
+
* @param {any} value - 对象
|
|
505
|
+
* @param {(this: any, key: string, value: any) => any} replacerFn - 替换函数
|
|
506
|
+
* @returns {string} JSON 字符串
|
|
507
|
+
*/
|
|
508
|
+
declare function stringifyJSON(value: any, replacerFn?: (this: any, key: string, value: any) => any): string;
|
|
417
509
|
/**
|
|
418
510
|
* JSON.stringify() second param
|
|
419
|
-
* @param
|
|
511
|
+
* @param _key
|
|
420
512
|
* @param value
|
|
421
513
|
*/
|
|
422
|
-
declare
|
|
514
|
+
declare function replacer(_key: any, value: any): any;
|
|
423
515
|
/**
|
|
424
516
|
* JSON.parse() second param
|
|
425
|
-
* @param
|
|
517
|
+
* @param _key
|
|
426
518
|
* @param value
|
|
427
519
|
*/
|
|
428
|
-
declare
|
|
520
|
+
declare function reviver(_key: any, value: any): any;
|
|
429
521
|
/**
|
|
430
522
|
* 过滤obj中仅包括keys的部分
|
|
431
523
|
* @param {Record<string,any>} obj 对象
|
|
@@ -436,13 +528,25 @@ declare const filterObj: (obj: Record<string, any>, keys: string[], reverse?: bo
|
|
|
436
528
|
[k: string]: any;
|
|
437
529
|
};
|
|
438
530
|
|
|
531
|
+
/**
|
|
532
|
+
* 千位分隔符
|
|
533
|
+
* @param num
|
|
534
|
+
*/
|
|
535
|
+
declare const toThousands: (num: number) => string | undefined;
|
|
536
|
+
/**
|
|
537
|
+
* 货币格式化
|
|
538
|
+
* @param {number | string | bigint} currency - 金额
|
|
539
|
+
* @param {number} [maximumFractionDigits] - 小数位数
|
|
540
|
+
*/
|
|
541
|
+
declare const currencyFmt: (currency: UnDef<Numeric | bigint>, maximumFractionDigits?: number) => string;
|
|
542
|
+
|
|
439
543
|
/**
|
|
440
544
|
* 格式化时间
|
|
441
545
|
* @param {import('dayjs').ConfigType} date 时间
|
|
442
546
|
* @param {string} format 格式
|
|
443
547
|
* @returns {string} 格式化后的时间
|
|
444
548
|
*/
|
|
445
|
-
declare const dateFmt: (date: ConfigType, format?: string |
|
|
549
|
+
declare const dateFmt: (date: ConfigType, format?: string | "date" | "datetime") => string;
|
|
446
550
|
/**
|
|
447
551
|
* 格式化时间间隔
|
|
448
552
|
* @param {import('dayjs').ConfigType} start 开始时间
|
|
@@ -450,28 +554,6 @@ declare const dateFmt: (date: ConfigType, format?: string | 'date' | 'datetime')
|
|
|
450
554
|
*/
|
|
451
555
|
declare const dateDuration: (start: ConfigType, end: ConfigType) => string;
|
|
452
556
|
|
|
453
|
-
/**
|
|
454
|
-
* 设置文件基本路径
|
|
455
|
-
* @param baseUrl
|
|
456
|
-
*/
|
|
457
|
-
declare function setBaseAttachUrl(baseUrl: string): void;
|
|
458
|
-
/**
|
|
459
|
-
* 获取文件基本路径
|
|
460
|
-
*/
|
|
461
|
-
declare function getBaseAttachUrl(): string;
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* 千位分隔符
|
|
465
|
-
* @param num
|
|
466
|
-
*/
|
|
467
|
-
declare const toThousands: (num: number) => string | undefined;
|
|
468
|
-
/**
|
|
469
|
-
* 货币格式化
|
|
470
|
-
* @param {number | string | bigint} currency - 金额
|
|
471
|
-
* @param {number} [maximumFractionDigits] - 小数位数
|
|
472
|
-
*/
|
|
473
|
-
declare const currencyFmt: (currency: UnDef<Numeric | bigint>, maximumFractionDigits?: number) => string;
|
|
474
|
-
|
|
475
557
|
type VantUploadFileStatus = '' | 'uploading' | 'done' | 'failed'
|
|
476
558
|
type AntdUploadFileStatus = 'removed' | 'uploading' | 'done' | 'error'
|
|
477
559
|
type ElementPlusUploadFileStatus = 'ready' | 'uploading' | 'success' | 'fail'
|
|
@@ -520,16 +602,16 @@ declare const recoverFile: (resource: Resource) => {
|
|
|
520
602
|
group: string;
|
|
521
603
|
id: string;
|
|
522
604
|
name: string;
|
|
523
|
-
size?: number
|
|
524
|
-
uid?: string
|
|
525
|
-
objectUrl?: string
|
|
526
|
-
isImage?: boolean
|
|
527
|
-
message?: string
|
|
528
|
-
deletable?: boolean
|
|
529
|
-
reupload?: boolean
|
|
530
|
-
fileName?: string
|
|
531
|
-
thumbUrl?: string
|
|
532
|
-
percentage?: number
|
|
605
|
+
size?: number;
|
|
606
|
+
uid?: string;
|
|
607
|
+
objectUrl?: string;
|
|
608
|
+
isImage?: boolean;
|
|
609
|
+
message?: string;
|
|
610
|
+
deletable?: boolean;
|
|
611
|
+
reupload?: boolean;
|
|
612
|
+
fileName?: string;
|
|
613
|
+
thumbUrl?: string;
|
|
614
|
+
percentage?: number;
|
|
533
615
|
};
|
|
534
616
|
/**
|
|
535
617
|
* 附件格式
|
|
@@ -544,16 +626,16 @@ declare const attachFmt: (data: UnDef<MaybeArray<Resource>> | string) => {
|
|
|
544
626
|
group: string;
|
|
545
627
|
id: string;
|
|
546
628
|
name: string;
|
|
547
|
-
size?: number
|
|
548
|
-
uid?: string
|
|
549
|
-
objectUrl?: string
|
|
550
|
-
isImage?: boolean
|
|
551
|
-
message?: string
|
|
552
|
-
deletable?: boolean
|
|
553
|
-
reupload?: boolean
|
|
554
|
-
fileName?: string
|
|
555
|
-
thumbUrl?: string
|
|
556
|
-
percentage?: number
|
|
629
|
+
size?: number;
|
|
630
|
+
uid?: string;
|
|
631
|
+
objectUrl?: string;
|
|
632
|
+
isImage?: boolean;
|
|
633
|
+
message?: string;
|
|
634
|
+
deletable?: boolean;
|
|
635
|
+
reupload?: boolean;
|
|
636
|
+
fileName?: string;
|
|
637
|
+
thumbUrl?: string;
|
|
638
|
+
percentage?: number;
|
|
557
639
|
}[];
|
|
558
640
|
|
|
559
641
|
/**
|
|
@@ -619,7 +701,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
|
|
|
619
701
|
* 是否是数组
|
|
620
702
|
* @param {any} val 检测的目标
|
|
621
703
|
*/
|
|
622
|
-
declare const isArray: (val: any) => val is any
|
|
704
|
+
declare const isArray: (val: any) => val is Array<any>;
|
|
623
705
|
/**
|
|
624
706
|
* 是否是函数,但也有可能是Class
|
|
625
707
|
* @param {any} val 检测的目标
|
|
@@ -707,38 +789,30 @@ declare const isArrStr: (str: UnDef<string>) => boolean;
|
|
|
707
789
|
* ```
|
|
708
790
|
* @returns {boolean} boolean
|
|
709
791
|
*/
|
|
710
|
-
declare const isValidKey: (key: string | number | symbol, object: object) => key is
|
|
792
|
+
declare const isValidKey: (key: string | number | symbol, object: object) => key is keyof typeof object;
|
|
711
793
|
/**
|
|
712
794
|
* 是否是空值/空数组/空对象 null undefined '' [] {} Set Map
|
|
713
795
|
* @param val
|
|
714
796
|
*/
|
|
715
797
|
declare const isEmpty: (val: UnDef<Numeric | boolean | Record<any, any> | Array<any> | Set<any> | Map<any, any>>) => boolean;
|
|
716
798
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
declare const
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
*
|
|
726
|
-
* @
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
*
|
|
731
|
-
* @
|
|
732
|
-
* @param code
|
|
799
|
+
declare const cnPhoneRE: RegExp;
|
|
800
|
+
declare const cnTelRE: RegExp;
|
|
801
|
+
declare const cnTelRE2: RegExp;
|
|
802
|
+
declare const cnUSCIRE: RegExp;
|
|
803
|
+
declare const cnIdCard15Re: RegExp;
|
|
804
|
+
declare const cnIdCard18Re: RegExp;
|
|
805
|
+
declare const emailRE: RegExp;
|
|
806
|
+
/**
|
|
807
|
+
* 是否是[统一社会信用代码](https://zh.wikipedia.org/zh-cn/%E7%BB%9F%E4%B8%80%E7%A4%BE%E4%BC%9A%E4%BF%A1%E7%94%A8%E4%BB%A3%E7%A0%81)
|
|
808
|
+
* @example
|
|
809
|
+
* ```ts
|
|
810
|
+
* isUSCI('91350100M000100Y43') // true
|
|
811
|
+
* ```
|
|
812
|
+
* @param {UnDef<string>} val - 待校验的值
|
|
813
|
+
* @returns {boolean} 是否是统一社会信用代码
|
|
733
814
|
*/
|
|
734
|
-
declare const
|
|
735
|
-
/**
|
|
736
|
-
* 校验接口分页返回内容
|
|
737
|
-
* @param res
|
|
738
|
-
* @param code
|
|
739
|
-
*/
|
|
740
|
-
declare const isValidPageRes: (res: PageRes, code?: number) => boolean;
|
|
741
|
-
|
|
815
|
+
declare const isUSCI: (val: UnDef<string>) => boolean;
|
|
742
816
|
/**
|
|
743
817
|
* 是否是中国手机号
|
|
744
818
|
* @param val
|
|
@@ -783,4 +857,30 @@ declare const nonASCII: (text: string) => boolean;
|
|
|
783
857
|
*/
|
|
784
858
|
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
785
859
|
|
|
786
|
-
|
|
860
|
+
/**
|
|
861
|
+
* 校验接口返回code
|
|
862
|
+
* @param res
|
|
863
|
+
* @param code
|
|
864
|
+
*/
|
|
865
|
+
declare const isValidResCode: (res: Res, code?: number) => boolean;
|
|
866
|
+
/**
|
|
867
|
+
* 校验接口返回内容
|
|
868
|
+
* @param res
|
|
869
|
+
* @param code
|
|
870
|
+
*/
|
|
871
|
+
declare const isValidRes: (res: Res, code?: number) => boolean;
|
|
872
|
+
/**
|
|
873
|
+
* 校验接口数组返回内容
|
|
874
|
+
* @param res
|
|
875
|
+
* @param code
|
|
876
|
+
*/
|
|
877
|
+
declare const isValidArrRes: (res: Res<any[]>, code?: number) => boolean;
|
|
878
|
+
/**
|
|
879
|
+
* 校验接口分页返回内容
|
|
880
|
+
* @param res
|
|
881
|
+
* @param code
|
|
882
|
+
*/
|
|
883
|
+
declare const isValidPageRes: (res: PageRes, code?: number) => boolean;
|
|
884
|
+
|
|
885
|
+
export { attachFmt, camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, cnIdCard15Re, cnIdCard18Re, cnPhoneRE, cnTelRE, cnTelRE2, cnUSCIRE, currencyFmt, dateDuration, dateFmt, emailRE, filterObj, fixiOSInputAutoZoomIn, getBaseAttachUrl, getCodeOfDate, getCodeOfHour, getCodeOfMonth, getHostEnv, getVariableType, hideBankCard, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hidePhone, hideSurname, hideTail, hideThird, inBrowser, isArrStr, isArray, isBigInt, isBlob, isBoolean, isDate, isDef, isEmail, isEmpty, isError, isFile, isFunction, isIdCard, isJSONStr, isMap, isNull, isNumber, isNumeric, isObject, isPhone, isPromise, isRegExp, isSet, isString, isSymbol, isTel, isURL, isUSCI, isUndefined, isValidArrRes, isValidFileType, isValidKey, isValidPageRes, isValidRes, isValidResCode, isWeakMap, isWeakSet, jClear, jDebug, jError, jGroup, jGroupC, jGroupE, jInfo, jLog, jLogDedupe, jLogOnce, jTime, jTimeEnd, jWarn, kebab2Camel, kebab2Pascal, kebab2Snake, kebab2Title, naturalSort, naturalSortBy, nonASCII, parseJSON, parseToJSON, pascal2Camel, pascal2Kebab, pascal2Snake, pascal2Title, recoverFile, replacer, resUrl, reviver, setBaseAttachUrl, snake2Camel, snake2Kebab, snake2Pascal, snake2Title, stringifyJSON, title2Camel, title2Kebab, title2Pascal, title2Snake, toThousands, userAgent, waitTime };
|
|
886
|
+
export type { Dict, HostEnv, MaybeArray, NullOrUndefinable, Nullable, Numeric, PageReq, PageRes, PageResData, PartialBy, Res, UnDef, Undefinable, VK };
|