@pawover/kit 0.1.0 → 0.2.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.
|
@@ -11,41 +11,55 @@ function useLatest(value) {
|
|
|
11
11
|
return ref;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
|
-
//#region ../utils/dist/
|
|
15
|
-
function _typeof(o) {
|
|
16
|
-
"@babel/helpers - typeof";
|
|
17
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
18
|
-
return typeof o;
|
|
19
|
-
} : function(o) {
|
|
20
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
21
|
-
}, _typeof(o);
|
|
22
|
-
}
|
|
23
|
-
function toPrimitive(t, r) {
|
|
24
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
25
|
-
var e = t[Symbol.toPrimitive];
|
|
26
|
-
if (void 0 !== e) {
|
|
27
|
-
var i = e.call(t, r || "default");
|
|
28
|
-
if ("object" != _typeof(i)) return i;
|
|
29
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
30
|
-
}
|
|
31
|
-
return ("string" === r ? String : Number)(t);
|
|
32
|
-
}
|
|
33
|
-
function toPropertyKey(t) {
|
|
34
|
-
var i = toPrimitive(t, "string");
|
|
35
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
36
|
-
}
|
|
37
|
-
function _defineProperty(e, r, t) {
|
|
38
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
39
|
-
value: t,
|
|
40
|
-
enumerable: !0,
|
|
41
|
-
configurable: !0,
|
|
42
|
-
writable: !0
|
|
43
|
-
}) : e[r] = t, e;
|
|
44
|
-
}
|
|
14
|
+
//#region ../utils/dist/stringUtil-CaY_wCS-.js
|
|
45
15
|
/**
|
|
46
16
|
* 类型工具类
|
|
47
17
|
*/
|
|
48
18
|
var TypeUtil = class {
|
|
19
|
+
static PROTOTYPE_TAGS = {
|
|
20
|
+
STRING: "[object String]",
|
|
21
|
+
NUMBER: "[object Number]",
|
|
22
|
+
BOOLEAN: "[object Boolean]",
|
|
23
|
+
BIGINT: "[object BigInt]",
|
|
24
|
+
SYMBOL: "[object Symbol]",
|
|
25
|
+
UNDEFINED: "[object Undefined]",
|
|
26
|
+
NULL: "[object Null]",
|
|
27
|
+
OBJECT: "[object Object]",
|
|
28
|
+
FUNCTION: "[object Function]",
|
|
29
|
+
GENERATOR_FUNCTION: "[object GeneratorFunction]",
|
|
30
|
+
ASYNC_FUNCTION: "[object AsyncFunction]",
|
|
31
|
+
ASYNC_GENERATOR_FUNCTION: "[object AsyncGeneratorFunction]",
|
|
32
|
+
PROMISE: "[object Promise]",
|
|
33
|
+
MAP: "[object Map]",
|
|
34
|
+
SET: "[object Set]",
|
|
35
|
+
WEAK_MAP: "[object WeakMap]",
|
|
36
|
+
WEAK_SET: "[object WeakSet]",
|
|
37
|
+
BLOB: "[object Blob]",
|
|
38
|
+
FILE: "[object File]",
|
|
39
|
+
READABLE_STREAM: "[object ReadableStream]",
|
|
40
|
+
GLOBAL: "[object global]",
|
|
41
|
+
WINDOW: "[object Window]",
|
|
42
|
+
IFRAME: "[object HTMLIFrameElement]",
|
|
43
|
+
DATE: "[object Date]",
|
|
44
|
+
ERROR: "[object Error]",
|
|
45
|
+
REG_EXP: "[object RegExp]",
|
|
46
|
+
WEB_SOCKET: "[object WebSocket]",
|
|
47
|
+
URL_SEARCH_PARAMS: "[object URLSearchParams]",
|
|
48
|
+
ABORT_SIGNAL: "[object AbortSignal]"
|
|
49
|
+
};
|
|
50
|
+
static TYPED_ARRAY_TAGS = /* @__PURE__ */ new Set([
|
|
51
|
+
"[object Int8Array]",
|
|
52
|
+
"[object Uint8Array]",
|
|
53
|
+
"[object Uint8ClampedArray]",
|
|
54
|
+
"[object Int16Array]",
|
|
55
|
+
"[object Uint16Array]",
|
|
56
|
+
"[object Int32Array]",
|
|
57
|
+
"[object Uint32Array]",
|
|
58
|
+
"[object Float32Array]",
|
|
59
|
+
"[object Float64Array]",
|
|
60
|
+
"[object BigInt64Array]",
|
|
61
|
+
"[object BigUint64Array]"
|
|
62
|
+
]);
|
|
49
63
|
/**
|
|
50
64
|
* 获取值的 [[Prototype]] 标签
|
|
51
65
|
*
|
|
@@ -65,19 +79,22 @@ var TypeUtil = class {
|
|
|
65
79
|
}
|
|
66
80
|
/**
|
|
67
81
|
* 检查 value 是否为 string 类型
|
|
82
|
+
* - 当 `checkEmpty` 为 `true` 时,会先 trim 再判断是否为空
|
|
68
83
|
*
|
|
69
84
|
* @param value 待检查值
|
|
70
|
-
* @param checkEmpty
|
|
85
|
+
* @param checkEmpty 是否检查空字符串(含空白字符串),默认为 `false`
|
|
71
86
|
* @returns 是否为字符串
|
|
72
87
|
* @example
|
|
73
88
|
* ```ts
|
|
74
89
|
* TypeUtil.isString("abc"); // true
|
|
75
90
|
* TypeUtil.isString(""); // true
|
|
76
91
|
* TypeUtil.isString("", true); // false
|
|
92
|
+
* TypeUtil.isString(" ", true); // false
|
|
93
|
+
* TypeUtil.isString(" a ", true); // true
|
|
77
94
|
* ```
|
|
78
95
|
*/
|
|
79
96
|
static isString(value, checkEmpty = false) {
|
|
80
|
-
return typeof value === "string" && (!checkEmpty ||
|
|
97
|
+
return typeof value === "string" && (!checkEmpty || value.trim().length > 0);
|
|
81
98
|
}
|
|
82
99
|
/**
|
|
83
100
|
* 检查 value 是否为 number 类型
|
|
@@ -326,7 +343,7 @@ var TypeUtil = class {
|
|
|
326
343
|
* ```
|
|
327
344
|
*/
|
|
328
345
|
static isPromiseLike(value) {
|
|
329
|
-
return this.isPromise(value) || this.
|
|
346
|
+
return this.isPromise(value) || this.isPlainObject(value, false) && this.isFunction(value["then"]);
|
|
330
347
|
}
|
|
331
348
|
/**
|
|
332
349
|
* 判断是否为普通对象类型
|
|
@@ -334,18 +351,19 @@ var TypeUtil = class {
|
|
|
334
351
|
*
|
|
335
352
|
* @param value 待检查值
|
|
336
353
|
* @param prototypeCheck 是否进行原型检查,默认 `true`
|
|
337
|
-
* @returns 是否为 Plain Object (当
|
|
354
|
+
* @returns 是否为 Plain Object (当 prototypeCheck=true) 或 object
|
|
338
355
|
* @example
|
|
339
356
|
* ```ts
|
|
340
|
-
* TypeUtil.
|
|
341
|
-
* TypeUtil.
|
|
342
|
-
* TypeUtil.
|
|
343
|
-
* TypeUtil.
|
|
344
|
-
* TypeUtil.
|
|
345
|
-
* TypeUtil.
|
|
357
|
+
* TypeUtil.isPlainObject({}); // true
|
|
358
|
+
* TypeUtil.isPlainObject([]); // false
|
|
359
|
+
* TypeUtil.isPlainObject(new Date()); // false
|
|
360
|
+
* TypeUtil.isPlainObject(new (class {})()); // false
|
|
361
|
+
* TypeUtil.isPlainObject(new (class {})(), false); // true
|
|
362
|
+
* TypeUtil.isPlainObject(Object.create(null)) // false
|
|
363
|
+
* TypeUtil.isPlainObject(Object.create(null), false) // true
|
|
346
364
|
* ```
|
|
347
365
|
*/
|
|
348
|
-
static
|
|
366
|
+
static isPlainObject(value, prototypeCheck = true) {
|
|
349
367
|
const check = this.getPrototypeString(value) === this.PROTOTYPE_TAGS.OBJECT;
|
|
350
368
|
return prototypeCheck ? check && Object.getPrototypeOf(value) === Object.prototype : check;
|
|
351
369
|
}
|
|
@@ -529,7 +547,7 @@ var TypeUtil = class {
|
|
|
529
547
|
*/
|
|
530
548
|
static isReadableStream(value) {
|
|
531
549
|
if (this.getPrototypeString(value) === this.PROTOTYPE_TAGS.READABLE_STREAM) return true;
|
|
532
|
-
return this.
|
|
550
|
+
return this.isPlainObject(value) && this.isFunction(value["getReader"]) && this.isFunction(value["pipeThrough"]);
|
|
533
551
|
}
|
|
534
552
|
/**
|
|
535
553
|
* 检查 value 是否为 Window
|
|
@@ -693,54 +711,17 @@ var TypeUtil = class {
|
|
|
693
711
|
return typeof value === "string" && (value === "null" || value === "undefined" || value === "NaN" || value === "false" || value === "0" || value === "-0" || value === "0n");
|
|
694
712
|
}
|
|
695
713
|
};
|
|
696
|
-
_defineProperty(TypeUtil, "PROTOTYPE_TAGS", {
|
|
697
|
-
STRING: "[object String]",
|
|
698
|
-
NUMBER: "[object Number]",
|
|
699
|
-
BOOLEAN: "[object Boolean]",
|
|
700
|
-
BIGINT: "[object BigInt]",
|
|
701
|
-
SYMBOL: "[object Symbol]",
|
|
702
|
-
UNDEFINED: "[object Undefined]",
|
|
703
|
-
NULL: "[object Null]",
|
|
704
|
-
OBJECT: "[object Object]",
|
|
705
|
-
FUNCTION: "[object Function]",
|
|
706
|
-
GENERATOR_FUNCTION: "[object GeneratorFunction]",
|
|
707
|
-
ASYNC_FUNCTION: "[object AsyncFunction]",
|
|
708
|
-
ASYNC_GENERATOR_FUNCTION: "[object AsyncGeneratorFunction]",
|
|
709
|
-
PROMISE: "[object Promise]",
|
|
710
|
-
MAP: "[object Map]",
|
|
711
|
-
SET: "[object Set]",
|
|
712
|
-
WEAK_MAP: "[object WeakMap]",
|
|
713
|
-
WEAK_SET: "[object WeakSet]",
|
|
714
|
-
BLOB: "[object Blob]",
|
|
715
|
-
FILE: "[object File]",
|
|
716
|
-
READABLE_STREAM: "[object ReadableStream]",
|
|
717
|
-
GLOBAL: "[object global]",
|
|
718
|
-
WINDOW: "[object Window]",
|
|
719
|
-
IFRAME: "[object HTMLIFrameElement]",
|
|
720
|
-
DATE: "[object Date]",
|
|
721
|
-
ERROR: "[object Error]",
|
|
722
|
-
REG_EXP: "[object RegExp]",
|
|
723
|
-
WEB_SOCKET: "[object WebSocket]",
|
|
724
|
-
URL_SEARCH_PARAMS: "[object URLSearchParams]",
|
|
725
|
-
ABORT_SIGNAL: "[object AbortSignal]"
|
|
726
|
-
});
|
|
727
|
-
_defineProperty(TypeUtil, "TYPED_ARRAY_TAGS", new Set([
|
|
728
|
-
"[object Int8Array]",
|
|
729
|
-
"[object Uint8Array]",
|
|
730
|
-
"[object Uint8ClampedArray]",
|
|
731
|
-
"[object Int16Array]",
|
|
732
|
-
"[object Uint16Array]",
|
|
733
|
-
"[object Int32Array]",
|
|
734
|
-
"[object Uint32Array]",
|
|
735
|
-
"[object Float32Array]",
|
|
736
|
-
"[object Float64Array]",
|
|
737
|
-
"[object BigInt64Array]",
|
|
738
|
-
"[object BigUint64Array]"
|
|
739
|
-
]));
|
|
740
714
|
/**
|
|
741
715
|
* 字符串工具类
|
|
742
716
|
*/
|
|
743
717
|
var StringUtil = class {
|
|
718
|
+
static cast(candidate, checkEmpty = true) {
|
|
719
|
+
if (checkEmpty) {
|
|
720
|
+
if (candidate === null || candidate === void 0) return "";
|
|
721
|
+
if (typeof candidate === "string" && candidate.trim().length === 0) return "";
|
|
722
|
+
}
|
|
723
|
+
return String(candidate);
|
|
724
|
+
}
|
|
744
725
|
/**
|
|
745
726
|
* 从字符串中提取数字字符串
|
|
746
727
|
* - 移除非数字字符,保留符号和小数点
|
|
@@ -841,8 +822,8 @@ var StringUtil = class {
|
|
|
841
822
|
let normalized = input.replace(/^[A-Za-z]:([\\/])?/, (_, separator) => {
|
|
842
823
|
return separator ? "/" : "";
|
|
843
824
|
});
|
|
844
|
-
normalized = normalized.
|
|
845
|
-
normalized = normalized.
|
|
825
|
+
normalized = normalized.replaceAll("\\", "/");
|
|
826
|
+
normalized = normalized.replaceAll(/\/+/g, "/");
|
|
846
827
|
if (removeLeadingSlash && normalized.startsWith("/")) normalized = normalized.substring(1);
|
|
847
828
|
return normalized;
|
|
848
829
|
}
|
|
@@ -1050,7 +1031,7 @@ var ArrayUtil = class {
|
|
|
1050
1031
|
static merge(initialList, mergeList, match) {
|
|
1051
1032
|
if (!TypeUtil.isArray(initialList)) return [];
|
|
1052
1033
|
if (!TypeUtil.isArray(mergeList)) return [...initialList];
|
|
1053
|
-
if (!TypeUtil.isFunction(match)) return Array.from(new Set([...initialList, ...mergeList]));
|
|
1034
|
+
if (!TypeUtil.isFunction(match)) return Array.from(/* @__PURE__ */ new Set([...initialList, ...mergeList]));
|
|
1054
1035
|
const keys = /* @__PURE__ */ new Map();
|
|
1055
1036
|
mergeList.forEach((item, index) => {
|
|
1056
1037
|
keys.set(match(item, index), item);
|
|
@@ -1186,11 +1167,145 @@ var ArrayUtil = class {
|
|
|
1186
1167
|
}, result);
|
|
1187
1168
|
}
|
|
1188
1169
|
};
|
|
1189
|
-
|
|
1190
|
-
/**
|
|
1191
|
-
*
|
|
1192
|
-
|
|
1193
|
-
|
|
1170
|
+
(class {
|
|
1171
|
+
/**
|
|
1172
|
+
* 每秒的毫秒数
|
|
1173
|
+
* @example
|
|
1174
|
+
* ```ts
|
|
1175
|
+
* DateTimeUtil.MILLISECONDS_PER_SECOND; // 1000
|
|
1176
|
+
* ```
|
|
1177
|
+
*/
|
|
1178
|
+
static MILLISECONDS_PER_SECOND = 1e3;
|
|
1179
|
+
/**
|
|
1180
|
+
* 每分钟的秒数
|
|
1181
|
+
* @example
|
|
1182
|
+
* ```ts
|
|
1183
|
+
* DateTimeUtil.SECOND_PER_MINUTE; // 60
|
|
1184
|
+
* ```
|
|
1185
|
+
*/
|
|
1186
|
+
static SECOND_PER_MINUTE = 60;
|
|
1187
|
+
/**
|
|
1188
|
+
* 每小时的分钟数
|
|
1189
|
+
* @example
|
|
1190
|
+
* ```ts
|
|
1191
|
+
* DateTimeUtil.MINUTE_PER_HOUR; // 60
|
|
1192
|
+
* ```
|
|
1193
|
+
*/
|
|
1194
|
+
static MINUTE_PER_HOUR = 60;
|
|
1195
|
+
/**
|
|
1196
|
+
* 每小时的秒数
|
|
1197
|
+
* @example
|
|
1198
|
+
* ```ts
|
|
1199
|
+
* DateTimeUtil.SECOND_PER_HOUR; // 3600
|
|
1200
|
+
* ```
|
|
1201
|
+
*/
|
|
1202
|
+
static SECOND_PER_HOUR = this.SECOND_PER_MINUTE ** 2;
|
|
1203
|
+
/**
|
|
1204
|
+
* 每天小时数
|
|
1205
|
+
* @example
|
|
1206
|
+
* ```ts
|
|
1207
|
+
* DateTimeUtil.HOUR_PER_DAY; // 24
|
|
1208
|
+
* ```
|
|
1209
|
+
*/
|
|
1210
|
+
static HOUR_PER_DAY = 24;
|
|
1211
|
+
/**
|
|
1212
|
+
* 每天秒数
|
|
1213
|
+
* @example
|
|
1214
|
+
* ```ts
|
|
1215
|
+
* DateTimeUtil.SECOND_PER_DAY; // 86400
|
|
1216
|
+
* ```
|
|
1217
|
+
*/
|
|
1218
|
+
static SECOND_PER_DAY = this.SECOND_PER_HOUR * this.HOUR_PER_DAY;
|
|
1219
|
+
/**
|
|
1220
|
+
* 每周天数
|
|
1221
|
+
* @example
|
|
1222
|
+
* ```ts
|
|
1223
|
+
* DateTimeUtil.DAY_PER_WEEK; // 7
|
|
1224
|
+
* ```
|
|
1225
|
+
*/
|
|
1226
|
+
static DAY_PER_WEEK = 7;
|
|
1227
|
+
/**
|
|
1228
|
+
* 每月天数
|
|
1229
|
+
* @example
|
|
1230
|
+
* ```ts
|
|
1231
|
+
* DateTimeUtil.DAY_PER_MONTH; // 30
|
|
1232
|
+
* ```
|
|
1233
|
+
*/
|
|
1234
|
+
static DAY_PER_MONTH = 30;
|
|
1235
|
+
/**
|
|
1236
|
+
* 每年天数
|
|
1237
|
+
* @example
|
|
1238
|
+
* ```ts
|
|
1239
|
+
* DateTimeUtil.DAY_PER_YEAR; // 365
|
|
1240
|
+
* ```
|
|
1241
|
+
*/
|
|
1242
|
+
static DAY_PER_YEAR = 365;
|
|
1243
|
+
/**
|
|
1244
|
+
* 每年月数
|
|
1245
|
+
* @example
|
|
1246
|
+
* ```ts
|
|
1247
|
+
* DateTimeUtil.MONTH_PER_YEAR; // 12
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
static MONTH_PER_YEAR = 12;
|
|
1251
|
+
/**
|
|
1252
|
+
* 每年平均周
|
|
1253
|
+
* @example
|
|
1254
|
+
* ```ts
|
|
1255
|
+
* DateTimeUtil.WEEK_PER_YEAR; // 52
|
|
1256
|
+
* ```
|
|
1257
|
+
*/
|
|
1258
|
+
static WEEK_PER_YEAR = 52;
|
|
1259
|
+
/**
|
|
1260
|
+
* 每月平均周
|
|
1261
|
+
* @example
|
|
1262
|
+
* ```ts
|
|
1263
|
+
* DateTimeUtil.WEEK_PER_MONTH; // 4
|
|
1264
|
+
* ```
|
|
1265
|
+
*/
|
|
1266
|
+
static WEEK_PER_MONTH = 4;
|
|
1267
|
+
/**
|
|
1268
|
+
* 常用时间格式模板集合
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* ```ts
|
|
1272
|
+
* DateTimeUtil.FORMAT.ISO_DATE; // "yyyy-MM-dd"
|
|
1273
|
+
* DateTimeUtil.FORMAT.CN_DATE_TIME; // "yyyy年MM月dd日 HH时mm分ss秒"
|
|
1274
|
+
* ```
|
|
1275
|
+
*/
|
|
1276
|
+
static FORMAT = {
|
|
1277
|
+
ISO_DATE: "yyyy-MM-dd",
|
|
1278
|
+
ISO_TIME: "HH:mm:ss",
|
|
1279
|
+
ISO_DATE_TIME: "yyyy-MM-dd HH:mm:ss",
|
|
1280
|
+
ISO_DATE_TIME_MS: "yyyy-MM-dd HH:mm:ss.SSS",
|
|
1281
|
+
ISO_DATETIME_TZ: "yyyy-MM-dd'T'HH:mm:ssXXX",
|
|
1282
|
+
ISO_DATETIME_TZ_MS: "yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
|
|
1283
|
+
US_DATE: "MM/dd/yyyy",
|
|
1284
|
+
US_DATE_TIME: "MM/dd/yyyy HH:mm:ss",
|
|
1285
|
+
US_DATE_SHORT_YEAR: "MM/dd/yy",
|
|
1286
|
+
EU_DATE: "dd/MM/yyyy",
|
|
1287
|
+
EU_DATE_TIME: "dd/MM/yyyy HH:mm:ss",
|
|
1288
|
+
CN_DATE: "yyyy年MM月dd日",
|
|
1289
|
+
CN_DATE_TIME: "yyyy年MM月dd日 HH时mm分ss秒",
|
|
1290
|
+
CN_DATE_WEEKDAY: "yyyy年MM月dd日 EEE",
|
|
1291
|
+
CN_WEEKDAY_FULL: "EEEE",
|
|
1292
|
+
SHORT_DATE: "yy-MM-dd",
|
|
1293
|
+
SHORT_DATE_SLASH: "yy/MM/dd",
|
|
1294
|
+
MONTH_DAY: "MM-dd",
|
|
1295
|
+
MONTH_DAY_CN: "MM月dd日",
|
|
1296
|
+
DATE_WITH_WEEKDAY_SHORT: "yyyy-MM-dd (EEE)",
|
|
1297
|
+
DATE_WITH_WEEKDAY_FULL: "yyyy-MM-dd (EEEE)",
|
|
1298
|
+
TIME_24: "HH:mm:ss",
|
|
1299
|
+
TIME_24_NO_SEC: "HH:mm",
|
|
1300
|
+
TIME_12: "hh:mm:ss a",
|
|
1301
|
+
TIME_12_NO_SEC: "hh:mm a",
|
|
1302
|
+
TIMESTAMP: "yyyyMMddHHmmss",
|
|
1303
|
+
TIMESTAMP_MS: "yyyyMMddHHmmssSSS",
|
|
1304
|
+
RFC2822: "EEE, dd MMM yyyy HH:mm:ss xxx",
|
|
1305
|
+
READABLE_DATE: "MMM dd, yyyy",
|
|
1306
|
+
READABLE_DATE_TIME: "MMM dd, yyyy HH:mm",
|
|
1307
|
+
COMPACT_DATETIME: "yyyyMMdd_HHmmss"
|
|
1308
|
+
};
|
|
1194
1309
|
/**
|
|
1195
1310
|
* 获取当前时区信息
|
|
1196
1311
|
*
|
|
@@ -1207,57 +1322,14 @@ var DateTimeUtil = class {
|
|
|
1207
1322
|
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
1208
1323
|
};
|
|
1209
1324
|
}
|
|
1210
|
-
};
|
|
1211
|
-
_DateTimeUtil = DateTimeUtil;
|
|
1212
|
-
_defineProperty(DateTimeUtil, "MILLISECONDS_PER_SECOND", 1e3);
|
|
1213
|
-
_defineProperty(DateTimeUtil, "SECOND_PER_MINUTE", 60);
|
|
1214
|
-
_defineProperty(DateTimeUtil, "MINUTE_PER_HOUR", 60);
|
|
1215
|
-
_defineProperty(DateTimeUtil, "SECOND_PER_HOUR", _DateTimeUtil.SECOND_PER_MINUTE ** 2);
|
|
1216
|
-
_defineProperty(DateTimeUtil, "HOUR_PER_DAY", 24);
|
|
1217
|
-
_defineProperty(DateTimeUtil, "SECOND_PER_DAY", _DateTimeUtil.SECOND_PER_HOUR * _DateTimeUtil.HOUR_PER_DAY);
|
|
1218
|
-
_defineProperty(DateTimeUtil, "DAY_PER_WEEK", 7);
|
|
1219
|
-
_defineProperty(DateTimeUtil, "DAY_PER_MONTH", 30);
|
|
1220
|
-
_defineProperty(DateTimeUtil, "DAY_PER_YEAR", 365);
|
|
1221
|
-
_defineProperty(DateTimeUtil, "MONTH_PER_YEAR", 12);
|
|
1222
|
-
_defineProperty(DateTimeUtil, "WEEK_PER_YEAR", 52);
|
|
1223
|
-
_defineProperty(DateTimeUtil, "WEEK_PER_MONTH", 4);
|
|
1224
|
-
_defineProperty(DateTimeUtil, "FORMAT", {
|
|
1225
|
-
ISO_DATE: "yyyy-MM-dd",
|
|
1226
|
-
ISO_TIME: "HH:mm:ss",
|
|
1227
|
-
ISO_DATE_TIME: "yyyy-MM-dd HH:mm:ss",
|
|
1228
|
-
ISO_DATE_TIME_MS: "yyyy-MM-dd HH:mm:ss.SSS",
|
|
1229
|
-
ISO_DATETIME_TZ: "yyyy-MM-dd'T'HH:mm:ssXXX",
|
|
1230
|
-
ISO_DATETIME_TZ_MS: "yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
|
|
1231
|
-
US_DATE: "MM/dd/yyyy",
|
|
1232
|
-
US_DATE_TIME: "MM/dd/yyyy HH:mm:ss",
|
|
1233
|
-
US_DATE_SHORT_YEAR: "MM/dd/yy",
|
|
1234
|
-
EU_DATE: "dd/MM/yyyy",
|
|
1235
|
-
EU_DATE_TIME: "dd/MM/yyyy HH:mm:ss",
|
|
1236
|
-
CN_DATE: "yyyy年MM月dd日",
|
|
1237
|
-
CN_DATE_TIME: "yyyy年MM月dd日 HH时mm分ss秒",
|
|
1238
|
-
CN_DATE_WEEKDAY: "yyyy年MM月dd日 EEE",
|
|
1239
|
-
CN_WEEKDAY_FULL: "EEEE",
|
|
1240
|
-
SHORT_DATE: "yy-MM-dd",
|
|
1241
|
-
SHORT_DATE_SLASH: "yy/MM/dd",
|
|
1242
|
-
MONTH_DAY: "MM-dd",
|
|
1243
|
-
MONTH_DAY_CN: "MM月dd日",
|
|
1244
|
-
DATE_WITH_WEEKDAY_SHORT: "yyyy-MM-dd (EEE)",
|
|
1245
|
-
DATE_WITH_WEEKDAY_FULL: "yyyy-MM-dd (EEEE)",
|
|
1246
|
-
TIME_24: "HH:mm:ss",
|
|
1247
|
-
TIME_24_NO_SEC: "HH:mm",
|
|
1248
|
-
TIME_12: "hh:mm:ss a",
|
|
1249
|
-
TIME_12_NO_SEC: "hh:mm a",
|
|
1250
|
-
TIMESTAMP: "yyyyMMddHHmmss",
|
|
1251
|
-
TIMESTAMP_MS: "yyyyMMddHHmmssSSS",
|
|
1252
|
-
RFC2822: "EEE, dd MMM yyyy HH:mm:ss xxx",
|
|
1253
|
-
READABLE_DATE: "MMM dd, yyyy",
|
|
1254
|
-
READABLE_DATE_TIME: "MMM dd, yyyy HH:mm",
|
|
1255
|
-
COMPACT_DATETIME: "yyyyMMdd_HHmmss"
|
|
1256
1325
|
});
|
|
1257
1326
|
/**
|
|
1258
1327
|
* 环境检查工具类
|
|
1259
1328
|
*/
|
|
1260
1329
|
var EnvUtil = class {
|
|
1330
|
+
static _isBrowser = typeof window !== "undefined" && TypeUtil.isFunction(window?.document?.createElement);
|
|
1331
|
+
static _isWebWorker = typeof window === "undefined" && typeof self !== "undefined" && "importScripts" in self;
|
|
1332
|
+
static _isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
1261
1333
|
/**
|
|
1262
1334
|
* 检测是否处于浏览器环境
|
|
1263
1335
|
*
|
|
@@ -1448,187 +1520,6 @@ var EnvUtil = class {
|
|
|
1448
1520
|
}
|
|
1449
1521
|
}
|
|
1450
1522
|
};
|
|
1451
|
-
_defineProperty(EnvUtil, "_isBrowser", typeof window !== "undefined" && TypeUtil.isFunction(window?.document?.createElement));
|
|
1452
|
-
_defineProperty(EnvUtil, "_isWebWorker", typeof window === "undefined" && typeof self !== "undefined" && "importScripts" in self);
|
|
1453
|
-
_defineProperty(EnvUtil, "_isReactNative", typeof navigator !== "undefined" && navigator.product === "ReactNative");
|
|
1454
|
-
/**
|
|
1455
|
-
* MIME 工具类
|
|
1456
|
-
*/
|
|
1457
|
-
var MimeUtil = class {};
|
|
1458
|
-
_defineProperty(MimeUtil, "MIME", {
|
|
1459
|
-
/** 普通文本文件 */
|
|
1460
|
-
TEXT: "text/plain",
|
|
1461
|
-
/** 超文本标记语言文档 */
|
|
1462
|
-
HTML: "text/html",
|
|
1463
|
-
/** 层叠样式表文件 */
|
|
1464
|
-
CSS: "text/css",
|
|
1465
|
-
/** 逗号分隔值文件(表格数据) */
|
|
1466
|
-
CSV: "text/csv",
|
|
1467
|
-
/** 制表符分隔值文件 */
|
|
1468
|
-
TSV: "text/tab-separated-values",
|
|
1469
|
-
/** XML 文档 */
|
|
1470
|
-
XML: "text/xml",
|
|
1471
|
-
/** XHTML 文档(XML 严格格式的 HTML) */
|
|
1472
|
-
XHTML: "application/xhtml+xml",
|
|
1473
|
-
/** JavaScript 文件 */
|
|
1474
|
-
JS: "text/javascript",
|
|
1475
|
-
/** TypeScript 文件 */
|
|
1476
|
-
TS: "text/typescript",
|
|
1477
|
-
/** Python 文件 */
|
|
1478
|
-
PY: "text/x-python",
|
|
1479
|
-
/** Shell 脚本 (.sh) */
|
|
1480
|
-
SH: "text/x-sh",
|
|
1481
|
-
/** C 语言源文件 */
|
|
1482
|
-
C: "text/x-c",
|
|
1483
|
-
/** C++ 源文件 */
|
|
1484
|
-
CPP: "text/x-c++",
|
|
1485
|
-
/** C# 源文件 */
|
|
1486
|
-
CSHARP: "text/x-csharp",
|
|
1487
|
-
/** Java 源文件 */
|
|
1488
|
-
JAVA: "text/x-java",
|
|
1489
|
-
/** Go 源文件 */
|
|
1490
|
-
GO: "text/x-go",
|
|
1491
|
-
/** Rust 源文件 */
|
|
1492
|
-
RUST: "text/x-rust",
|
|
1493
|
-
/** PHP 文件 */
|
|
1494
|
-
PHP: "text/x-php",
|
|
1495
|
-
/** Ruby 文件 */
|
|
1496
|
-
RUBY: "text/x-ruby",
|
|
1497
|
-
/** Swift 源文件 */
|
|
1498
|
-
SWIFT: "text/x-swift",
|
|
1499
|
-
/** YAML 文档 */
|
|
1500
|
-
YAML: "text/vnd.yaml",
|
|
1501
|
-
/** TOML 文档 */
|
|
1502
|
-
TOML: "text/x-toml",
|
|
1503
|
-
/** SQL 脚本 */
|
|
1504
|
-
SQL: "text/x-sql",
|
|
1505
|
-
/** Markdown 格式文档 */
|
|
1506
|
-
MARKDOWN: "text/markdown",
|
|
1507
|
-
/** 富文本格式文档(.rtf) */
|
|
1508
|
-
RTF: "application/rtf",
|
|
1509
|
-
/** iCalendar 日历格式(.ics) */
|
|
1510
|
-
CALENDAR: "text/calendar",
|
|
1511
|
-
/** JPEG 图像(.jpg/.jpeg) */
|
|
1512
|
-
JPEG: "image/jpeg",
|
|
1513
|
-
/** PNG 图像(无损压缩,支持透明) */
|
|
1514
|
-
PNG: "image/png",
|
|
1515
|
-
/** GIF 图像(支持动画) */
|
|
1516
|
-
GIF: "image/gif",
|
|
1517
|
-
/** Windows 位图(.bmp) */
|
|
1518
|
-
BMP: "image/bmp",
|
|
1519
|
-
/** SVG 向量图形(.svg) */
|
|
1520
|
-
SVG: "image/svg+xml",
|
|
1521
|
-
/** APNG 动态图像(.apng) */
|
|
1522
|
-
APNG: "image/apng",
|
|
1523
|
-
/** AVIF 图像(高效压缩) */
|
|
1524
|
-
AVIF: "image/avif",
|
|
1525
|
-
/** 图标文件格式(.ico) */
|
|
1526
|
-
ICO: "image/vnd.microsoft.icon",
|
|
1527
|
-
/** WebP 图像(高效压缩) */
|
|
1528
|
-
WEBP: "image/webp",
|
|
1529
|
-
/** TIFF 图像(.tif/.tiff) */
|
|
1530
|
-
TIFF: "image/tiff",
|
|
1531
|
-
/** HEIC 图像(高效编码) */
|
|
1532
|
-
HEIC: "image/heic",
|
|
1533
|
-
/** Adobe Photoshop 文件(.psd) */
|
|
1534
|
-
PSD: "image/vnd.adobe.photoshop",
|
|
1535
|
-
/** MP3 音频(.mp3) */
|
|
1536
|
-
MP3: "audio/mpeg",
|
|
1537
|
-
/** AAC 音频(.aac) */
|
|
1538
|
-
AAC: "audio/aac",
|
|
1539
|
-
/** MIDI 音乐文件(.mid/.midi) */
|
|
1540
|
-
MIDI: "audio/midi",
|
|
1541
|
-
/** OGG 音频(.oga) */
|
|
1542
|
-
OGG_AUDIO: "audio/ogg",
|
|
1543
|
-
/** Opus 音频(.opus) */
|
|
1544
|
-
OPUS: "audio/opus",
|
|
1545
|
-
/** WAV 音频(.wav) */
|
|
1546
|
-
WAV: "audio/wav",
|
|
1547
|
-
/** RealAudio 音频(.ra/.ram) */
|
|
1548
|
-
REAL_AUDIO: "audio/x-pn-realaudio",
|
|
1549
|
-
/** MP4 视频(.mp4) */
|
|
1550
|
-
MP4: "video/mp4",
|
|
1551
|
-
/** MPEG 视频(.mpeg/.mpg) */
|
|
1552
|
-
MPEG: "video/mpeg",
|
|
1553
|
-
/** OGG 视频(.ogv) */
|
|
1554
|
-
OGG_VIDEO: "video/ogg",
|
|
1555
|
-
/** AVI 视频(.avi) */
|
|
1556
|
-
AVI: "video/x-msvideo",
|
|
1557
|
-
/** 3GPP 视频(.3gp) */
|
|
1558
|
-
THREE_GPP: "video/3gpp",
|
|
1559
|
-
/** 3GPP2 视频(.3g2) */
|
|
1560
|
-
THREE_GPP2: "video/3gpp2",
|
|
1561
|
-
/** WebM 视频(.webm) */
|
|
1562
|
-
WEBM: "video/webm",
|
|
1563
|
-
/** PDF 文档 */
|
|
1564
|
-
PDF: "application/pdf",
|
|
1565
|
-
/** Word 97-2003 文档(.doc) */
|
|
1566
|
-
DOC: "application/msword",
|
|
1567
|
-
/** Word 2007+ 文档(.docx) */
|
|
1568
|
-
DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1569
|
-
/** Excel 2007+ 工作簿(.xlsx) */
|
|
1570
|
-
XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1571
|
-
/** 启用宏的Excel工作簿(.xlsm) */
|
|
1572
|
-
XLSM: "application/vnd.ms-excel.sheet.macroEnabled.12",
|
|
1573
|
-
/** Excel模板文件(.xltx) */
|
|
1574
|
-
XLTX: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
1575
|
-
/** PowerPoint 2007+ 演示文稿(.pptx) */
|
|
1576
|
-
PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
1577
|
-
/** PowerPoint 97-2003 演示文稿(.ppt) */
|
|
1578
|
-
PPT: "application/vnd.ms-powerpoint",
|
|
1579
|
-
/** OpenDocument 文本文档(.odt) */
|
|
1580
|
-
ODT: "application/vnd.oasis.opendocument.text",
|
|
1581
|
-
/** OpenDocument 表格文档(.ods) */
|
|
1582
|
-
ODS: "application/vnd.oasis.opendocument.spreadsheet",
|
|
1583
|
-
/** OpenDocument 演示文稿(.odp) */
|
|
1584
|
-
ODP: "application/vnd.oasis.opendocument.presentation",
|
|
1585
|
-
/** EPUB 电子书(.epub) */
|
|
1586
|
-
EPUB: "application/epub+zip",
|
|
1587
|
-
/** Kindle 电子书(.azw) */
|
|
1588
|
-
AZW: "application/vnd.amazon.ebook",
|
|
1589
|
-
/** ZIP 压缩文件(.zip) */
|
|
1590
|
-
ZIP: "application/zip",
|
|
1591
|
-
/** GZIP 压缩文件(.gz) */
|
|
1592
|
-
GZIP: "application/gzip",
|
|
1593
|
-
/** GZIP 压缩文件(旧格式) */
|
|
1594
|
-
X_GZIP: "application/x-gzip",
|
|
1595
|
-
/** TAR 归档文件(.tar) */
|
|
1596
|
-
TAR: "application/x-tar",
|
|
1597
|
-
/** BZip 归档(.bz) */
|
|
1598
|
-
BZIP: "application/x-bzip",
|
|
1599
|
-
/** BZip2 归档(.bz2) */
|
|
1600
|
-
BZIP2: "application/x-bzip2",
|
|
1601
|
-
/** 7-Zip 压缩文件(.7z) */
|
|
1602
|
-
SEVEN_Z: "application/x-7z-compressed",
|
|
1603
|
-
/** RAR 压缩文件(.rar) */
|
|
1604
|
-
RAR: "application/vnd.rar",
|
|
1605
|
-
/** 通用二进制数据(默认类型) */
|
|
1606
|
-
OCTET_STREAM: "application/octet-stream",
|
|
1607
|
-
/** JSON 数据格式(.json) */
|
|
1608
|
-
JSON: "application/json",
|
|
1609
|
-
/** JSON-LD 格式(.jsonld) */
|
|
1610
|
-
LD_JSON: "application/ld+json",
|
|
1611
|
-
/** Java 归档文件(.jar) */
|
|
1612
|
-
JAR: "application/java-archive",
|
|
1613
|
-
/** WebAssembly 二进制指令格式(.wasm) */
|
|
1614
|
-
WASM: "application/wasm",
|
|
1615
|
-
/** MS 嵌入式 OpenType 字体(.eot) */
|
|
1616
|
-
EOT: "application/vnd.ms-fontobject",
|
|
1617
|
-
/** OpenType 字体(.otf) */
|
|
1618
|
-
OTF: "font/otf",
|
|
1619
|
-
/** WOFF 字体(.woff) */
|
|
1620
|
-
WOFF: "font/woff",
|
|
1621
|
-
/** WOFF2 字体(.woff2) */
|
|
1622
|
-
WOFF2: "font/woff2",
|
|
1623
|
-
/** TrueType 字体(.ttf) */
|
|
1624
|
-
TTF: "font/ttf",
|
|
1625
|
-
/** Excel 97-2003 工作簿(.xls) */
|
|
1626
|
-
XLS: "application/vnd.ms-excel",
|
|
1627
|
-
/** Microsoft XPS 文档(.xps) */
|
|
1628
|
-
XPS: "application/vnd.ms-xpsdocument",
|
|
1629
|
-
/** Word 启用宏文档(.docm) */
|
|
1630
|
-
DOCM: "application/vnd.ms-word.document.macroEnabled.12"
|
|
1631
|
-
});
|
|
1632
1523
|
/**
|
|
1633
1524
|
* 对象工具类
|
|
1634
1525
|
*/
|
|
@@ -1660,7 +1551,7 @@ var ObjectUtil = class {
|
|
|
1660
1551
|
*/
|
|
1661
1552
|
static entriesMap(plainObject, toEntry) {
|
|
1662
1553
|
const defaultResult = {};
|
|
1663
|
-
if (!TypeUtil.
|
|
1554
|
+
if (!TypeUtil.isPlainObject(plainObject)) return defaultResult;
|
|
1664
1555
|
return this.entries(plainObject).reduce((acc, [key, value]) => {
|
|
1665
1556
|
const [newKey, newValue] = toEntry(key, value);
|
|
1666
1557
|
acc[newKey] = newValue;
|
|
@@ -1669,7 +1560,7 @@ var ObjectUtil = class {
|
|
|
1669
1560
|
}
|
|
1670
1561
|
static pick(obj, keys) {
|
|
1671
1562
|
const result = {};
|
|
1672
|
-
if (!TypeUtil.
|
|
1563
|
+
if (!TypeUtil.isPlainObject(obj)) return result;
|
|
1673
1564
|
if (!TypeUtil.isArray(keys)) return obj;
|
|
1674
1565
|
return keys.reduce((acc, key) => {
|
|
1675
1566
|
if (key in obj) acc[key] = obj[key];
|
|
@@ -1678,7 +1569,7 @@ var ObjectUtil = class {
|
|
|
1678
1569
|
}
|
|
1679
1570
|
static omit(obj, keys) {
|
|
1680
1571
|
const result = {};
|
|
1681
|
-
if (!TypeUtil.
|
|
1572
|
+
if (!TypeUtil.isPlainObject(obj)) return result;
|
|
1682
1573
|
if (!TypeUtil.isArray(keys)) return obj;
|
|
1683
1574
|
const keysToOmit = new Set(keys);
|
|
1684
1575
|
return Object.keys(obj).reduce((acc, key) => {
|
|
@@ -1688,14 +1579,14 @@ var ObjectUtil = class {
|
|
|
1688
1579
|
}
|
|
1689
1580
|
static invert(obj) {
|
|
1690
1581
|
const result = {};
|
|
1691
|
-
if (!TypeUtil.
|
|
1582
|
+
if (!TypeUtil.isPlainObject(obj)) return result;
|
|
1692
1583
|
for (const [k, v] of this.entries(obj)) if (TypeUtil.isString(v) || TypeUtil.isNumber(v) || TypeUtil.isSymbol(v)) result[v] = k;
|
|
1693
1584
|
return result;
|
|
1694
1585
|
}
|
|
1695
1586
|
static crush(obj) {
|
|
1696
1587
|
if (!obj) return {};
|
|
1697
1588
|
function crushReducer(crushed, value, path) {
|
|
1698
|
-
if (TypeUtil.
|
|
1589
|
+
if (TypeUtil.isPlainObject(value) || TypeUtil.isArray(value)) for (const [prop, propValue] of Object.entries(value)) crushReducer(crushed, propValue, path ? `${path}.${prop}` : prop);
|
|
1699
1590
|
else crushed[path] = value;
|
|
1700
1591
|
return crushed;
|
|
1701
1592
|
}
|
|
@@ -1723,375 +1614,6 @@ var ObjectUtil = class {
|
|
|
1723
1614
|
return entries;
|
|
1724
1615
|
}
|
|
1725
1616
|
};
|
|
1726
|
-
/**
|
|
1727
|
-
* 主题工具类
|
|
1728
|
-
*/
|
|
1729
|
-
var ThemeUtil = class {};
|
|
1730
|
-
_defineProperty(ThemeUtil, "THEME", {
|
|
1731
|
-
LIGHT: "light",
|
|
1732
|
-
DARK: "dark"
|
|
1733
|
-
});
|
|
1734
|
-
_defineProperty(ThemeUtil, "THEME_MODE", {
|
|
1735
|
-
LIGHT: "light",
|
|
1736
|
-
DARK: "dark",
|
|
1737
|
-
SYSTEM: "system"
|
|
1738
|
-
});
|
|
1739
|
-
/**
|
|
1740
|
-
* 验证工具类
|
|
1741
|
-
*/
|
|
1742
|
-
var ValidateUtil = class {
|
|
1743
|
-
/**
|
|
1744
|
-
* 验证是否为手机号码
|
|
1745
|
-
* @example
|
|
1746
|
-
* ```ts
|
|
1747
|
-
* ValidateUtil.isPhone("13800138000"); // true
|
|
1748
|
-
* ```
|
|
1749
|
-
*/
|
|
1750
|
-
static isPhone(input) {
|
|
1751
|
-
return this._phone.test(input.toString());
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* 验证是否为固定电话
|
|
1755
|
-
* @example
|
|
1756
|
-
* ```ts
|
|
1757
|
-
* ValidateUtil.isTelephone("010-12345678"); // true
|
|
1758
|
-
* ```
|
|
1759
|
-
*/
|
|
1760
|
-
static isTelephone(input) {
|
|
1761
|
-
return this._telephone.test(input.toString());
|
|
1762
|
-
}
|
|
1763
|
-
/**
|
|
1764
|
-
* 验证是否为移动设备识别码
|
|
1765
|
-
* @example
|
|
1766
|
-
* ```ts
|
|
1767
|
-
* ValidateUtil.isIMEI("490154203237518"); // true
|
|
1768
|
-
* ```
|
|
1769
|
-
*/
|
|
1770
|
-
static isIMEI(input) {
|
|
1771
|
-
return this._IMEI.test(input.toString());
|
|
1772
|
-
}
|
|
1773
|
-
/**
|
|
1774
|
-
* 验证是否为电子邮箱
|
|
1775
|
-
* @example
|
|
1776
|
-
* ```ts
|
|
1777
|
-
* ValidateUtil.isEmail("dev@example.com"); // true
|
|
1778
|
-
* ```
|
|
1779
|
-
*/
|
|
1780
|
-
static isEmail(input) {
|
|
1781
|
-
return this._email.test(input.toString());
|
|
1782
|
-
}
|
|
1783
|
-
/**
|
|
1784
|
-
* 验证是否为 http(s) 链接
|
|
1785
|
-
* @example
|
|
1786
|
-
* ```ts
|
|
1787
|
-
* ValidateUtil.isHttpLink("https://example.com/path"); // true
|
|
1788
|
-
* ```
|
|
1789
|
-
*/
|
|
1790
|
-
static isHttpLink(input) {
|
|
1791
|
-
return this._link.test(input.toString());
|
|
1792
|
-
}
|
|
1793
|
-
/**
|
|
1794
|
-
* 验证是否为端口号链接
|
|
1795
|
-
* @example
|
|
1796
|
-
* ```ts
|
|
1797
|
-
* ValidateUtil.isPortLink("http://example.com:8080"); // true
|
|
1798
|
-
* ```
|
|
1799
|
-
*/
|
|
1800
|
-
static isPortLink(input) {
|
|
1801
|
-
return this._portLink.test(input.toString());
|
|
1802
|
-
}
|
|
1803
|
-
/**
|
|
1804
|
-
* 验证是否为迅雷链接
|
|
1805
|
-
* @example
|
|
1806
|
-
* ```ts
|
|
1807
|
-
* ValidateUtil.isThunderLink("thunder://QUFodHRwOi8vZXhhbXBsZS5jb20vZmlsZQ=="); // true
|
|
1808
|
-
* ```
|
|
1809
|
-
*/
|
|
1810
|
-
static isThunderLink(input) {
|
|
1811
|
-
return this._thunderLink.test(input.toString());
|
|
1812
|
-
}
|
|
1813
|
-
/**
|
|
1814
|
-
* 验证是否为统一社会信用代码
|
|
1815
|
-
* @example
|
|
1816
|
-
* ```ts
|
|
1817
|
-
* ValidateUtil.isUSCC("91350100M000100Y43"); // true
|
|
1818
|
-
* ```
|
|
1819
|
-
*/
|
|
1820
|
-
static isUSCC(input) {
|
|
1821
|
-
return this._uscc.test(input.toString());
|
|
1822
|
-
}
|
|
1823
|
-
/**
|
|
1824
|
-
* 验证是否为统一社会信用代码 - 15位/18位/20位数字/字母
|
|
1825
|
-
* @example
|
|
1826
|
-
* ```ts
|
|
1827
|
-
* ValidateUtil.isUSCCS("91350100M000100Y43"); // true
|
|
1828
|
-
* ```
|
|
1829
|
-
*/
|
|
1830
|
-
static isUSCCS(input) {
|
|
1831
|
-
return this._usccs.test(input.toString());
|
|
1832
|
-
}
|
|
1833
|
-
/**
|
|
1834
|
-
* 验证是否为 Windows 系统文件夹路径
|
|
1835
|
-
* @example
|
|
1836
|
-
* ```ts
|
|
1837
|
-
* ValidateUtil.isDirPathWindows("C:\\Users\\pawover\\"); // true
|
|
1838
|
-
* ```
|
|
1839
|
-
*/
|
|
1840
|
-
static isDirPathWindows(input) {
|
|
1841
|
-
return this._dirPathWindows.test(input.toString());
|
|
1842
|
-
}
|
|
1843
|
-
/**
|
|
1844
|
-
* 验证是否为 Windows 系统文件路径
|
|
1845
|
-
* @example
|
|
1846
|
-
* ```ts
|
|
1847
|
-
* ValidateUtil.isFilePathWindows("C:\\Users\\pawover\\a.txt"); // true
|
|
1848
|
-
* ```
|
|
1849
|
-
*/
|
|
1850
|
-
static isFilePathWindows(input) {
|
|
1851
|
-
return this._filePathWindows.test(input.toString());
|
|
1852
|
-
}
|
|
1853
|
-
/**
|
|
1854
|
-
* 验证是否为 Linux 系统文件夹路径
|
|
1855
|
-
* @example
|
|
1856
|
-
* ```ts
|
|
1857
|
-
* ValidateUtil.isDirPathLinux("/usr/local/"); // true
|
|
1858
|
-
* ```
|
|
1859
|
-
*/
|
|
1860
|
-
static isDirPathLinux(input) {
|
|
1861
|
-
return this._dirPathLinux.test(input.toString());
|
|
1862
|
-
}
|
|
1863
|
-
/**
|
|
1864
|
-
* 验证是否为 Linux 系统文件路径
|
|
1865
|
-
* @example
|
|
1866
|
-
* ```ts
|
|
1867
|
-
* ValidateUtil.isFilePathLinux("/usr/local/bin/node"); // true
|
|
1868
|
-
* ```
|
|
1869
|
-
*/
|
|
1870
|
-
static isFilePathLinux(input) {
|
|
1871
|
-
return this._filePathLinux.test(input.toString());
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* 验证是否为新能源车牌号
|
|
1875
|
-
* @example
|
|
1876
|
-
* ```ts
|
|
1877
|
-
* ValidateUtil.isEVCarNumber("粤AD12345"); // true
|
|
1878
|
-
* ```
|
|
1879
|
-
*/
|
|
1880
|
-
static isEVCarNumber(input) {
|
|
1881
|
-
return this._EVCarNumber.test(input.toString());
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* 验证是否为燃油车车牌号
|
|
1885
|
-
* @example
|
|
1886
|
-
* ```ts
|
|
1887
|
-
* ValidateUtil.isGVCarNumber("粤B12345"); // true
|
|
1888
|
-
* ```
|
|
1889
|
-
*/
|
|
1890
|
-
static isGVCarNumber(input) {
|
|
1891
|
-
return this._GVCarNumber.test(input.toString());
|
|
1892
|
-
}
|
|
1893
|
-
/**
|
|
1894
|
-
* 验证是否为中文姓名
|
|
1895
|
-
* @example
|
|
1896
|
-
* ```ts
|
|
1897
|
-
* ValidateUtil.isChineseName("张三"); // true
|
|
1898
|
-
* ```
|
|
1899
|
-
*/
|
|
1900
|
-
static isChineseName(input) {
|
|
1901
|
-
return this._chineseName.test(input.toString());
|
|
1902
|
-
}
|
|
1903
|
-
/**
|
|
1904
|
-
* 验证是否为中国身份证号
|
|
1905
|
-
* @example
|
|
1906
|
-
* ```ts
|
|
1907
|
-
* ValidateUtil.isChineseID("11010519491231002X"); // true
|
|
1908
|
-
* ```
|
|
1909
|
-
*/
|
|
1910
|
-
static isChineseID(input) {
|
|
1911
|
-
return this._chineseId.test(input.toString());
|
|
1912
|
-
}
|
|
1913
|
-
/**
|
|
1914
|
-
* 验证是否为中国省份
|
|
1915
|
-
* @example
|
|
1916
|
-
* ```ts
|
|
1917
|
-
* ValidateUtil.isChineseProvince("浙江"); // true
|
|
1918
|
-
* ```
|
|
1919
|
-
*/
|
|
1920
|
-
static isChineseProvince(input) {
|
|
1921
|
-
return this._chineseProvince.test(input.toString());
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* 验证是否为中华民族
|
|
1925
|
-
* @example
|
|
1926
|
-
* ```ts
|
|
1927
|
-
* ValidateUtil.isChineseNation("汉族"); // true
|
|
1928
|
-
* ```
|
|
1929
|
-
*/
|
|
1930
|
-
static isChineseNation(input) {
|
|
1931
|
-
return this._chineseNation.test(input.toString());
|
|
1932
|
-
}
|
|
1933
|
-
/**
|
|
1934
|
-
* 验证是否只包含字母
|
|
1935
|
-
* @example
|
|
1936
|
-
* ```ts
|
|
1937
|
-
* ValidateUtil.isLetter("abcDEF"); // true
|
|
1938
|
-
* ```
|
|
1939
|
-
*/
|
|
1940
|
-
static isLetter(input) {
|
|
1941
|
-
return this._letter.test(input.toString());
|
|
1942
|
-
}
|
|
1943
|
-
/**
|
|
1944
|
-
* 验证是否只包含小写字母
|
|
1945
|
-
* @example
|
|
1946
|
-
* ```ts
|
|
1947
|
-
* ValidateUtil.isLetterLowercase("abc"); // true
|
|
1948
|
-
* ```
|
|
1949
|
-
*/
|
|
1950
|
-
static isLetterLowercase(input) {
|
|
1951
|
-
return this._letterLowercase.test(input.toString());
|
|
1952
|
-
}
|
|
1953
|
-
/**
|
|
1954
|
-
* 验证是否只包含大写字母
|
|
1955
|
-
* @example
|
|
1956
|
-
* ```ts
|
|
1957
|
-
* ValidateUtil.isLetterUppercase("ABC"); // true
|
|
1958
|
-
* ```
|
|
1959
|
-
*/
|
|
1960
|
-
static isLetterUppercase(input) {
|
|
1961
|
-
return this._letterUppercase.test(input.toString());
|
|
1962
|
-
}
|
|
1963
|
-
/**
|
|
1964
|
-
* 验证是否不包含字母
|
|
1965
|
-
* @example
|
|
1966
|
-
* ```ts
|
|
1967
|
-
* ValidateUtil.isLetterOmit("123_-"); // true
|
|
1968
|
-
* ```
|
|
1969
|
-
*/
|
|
1970
|
-
static isLetterOmit(input) {
|
|
1971
|
-
return this._letterOmit.test(input.toString());
|
|
1972
|
-
}
|
|
1973
|
-
/**
|
|
1974
|
-
* 验证是否为数字和字母组合
|
|
1975
|
-
* @example
|
|
1976
|
-
* ```ts
|
|
1977
|
-
* ValidateUtil.isLetterAndNumber("A1B2"); // true
|
|
1978
|
-
* ```
|
|
1979
|
-
*/
|
|
1980
|
-
static isLetterAndNumber(input) {
|
|
1981
|
-
return this._LetterAndNumber.test(input.toString());
|
|
1982
|
-
}
|
|
1983
|
-
/**
|
|
1984
|
-
* 验证是否为有符号浮点数
|
|
1985
|
-
* @example
|
|
1986
|
-
* ```ts
|
|
1987
|
-
* ValidateUtil.isSignedFloat("-12.34"); // true
|
|
1988
|
-
* ```
|
|
1989
|
-
*/
|
|
1990
|
-
static isSignedFloat(input) {
|
|
1991
|
-
return this._signedFloat.test(input.toString());
|
|
1992
|
-
}
|
|
1993
|
-
/**
|
|
1994
|
-
* 验证是否为无符号浮点数
|
|
1995
|
-
* @example
|
|
1996
|
-
* ```ts
|
|
1997
|
-
* ValidateUtil.isUnsignedFloat("12.34"); // true
|
|
1998
|
-
* ```
|
|
1999
|
-
*/
|
|
2000
|
-
static isUnsignedFloat(input) {
|
|
2001
|
-
return this._unsignedFloat.test(input.toString());
|
|
2002
|
-
}
|
|
2003
|
-
/**
|
|
2004
|
-
* 验证是否为有符号整数
|
|
2005
|
-
* @example
|
|
2006
|
-
* ```ts
|
|
2007
|
-
* ValidateUtil.isSignedInteger("-12"); // true
|
|
2008
|
-
* ```
|
|
2009
|
-
*/
|
|
2010
|
-
static isSignedInteger(input) {
|
|
2011
|
-
return this._signedInteger.test(input.toString());
|
|
2012
|
-
}
|
|
2013
|
-
/**
|
|
2014
|
-
* 验证是否为无符号整数
|
|
2015
|
-
* @example
|
|
2016
|
-
* ```ts
|
|
2017
|
-
* ValidateUtil.isUnsignedInteger("12"); // true
|
|
2018
|
-
* ```
|
|
2019
|
-
*/
|
|
2020
|
-
static isUnsignedInteger(input) {
|
|
2021
|
-
return this._unsignedInteger.test(input.toString());
|
|
2022
|
-
}
|
|
2023
|
-
/**
|
|
2024
|
-
* 验证是否包含空格
|
|
2025
|
-
* @example
|
|
2026
|
-
* ```ts
|
|
2027
|
-
* ValidateUtil.isSpaceInclude("a b"); // true
|
|
2028
|
-
* ```
|
|
2029
|
-
*/
|
|
2030
|
-
static isSpaceInclude(input) {
|
|
2031
|
-
return this._spaceInclude.test(input.toString());
|
|
2032
|
-
}
|
|
2033
|
-
/**
|
|
2034
|
-
* 验证是否以空格开头
|
|
2035
|
-
* @example
|
|
2036
|
-
* ```ts
|
|
2037
|
-
* ValidateUtil.isSpaceStart(" abc"); // true
|
|
2038
|
-
* ```
|
|
2039
|
-
*/
|
|
2040
|
-
static isSpaceStart(input) {
|
|
2041
|
-
return this._spaceStart.test(input.toString());
|
|
2042
|
-
}
|
|
2043
|
-
/**
|
|
2044
|
-
* 验证是否以空格结尾
|
|
2045
|
-
* @example
|
|
2046
|
-
* ```ts
|
|
2047
|
-
* ValidateUtil.isSpaceEnd("abc "); // true
|
|
2048
|
-
* ```
|
|
2049
|
-
*/
|
|
2050
|
-
static isSpaceEnd(input) {
|
|
2051
|
-
return this._spaceEnd.test(input.toString());
|
|
2052
|
-
}
|
|
2053
|
-
/**
|
|
2054
|
-
* 验证是否以空格开头或结尾
|
|
2055
|
-
* @example
|
|
2056
|
-
* ```ts
|
|
2057
|
-
* ValidateUtil.isSpaceStartOrEnd(" abc"); // true
|
|
2058
|
-
* ```
|
|
2059
|
-
*/
|
|
2060
|
-
static isSpaceStartOrEnd(input) {
|
|
2061
|
-
return this.isSpaceStart(input) || this.isSpaceEnd(input);
|
|
2062
|
-
}
|
|
2063
|
-
};
|
|
2064
|
-
_defineProperty(ValidateUtil, "_phone", /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/);
|
|
2065
|
-
_defineProperty(ValidateUtil, "_telephone", /^(((0\d{2,3})-)?((\d{7,8})|(400\d{7})|(800\d{7}))(-(\d{1,4}))?)$/);
|
|
2066
|
-
_defineProperty(ValidateUtil, "_IMEI", /^\d{15,17}$/);
|
|
2067
|
-
_defineProperty(ValidateUtil, "_email", /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-0-9]+\.)+[a-z]{2,}))$/i);
|
|
2068
|
-
_defineProperty(ValidateUtil, "_link", /^(https?:\/\/)?(([\w-]+(\.[\w-]+)*\.[a-z]{2,6})|((\d{1,3}\.){3}\d{1,3}))(:\d+)?(\/\S*)?$/i);
|
|
2069
|
-
_defineProperty(ValidateUtil, "_portLink", /^(https?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/i);
|
|
2070
|
-
_defineProperty(ValidateUtil, "_thunderLink", /^thunderx?:\/\/[a-zA-Z\d]+=$/i);
|
|
2071
|
-
_defineProperty(ValidateUtil, "_uscc", /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/);
|
|
2072
|
-
_defineProperty(ValidateUtil, "_usccs", /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/);
|
|
2073
|
-
_defineProperty(ValidateUtil, "_dirPathWindows", /^[a-z]:\\(?:\w+\\?)*$/i);
|
|
2074
|
-
_defineProperty(ValidateUtil, "_filePathWindows", /^[a-z]:\\(?:\w+\\)*\w+\.\w+$/i);
|
|
2075
|
-
_defineProperty(ValidateUtil, "_dirPathLinux", /^\/(?:[^\\/\s]+\/)*$/);
|
|
2076
|
-
_defineProperty(ValidateUtil, "_filePathLinux", /^(\/$|\/(?:[^\\/\s]+\/)*[^\\/\s]+$)/);
|
|
2077
|
-
_defineProperty(ValidateUtil, "_EVCarNumber", /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))\d{4})|(\d{5}[DF]))$/);
|
|
2078
|
-
_defineProperty(ValidateUtil, "_GVCarNumber", /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/);
|
|
2079
|
-
_defineProperty(ValidateUtil, "_chineseName", /^[一-龢][一·-龢]*$/);
|
|
2080
|
-
_defineProperty(ValidateUtil, "_chineseId", /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))([\dX])$/i);
|
|
2081
|
-
_defineProperty(ValidateUtil, "_chineseProvince", /^安徽|澳门|北京|重庆|福建|甘肃|广东|广西|贵州|海南|河北|河南|黑龙江|湖北|湖南|吉林|江苏|江西|辽宁|内蒙古|宁夏|青海|山东|山西|陕西|上海|四川|台湾|天津|西藏|香港|新疆|云南|浙江$/);
|
|
2082
|
-
_defineProperty(ValidateUtil, "_chineseNation", /^汉族|蒙古族|回族|藏族|维吾尔族|苗族|彝族|壮族|布依族|朝鲜族|满族|侗族|瑶族|白族|土家族|哈尼族|哈萨克族|傣族|黎族|傈僳族|佤族|畲族|高山族|拉祜族|水族|东乡族|纳西族|景颇族|柯尔克孜族|土族|达斡尔族|仫佬族|羌族|布朗族|撒拉族|毛南族|仡佬族|锡伯族|阿昌族|普米族|塔吉克族|怒族|乌孜别克族|俄罗斯族|鄂温克族|德昂族|保安族|裕固族|京族|塔塔尔族|独龙族|鄂伦春族|赫哲族|门巴族|珞巴族|基诺族|其它未识别民族|外国人入中国籍$/);
|
|
2083
|
-
_defineProperty(ValidateUtil, "_letter", /^[a-z]+$/i);
|
|
2084
|
-
_defineProperty(ValidateUtil, "_letterLowercase", /^[a-z]+$/);
|
|
2085
|
-
_defineProperty(ValidateUtil, "_letterUppercase", /^[A-Z]+$/);
|
|
2086
|
-
_defineProperty(ValidateUtil, "_letterOmit", /^[^A-Z]*$/i);
|
|
2087
|
-
_defineProperty(ValidateUtil, "_LetterAndNumber", /^[A-Z0-9]+$/i);
|
|
2088
|
-
_defineProperty(ValidateUtil, "_signedFloat", /^[+-]?(\d+(\.\d+)?|\.\d+)$/);
|
|
2089
|
-
_defineProperty(ValidateUtil, "_unsignedFloat", /^\+?(\d+(\.\d+)?|\.\d+)$/);
|
|
2090
|
-
_defineProperty(ValidateUtil, "_signedInteger", /^[+-]?\d+$/);
|
|
2091
|
-
_defineProperty(ValidateUtil, "_unsignedInteger", /^\+?\d+$/);
|
|
2092
|
-
_defineProperty(ValidateUtil, "_spaceInclude", /\s/);
|
|
2093
|
-
_defineProperty(ValidateUtil, "_spaceStart", /^\s/);
|
|
2094
|
-
_defineProperty(ValidateUtil, "_spaceEnd", /\s$/);
|
|
2095
1617
|
//#endregion
|
|
2096
1618
|
//#region src/react/useMount.ts
|
|
2097
1619
|
/**
|
|
@@ -2127,37 +1649,13 @@ function useMount(effect) {
|
|
|
2127
1649
|
}, [effectRef]);
|
|
2128
1650
|
}
|
|
2129
1651
|
//#endregion
|
|
2130
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
2131
|
-
const globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() {
|
|
2132
|
-
return this;
|
|
2133
|
-
})() || Function("return this")();
|
|
2134
|
-
//#endregion
|
|
2135
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/function/noop.mjs
|
|
2136
|
-
/**
|
|
2137
|
-
* A no-operation function that does nothing.
|
|
2138
|
-
* This can be used as a placeholder or default function.
|
|
2139
|
-
*
|
|
2140
|
-
* @example
|
|
2141
|
-
* noop(); // Does nothing
|
|
2142
|
-
*
|
|
2143
|
-
* @returns {void} This function does not return anything.
|
|
2144
|
-
*/
|
|
2145
|
-
function noop() {}
|
|
2146
|
-
//#endregion
|
|
2147
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.47.0/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
|
|
1652
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
|
|
2148
1653
|
/**
|
|
2149
1654
|
* Checks whether a value is a JavaScript primitive.
|
|
2150
1655
|
* JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.
|
|
2151
1656
|
*
|
|
2152
|
-
* @param
|
|
2153
|
-
* @returns
|
|
2154
|
-
* null
|
|
2155
|
-
* | undefined
|
|
2156
|
-
* | string
|
|
2157
|
-
* | number
|
|
2158
|
-
* | boolean
|
|
2159
|
-
* | symbol
|
|
2160
|
-
* | bigint} Returns true if `value` is a primitive, false otherwise.
|
|
1657
|
+
* @param value The value to check.
|
|
1658
|
+
* @returns Returns true if `value` is a primitive, false otherwise.
|
|
2161
1659
|
*
|
|
2162
1660
|
* @example
|
|
2163
1661
|
* isPrimitive(null); // true
|
|
@@ -2177,22 +1675,11 @@ function isPrimitive(value) {
|
|
|
2177
1675
|
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
2178
1676
|
}
|
|
2179
1677
|
//#endregion
|
|
2180
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1678
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
|
|
2181
1679
|
/**
|
|
2182
1680
|
* Checks if a value is a TypedArray.
|
|
2183
|
-
* @param
|
|
2184
|
-
* @returns
|
|
2185
|
-
* Uint8Array
|
|
2186
|
-
* | Uint8ClampedArray
|
|
2187
|
-
* | Uint16Array
|
|
2188
|
-
* | Uint32Array
|
|
2189
|
-
* | BigUint64Array
|
|
2190
|
-
* | Int8Array
|
|
2191
|
-
* | Int16Array
|
|
2192
|
-
* | Int32Array
|
|
2193
|
-
* | BigInt64Array
|
|
2194
|
-
* | Float32Array
|
|
2195
|
-
* | Float64Array} Returns true if `x` is a TypedArray, false otherwise.
|
|
1681
|
+
* @param x The value to check.
|
|
1682
|
+
* @returns Returns true if `x` is a TypedArray, false otherwise.
|
|
2196
1683
|
*
|
|
2197
1684
|
* @example
|
|
2198
1685
|
* const arr = new Uint8Array([1, 2, 3]);
|
|
@@ -2208,16 +1695,16 @@ function isTypedArray(x) {
|
|
|
2208
1695
|
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
2209
1696
|
}
|
|
2210
1697
|
//#endregion
|
|
2211
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1698
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/object/clone.mjs
|
|
2212
1699
|
/**
|
|
2213
1700
|
* Creates a shallow clone of the given object.
|
|
2214
1701
|
*
|
|
2215
1702
|
* @template T - The type of the object.
|
|
2216
|
-
* @param
|
|
2217
|
-
* @returns
|
|
1703
|
+
* @param obj - The object to clone.
|
|
1704
|
+
* @returns A shallow clone of the given object.
|
|
2218
1705
|
*
|
|
2219
1706
|
* @example
|
|
2220
|
-
* // Clone a primitive
|
|
1707
|
+
* // Clone a primitive value
|
|
2221
1708
|
* const num = 29;
|
|
2222
1709
|
* const clonedNum = clone(num);
|
|
2223
1710
|
* console.log(clonedNum); // 29
|
|
@@ -2266,35 +1753,24 @@ function clone(obj) {
|
|
|
2266
1753
|
return obj;
|
|
2267
1754
|
}
|
|
2268
1755
|
//#endregion
|
|
2269
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1756
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/function/noop.mjs
|
|
2270
1757
|
/**
|
|
2271
|
-
*
|
|
2272
|
-
*
|
|
2273
|
-
* This function tests whether the provided value is an instance of Buffer.
|
|
2274
|
-
* It returns `true` if the value is a Buffer, and `false` otherwise.
|
|
2275
|
-
*
|
|
2276
|
-
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
|
|
2277
|
-
*
|
|
2278
|
-
* @param {unknown} x - The value to check if it is a Buffer.
|
|
2279
|
-
* @returns {boolean} Returns `true` if `x` is a Buffer, else `false`.
|
|
1758
|
+
* A no-operation function that does nothing.
|
|
1759
|
+
* This can be used as a placeholder or default function.
|
|
2280
1760
|
*
|
|
2281
1761
|
* @example
|
|
2282
|
-
*
|
|
2283
|
-
* console.log(isBuffer(buffer)); // true
|
|
1762
|
+
* noop(); // Does nothing
|
|
2284
1763
|
*
|
|
2285
|
-
*
|
|
2286
|
-
* console.log(isBuffer(notBuffer)); // false
|
|
1764
|
+
* @returns This function does not return anything.
|
|
2287
1765
|
*/
|
|
2288
|
-
function
|
|
2289
|
-
return typeof globalThis_.Buffer !== "undefined" && globalThis_.Buffer.isBuffer(x);
|
|
2290
|
-
}
|
|
1766
|
+
function noop() {}
|
|
2291
1767
|
//#endregion
|
|
2292
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1768
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
|
|
2293
1769
|
function getSymbols(object) {
|
|
2294
1770
|
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
2295
1771
|
}
|
|
2296
1772
|
//#endregion
|
|
2297
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1773
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
|
|
2298
1774
|
/**
|
|
2299
1775
|
* Gets the `toStringTag` of `value`.
|
|
2300
1776
|
*
|
|
@@ -2307,7 +1783,7 @@ function getTag(value) {
|
|
|
2307
1783
|
return Object.prototype.toString.call(value);
|
|
2308
1784
|
}
|
|
2309
1785
|
//#endregion
|
|
2310
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1786
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
|
|
2311
1787
|
const regexpTag = "[object RegExp]";
|
|
2312
1788
|
const stringTag = "[object String]";
|
|
2313
1789
|
const numberTag = "[object Number]";
|
|
@@ -2334,12 +1810,40 @@ const bigInt64ArrayTag = "[object BigInt64Array]";
|
|
|
2334
1810
|
const float32ArrayTag = "[object Float32Array]";
|
|
2335
1811
|
const float64ArrayTag = "[object Float64Array]";
|
|
2336
1812
|
//#endregion
|
|
2337
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1813
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/globalThis.mjs
|
|
1814
|
+
const globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || (function() {
|
|
1815
|
+
return this;
|
|
1816
|
+
})();
|
|
1817
|
+
//#endregion
|
|
1818
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isBuffer.mjs
|
|
1819
|
+
/**
|
|
1820
|
+
* Checks if the given value is a Buffer instance.
|
|
1821
|
+
*
|
|
1822
|
+
* This function tests whether the provided value is an instance of Buffer.
|
|
1823
|
+
* It returns `true` if the value is a Buffer, and `false` otherwise.
|
|
1824
|
+
*
|
|
1825
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
|
|
1826
|
+
*
|
|
1827
|
+
* @param x - The value to check if it is a Buffer.
|
|
1828
|
+
* @returns Returns `true` if `x` is a Buffer, else `false`.
|
|
1829
|
+
*
|
|
1830
|
+
* @example
|
|
1831
|
+
* const buffer = Buffer.from("test");
|
|
1832
|
+
* console.log(isBuffer(buffer)); // true
|
|
1833
|
+
*
|
|
1834
|
+
* const notBuffer = "not a buffer";
|
|
1835
|
+
* console.log(isBuffer(notBuffer)); // false
|
|
1836
|
+
*/
|
|
1837
|
+
function isBuffer(x) {
|
|
1838
|
+
return typeof globalThis_.Buffer !== "undefined" && globalThis_.Buffer.isBuffer(x);
|
|
1839
|
+
}
|
|
1840
|
+
//#endregion
|
|
1841
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
2338
1842
|
/**
|
|
2339
1843
|
* Checks if a given value is a plain object.
|
|
2340
1844
|
*
|
|
2341
|
-
* @param
|
|
2342
|
-
* @returns
|
|
1845
|
+
* @param value - The value to check.
|
|
1846
|
+
* @returns True if the value is a plain object, otherwise false.
|
|
2343
1847
|
*
|
|
2344
1848
|
* @example
|
|
2345
1849
|
* ```typescript
|
|
@@ -2384,7 +1888,7 @@ function isPlainObject(value) {
|
|
|
2384
1888
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
2385
1889
|
}
|
|
2386
1890
|
//#endregion
|
|
2387
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1891
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/_internal/isEqualsSameValueZero.mjs
|
|
2388
1892
|
/**
|
|
2389
1893
|
* Performs a `SameValueZero` comparison between two values to determine if they are equivalent.
|
|
2390
1894
|
*
|
|
@@ -2402,7 +1906,7 @@ function isEqualsSameValueZero(value, other) {
|
|
|
2402
1906
|
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
2403
1907
|
}
|
|
2404
1908
|
//#endregion
|
|
2405
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
1909
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
|
|
2406
1910
|
/**
|
|
2407
1911
|
* Compares two values for equality using a custom comparison function.
|
|
2408
1912
|
*
|
|
@@ -2421,12 +1925,12 @@ function isEqualsSameValueZero(value, other) {
|
|
|
2421
1925
|
* - `yParent`: The parent of the second value `y`.
|
|
2422
1926
|
* - `stack`: An internal stack (Map) to handle circular references.
|
|
2423
1927
|
*
|
|
2424
|
-
* @param
|
|
2425
|
-
* @param
|
|
2426
|
-
* @param
|
|
1928
|
+
* @param a - The first value to compare.
|
|
1929
|
+
* @param b - The second value to compare.
|
|
1930
|
+
* @param areValuesEqual - A function to customize the comparison.
|
|
2427
1931
|
* If it returns a boolean, that result will be used. If it returns undefined,
|
|
2428
1932
|
* the default equality comparison will be used.
|
|
2429
|
-
* @returns
|
|
1933
|
+
* @returns `true` if the values are equal according to the customizer, otherwise `false`.
|
|
2430
1934
|
*
|
|
2431
1935
|
* @example
|
|
2432
1936
|
* const customizer = (a, b) => {
|
|
@@ -2543,13 +2047,13 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
2543
2047
|
}
|
|
2544
2048
|
}
|
|
2545
2049
|
//#endregion
|
|
2546
|
-
//#region ../../node_modules/.pnpm/es-toolkit@1.
|
|
2050
|
+
//#region ../../node_modules/.pnpm/es-toolkit@1.49.0/node_modules/es-toolkit/dist/predicate/isEqual.mjs
|
|
2547
2051
|
/**
|
|
2548
2052
|
* Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.
|
|
2549
2053
|
*
|
|
2550
|
-
* @param
|
|
2551
|
-
* @param
|
|
2552
|
-
* @returns
|
|
2054
|
+
* @param a - The first value to compare.
|
|
2055
|
+
* @param b - The second value to compare.
|
|
2056
|
+
* @returns `true` if the values are equal, otherwise `false`.
|
|
2553
2057
|
*
|
|
2554
2058
|
* @example
|
|
2555
2059
|
* isEqual(1, 1); // true
|