@jhqn/utils-core 0.0.2-beta.7 → 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 +4 -2
- package/dist/index.d.cts +7 -2
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +3 -2
- 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";
|
|
@@ -478,8 +479,8 @@ const getCodeOfHour = () => getCodeOfTime(`${dateFmt( new Date(), "YYYY-MM-DD HH
|
|
|
478
479
|
const getCodeOfDate = () => getCodeOfTime(dateFmt(/* @__PURE__ */ new Date(), "date"));
|
|
479
480
|
const getCodeOfMonth = () => getCodeOfTime(dateFmt(dayjs__default().endOf("month"), "date"));
|
|
480
481
|
|
|
481
|
-
exports.dayjs = dayjs__default;
|
|
482
482
|
exports.detect = detectBrowser.detect;
|
|
483
|
+
exports.dayjs = dayjs__default;
|
|
483
484
|
exports.attachFmt = attachFmt;
|
|
484
485
|
exports.camel2Kebab = camel2Kebab;
|
|
485
486
|
exports.camel2Pascal = camel2Pascal;
|
|
@@ -511,6 +512,7 @@ exports.hideThird = hideThird;
|
|
|
511
512
|
exports.inBrowser = inBrowser;
|
|
512
513
|
exports.isArrStr = isArrStr;
|
|
513
514
|
exports.isArray = isArray;
|
|
515
|
+
exports.isBigInt = isBigInt;
|
|
514
516
|
exports.isBlob = isBlob;
|
|
515
517
|
exports.isBoolean = isBoolean;
|
|
516
518
|
exports.isDate = isDate;
|
package/dist/index.d.cts
CHANGED
|
@@ -543,6 +543,11 @@ declare const getVariableType: (val: any) => string | undefined;
|
|
|
543
543
|
* @param {any} val 检测的目标
|
|
544
544
|
*/
|
|
545
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;
|
|
546
551
|
/**
|
|
547
552
|
* 是否是字符串
|
|
548
553
|
* @param {any} val 检测的目标
|
|
@@ -579,7 +584,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
|
|
|
579
584
|
*/
|
|
580
585
|
declare const isArray: (val: any) => val is any[];
|
|
581
586
|
/**
|
|
582
|
-
*
|
|
587
|
+
* 是否是函数,但也有可能是Class
|
|
583
588
|
* @param {any} val 检测的目标
|
|
584
589
|
*/
|
|
585
590
|
declare const isFunction: (val: any) => val is Function;
|
|
@@ -741,4 +746,4 @@ declare const nonASCII: (text: string) => boolean;
|
|
|
741
746
|
*/
|
|
742
747
|
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
743
748
|
|
|
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 };
|
|
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
|
@@ -543,6 +543,11 @@ declare const getVariableType: (val: any) => string | undefined;
|
|
|
543
543
|
* @param {any} val 检测的目标
|
|
544
544
|
*/
|
|
545
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;
|
|
546
551
|
/**
|
|
547
552
|
* 是否是字符串
|
|
548
553
|
* @param {any} val 检测的目标
|
|
@@ -579,7 +584,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
|
|
|
579
584
|
*/
|
|
580
585
|
declare const isArray: (val: any) => val is any[];
|
|
581
586
|
/**
|
|
582
|
-
*
|
|
587
|
+
* 是否是函数,但也有可能是Class
|
|
583
588
|
* @param {any} val 检测的目标
|
|
584
589
|
*/
|
|
585
590
|
declare const isFunction: (val: any) => val is Function;
|
|
@@ -741,4 +746,4 @@ declare const nonASCII: (text: string) => boolean;
|
|
|
741
746
|
*/
|
|
742
747
|
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
743
748
|
|
|
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 };
|
|
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
|
@@ -543,6 +543,11 @@ declare const getVariableType: (val: any) => string | undefined;
|
|
|
543
543
|
* @param {any} val 检测的目标
|
|
544
544
|
*/
|
|
545
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;
|
|
546
551
|
/**
|
|
547
552
|
* 是否是字符串
|
|
548
553
|
* @param {any} val 检测的目标
|
|
@@ -579,7 +584,7 @@ declare const isObject: (val: any) => val is Record<any, any>;
|
|
|
579
584
|
*/
|
|
580
585
|
declare const isArray: (val: any) => val is any[];
|
|
581
586
|
/**
|
|
582
|
-
*
|
|
587
|
+
* 是否是函数,但也有可能是Class
|
|
583
588
|
* @param {any} val 检测的目标
|
|
584
589
|
*/
|
|
585
590
|
declare const isFunction: (val: any) => val is Function;
|
|
@@ -741,4 +746,4 @@ declare const nonASCII: (text: string) => boolean;
|
|
|
741
746
|
*/
|
|
742
747
|
declare const isValidFileType: (file: File, type: string) => boolean;
|
|
743
748
|
|
|
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 };
|
|
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
|
@@ -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";
|
|
@@ -467,4 +468,4 @@ const getCodeOfHour = () => getCodeOfTime(`${dateFmt( new Date(), "YYYY-MM-DD HH
|
|
|
467
468
|
const getCodeOfDate = () => getCodeOfTime(dateFmt(/* @__PURE__ */ new Date(), "date"));
|
|
468
469
|
const getCodeOfMonth = () => getCodeOfTime(dateFmt(dayjs().endOf("month"), "date"));
|
|
469
470
|
|
|
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 };
|
|
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