@jhqn/utils-core 0.0.1-beta.9 → 0.0.2-beta.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/index.cjs +406 -41
- package/dist/index.d.cts +862 -0
- package/dist/index.d.mts +862 -0
- package/dist/index.d.ts +577 -22
- package/dist/index.mjs +347 -42
- package/package.json +13 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/// <reference types="dayjs/plugin/localeData" />
|
|
2
|
+
/// <reference types="dayjs/plugin/duration" />
|
|
3
|
+
/// <reference types="dayjs/plugin/relativeTime" />
|
|
4
|
+
/// <reference types="dayjs/plugin/customParseFormat" />
|
|
5
|
+
/// <reference types="dayjs/plugin/objectSupport" />
|
|
6
|
+
import * as detect_browser from 'detect-browser';
|
|
7
|
+
import { ConfigType } from 'dayjs';
|
|
8
|
+
export { Dayjs, default as dayjs } from 'dayjs';
|
|
9
|
+
|
|
1
10
|
/**
|
|
2
11
|
* snake2Kebab
|
|
3
12
|
* @param {string} str 字符串
|
|
@@ -212,39 +221,289 @@ declare type Undefinable<T> = T | undefined;
|
|
|
212
221
|
* 可 Null 或 Undefined
|
|
213
222
|
*/
|
|
214
223
|
declare type NullOrUndefinable<T> = Nullable<Undefinable<T>>;
|
|
224
|
+
/**
|
|
225
|
+
* alias for NullOrUndefinable
|
|
226
|
+
*/
|
|
227
|
+
declare type UnDef<T> = NullOrUndefinable<T>;
|
|
228
|
+
/**
|
|
229
|
+
* 请求结果
|
|
230
|
+
*/
|
|
231
|
+
declare type Res<T = any> = Service.Response<T>;
|
|
232
|
+
/**
|
|
233
|
+
* 分页请求结果数据
|
|
234
|
+
*/
|
|
235
|
+
declare type PageResData<T = any> = Service.PageResponseData<T>;
|
|
236
|
+
/**
|
|
237
|
+
* 分页请求结果
|
|
238
|
+
*/
|
|
239
|
+
declare type PageRes<T = any> = Service.PageResponse<T>;
|
|
240
|
+
/**
|
|
241
|
+
* 可能是数组
|
|
242
|
+
*/
|
|
243
|
+
declare type MaybeArray<T = any> = T | Array<T>;
|
|
215
244
|
|
|
245
|
+
/**
|
|
246
|
+
* 隐藏中间部分
|
|
247
|
+
* @param {string} str 需要隐藏的字符串
|
|
248
|
+
*/
|
|
249
|
+
declare const hideMiddle: (str: UnDef<string>) => string;
|
|
250
|
+
/**
|
|
251
|
+
* 隐藏首尾仅保留中间3分之1
|
|
252
|
+
* @param {string} str 需要隐藏的字符串
|
|
253
|
+
*/
|
|
254
|
+
declare const hideThird: (str: UnDef<string>) => string;
|
|
255
|
+
/**
|
|
256
|
+
* 隐藏首部
|
|
257
|
+
* @param {string} str 需要隐藏的字符串
|
|
258
|
+
* @param {number} count 隐藏的字符数
|
|
259
|
+
*/
|
|
260
|
+
declare const hideHead: (str: UnDef<string>, count?: number) => string;
|
|
261
|
+
/**
|
|
262
|
+
* 隐藏尾部
|
|
263
|
+
* @param {string} str 需要隐藏的字符串
|
|
264
|
+
* @param {number} count 隐藏的字符数
|
|
265
|
+
*/
|
|
266
|
+
declare const hideTail: (str: UnDef<string>, count?: number) => string;
|
|
216
267
|
/**
|
|
217
268
|
* 隐藏手机号
|
|
218
|
-
* @param
|
|
269
|
+
* @param {string} phone 手机号
|
|
219
270
|
*/
|
|
220
|
-
declare const hidePhone: (
|
|
271
|
+
declare const hidePhone: (phone: UnDef<string>) => string;
|
|
221
272
|
/**
|
|
222
273
|
* 隐藏身份证号
|
|
223
|
-
* @param cardNo
|
|
274
|
+
* @param {string} cardNo 身份证号
|
|
275
|
+
* @param {boolean} strong 是否强化隐藏
|
|
224
276
|
*/
|
|
225
|
-
declare const hideCardNo: (cardNo:
|
|
277
|
+
declare const hideCardNo: (cardNo: UnDef<string>, strong?: boolean) => string;
|
|
226
278
|
/**
|
|
227
|
-
*
|
|
228
|
-
* @param name
|
|
279
|
+
* 隐藏姓名第一个字
|
|
280
|
+
* @param {string} name 姓名
|
|
281
|
+
* @deprecated 请使用 hideSurname
|
|
229
282
|
*/
|
|
230
|
-
declare const hideName: (name:
|
|
283
|
+
declare const hideName: (name: UnDef<string>) => string;
|
|
231
284
|
/**
|
|
232
|
-
*
|
|
233
|
-
* @param
|
|
285
|
+
* 隐藏姓氏
|
|
286
|
+
* @param {string} name 姓名
|
|
234
287
|
*/
|
|
235
|
-
declare const
|
|
288
|
+
declare const hideSurname: (name: UnDef<string>) => string;
|
|
236
289
|
/**
|
|
237
|
-
*
|
|
238
|
-
* @param
|
|
290
|
+
* 隐藏名字
|
|
291
|
+
* @param {string} name 姓名
|
|
292
|
+
*/
|
|
293
|
+
declare const hideFirstName: (name: UnDef<string>) => string;
|
|
294
|
+
/**
|
|
295
|
+
* 隐藏邮箱
|
|
296
|
+
* @param {string} email 邮箱
|
|
297
|
+
*/
|
|
298
|
+
declare const hideEmail: (email: UnDef<string>) => string;
|
|
299
|
+
/**
|
|
300
|
+
* 隐藏银行卡号
|
|
301
|
+
* @param {string} bankCard 银行卡号
|
|
239
302
|
*/
|
|
240
|
-
declare const
|
|
303
|
+
declare const hideBankCard: (bankCard: UnDef<string>) => string;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* 判断是否是浏览器环境
|
|
307
|
+
*/
|
|
308
|
+
declare const inBrowser: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* 等待一段时间
|
|
311
|
+
* @param time
|
|
312
|
+
*/
|
|
313
|
+
declare const waitTime: (time?: number) => Promise<unknown>;
|
|
314
|
+
/**
|
|
315
|
+
* 防止 iOS 因输入框字体小于16px 而在 focus 时页面缩放变大需要手动回正的情况。
|
|
316
|
+
* iOS 10+ 允许 pinch-zoom, 即使 viewport 是不可伸缩的。
|
|
317
|
+
* 只对这些浏览器添加额外规则
|
|
318
|
+
*/
|
|
319
|
+
declare const fixiOSInputAutoZoomIn: () => void;
|
|
320
|
+
/**
|
|
321
|
+
* 用户代理
|
|
322
|
+
*/
|
|
323
|
+
declare const userAgent: string;
|
|
324
|
+
/**
|
|
325
|
+
* 获取宿主环境信息
|
|
326
|
+
*/
|
|
327
|
+
declare const getHostEnv: () => {
|
|
328
|
+
/**
|
|
329
|
+
* 是否是浙里办
|
|
330
|
+
*/
|
|
331
|
+
zlb: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* 是否是专有钉
|
|
334
|
+
*/
|
|
335
|
+
zyd: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* 是否是浙政钉
|
|
338
|
+
*/
|
|
339
|
+
zzd: boolean;
|
|
340
|
+
/**
|
|
341
|
+
* 是否是微信
|
|
342
|
+
*/
|
|
343
|
+
wx: boolean;
|
|
344
|
+
/**
|
|
345
|
+
* 是否是支付宝
|
|
346
|
+
*/
|
|
347
|
+
zfb: boolean;
|
|
348
|
+
/**
|
|
349
|
+
* 是否是小程序
|
|
350
|
+
*/
|
|
351
|
+
mini: boolean;
|
|
352
|
+
} | {
|
|
353
|
+
/**
|
|
354
|
+
* 是否是浙里办
|
|
355
|
+
*/
|
|
356
|
+
zlb: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* 是否是专有钉
|
|
359
|
+
*/
|
|
360
|
+
zyd: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* 是否是浙政钉
|
|
363
|
+
*/
|
|
364
|
+
zzd: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* 是否是微信
|
|
367
|
+
*/
|
|
368
|
+
wx: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* 是否是支付宝
|
|
371
|
+
*/
|
|
372
|
+
zfb: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* 是否是小程序
|
|
375
|
+
*/
|
|
376
|
+
mini: boolean;
|
|
377
|
+
name: detect_browser.Browser;
|
|
378
|
+
version: string;
|
|
379
|
+
os: detect_browser.OperatingSystem | null;
|
|
380
|
+
type: "browser";
|
|
381
|
+
} | {
|
|
382
|
+
/**
|
|
383
|
+
* 是否是浙里办
|
|
384
|
+
*/
|
|
385
|
+
zlb: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* 是否是专有钉
|
|
388
|
+
*/
|
|
389
|
+
zyd: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* 是否是浙政钉
|
|
392
|
+
*/
|
|
393
|
+
zzd: boolean;
|
|
394
|
+
/**
|
|
395
|
+
* 是否是微信
|
|
396
|
+
*/
|
|
397
|
+
wx: boolean;
|
|
398
|
+
/**
|
|
399
|
+
* 是否是支付宝
|
|
400
|
+
*/
|
|
401
|
+
zfb: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* 是否是小程序
|
|
404
|
+
*/
|
|
405
|
+
mini: boolean;
|
|
406
|
+
name: detect_browser.Browser;
|
|
407
|
+
version: string;
|
|
408
|
+
os: detect_browser.OperatingSystem | null;
|
|
409
|
+
bot: string;
|
|
410
|
+
type: "bot-device";
|
|
411
|
+
} | {
|
|
412
|
+
/**
|
|
413
|
+
* 是否是浙里办
|
|
414
|
+
*/
|
|
415
|
+
zlb: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* 是否是专有钉
|
|
418
|
+
*/
|
|
419
|
+
zyd: boolean;
|
|
420
|
+
/**
|
|
421
|
+
* 是否是浙政钉
|
|
422
|
+
*/
|
|
423
|
+
zzd: boolean;
|
|
424
|
+
/**
|
|
425
|
+
* 是否是微信
|
|
426
|
+
*/
|
|
427
|
+
wx: boolean;
|
|
428
|
+
/**
|
|
429
|
+
* 是否是支付宝
|
|
430
|
+
*/
|
|
431
|
+
zfb: boolean;
|
|
432
|
+
/**
|
|
433
|
+
* 是否是小程序
|
|
434
|
+
*/
|
|
435
|
+
mini: boolean;
|
|
436
|
+
type: "bot";
|
|
437
|
+
bot: true;
|
|
438
|
+
name: "bot";
|
|
439
|
+
version: null;
|
|
440
|
+
os: null;
|
|
441
|
+
} | {
|
|
442
|
+
/**
|
|
443
|
+
* 是否是浙里办
|
|
444
|
+
*/
|
|
445
|
+
zlb: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* 是否是专有钉
|
|
448
|
+
*/
|
|
449
|
+
zyd: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* 是否是浙政钉
|
|
452
|
+
*/
|
|
453
|
+
zzd: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* 是否是微信
|
|
456
|
+
*/
|
|
457
|
+
wx: boolean;
|
|
458
|
+
/**
|
|
459
|
+
* 是否是支付宝
|
|
460
|
+
*/
|
|
461
|
+
zfb: boolean;
|
|
462
|
+
/**
|
|
463
|
+
* 是否是小程序
|
|
464
|
+
*/
|
|
465
|
+
mini: boolean;
|
|
466
|
+
version: string;
|
|
467
|
+
type: "node";
|
|
468
|
+
name: "node";
|
|
469
|
+
os: NodeJS.Platform;
|
|
470
|
+
} | {
|
|
471
|
+
/**
|
|
472
|
+
* 是否是浙里办
|
|
473
|
+
*/
|
|
474
|
+
zlb: boolean;
|
|
475
|
+
/**
|
|
476
|
+
* 是否是专有钉
|
|
477
|
+
*/
|
|
478
|
+
zyd: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* 是否是浙政钉
|
|
481
|
+
*/
|
|
482
|
+
zzd: boolean;
|
|
483
|
+
/**
|
|
484
|
+
* 是否是微信
|
|
485
|
+
*/
|
|
486
|
+
wx: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* 是否是支付宝
|
|
489
|
+
*/
|
|
490
|
+
zfb: boolean;
|
|
491
|
+
/**
|
|
492
|
+
* 是否是小程序
|
|
493
|
+
*/
|
|
494
|
+
mini: boolean;
|
|
495
|
+
type: "react-native";
|
|
496
|
+
name: "react-native";
|
|
497
|
+
version: null;
|
|
498
|
+
os: null;
|
|
499
|
+
};
|
|
241
500
|
|
|
242
501
|
/**
|
|
243
502
|
* Json字符串转对象
|
|
244
503
|
* @param str
|
|
245
504
|
* @param reviver
|
|
246
505
|
*/
|
|
247
|
-
declare const parseToJSON: <T = any>(str: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => T
|
|
506
|
+
declare const parseToJSON: <T = any>(str: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => Nullable<T>;
|
|
248
507
|
/**
|
|
249
508
|
* JSON.stringify() second param
|
|
250
509
|
* @param _
|
|
@@ -268,40 +527,336 @@ declare const filterObj: (obj: Record<string, any>, keys: string[], reverse?: bo
|
|
|
268
527
|
};
|
|
269
528
|
|
|
270
529
|
/**
|
|
271
|
-
*
|
|
272
|
-
* @param
|
|
530
|
+
* 格式化时间
|
|
531
|
+
* @param {import('dayjs').ConfigType} date 时间
|
|
532
|
+
* @param {string} format 格式
|
|
533
|
+
* @returns {string} 格式化后的时间
|
|
534
|
+
*/
|
|
535
|
+
declare const dateFmt: (date: ConfigType, format?: string | 'date' | 'datetime') => string;
|
|
536
|
+
/**
|
|
537
|
+
* 格式化时间间隔
|
|
538
|
+
* @param {import('dayjs').ConfigType} start 开始时间
|
|
539
|
+
* @param {import('dayjs').ConfigType} end 结束时间
|
|
540
|
+
*/
|
|
541
|
+
declare const dateDuration: (start: ConfigType, end: ConfigType) => string;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* 设置文件基本路径
|
|
545
|
+
* @param key
|
|
546
|
+
* @param baseUrl
|
|
547
|
+
*/
|
|
548
|
+
declare function setBaseAttachUrl(baseUrl: string): void;
|
|
549
|
+
/**
|
|
550
|
+
* 获取文件基本路径
|
|
551
|
+
*/
|
|
552
|
+
declare function getBaseAttachUrl(): string;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* 千位分隔符
|
|
556
|
+
* @param num
|
|
557
|
+
*/
|
|
558
|
+
declare const toThousands: (num: number) => string | undefined;
|
|
559
|
+
/**
|
|
560
|
+
* 货币格式化
|
|
561
|
+
* @param {number | string | bigint} currency - 金额
|
|
562
|
+
* @param {number} [maximumFractionDigits] - 小数位数
|
|
563
|
+
*/
|
|
564
|
+
declare const currencyFmt: (currency: UnDef<Numeric | bigint>, maximumFractionDigits?: number) => string;
|
|
565
|
+
|
|
566
|
+
type VantUploadFileStatus = '' | 'uploading' | 'done' | 'failed'
|
|
567
|
+
type AntdUploadFileStatus = 'removed' | 'uploading' | 'done' | 'error'
|
|
568
|
+
type ElementPlusUploadFileStatus = 'ready' | 'uploading' | 'success' | 'fail'
|
|
569
|
+
|
|
570
|
+
interface Resource {
|
|
571
|
+
/** origin */
|
|
572
|
+
group: string
|
|
573
|
+
id: string
|
|
574
|
+
name: string
|
|
575
|
+
uri: string
|
|
576
|
+
/** extend */
|
|
577
|
+
url?: string
|
|
578
|
+
size?: number
|
|
579
|
+
uid?: string
|
|
580
|
+
status?: VantUploadFileStatus | AntdUploadFileStatus | ElementPlusUploadFileStatus
|
|
581
|
+
/** vant */
|
|
582
|
+
objectUrl?: string
|
|
583
|
+
content?: string
|
|
584
|
+
isImage?: boolean
|
|
585
|
+
message?: string
|
|
586
|
+
deletable?: boolean
|
|
587
|
+
reupload?: boolean
|
|
588
|
+
/** antd */
|
|
589
|
+
fileName?: string
|
|
590
|
+
percent?: number
|
|
591
|
+
thumbUrl?: string
|
|
592
|
+
/** element-plus */
|
|
593
|
+
percentage?: number
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* 获取文件完整地址
|
|
598
|
+
* @param url
|
|
599
|
+
*/
|
|
600
|
+
declare const resUrl: (url: Undefinable<string>) => string | undefined;
|
|
601
|
+
/**
|
|
602
|
+
* 统一文件字段内容
|
|
603
|
+
* @param resource
|
|
604
|
+
*/
|
|
605
|
+
declare const recoverFile: (resource: Resource) => {
|
|
606
|
+
url: string | undefined;
|
|
607
|
+
content: string | undefined;
|
|
608
|
+
uri: string;
|
|
609
|
+
status: string;
|
|
610
|
+
percent: number;
|
|
611
|
+
group: string;
|
|
612
|
+
id: string;
|
|
613
|
+
name: string;
|
|
614
|
+
size?: number | undefined;
|
|
615
|
+
uid?: string | undefined;
|
|
616
|
+
objectUrl?: string | undefined;
|
|
617
|
+
isImage?: boolean | undefined;
|
|
618
|
+
message?: string | undefined;
|
|
619
|
+
deletable?: boolean | undefined;
|
|
620
|
+
reupload?: boolean | undefined;
|
|
621
|
+
fileName?: string | undefined;
|
|
622
|
+
thumbUrl?: string | undefined; /**
|
|
623
|
+
* 统一文件字段内容
|
|
624
|
+
* @param resource
|
|
625
|
+
*/
|
|
626
|
+
percentage?: number | undefined;
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* 附件格式
|
|
630
|
+
* @param data
|
|
631
|
+
*/
|
|
632
|
+
declare const attachFmt: (data: UnDef<MaybeArray<Resource>> | string) => {
|
|
633
|
+
url: string | undefined;
|
|
634
|
+
content: string | undefined;
|
|
635
|
+
uri: string;
|
|
636
|
+
status: string;
|
|
637
|
+
percent: number;
|
|
638
|
+
group: string;
|
|
639
|
+
id: string;
|
|
640
|
+
name: string;
|
|
641
|
+
size?: number | undefined;
|
|
642
|
+
uid?: string | undefined;
|
|
643
|
+
objectUrl?: string | undefined;
|
|
644
|
+
isImage?: boolean | undefined;
|
|
645
|
+
message?: string | undefined;
|
|
646
|
+
deletable?: boolean | undefined;
|
|
647
|
+
reupload?: boolean | undefined;
|
|
648
|
+
fileName?: string | undefined;
|
|
649
|
+
thumbUrl?: string | undefined; /**
|
|
650
|
+
* 统一文件字段内容
|
|
651
|
+
* @param resource
|
|
652
|
+
*/
|
|
653
|
+
percentage?: number | undefined;
|
|
654
|
+
}[];
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* 检测变量类型
|
|
658
|
+
* @param {any} val 检测的目标
|
|
659
|
+
*/
|
|
660
|
+
declare const getVariableType: (val: any) => string | undefined;
|
|
661
|
+
/**
|
|
662
|
+
* 是否是数字
|
|
663
|
+
* @param {any} val 检测的目标
|
|
664
|
+
*/
|
|
665
|
+
declare const isNumber: (val: any) => val is number;
|
|
666
|
+
/**
|
|
667
|
+
* 是否是字符串
|
|
668
|
+
* @param {any} val 检测的目标
|
|
669
|
+
*/
|
|
670
|
+
declare const isString: (val: any) => val is string;
|
|
671
|
+
/**
|
|
672
|
+
* 是否是布尔值
|
|
673
|
+
* @param {any} val 检测的目标
|
|
674
|
+
*/
|
|
675
|
+
declare const isBoolean: (val: any) => val is boolean;
|
|
676
|
+
/**
|
|
677
|
+
* 是否是null
|
|
678
|
+
* @param {any} val 检测的目标
|
|
679
|
+
*/
|
|
680
|
+
declare const isNull: (val: any) => val is null;
|
|
681
|
+
/**
|
|
682
|
+
* 是否是undefined
|
|
683
|
+
* @param {any} val 检测的目标
|
|
684
|
+
*/
|
|
685
|
+
declare const isUndefined: (val: any) => val is undefined;
|
|
686
|
+
/**
|
|
687
|
+
* 是否是symbol
|
|
688
|
+
* @param {any} val 检测的目标
|
|
689
|
+
*/
|
|
690
|
+
declare const isSymbol: (val: any) => val is symbol;
|
|
691
|
+
/**
|
|
692
|
+
* 是否是对象
|
|
693
|
+
* @param {any} val 检测的目标
|
|
694
|
+
*/
|
|
695
|
+
declare const isObject: (val: any) => val is Record<any, any>;
|
|
696
|
+
/**
|
|
697
|
+
* 是否是数组
|
|
698
|
+
* @param {any} val 检测的目标
|
|
699
|
+
*/
|
|
700
|
+
declare const isArray: (val: any) => val is any[];
|
|
701
|
+
/**
|
|
702
|
+
* 是否是函数
|
|
703
|
+
* @param {any} val 检测的目标
|
|
704
|
+
*/
|
|
705
|
+
declare const isFunction: (val: any) => val is Function;
|
|
706
|
+
/**
|
|
707
|
+
* 是否是日期
|
|
708
|
+
* @param {any} val 检测的目标
|
|
709
|
+
*/
|
|
710
|
+
declare const isDate: (val: any) => val is Date;
|
|
711
|
+
/**
|
|
712
|
+
* 是否是正则
|
|
713
|
+
* @param {any} val 检测的目标
|
|
714
|
+
*/
|
|
715
|
+
declare const isRegExp: (val: any) => val is RegExp;
|
|
716
|
+
/**
|
|
717
|
+
* 是否是期望(Promise)
|
|
718
|
+
* @param {any} val 检测的目标
|
|
719
|
+
*/
|
|
720
|
+
declare const isPromise: (val: any) => val is Promise<any>;
|
|
721
|
+
/**
|
|
722
|
+
* 是否是集合(Set)
|
|
723
|
+
* @param {any} val 检测的目标
|
|
724
|
+
*/
|
|
725
|
+
declare const isSet: (val: any) => val is Set<any>;
|
|
726
|
+
/**
|
|
727
|
+
* 是否是映射(Map)
|
|
728
|
+
* @param {any} val 检测的目标
|
|
729
|
+
*/
|
|
730
|
+
declare const isMap: (val: any) => val is Map<any, any>;
|
|
731
|
+
/**
|
|
732
|
+
* 是否是弱集合(WeakSet)
|
|
733
|
+
* @param {any} val 检测的目标
|
|
734
|
+
*/
|
|
735
|
+
declare const isWeakSet: (val: any) => val is WeakSet<any>;
|
|
736
|
+
/**
|
|
737
|
+
* 是否是弱映射(WeakMap)
|
|
738
|
+
* @param {any} val 检测的目标
|
|
739
|
+
*/
|
|
740
|
+
declare const isWeakMap: (val: any) => val is WeakMap<any, any>;
|
|
741
|
+
/**
|
|
742
|
+
* 是否是File
|
|
743
|
+
* @param {any} val 检测的目标
|
|
744
|
+
*/
|
|
745
|
+
declare const isFile: (val: any) => val is File;
|
|
746
|
+
/**
|
|
747
|
+
* 是否是Blob
|
|
748
|
+
* @param {any} val 检测的目标
|
|
749
|
+
*/
|
|
750
|
+
declare const isBlob: (val: any) => val is Blob;
|
|
751
|
+
/**
|
|
752
|
+
* 是否是URL
|
|
753
|
+
* @param {any} val 检测的目标
|
|
754
|
+
*/
|
|
755
|
+
declare const isURL: (val: any) => val is URL;
|
|
756
|
+
/**
|
|
757
|
+
* 是否是错误(Error)
|
|
758
|
+
* @param {any} val 检测的目标
|
|
759
|
+
*/
|
|
760
|
+
declare const isError: (val: any) => val is Error;
|
|
761
|
+
/**
|
|
762
|
+
* 是否既不是 null 也不是 undefined
|
|
763
|
+
* @param {any} val 检测的目标
|
|
273
764
|
*/
|
|
274
765
|
declare const isDef: <T>(val: T) => val is NonNullable<T>;
|
|
275
766
|
/**
|
|
276
767
|
* 是否是数字或字符
|
|
277
768
|
* @param val
|
|
278
769
|
*/
|
|
279
|
-
declare const isNumeric: (val: Numeric) => val is string;
|
|
770
|
+
declare const isNumeric: (val: UnDef<Numeric>) => val is string;
|
|
280
771
|
/**
|
|
281
772
|
* 是否是需要的图片格式
|
|
282
773
|
* @param ext
|
|
283
774
|
*/
|
|
284
775
|
declare const checkImg: (ext?: string) => boolean;
|
|
776
|
+
/**
|
|
777
|
+
* 是否是空值/空数组/空对象 null undefined '' [] {} Set Map
|
|
778
|
+
* @param val
|
|
779
|
+
*/
|
|
780
|
+
declare const isEmpty: (val: UnDef<Numeric | boolean | Record<any, any> | Array<any> | Set<any> | Map<any, any>>) => boolean;
|
|
285
781
|
/**
|
|
286
782
|
* 判断是否合法JSON字符串
|
|
287
783
|
* @param str
|
|
288
784
|
*/
|
|
289
|
-
declare const isJSONStr: (str: string) => boolean;
|
|
785
|
+
declare const isJSONStr: (str: UnDef<string>) => boolean;
|
|
290
786
|
/**
|
|
291
787
|
* 判断是否合法JSON数组字符串
|
|
292
788
|
* @param str
|
|
293
789
|
*/
|
|
294
|
-
declare const isArrStr: (str: string) => boolean;
|
|
790
|
+
declare const isArrStr: (str: UnDef<string>) => boolean;
|
|
791
|
+
/**
|
|
792
|
+
* 判断是否有效的key
|
|
793
|
+
* @param {string | number | symbol} key 键名
|
|
794
|
+
* @param {object} object 对象
|
|
795
|
+
* @example
|
|
796
|
+
*
|
|
797
|
+
* ```ts
|
|
798
|
+
* const obj = { a: 1, b: 2 }
|
|
799
|
+
* isValidKey('a', obj) // true
|
|
800
|
+
* ```
|
|
801
|
+
* @returns {boolean} boolean
|
|
802
|
+
*/
|
|
295
803
|
declare const isValidKey: (key: string | number | symbol, object: object) => key is never;
|
|
296
804
|
/**
|
|
297
805
|
* 是否是中国手机号
|
|
298
806
|
* @param val
|
|
299
807
|
*/
|
|
300
|
-
declare const isPhone: (val:
|
|
808
|
+
declare const isPhone: (val: UnDef<Numeric>) => boolean;
|
|
301
809
|
/**
|
|
302
810
|
* 是否是中国座机号
|
|
303
811
|
* @param val
|
|
304
812
|
*/
|
|
305
|
-
declare const isTel: (val:
|
|
813
|
+
declare const isTel: (val: UnDef<Numeric>) => boolean;
|
|
814
|
+
/**
|
|
815
|
+
* 是否是邮箱
|
|
816
|
+
* @param val
|
|
817
|
+
*/
|
|
818
|
+
declare const isEmail: (val: UnDef<string>) => boolean;
|
|
819
|
+
/**
|
|
820
|
+
* 是否是身份证
|
|
821
|
+
* @param {string|null|undefined} val 身份证号
|
|
822
|
+
* @param {boolean} compatible 兼容15位
|
|
823
|
+
*/
|
|
824
|
+
declare const isIdCard: (val: UnDef<string>, compatible?: boolean) => boolean;
|
|
825
|
+
/**
|
|
826
|
+
* 包含非ASCII字符
|
|
827
|
+
* @param text
|
|
828
|
+
*/
|
|
829
|
+
declare const nonASCII: (text: string) => boolean;
|
|
830
|
+
/**
|
|
831
|
+
* 校验接口返回code
|
|
832
|
+
* @param res
|
|
833
|
+
* @param code
|
|
834
|
+
*/
|
|
835
|
+
declare const isValidResCode: (res: Res, code?: number) => boolean;
|
|
836
|
+
/**
|
|
837
|
+
* 校验接口返回内容
|
|
838
|
+
* @param res
|
|
839
|
+
* @param code
|
|
840
|
+
*/
|
|
841
|
+
declare const isValidRes: (res: Res, code?: number) => boolean;
|
|
842
|
+
/**
|
|
843
|
+
* 校验接口数组返回内容
|
|
844
|
+
* @param res
|
|
845
|
+
* @param code
|
|
846
|
+
*/
|
|
847
|
+
declare const isValidArrRes: (res: Res<any[]>, code?: number) => boolean;
|
|
848
|
+
/**
|
|
849
|
+
* 校验接口分页返回内容
|
|
850
|
+
* @param res
|
|
851
|
+
* @param code
|
|
852
|
+
*/
|
|
853
|
+
declare const isValidPageRes: (res: PageRes, code?: number) => boolean;
|
|
854
|
+
/**
|
|
855
|
+
* 校验文件类型
|
|
856
|
+
* 1. XXX/YYY 2. .xxx 3. XXX/* 4.*
|
|
857
|
+
* @param {File} file 需要校验的文件
|
|
858
|
+
* @param {string} type 文件类型, 与input.accept一致
|
|
859
|
+
*/
|
|
860
|
+
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
306
861
|
|
|
307
|
-
export { NullOrUndefinable, Nullable, Numeric, Undefinable, camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, filterObj, hideCardNo, hideMiddle, hideName, hidePhone, hideThird, isArrStr, isDef, isJSONStr, isNumeric, isPhone, isTel, isValidKey, jClear, jDebug, jError, jGroup, jGroupC, jGroupE, jInfo, jLog, jTime, jTimeEnd, jWarn, kebab2Camel, kebab2Pascal, kebab2Snake, kebab2Title, parseToJSON, pascal2Camel, pascal2Kebab, pascal2Snake, pascal2Title, replacer, reviver, snake2Camel, snake2Kebab, snake2Pascal, snake2Title, title2Camel, title2Kebab, title2Pascal, title2Snake };
|
|
862
|
+
export { type MaybeArray, type NullOrUndefinable, type Nullable, type Numeric, type PageRes, type PageResData, type Res, type UnDef, type Undefinable, attachFmt, camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, currencyFmt, dateDuration, dateFmt, filterObj, fixiOSInputAutoZoomIn, getBaseAttachUrl, getHostEnv, getVariableType, hideBankCard, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hideName, hidePhone, hideSurname, hideTail, hideThird, inBrowser, isArrStr, isArray, isBlob, isBoolean, isDate, isDef, isEmail, isEmpty, isError, isFile, isFunction, isIdCard, isJSONStr, isMap, isNull, isNumber, isNumeric, isObject, isPhone, isPromise, isRegExp, isSet, isString, isSymbol, isTel, isURL, isUndefined, isValidArrRes, isValidFileType, isValidKey, isValidPageRes, isValidRes, isValidResCode, isWeakMap, isWeakSet, jClear, jDebug, jError, jGroup, jGroupC, jGroupE, jInfo, jLog, jTime, jTimeEnd, jWarn, kebab2Camel, kebab2Pascal, kebab2Snake, kebab2Title, nonASCII, parseToJSON, pascal2Camel, pascal2Kebab, pascal2Snake, pascal2Title, recoverFile, replacer, resUrl, reviver, setBaseAttachUrl, snake2Camel, snake2Kebab, snake2Pascal, snake2Title, title2Camel, title2Kebab, title2Pascal, title2Snake, toThousands, userAgent, waitTime };
|