@jhqn/utils-core 0.0.1-beta.22 → 0.0.1-beta.24

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.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- /// <reference types="dayjs/esm/plugin/localeData" />
2
- /// <reference types="dayjs/esm/plugin/duration" />
3
- /// <reference types="dayjs/esm/plugin/relativeTime" />
4
- /// <reference types="dayjs/esm/plugin/customParseFormat" />
5
- /// <reference types="dayjs/esm/plugin/objectSupport" />
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
6
  import * as detect_browser from 'detect-browser';
7
- import { ConfigType } from 'dayjs/esm';
8
- export { Dayjs, default as dayjs } from 'dayjs/esm';
7
+ import { ConfigType } from 'dayjs';
8
+ export { Dayjs, default as dayjs } from 'dayjs';
9
9
 
10
10
  /**
11
11
  * snake2Kebab
@@ -233,32 +233,62 @@ declare type PageResData<T = any> = Service.PageResponseData<T>;
233
233
  * 分页请求结果
234
234
  */
235
235
  declare type PageRes<T = any> = Service.PageResponse<T>;
236
+ /**
237
+ * 可能是数组
238
+ */
239
+ declare type MaybeArray<T = any> = T | Array<T>;
236
240
 
241
+ /**
242
+ * 隐藏中间部分
243
+ * @param {string} str 需要隐藏的字符串
244
+ */
245
+ declare const hideMiddle: (str: NullOrUndefinable<string>) => string;
246
+ /**
247
+ * 隐藏首尾仅保留中间3分之1
248
+ * @param {string} str 需要隐藏的字符串
249
+ */
250
+ declare const hideThird: (str: NullOrUndefinable<string>) => string;
251
+ /**
252
+ * 隐藏首部
253
+ * @param {string} str 需要隐藏的字符串
254
+ */
255
+ declare const hideHead: (str: NullOrUndefinable<string>) => string;
256
+ /**
257
+ * 隐藏尾部
258
+ * @param {string} str 需要隐藏的字符串
259
+ */
260
+ declare const hideTail: (str: NullOrUndefinable<string>) => string;
237
261
  /**
238
262
  * 隐藏手机号
239
- * @param str
263
+ * @param {string} phone 手机号
240
264
  */
241
- declare const hidePhone: (str: NullOrUndefinable<string>) => string;
265
+ declare const hidePhone: (phone: NullOrUndefinable<string>) => string;
242
266
  /**
243
267
  * 隐藏身份证号
244
- * @param cardNo
268
+ * @param {string} cardNo 身份证号
245
269
  */
246
270
  declare const hideCardNo: (cardNo: NullOrUndefinable<string>) => string;
247
271
  /**
248
- * 隐藏姓名
249
- * @param name
272
+ * 隐藏姓名第一个字
273
+ * @param {string} name 姓名
274
+ * @deprecated 请使用 hideSurname
250
275
  */
251
276
  declare const hideName: (name: NullOrUndefinable<string>) => string;
252
277
  /**
253
- * 隐藏中间部分
254
- * @param str
278
+ * 隐藏姓氏
279
+ * @param {string} name 姓名
255
280
  */
256
- declare const hideMiddle: (str: NullOrUndefinable<string>) => string;
281
+ declare const hideSurname: (name: NullOrUndefinable<string>) => string;
257
282
  /**
258
- * 隐藏首尾仅保留中间3分之1
259
- * @param str
283
+ * 隐藏名字
284
+ * @param {string} name 姓名
260
285
  */
261
- declare const hideThird: (str: NullOrUndefinable<string>) => string;
286
+ declare const hideFirstName: (name: NullOrUndefinable<string>) => string;
287
+ /**
288
+ * 隐藏邮箱
289
+ * @param {string} email 邮箱
290
+ */
291
+ declare const hideEmail: (email: NullOrUndefinable<string>) => string;
262
292
 
263
293
  /**
264
294
  * 判断是否是浏览器环境
@@ -486,18 +516,125 @@ declare const filterObj: (obj: Record<string, any>, keys: string[], reverse?: bo
486
516
 
487
517
  /**
488
518
  * 格式化时间
489
- * @param {import('dayjs/esm').ConfigType} date 时间
519
+ * @param {import('dayjs').ConfigType} date 时间
490
520
  * @param {string} format 格式
491
521
  * @returns {string} 格式化后的时间
492
522
  */
