@jhqn/utils-core 0.0.2-beta.6 → 0.0.3-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 CHANGED
@@ -93,6 +93,7 @@ const getVariableType = (val) => {
93
93
  return result?.toLocaleLowerCase();
94
94
  };
95
95
  const isNumber = (val) => getVariableType(val) === "number";
96
+ const isBigInt = (val) => getVariableType(val) === "bigint";
96
97
  const isString = (val) => getVariableType(val) === "string";
97
98
  const isBoolean = (val) => getVariableType(val) === "boolean";
98
99
  const isNull = (val) => getVariableType(val) === "null";
@@ -310,42 +311,6 @@ const hideBankCard = (bankCard) => {
310
311
  return "";
311
312
  };
312
313
 
313
- const inBrowser = typeof window !== "undefined";
314
- const waitTime = (time = 100) => {
315
- return new Promise((resolve) => {
316
- setTimeout(() => {
317
- resolve(true);
318
- }, time);
319
- });
320
- };
321
- const fixiOSInputAutoZoomIn = () => {
322
- if (CSS.supports("(font:-apple-system-body) and (-webkit-touch-callout:none) and (-webkit-tap-highlight-color:hotpink)")) {
323
- const viewport = document.querySelector('meta[name="viewport"]');
324
- if (viewport !== null) {
325
- viewport.content = `${viewport.content}, user-scalable=no`;
326
- }
327
- }
328
- };
329
- const userAgent = inBrowser ? window.navigator.userAgent : "";
330
- const getHostEnv = () => {
331
- const ua = userAgent.toLowerCase();
332
- const zlb = ua.includes("@zlb");
333
- const zyd = ua.includes("saas");
334
- const zzd = ua.includes("zhejiang") || ua.includes("tauruszjd");
335
- const wx = ua.includes("micromessenger");
336
- const zfb = ua.includes("alipay");
337
- const mini = ua.includes("miniprogram");
338
- const info = {
339
- zlb,
340
- zyd,
341
- zzd,
342
- wx,
343
- zfb,
344
- mini
345
- };
346
- return info;
347
- };
348
-
349
314
  const parseToJSON = (str, reviver2) => isJSONStr(str) ? JSON.parse(str, reviver2) : null;
