@jhqn/utils-core 0.0.2-beta.7 → 0.0.3-beta.1
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 +8 -9
- package/dist/index.d.cts +9 -10
- package/dist/index.d.mts +9 -10
- package/dist/index.d.ts +9 -10
- package/dist/index.mjs +7 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const detectBrowser = require('detect-browser');
|
|
3
4
|
const dayjs = require('dayjs');
|
|
4
5
|
const localeData = require('dayjs/plugin/localeData');
|
|
5
6
|
const duration = require('dayjs/plugin/duration');
|
|
@@ -7,7 +8,6 @@ const relativeTime = require('dayjs/plugin/relativeTime');
|
|
|
7
8
|
const customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
8
9
|
const objectSupport = require('dayjs/plugin/objectSupport');
|
|
9
10
|
const zhCN = require('dayjs/locale/zh-cn');
|
|
10
|
-
const detectBrowser = require('detect-browser');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
13
13
|
|
|
@@ -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";
|
|
@@ -363,15 +364,12 @@ const dateDuration = (start, end) => {
|
|
|
363
364
|
return dd.format(format);
|
|
364
365
|
};
|
|
365
366
|
|
|
366
|
-
let
|
|
367
|
+
let __BASE_ATTACH_URL__;
|
|
367
368
|
function setBaseAttachUrl(baseUrl) {
|
|
368
|
-
|
|
369
|
+
__BASE_ATTACH_URL__ = baseUrl;
|
|
369
370
|
}
|
|
370
371
|
function getBaseAttachUrl() {
|
|
371
|
-
return
|
|
372
|
-
}
|
|
373
|
-
if (undefined?.VITE_BASE_ATTACH_URL) {
|
|
374
|
-
setBaseAttachUrl(undefined.VITE_BASE_ATTACH_URL);
|
|
372
|
+
return __BASE_ATTACH_URL__;
|
|
375
373
|
}
|
|
376
374
|
|
|
377
375
|
const toThousands = (num) => {
|
|
@@ -398,7 +396,7 @@ const resUrl = (url) => {
|
|
|
398
396
|
}
|
|
399
397
|
const baseUrl = getBaseAttachUrl();
|
|
400
398
|
if (!isDef(baseUrl)) {
|
|
401
|
-
throw new Error("\u8BF7\u5148\u8BBE\u7F6E
|
|
399
|
+
throw new Error("\u8BF7\u5148\u4F7F\u7528 setBaseAttachUrl \u8BBE\u7F6E\u6587\u4EF6\u57FA\u672C\u8DEF\u5F84");
|
|
402
400
|
}
|
|
403
401
|
return `${baseUrl}/${url}`.replace(/([^:]\/)\/+/g, "$1");
|
|
404
402
|
};
|
|
@@ -478,8 +476,8 @@ const getCodeOfHour = () => getCodeOfTime(`${dateFmt( new Date(), "YYYY-MM-DD HH
|
|
|
478
476
|
const getCodeOfDate = () => getCodeOfTime(dateFmt(/* @__PURE__ */ new Date(), "date"));
|
|
479
477
|
const getCodeOfMonth = () => getCodeOfTime(dateFmt(dayjs__default().endOf("month"), "date"));
|
|
480
478
|
|
|
481
|
-
exports.dayjs = dayjs__default;
|
|
482
479
|
exports.detect = detectBrowser.detect;
|
|
480
|
+
exports.dayjs = dayjs__default;
|
|
483
481
|
exports.attachFmt = attachFmt;
|
|
484
482
|
exports.camel2Kebab = camel2Kebab;
|
|
485
483
|
exports.camel2Pascal = camel2Pascal;
|
|
@@ -511,6 +509,7 @@ exports.hideThird = hideThird;
|
|
|
511
509
|
exports.inBrowser = inBrowser;
|
|
512
510
|
exports.isArrStr = isArrStr;
|
|
513
511
|
exports.isArray = isArray;
|
|
512
|
+
exports.isBigInt = isBigInt;
|
|
514
513
|
exports.isBlob = isBlob;
|
|
515
514
|
exports.isBoolean = isBoolean;
|
|
516
515
|
exports.isDate = isDate;
|
package/dist/index.d.cts
CHANGED
|
@@ -499,10 +499,7 @@ declare const recoverFile: (resource: Resource) => {
|
|
|
499
499
|
deletable?: boolean | undefined;
|
|
500
500
|
reupload?: boolean | undefined;
|
|
501
501
|
fileName?: string | undefined;
|
|
502
|
-
thumbUrl?: string | undefined;
|
|
503
|
-
* 统一文件字段内容
|
|
504
|
-
* @param resource
|
|
505
|
-
*/
|
|
502
|
+
thumbUrl?: string | undefined;
|
|
506
503
|
percentage?: number | undefined;
|
|
507
504
|
};
|
|
508
505
|
/**
|
|
@@ -526,10 +523,7 @@ declare const attachFmt: (data: UnDef<MaybeArray<Resource>> | string) => {
|
|
|
526
523
|
deletable?: boolean | undefined;
|
|
527
524
|
reupload?: boolean | undefined;
|
|
528
525
|
fileName?: string | undefined;
|
|
529
|
-
thumbUrl?: string | undefined;
|
|
530
|
-
* 统一文件字段内容
|
|
531
|
-
* @param resource
|
|
532
|
-
*/
|
|
526
|
+
thumbUrl?: string | undefined;
|
|
533
527
|
percentage?: number | undefined;
|
|
534
528
|
}[];
|
|
535
529
|
|
|
@@ -543,6 +537,11 @@ declare const getVariableType: (val: any) => string | undefined;
|
|
|
543
537
|
* @param {any} val 检测的目标
|
|
544
538
|
*/
|
|
545
539
|
declare const isNumber: (val: any) => val is number;
|
|
540
|
+
/**
|
|
541
|
+
* 是否是任意精度整数
|
|
542
|
+
* @param {any} val 检测的目标
|
|
543
|
+
*/
|
|
544
|
+
declare const isBigInt: (val: any) => val is bigint;
|
|
546
545
|
/**
|
|
547
546
|
* 是否是字符串
|
|
548
547
|
* @param {any} val 检测的目标
|
|
@@ -579,7 +578,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
|
|
|
579
578
|
*/
|
|
580
579
|
declare const isArray: (val: any) => val is any[];
|
|
581
580
|
/**
|
|
582
|
-
*
|
|
581
|
+
* 是否是函数,但也有可能是Class
|
|
583
582
|
* @param {any} val 检测的目标
|
|
584
583
|
*/
|
|
585
584
|
declare const isFunction: (val: any) => val is Function;
|
|
@@ -741,4 +740,4 @@ declare const nonASCII: (text: string) => boolean;
|
|
|
741
740
|
*/
|
|
742
741
|
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
743
742
|
|
|
744
|
-
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, 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 };
|
|
743
|
+
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
|
@@ -499,10 +499,7 @@ declare const recoverFile: (resource: Resource) => {
|
|
|
499
499
|
deletable?: boolean | undefined;
|
|
500
500
|
reupload?: boolean | undefined;
|
|
501
501
|
fileName?: string | undefined;
|
|
502
|
-
thumbUrl?: string | undefined;
|
|
503
|
-
* 统一文件字段内容
|
|
504
|
-
* @param resource
|
|
505
|
-
*/
|
|
502
|
+
thumbUrl?: string | undefined;
|
|
506
503
|
percentage?: number | undefined;
|
|
507
504
|
};
|
|
508
505
|
/**
|
|
@@ -526,10 +523,7 @@ declare const attachFmt: (data: UnDef<MaybeArray<Resource>> | string) => {
|
|
|
526
523
|
deletable?: boolean | undefined;
|
|
527
524
|
reupload?: boolean | undefined;
|
|
528
525
|
fileName?: string | undefined;
|
|
529
|
-
thumbUrl?: string | undefined;
|
|
530
|
-
* 统一文件字段内容
|
|
531
|
-
* @param resource
|
|
532
|
-
*/
|
|
526
|
+
thumbUrl?: string | undefined;
|
|
533
527
|
percentage?: number | undefined;
|
|
534
528
|
}[];
|
|
535
529
|
|
|
@@ -543,6 +537,11 @@ declare const getVariableType: (val: any) => string | undefined;
|
|
|
543
537
|
* @param {any} val 检测的目标
|
|
544
538
|
*/
|
|
545
539
|
declare const isNumber: (val: any) => val is number;
|
|
540
|
+
/**
|
|
541
|
+
* 是否是任意精度整数
|
|
542
|
+
* @param {any} val 检测的目标
|
|
543
|
+
*/
|
|
544
|
+
declare const isBigInt: (val: any) => val is bigint;
|
|
546
545
|
/**
|
|
547
546
|
* 是否是字符串
|
|
548
547
|
* @param {any} val 检测的目标
|
|
@@ -579,7 +578,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
|
|
|
579
578
|
*/
|
|
580
579
|
declare const isArray: (val: any) => val is any[];
|
|
581
580
|
/**
|
|
582
|
-
*
|
|
581
|
+
* 是否是函数,但也有可能是Class
|
|
583
582
|
* @param {any} val 检测的目标
|
|
584
583
|
*/
|
|
585
584
|
declare const isFunction: (val: any) => val is Function;
|
|
@@ -741,4 +740,4 @@ declare const nonASCII: (text: string) => boolean;
|
|
|
741
740
|
*/
|
|
742
741
|
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
743
742
|
|
|
744
|
-
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, 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 };
|
|
743
|
+
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
|
@@ -499,10 +499,7 @@ declare const recoverFile: (resource: Resource) => {
|
|
|
499
499
|
deletable?: boolean | undefined;
|
|
500
500
|
reupload?: boolean | undefined;
|
|
501
501
|
fileName?: string | undefined;
|
|
502
|
-
thumbUrl?: string | undefined;
|
|
503
|
-
* 统一文件字段内容
|
|
504
|
-
* @param resource
|
|
505
|
-
*/
|
|
502
|
+
thumbUrl?: string | undefined;
|
|
506
503
|
percentage?: number | undefined;
|
|
507
504
|
};
|
|
508
505
|
/**
|
|
@@ -526,10 +523,7 @@ declare const attachFmt: (data: UnDef<MaybeArray<Resource>> | string) => {
|
|
|
526
523
|
deletable?: boolean | undefined;
|
|
527
524
|
reupload?: boolean | undefined;
|
|
528
525
|
fileName?: string | undefined;
|
|
529
|
-
thumbUrl?: string | undefined;
|
|
530
|
-
* 统一文件字段内容
|
|
531
|
-
* @param resource
|
|
532
|
-
*/
|
|
526
|
+
thumbUrl?: string | undefined;
|
|
533
527
|
percentage?: number | undefined;
|
|
534
528
|
}[];
|
|
535
529
|
|
|
@@ -543,6 +537,11 @@ declare const getVariableType: (val: any) => string | undefined;
|
|
|
543
537
|
* @param {any} val 检测的目标
|
|
544
538
|
*/
|
|
545
539
|
declare const isNumber: (val: any) => val is number;
|
|
540
|
+
/**
|
|
541
|
+
* 是否是任意精度整数
|
|
542
|
+
* @param {any} val 检测的目标
|
|
543
|
+
*/
|
|
544
|
+
declare const isBigInt: (val: any) => val is bigint;
|
|
546
545
|
/**
|
|
547
546
|
* 是否是字符串
|
|
548
547
|
* @param {any} val 检测的目标
|
|
@@ -579,7 +578,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
|
|
|
579
578
|
*/
|
|
580
579
|
declare const isArray: (val: any) => val is any[];
|
|
581
580
|
/**
|
|
582
|
-
*
|
|
581
|
+
* 是否是函数,但也有可能是Class
|
|
583
582
|
* @param {any} val 检测的目标
|
|
584
583
|
*/
|
|
585
584
|
declare const isFunction: (val: any) => val is Function;
|
|
@@ -741,4 +740,4 @@ declare const nonASCII: (text: string) => boolean;
|
|
|
741
740
|
*/
|
|
742
741
|
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
743
742
|
|
|
744
|
-
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, 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 };
|
|
743
|
+
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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { detect } from 'detect-browser';
|
|
1
2
|
import dayjs from 'dayjs';
|
|
2
3
|
export { default as dayjs } from 'dayjs';
|
|
3
4
|
import localeData from 'dayjs/plugin/localeData';
|
|
@@ -6,7 +7,6 @@ import relativeTime from 'dayjs/plugin/relativeTime';
|
|
|
6
7
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
7
8
|
import objectSupport from 'dayjs/plugin/objectSupport';
|
|
8
9
|
import zhCN from 'dayjs/locale/zh-cn';
|
|
9
|
-
export { detect } from 'detect-browser';
|
|
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());
|
|
@@ -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";
|
|
@@ -352,15 +353,12 @@ const dateDuration = (start, end) => {
|
|
|
352
353
|
return dd.format(format);
|
|
353
354
|
};
|
|
354
355
|
|
|
355
|
-
let
|
|
356
|
+
let __BASE_ATTACH_URL__;
|
|
356
357
|
function setBaseAttachUrl(baseUrl) {
|
|
357
|
-
|
|
358
|
+
__BASE_ATTACH_URL__ = baseUrl;
|
|
358
359
|
}
|
|
359
360
|
function getBaseAttachUrl() {
|
|
360
|
-
return
|
|
361
|
-
}
|
|
362
|
-
if (import.meta.env?.VITE_BASE_ATTACH_URL) {
|
|
363
|
-
setBaseAttachUrl(import.meta.env.VITE_BASE_ATTACH_URL);
|
|
361
|
+
return __BASE_ATTACH_URL__;
|
|
364
362
|
}
|
|
365
363
|
|
|
366
364
|
const toThousands = (num) => {
|
|
@@ -387,7 +385,7 @@ const resUrl = (url) => {
|
|
|
387
385
|
}
|
|
388
386
|
const baseUrl = getBaseAttachUrl();
|
|
389
387
|
if (!isDef(baseUrl)) {
|
|
390
|
-
throw new Error("\u8BF7\u5148\u8BBE\u7F6E
|
|
388
|
+
throw new Error("\u8BF7\u5148\u4F7F\u7528 setBaseAttachUrl \u8BBE\u7F6E\u6587\u4EF6\u57FA\u672C\u8DEF\u5F84");
|
|
391
389
|
}
|
|
392
390
|
return `${baseUrl}/${url}`.replace(/([^:]\/)\/+/g, "$1");
|
|
393
391
|
};
|
|
@@ -467,4 +465,4 @@ const getCodeOfHour = () => getCodeOfTime(`${dateFmt( new Date(), "YYYY-MM-DD HH
|
|
|
467
465
|
const getCodeOfDate = () => getCodeOfTime(dateFmt(/* @__PURE__ */ new Date(), "date"));
|
|
468
466
|
const getCodeOfMonth = () => getCodeOfTime(dateFmt(dayjs().endOf("month"), "date"));
|
|
469
467
|
|
|
470
|
-
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, 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 };
|
|
468
|
+
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