493
523
  declare const dateFmt: (date: ConfigType, format?: string | 'date' | 'datetime') => string;
494
524
  /**
495
525
  * 格式化时间间隔
496
- * @param {import('dayjs/esm').ConfigType} start 开始时间
497
- * @param {import('dayjs/esm').ConfigType} end 结束时间
526
+ * @param {import('dayjs').ConfigType} start 开始时间
527
+ * @param {import('dayjs').ConfigType} end 结束时间
498
528
  */
499
529
  declare const dateDuration: (start: ConfigType, end: ConfigType) => string;
500
530
 
531
+ /**
532
+ * 设置文件基本路径
533
+ * @param key
534
+ * @param baseUrl
535
+ */
536
+ declare function setBaseAttachUrl(baseUrl: string): void;
537
+ /**
538
+ * 获取文件基本路径
539
+ */
540
+ declare function getBaseAttachUrl(): string;
541
+
542
+ /**
543
+ * 千位分隔符
544
+ * @param num
545
+ */
546
+ declare const toThousands: (num: number) => string | undefined;
547
+ /**
548
+ * 货币格式化
549
+ * @param currency
550
+ * @param fraction
551
+ */
552
+ declare const currencyFmt: (currency: NullOrUndefinable<number | bigint>, fraction?: number) => string;
553
+
554
+ type VantUploadFileStatus = '' | 'uploading' | 'done' | 'failed'
555
+ type AntdUploadFileStatus = 'removed' | 'uploading' | 'done' | 'error'
556
+ type ElementPlusUploadFileStatus = 'ready' | 'uploading' | 'success' | 'fail'
557
+
558
+ interface Resource {
559
+ /** origin */
560
+ group: string
561
+ id: string
562
+ name: string
563
+ uri: string
564
+ /** extend */
565
+ url?: string
566
+ size?: number
567
+ uid?: string
568
+ status?: VantUploadFileStatus | AntdUploadFileStatus | ElementPlusUploadFileStatus
569
+ /** vant */
570
+ objectUrl?: string
571
+ content?: string
572
+ isImage?: boolean
573
+ message?: string
574
+ deletable?: boolean
575
+ reupload?: boolean
576
+ /** antd */
577
+ fileName?: string
578
+ percent?: number
579
+ thumbUrl?: string
580
+ /** element-plus */
581
+ percentage?: number
582
+ }
583
+
584
+ /**
585
+ * 获取文件完整地址
586
+ * @param url
587
+ */
588
+ declare const resUrl: (url: Undefinable<string>) => string | undefined;
589
+ /**
590
+ * 统一文件字段内容
591
+ * @param resource
592
+ */
593
+ declare const recoverFile: (resource: Resource) => {
594
+ url: string | undefined;
595
+ content: string | undefined;
596
+ uri: string;
597
+ status: string;
598
+ percent: number;
599
+ group: string;
600
+ id: string;
601
+ name: string;
602
+ size?: number | undefined;
603
+ uid?: string | undefined;
604
+ objectUrl?: string | undefined;
605
+ isImage?: boolean | undefined;
606
+ message?: string | undefined;
607
+ deletable?: boolean | undefined;
608
+ reupload?: boolean | undefined;
609
+ fileName?: string | undefined;
610
+ thumbUrl?: string | undefined;
611
+ percentage?: number | undefined;
612
+ };
613
+ /**
614
+ * 附件格式
615
+ * @param data
616
+ */
617
+ declare const attachFmt: (data: NullOrUndefinable<MaybeArray<Resource>> | string) => {
618
+ url: string | undefined;
619
+ content: string | undefined;
620
+ uri: string;
621
+ status: string;
622
+ percent: number;
623
+ group: string;
624
+ id: string;
625
+ name: string;
626
+ size?: number | undefined;
627
+ uid?: string | undefined;
628
+ objectUrl?: string | undefined;
629
+ isImage?: boolean | undefined;
630
+ message?: string | undefined;
631
+ deletable?: boolean | undefined;
632
+ reupload?: boolean | undefined;
633
+ fileName?: string | undefined;
634
+ thumbUrl?: string | undefined;
635
+ percentage?: number | undefined;
636
+ }[];
637
+
501
638
  /**
502
639
  * 是否有意义的值
503
640
  * @param val
@@ -513,6 +650,11 @@ declare const isNumeric: (val: Numeric) => val is string;
513
650
  * @param ext
514
651
  */