350
315
  const replacer = (_, value) => {
351
316
  if (value instanceof Map) {
@@ -473,6 +438,47 @@ const attachFmt = (data) => {
473
438
  return attachList.map(recoverFile);
474
439
  };
475
440
 
441
+ const inBrowser = typeof window !== "undefined";
442
+ const waitTime = (time = 100) => {
443
+ return new Promise((resolve) => {
444
+ setTimeout(() => {
445
+ resolve(true);
446
+ }, time);
447
+ });
448
+ };
449
+ const fixiOSInputAutoZoomIn = () => {
450
+ if (CSS.supports("(font:-apple-system-body) and (-webkit-touch-callout:none) and (-webkit-tap-highlight-color:hotpink)")) {
451
+ const viewport = document.querySelector('meta[name="viewport"]');
452
+ if (viewport !== null) {
453
+ viewport.content = `${viewport.content}, user-scalable=no`;
454
+ }
455
+ }
456
+ };
457
+ const userAgent = inBrowser ? window.navigator.userAgent : "";
458
+ const getHostEnv = () => {
459
+ const ua = userAgent.toLowerCase();
460
+ const zlb = ua.includes("@zlb");
461
+ const zyd = ua.includes("saas");
462
+ const zzd = ua.includes("zhejiang") || ua.includes("tauruszjd");
463
+ const wx = ua.includes("micromessenger");
464
+ const zfb = ua.includes("alipay");
465
+ const mini = ua.includes("miniprogram");
466
+ const info = {
467
+ zlb,
468
+ zyd,
469
+ zzd,
470
+ wx,
471
+ zfb,
472
+ mini
473
+ };
474
+ return info;
475
+ };
476
+ const XOR_VAL = 1111;
477
+ const getCodeOfTime = (time) => Math.abs(new Date(time).getTime() ^ XOR_VAL);
478
+ const getCodeOfHour = () => getCodeOfTime(`${dateFmt( new Date(), "YYYY-MM-DD HH")}:00:00`);
479
+ const getCodeOfDate = () => getCodeOfTime(dateFmt(/* @__PURE__ */ new Date(), "date"));
480
+ const getCodeOfMonth = () => getCodeOfTime(dateFmt(dayjs__default().endOf("month"), "date"));
481
+
476
482
  exports.detect = detectBrowser.detect;
477
483
  exports.dayjs = dayjs__default;
478
484
  exports.attachFmt = attachFmt;
@@ -487,6 +493,9 @@ exports.dateFmt = dateFmt;
487
493
  exports.filterObj = filterObj;
488
494
  exports.fixiOSInputAutoZoomIn = fixiOSInputAutoZoomIn;
489
495
  exports.getBaseAttachUrl = getBaseAttachUrl;
496
+ exports.getCodeOfDate = getCodeOfDate;
497
+ exports.getCodeOfHour = getCodeOfHour;
498
+ exports.getCodeOfMonth = getCodeOfMonth;
490
499
  exports.getHostEnv = getHostEnv;
491
500
  exports.getVariableType = getVariableType;
492
501
  exports.hideBankCard = hideBankCard;
@@ -503,6 +512,7 @@ exports.hideThird = hideThird;
503
512
  exports.inBrowser = inBrowser;
504
513
  exports.isArrStr = isArrStr;
505
514
  exports.isArray = isArray;
515
+ exports.isBigInt = isBigInt;
506
516
  exports.isBlob = isBlob;
507
517
  exports.isBoolean = isBoolean;
508
518
  exports.isDate = isDate;
package/dist/index.d.cts CHANGED
@@ -365,6 +365,19 @@ declare const userAgent: string;
365
365
  */
366
366
  declare const getHostEnv: () => HostEnv;
367
367
 
368
+ /**
369
+ * 获取当小时的时间戳的异或值的绝对值, 当小时内获取的值是唯一的
370
+ */
371
+ declare const getCodeOfHour: () => number;
372
+ /**
373
+ * 获取当天的时间戳的异或值的绝对值, 当天内获取的值是唯一的
374
+ */
375
+ declare const getCodeOfDate: () => number;
376
+ /**
377
+ * 获取当月的时间戳的异或值的绝对值, 当月内获取的值是唯一的
378
+ */
379
+ declare const getCodeOfMonth: () => number;
380
+
368
381
  /**
369
382
  * Json字符串转对象
370
383
  * @param str
@@ -530,6 +543,11 @@ declare const getVariableType: (val: any) => string | undefined;
530
543
  * @param {any} val 检测的目标
531
544
  */
532
545
  declare const isNumber: (val: any) => val is number;
546
+ /**
547
+ * 是否是任意精度整数
548
+ * @param {any} val 检测的目标
549
+ */
550
+ declare const isBigInt: (val: any) => val is bigint;
533
551
  /**
534
552
  * 是否是字符串
535
553
  * @param {any} val 检测的目标
@@ -566,7 +584,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
566
584
  */
567
585
  declare const isArray: (val: any) => val is any[];
568
586
  /**
569
- * 是否是函数
587
+ * 是否是函数,但也有可能是Class
570
588
  * @param {any} val 检测的目标
571
589
  */
572
590
  declare const isFunction: (val: any) => val is Function;
@@ -728,4 +746,4 @@ declare const nonASCII: (text: string) => boolean;
728
746
  */
729
747
  declare const isValidFileType: (file: File, type: string) => boolean;
730
748
 
731
- 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, jLogDedupe, jLogOnce, 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 };
749
+ 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, getCodeOfDate, getCodeOfHour, getCodeOfMonth, getHostEnv, getVariableType, hideBankCard, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hideName, 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, 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, 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.d.mts CHANGED
@@ -365,6 +365,19 @@ declare const userAgent: string;
365
365
  */
366
366
  declare const getHostEnv: () => HostEnv;
367
367
 
368
+ /**
369
+ * 获取当小时的时间戳的异或值的绝对值, 当小时内获取的值是唯一的
370
+ */
371
+ declare const getCodeOfHour: () => number;
372
+ /**
373
+ * 获取当天的时间戳的异或值的绝对值, 当天内获取的值是唯一的
374
+ */
375
+ declare const getCodeOfDate: () => number;
376
+ /**
377
+ * 获取当月的时间戳的异或值的绝对值, 当月内获取的值是唯一的
378
+ */
379
+ declare const getCodeOfMonth: () => number;
380
+
368
381
  /**
369
382
  * Json字符串转对象
370
383
  * @param str
@@ -530,6 +543,11 @@ declare const getVariableType: (val: any) => string | undefined;
530
543
  * @param {any} val 检测的目标
531
544
  */
532
545
  declare const isNumber: (val: any) => val is number;
546
+ /**
547
+ * 是否是任意精度整数
548
+ * @param {any} val 检测的目标
549
+ */
550
+ declare const isBigInt: (val: any) => val is bigint;
533
551
  /**
534
552
  * 是否是字符串
535
553
  * @param {any} val 检测的目标
@@ -566,7 +584,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
566
584
  */
567
585
  declare const isArray: (val: any) => val is any[];
568
586
  /**
569
- * 是否是函数
587
+ * 是否是函数,但也有可能是Class
570
588
  * @param {any} val 检测的目标
571
589
  */
572
590
  declare const isFunction: (val: any) => val is Function;
@@ -728,4 +746,4 @@ declare const nonASCII: (text: string) => boolean;
728
746
  */
729
747
  declare const isValidFileType: (file: File, type: string) => boolean;
730
748
 
731
- 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, jLogDedupe, jLogOnce, 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 };
749
+ 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, getCodeOfDate, getCodeOfHour, getCodeOfMonth, getHostEnv, getVariableType, hideBankCard, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hideName, 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, 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, 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.d.ts CHANGED
@@ -365,6 +365,19 @@ declare const userAgent: string;
365
365
  */
