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