515
652
  declare const checkImg: (ext?: string) => boolean;
653
+ /**
654
+ * 是否是空值/空数组/空对象 null undefined '' [] {} Set Map
655
+ * @param val
656
+ */
657
+ declare const isEmpty: (val: NullOrUndefinable<Numeric | boolean | Record<any, any> | Array<any> | Set<any> | Map<any, any>>) => boolean;
516
658
  /**
517
659
  * 判断是否合法JSON字符串
518
660
  * @param str
@@ -561,20 +703,36 @@ declare const isIdCard: (val: NullOrUndefinable<string>) => boolean;
561
703
  * @param text
562
704
  */
563
705
  declare const nonASCII: (text: string) => boolean;
706
+ /**
707
+ * 校验接口返回code
708
+ * @param res
709
+ * @param code
710
+ */
711
+ declare const isValidResCode: (res: Res, code?: number) => boolean;
564
712
  /**
565
713
  * 校验接口返回内容
566
714
  * @param res
715
+ * @param code
567
716
  */
568
- declare const isValidRes: (res: Res) => boolean;
717
+ declare const isValidRes: (res: Res, code?: number) => boolean;
569
718
  /**
570
719
  * 校验接口数组返回内容
571
720
  * @param res
721
+ * @param code
572
722
  */
573
- declare const isValidArrRes: (res: Res<any[]>) => boolean;
723
+ declare const isValidArrRes: (res: Res<any[]>, code?: number) => boolean;
574
724
  /**
575
725
  * 校验接口分页返回内容
576
726
  * @param res
727
+ * @param code
728
+ */
729
+ declare const isValidPageRes: (res: PageRes, code?: number) => boolean;
730
+ /**
731
+ * 校验文件类型
732
+ * 1. XXX/YYY 2. .xxx 3. XXX/* 4.*
733
+ * @param {File} file 需要校验的文件
734
+ * @param {string} type 文件类型, 与input.accept一致
577
735
  */
578
- declare const isValidPageRes: (res: PageRes) => boolean;
736
+ declare const isValidFileType: (file: File, type: string) => boolean;
579
737
 
580
- export { NullOrUndefinable, Nullable, Numeric, PageRes, PageResData, Res, Undefinable, camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, dateDuration, dateFmt, filterObj, fixiOSInputAutoZoomIn, getHostEnv, hideCardNo, hideMiddle, hideName, hidePhone, hideThird, inBrowser, isArrStr, isDef, isEmail, isIdCard, isJSONStr, isNumeric, isPhone, isTel, isValidArrRes, isValidKey, isValidPageRes, isValidRes, jClear, jDebug, jError, jGroup, jGroupC, jGroupE, jInfo, jLog, jTime, jTimeEnd, jWarn, kebab2Camel, kebab2Pascal, kebab2Snake, kebab2Title, nonASCII, parseToJSON, pascal2Camel, pascal2Kebab, pascal2Snake, pascal2Title, replacer, reviver, snake2Camel, snake2Kebab, snake2Pascal, snake2Title, title2Camel, title2Kebab, title2Pascal, title2Snake, userAgent, waitTime };
738
+ export { type NullOrUndefinable, type Nullable, type Numeric, type PageRes, type PageResData, type Res, type Undefinable, attachFmt, camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, currencyFmt, dateDuration, dateFmt, filterObj, fixiOSInputAutoZoomIn, getBaseAttachUrl, getHostEnv, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hideName, hidePhone, hideSurname, hideTail, hideThird, inBrowser, isArrStr, isDef, isEmail, isEmpty, isIdCard, isJSONStr, isNumeric, isPhone, isTel, isValidArrRes, isValidFileType, isValidKey, isValidPageRes, isValidRes, isValidResCode, 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 };
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { detect } from 'detect-browser';
2
- import dayjs from 'dayjs/esm';
3
- export { default as dayjs } from 'dayjs/esm';
4
- import localeData from 'dayjs/esm/plugin/localeData';
5
- import duration from 'dayjs/esm/plugin/duration';
6
- import relativeTime from 'dayjs/esm/plugin/relativeTime';
7
- import customParseFormat from 'dayjs/esm/plugin/customParseFormat';
8
- import objectSupport from 'dayjs/esm/plugin/objectSupport';
9
- import zhCN from 'dayjs/esm/locale/zh-cn';
2
+ import dayjs from 'dayjs';
3
+ export { default as dayjs } from 'dayjs';
4
+ import localeData from 'dayjs/plugin/localeData';
5
+ import duration from 'dayjs/plugin/duration';
6
+ import relativeTime from 'dayjs/plugin/relativeTime';
7
+ import customParseFormat from 'dayjs/plugin/customParseFormat';
8
+ import objectSupport from 'dayjs/plugin/objectSupport';
9
+ import zhCN from 'dayjs/locale/zh-cn';
10
10
 