366
366
  declare const getHostEnv: () => HostEnv;
367
367
 
368
+ /**
369
+ * 获取当小时的时间戳的异或值的绝对值, 当小时内获取的值是唯一的
370
+ */
371
+ declare const getCodeOfHour: () => number;
372
+ /**
373
+ * 获取当天的时间戳的异或值的绝对值, 当天内获取的值是唯一的
374
+ */
375
+ declare const getCodeOfDate: () => number;
376
+ /**
377
+ * 获取当月的时间戳的异或值的绝对值, 当月内获取的值是唯一的
378
+ */
379
+ declare const getCodeOfMonth: () => number;
380
+
368
381
  /**
369
382
  * Json字符串转对象
370
383
  * @param str
@@ -530,6 +543,11 @@ declare const getVariableType: (val: any) => string | undefined;
530
543
  * @param {any} val 检测的目标
531
544
  */
532
545
  declare const isNumber: (val: any) => val is number;
546
+ /**
547
+ * 是否是任意精度整数
548
+ * @param {any} val 检测的目标
549
+ */
550
+ declare const isBigInt: (val: any) => val is bigint;
533
551
  /**
534
552
  * 是否是字符串
535
553
  * @param {any} val 检测的目标
@@ -566,7 +584,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
566
584
  */
567
585
  declare const isArray: (val: any) => val is any[];
568
586
  /**
569
- * 是否是函数
587
+ * 是否是函数,但也有可能是Class
570
588
  * @param {any} val 检测的目标
571
589
  */
572
590
  declare const isFunction: (val: any) => val is Function;
@@ -728,4 +746,4 @@ declare const nonASCII: (text: string) => boolean;
728
746
  */
729
747
  declare const isValidFileType: (file: File, type: string) => boolean;
730
748
 
731
- 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, jLogDedupe, jLogOnce, 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 };
749
+ 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, getCodeOfDate, getCodeOfHour, getCodeOfMonth, getHostEnv, getVariableType, hideBankCard, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hideName, 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, 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, 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
@@ -82,6 +82,7 @@ const getVariableType = (val) => {
82
82
  return result?.toLocaleLowerCase();
83
83
  };
84
84
  const isNumber = (val) => getVariableType(val) === "number";
85
+ const isBigInt = (val) => getVariableType(val) === "bigint";
85
86
  const isString = (val) => getVariableType(val) === "string";
86
87
  const isBoolean = (val) => getVariableType(val) === "boolean";
87
88
  const isNull = (val) => getVariableType(val) === "null";
@@ -299,42 +300,6 @@ const hideBankCard = (bankCard) => {
299
300
  return "";
300
301
  };
301
302
 