11
11
  const snake2Kebab = (str) => str.replace(/_([a-z])/g, (_, letter) => `-${letter.toLowerCase()}`);
12
12
  const snake2Pascal = (str) => str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()).replace(/^[a-z]/, (letter) => letter.toUpperCase());
@@ -65,6 +65,9 @@ const isNumeric = (val) => typeof val === "number" || /^\d+(?:\.\d+)?$/.test(val
65
65
  const checkImg = (ext) => {
66
66
  return /\.(?:jpg|jpeg|png|gif)$/.test((ext || "").toLowerCase());
67
67
  };
68
+ const isEmpty = (val) => {
69
+ return !isDef(val) || val === "" || Array.isArray(val) && val.length === 0 || Object.prototype.toString.call(val) === "[object Object]" && Object.keys(val).length === 0 || val instanceof Map && val.size === 0 || val instanceof Set && val.size === 0;
70
+ };
68
71
  const isJSONStr = (str) => {
69
72
  try {
70
73
  JSON.parse(str);
@@ -105,19 +108,80 @@ const isIdCard = (val) => {
105
108
  return card15.test(val) || card18.test(val);
106
109
  };
107
110
  const nonASCII = (text) => /[^\x20-\x7E]/.test(text);
108
- const isValidRes = (res) => res.code === 200 && isDef(res.data);
109
- const isValidArrRes = (res) => res.code === 200 && Array.isArray(res.data);
110
- const isValidPageRes = (res) => res.code === 200 && isDef(res.data) && Array.isArray(res.data.list || res.data.records);
111
+ const isValidResCode = (res, code = 200) => res.code === code;
112
+ const isValidRes = (res, code) => isValidResCode(res, code) && isDef(res.data);
113
+ const isValidArrRes = (res, code) => isValidResCode(res, code) && Array.isArray(res.data);
114
+ const isValidPageRes = (res, code) => isValidResCode(res, code) && isDef(res.data) && Array.isArray(res.data.list || res.data.records);
115
+ const isValidFileType = (file, type) => {
116
+ if (type === "*")
117
+ return true;
118
+ const fileType = file.type;
119
+ const fileName = file.name;
120
+ function validate(item) {
121
+ if (item.startsWith(".")) {
122
+ return fileName.endsWith(item);
123
+ }
124
+ if (item.endsWith("/*")) {
125
+ return fileType.startsWith(item.replace("/*", ""));
126
+ }
127
+ if (item.includes("/")) {
128
+ return fileType === item;
129
+ }
130
+ return false;
131
+ }
132
+ const typeArrStr = type.split(",").map((item) => item.trim());
133
+ if (typeArrStr.length > 1) {
134
+ return typeArrStr.some(validate);
135
+ }
136
+ return validate(type);
137
+ };
111
138
 
112
- const hidePhone = (str) => {
113
- if (str) {
114
- if (isPhone(str)) {
115
- return str.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2");
139
+ const hideMiddle = (str) => {
140
+ if (!isDef(str))
141
+ return "";
142
+ const len = str.length;
143
+ if (len === 1)
144
+ return "*";
145
+ if (len === 2)
146
+ return "**";
147
+ return str[0] + "*".repeat(len - 2) + str[len - 1];
148
+ };
149
+ const hideThird = (str) => {
150
+ if (!isDef(str))
151
+ return "";
152
+ const len = str.length;
153
+ const partLen = Math.round(len / 3);
154
+ if (len === 1)
155
+ return "*";
156
+ if (len === 2)
157
+ return "**";
158
+ return str.slice(0, partLen) + "*".repeat(len - 2 * partLen) + str.slice(len - partLen);
159
+ };
160
+ const hideHead = (str) => {
161
+ if (!isDef(str))
162
+ return "";
163
+ const len = str.length;
164
+ if (len === 1)
165
+ return "*";
166
+ return "*".repeat(len - 1) + str[len - 1];
167
+ };
168
+ const hideTail = (str) => {
169
+ if (!isDef(str))
170
+ return "";
171
+ const len = str.length;
172
+ if (len === 1)
173
+ return "*";
174
+ return str[0] + "*".repeat(len - 1);
175
+ };
176
+ const hidePhone = (phone) => {
177
+ if (phone) {
178
+ if (isPhone(phone)) {
179
+ return phone.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2");
116
180
  }
117
- if (isTel(str)) {
118
- return str.replace(/^(\d{3,4})-?\d{3,4}(\d{4})$/, "$1****$2");
181
+ if (isTel(phone)) {
182
+ return phone.replace(/^(\d{3,4})-?\d{3,4}(\d{4})$/, "$1****$2");
119
183
  }
120
- return str;
184
+ return phone;
121
185
  }
122
186
  return "";
123
187
  };
@@ -141,26 +205,25 @@ const hideName = (name) => {
141
205
  }
142
206
  return "";
143
207
  };
144
- const hideMiddle = (str) => {
145
- if (!isDef(str))
146
- return "";
147
- const len = str.length;
148
- if (len === 1)
149
- return "*";
150
- if (len === 2)
151
- return "**";
152
- return str[0] + "*".repeat(len - 2) + str[len - 1];
208
+ const hideSurname = (name) => {
209
+ return hideHead(name);
153
210
  };
154
- const hideThird = (str) => {
155
- if (!isDef(str))
156
- return "";
157
- const len = str.length;
158
- const partLen = Math.round(len / 3);
159
- if (len === 1)
160
- return "*";
161
- if (len === 2)
162
- return "**";
163
- return str.slice(0, partLen) + "*".repeat(len - 2 * partLen) + str.slice(len - partLen);
211
+ const hideFirstName = (name) => {
212
+ return hideTail(name);
213
+ };
214
+ const hideEmail = (email) => {
215
+ if (email) {
216
+ if (!email.includes("@"))
217
+ return "";
218
+ const arr = email.split("@");
219
+ const name = arr[0];
220
+ const domain = arr[1];
221
+ const len = name?.length;
222
+ if (!len)
223
+ return email;
224
+ return `${hideTail(name)}@${domain}`;
225
+ }
226
+ return "";
164
227
  };
165
228
 
166
229
  const inBrowser = typeof window !== "undefined";
@@ -271,4 +334,77 @@ const dateDuration = (start, end) => {
271
334
  return dd.format(format);
272
335
  };
273
336
 
274
- export { camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, dateDuration, dateFmt, filterObj, fixiOSInputAutoZoomIn, getHostEnv, hideCardNo, hideMiddle, hideName, hidePhone, hideThird, inBrowser, isArrStr, isDef, isEmail, isIdCard, isJSONStr, isNumeric, isPhone, isTel, isValidArrRes, isValidKey, isValidPageRes, isValidRes, jClear, jDebug, jError, jGroup, jGroupC, jGroupE, jInfo, jLog, jTime, jTimeEnd, jWarn, kebab2Camel, kebab2Pascal, kebab2Snake, kebab2Title, nonASCII, parseToJSON, pascal2Camel, pascal2Kebab, pascal2Snake, pascal2Title, replacer, reviver, snake2Camel, snake2Kebab, snake2Pascal, snake2Title, title2Camel, title2Kebab, title2Pascal, title2Snake, userAgent, waitTime };
337
+ let BASE_ATTACH_URL;
338
+ function setBaseAttachUrl(baseUrl) {
339
+ BASE_ATTACH_URL = baseUrl;
340
+ }
341
+ function getBaseAttachUrl() {
342
+ return BASE_ATTACH_URL;
343
+ }
344
+ if (import.meta.env?.VITE_BASE_ATTACH_URL) {
345
+ setBaseAttachUrl(import.meta.env.VITE_BASE_ATTACH_URL);
346
+ }
347
+
348
+ const toThousands = (num) => {
349
+ const arr = num.toString().split(".");
350
+ const integer = arr[0]?.replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
351
+ if (arr.length > 1)
352
+ return `${integer}.${arr[1]}`;
353
+ return integer;
354
+ };
355
+ const currencyFmt = (currency, fraction = 0) => {
356
+ if (!isDef(currency))
357
+ return "";
358
+ return new Intl.NumberFormat("zh-CN", { style: "currency", currency: "CNY", maximumFractionDigits: fraction }).format(
359
+ currency
360
+ );
361
+ };
362
+
363
+ const resUrl = (url) => {
364
+ if (!isDef(url))
365
+ return void 0;
366
+ if (/^https?:\/\//.test(url) || /^blob:/.test(url) || /^data:/.test(url)) {
367
+ return url;
368
+ }
369
+ const baseUrl = getBaseAttachUrl();
370
+ if (!isDef(baseUrl)) {
371
+ throw new Error("\u8BF7\u5148\u8BBE\u7F6E import.meta\u200B.env.VITE_BASE_ATTACH_URL");
372
+ }
373
+ return `${baseUrl}/${url}`.replace(/([^:]\/)\/+/g, "$1");
374
+ };
375
+ const recoverFile = (resource) => {
376
+ const { uri, url, ...item } = resource;
377
+ const validUrl = uri || url;
378
+ return {
379
+ ...item,
380
+ url: resUrl(validUrl),
381
+ content: resUrl(validUrl),
382
+ uri: validUrl || "",
383
+ status: "done",
384
+ percent: 100
385
+ };
386
+ };
387
+ const attachFmt = (data) => {
388
+ let attachList = [];
389
+ const prototype = Object.prototype.toString.call(data);
390
+ if (!data)
391
+ attachList = [];
392
+ else if (Array.isArray(data))
393
+ attachList = data.filter(Boolean);
394
+ else if (typeof data === "string") {
395
+ if (isArrStr(data)) {
396
+ attachList = (parseToJSON(data) || []).filter(Boolean);
397
+ } else {
398
+ const jsonData = parseToJSON(data);
399
+ const prototypeJson = Object.prototype.toString.call(jsonData);
400
+ if (prototypeJson === "[object Object]")
401
+ attachList = [jsonData].filter(Boolean);
402
+ else
403
+ attachList = [{ id: data, name: "name", uri: data, group: "default" }];
404
+ }
405
+ } else if (prototype === "[object Object]")
406
+ attachList = [data];
407
+ return attachList.map(recoverFile);
408
+ };
409
+
410
+ export { attachFmt, camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, currencyFmt, dateDuration, dateFmt, filterObj, fixiOSInputAutoZoomIn, getBaseAttachUrl, getHostEnv, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hideName, hidePhone, hideSurname, hideTail, hideThird, inBrowser, isArrStr, isDef, isEmail, isEmpty, isIdCard, isJSONStr, isNumeric, isPhone, isTel, isValidArrRes, isValidFileType, isValidKey, isValidPageRes, isValidRes, isValidResCode, 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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jhqn/utils-core",
3
3
  "type": "module",
4
- "version": "0.0.1-beta.22",
4
+ "version": "0.0.1-beta.24",
5
5
  "author": "jade-gjz <jiangang.zhang@jaderd.com>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/jaderd-jh/utils/tree/main/packages/core#readme",
@@ -20,9 +20,14 @@
20
20
  "sideEffects": false,
21
21
  "exports": {
22
22
  ".": {
23
- "types": "./dist/index.d.ts",
24
- "import": "./dist/index.mjs",
25
- "require": "./dist/index.cjs"
23
+ "import": {
24
+ "types": "./dist/index.d.mts",
25
+ "default": "./dist/index.mjs"
26
+ },
27
+ "require": {
28
+ "types": "./dist/index.d.cts",
29
+ "default": "./dist/index.cjs"
30
+ }
26
31
  }
27
32
  },
28
33
  "main": "dist/index.cjs",
@@ -37,7 +42,6 @@
37
42
  },
38
43
  "scripts": {
39
44
  "test": "vitest",
40
- "//build": "tsup",
41
45
  "build": "unbuild",
42
46
  "publint": "publint"
43
47
  }