302
- const inBrowser = typeof window !== "undefined";
303
- const waitTime = (time = 100) => {
304
- return new Promise((resolve) => {
305
- setTimeout(() => {
306
- resolve(true);
307
- }, time);
308
- });
309
- };
310
- const fixiOSInputAutoZoomIn = () => {
311
- if (CSS.supports("(font:-apple-system-body) and (-webkit-touch-callout:none) and (-webkit-tap-highlight-color:hotpink)")) {
312
- const viewport = document.querySelector('meta[name="viewport"]');
313
- if (viewport !== null) {
314
- viewport.content = `${viewport.content}, user-scalable=no`;
315
- }
316
- }
317
- };
318
- const userAgent = inBrowser ? window.navigator.userAgent : "";
319
- const getHostEnv = () => {
320
- const ua = userAgent.toLowerCase();
321
- const zlb = ua.includes("@zlb");
322
- const zyd = ua.includes("saas");
323
- const zzd = ua.includes("zhejiang") || ua.includes("tauruszjd");
324
- const wx = ua.includes("micromessenger");
325
- const zfb = ua.includes("alipay");
326
- const mini = ua.includes("miniprogram");
327
- const info = {
328
- zlb,
329
- zyd,
330
- zzd,
331
- wx,
332
- zfb,
333
- mini
334
- };
335
- return info;
336
- };
337
-
338
303
  const parseToJSON = (str, reviver2) => isJSONStr(str) ? JSON.parse(str, reviver2) : null;
339
304
  const replacer = (_, value) => {
340
305
  if (value instanceof Map) {
@@ -462,4 +427,45 @@ const attachFmt = (data) => {
462
427
  return attachList.map(recoverFile);
463
428
  };
464
429
 
465
- export { 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, jLogDedupe, jLogOnce, 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 };
430
+ const inBrowser = typeof window !== "undefined";
431
+ const waitTime = (time = 100) => {
432
+ return new Promise((resolve) => {
433
+ setTimeout(() => {
434
+ resolve(true);
435
+ }, time);
436
+ });
437
+ };
438
+ const fixiOSInputAutoZoomIn = () => {
439
+ if (CSS.supports("(font:-apple-system-body) and (-webkit-touch-callout:none) and (-webkit-tap-highlight-color:hotpink)")) {
440
+ const viewport = document.querySelector('meta[name="viewport"]');
441
+ if (viewport !== null) {
442
+ viewport.content = `${viewport.content}, user-scalable=no`;
443
+ }
444
+ }
445
+ };
446
+ const userAgent = inBrowser ? window.navigator.userAgent : "";
447
+ const getHostEnv = () => {
448
+ const ua = userAgent.toLowerCase();
449
+ const zlb = ua.includes("@zlb");
450
+ const zyd = ua.includes("saas");
451
+ const zzd = ua.includes("zhejiang") || ua.includes("tauruszjd");
452
+ const wx = ua.includes("micromessenger");
453
+ const zfb = ua.includes("alipay");
454
+ const mini = ua.includes("miniprogram");
455
+ const info = {
456
+ zlb,
457
+ zyd,
458
+ zzd,
459
+ wx,
460
+ zfb,
461
+ mini
462
+ };
463
+ return info;
464
+ };
465
+ const XOR_VAL = 1111;
466
+ const getCodeOfTime = (time) => Math.abs(new Date(time).getTime() ^ XOR_VAL);
467
+ const getCodeOfHour = () => getCodeOfTime(`${dateFmt( new Date(), "YYYY-MM-DD HH")}:00:00`);
468
+ const getCodeOfDate = () => getCodeOfTime(dateFmt(/* @__PURE__ */ new Date(), "date"));
469
+ const getCodeOfMonth = () => getCodeOfTime(dateFmt(dayjs().endOf("month"), "date"));
470
+
471
+ export { attachFmt, camel2Kebab, camel2Pascal, camel2Snake, camel2Title, checkImg, currencyFmt, dateDuration, dateFmt, filterObj, fixiOSInputAutoZoomIn, getBaseAttachUrl, getCodeOfDate, getCodeOfHour, getCodeOfMonth, getHostEnv, getVariableType, hideBankCard, hideCardNo, hideEmail, hideFirstName, hideHead, hideMiddle, hideName, 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, 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, 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.2-beta.6",
4
+ "version": "0.0.3-beta.0",
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",