@antsoo-lib/utils 0.1.2 → 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.
package/dist/index.js CHANGED
@@ -1,607 +1,736 @@
1
- // src/date.ts
2
1
  import dayjs from "dayjs";
2
+ import { add, bignumber, divide, multiply, subtract } from "mathjs";
3
+ import { isArguments as isArguments$1, isArray as isArray$1, isArrayBuffer as isArrayBuffer$1, isArrayLike as isArrayLike$1, isArrayLikeObject as isArrayLikeObject$1, isBoolean as isBoolean$1, isDate as isDate$1, isElement as isElement$1, isEmpty as isEmpty$1, isEqual as isEqual$1, isError as isError$1, isFinite as isFinite$1, isFunction as isFunction$1, isInteger as isInteger$1, isLength as isLength$1, isMap as isMap$1, isMatch as isMatch$1, isNaN as isNaN$1, isNative as isNative$1, isNil as isNil$1, isNull as isNull$1, isNumber as isNumber$1, isObject as isObject$1, isObjectLike as isObjectLike$1, isPlainObject as isPlainObject$1, isRegExp as isRegExp$1, isSafeInteger as isSafeInteger$1, isSet as isSet$1, isString as isString$1, isSymbol as isSymbol$1, isTypedArray as isTypedArray$1, isUndefined as isUndefined$1, isWeakMap as isWeakMap$1, isWeakSet as isWeakSet$1 } from "lodash-es";
4
+
5
+ //#region src/date.ts
6
+ /**
7
+ * 校验日期是否与指定日期相同或晚于指定日期
8
+ * @param date 日期
9
+ * @param day 指定日期
10
+ * @returns 是否相同或晚于指定日期
11
+ */
3
12
  function isSameOrAfterDay(date, day) {
4
- return dayjs(date).isSame(dayjs(day), "day") || dayjs(date).isAfter(dayjs(day), "day");
5
- }
13
+ return dayjs(date).isSame(dayjs(day), "day") || dayjs(date).isAfter(dayjs(day), "day");
14
+ }
15
+ /**
16
+ * 校验日期是否与指定日期相同或早于指定日期
17
+ * @param date 日期
18
+ * @param day 指定日期
19
+ * @returns 是否相同或早于指定日期
20
+ */
6
21
  function isSameOrBeforeDay(date, day) {
7
- return dayjs(date).isSame(dayjs(day), "day") || dayjs(date).isBefore(dayjs(day), "day");
22
+ return dayjs(date).isSame(dayjs(day), "day") || dayjs(date).isBefore(dayjs(day), "day");
8
23
  }
9
24
 
10
- // src/math.ts
11
- import { add, bignumber, divide, multiply, subtract } from "mathjs";
12
-
13
- // src/is.ts
14
- import {
15
- isArguments as _isArguments,
16
- isArray as _isArray,
17
- isArrayBuffer as _isArrayBuffer,
18
- isArrayLike as _isArrayLike,
19
- isArrayLikeObject as _isArrayLikeObject,
20
- isBoolean as _isBoolean,
21
- isDate as _isDate,
22
- isElement as _isElement,
23
- isEqual as _isEqual,
24
- isError as _isError,
25
- isFinite as _isFinite,
26
- isInteger as _isInteger,
27
- isLength as _isLength,
28
- isMap as _isMap,
29
- isMatch as _isMatch,
30
- isNative as _isNative,
31
- isNull as _isNull,
32
- isObjectLike as _isObjectLike,
33
- isPlainObject as _isPlainObject,
34
- isRegExp as _isRegExp,
35
- isSafeInteger as _isSafeInteger,
36
- isSet as _isSet,
37
- isSymbol as _isSymbol,
38
- isTypedArray as _isTypedArray,
39
- isWeakMap as _isWeakMap,
40
- isWeakSet as _isWeakSet,
41
- isEmpty as lodashIsEmpty,
42
- isFunction as lodashIsFunction,
43
- isNaN as lodashIsNaN,
44
- isNil as lodashIsNil,
45
- isNumber as lodashIsNumber,
46
- isObject as lodashIsObject,
47
- isString as lodashIsString,
48
- isUndefined as lodashIsUndefined
49
- } from "lodash-es";
50
- var getTag = (value) => {
51
- return Object.prototype.toString.call(value);
25
+ //#endregion
26
+ //#region src/is.ts
27
+ /**
28
+ * 获取值的类型标签
29
+ */
30
+ const getTag = (value) => {
31
+ return Object.prototype.toString.call(value);
52
32
  };
53
- var isArray = _isArray;
54
- var isArrayBuffer = _isArrayBuffer;
33
+ /**
34
+ * 检查是否为数组 - 使用 lodash-es 的实现
35
+ */
36
+ const isArray = isArray$1;
37
+ /**
38
+ * 检查是否为 ArrayBuffer
39
+ */
40
+ const isArrayBuffer = isArrayBuffer$1;
41
+ /**
42
+ * 检查是否为 AsyncFunction
43
+ */
55
44
  function isAsyncFunction(value) {
56
- return getTag(value) === "[object AsyncFunction]" || typeof value === "function" && value.constructor.name === "AsyncFunction";
45
+ return getTag(value) === "[object AsyncFunction]" || typeof value === "function" && value.constructor.name === "AsyncFunction";
57
46
  }
47
+ /**
48
+ * 检查是否为 BigInt
49
+ */
58
50
  function isBigInt(value) {
59
- return typeof value === "bigint" || getTag(value) === "[object BigInt]";
51
+ return typeof value === "bigint" || getTag(value) === "[object BigInt]";
60
52
  }
53
+ /**
54
+ * 检查是否为 Blob 对象(浏览器环境)
55
+ */
61
56
  function isBlob(value) {
62
- return typeof Blob !== "undefined" && value instanceof Blob;
63
- }
64
- var isBoolean = _isBoolean;
65
- var isArrayLike = _isArrayLike;
66
- var isArrayLikeObject = _isArrayLikeObject;
67
- var isArguments = _isArguments;
68
- var isDate = _isDate;
69
- var isElement = _isElement;
70
- var isEmpty = lodashIsEmpty;
71
- var isEqual = _isEqual;
72
- var isError = _isError;
57
+ return typeof Blob !== "undefined" && value instanceof Blob;
58
+ }
59
+ /**
60
+ * 检查是否为布尔值 - 使用 lodash-es 的实现
61
+ */
62
+ const isBoolean = isBoolean$1;
63
+ /**
64
+ * 检查是否为类数组
65
+ */
66
+ const isArrayLike = isArrayLike$1;
67
+ /**
68
+ * 检查是否为类数组对象
69
+ */
70
+ const isArrayLikeObject = isArrayLikeObject$1;
71
+ /**
72
+ * 检查是否为类数组参数
73
+ */
74
+ const isArguments = isArguments$1;
75
+ /**
76
+ * 检查是否为 Date 对象 - 使用 lodash-es 的实现
77
+ */
78
+ const isDate = isDate$1;
79
+ /**
80
+ * 检查是否为 DOM 元素 - 使用 lodash-es 的实现
81
+ */
82
+ const isElement = isElement$1;
83
+ /**
84
+ * 检查是否为空值 - 使用 lodash-es 的实现
85
+ */
86
+ const isEmpty = isEmpty$1;
87
+ /**
88
+ * 检查是否严格相等 - 使用 lodash-es 的实现
89
+ */
90
+ const isEqual = isEqual$1;
91
+ /**
92
+ * 检查是否为 Error 对象 - 使用 lodash-es 的实现
93
+ */
94
+ const isError = isError$1;
95
+ /**
96
+ * 检查是否为 File 对象(浏览器环境)
97
+ */
73
98
  function isFile(value) {
74
- return typeof File !== "undefined" && value instanceof File;
99
+ return typeof File !== "undefined" && value instanceof File;
75
100
  }
101
+ /**
102
+ * 检查是否为 FormData 对象(浏览器环境)
103
+ */
76
104
  function isFormData(value) {
77
- return typeof FormData !== "undefined" && value instanceof FormData;
78
- }
79
- var isFunction = lodashIsFunction;
105
+ return typeof FormData !== "undefined" && value instanceof FormData;
106
+ }
107
+ /**
108
+ * 检查是否为函数 - 使用 lodash-es 的实现
109
+ */
110
+ const isFunction = isFunction$1;
111
+ /**
112
+ * 检查是否为 GeneratorFunction
113
+ */
80
114
  function isGeneratorFunction(value) {
81
- return getTag(value) === "[object GeneratorFunction]" || typeof value === "function" && value.constructor.name === "GeneratorFunction";
82
- }
83
- var isInteger = _isInteger;
84
- var isFinite = _isFinite;
85
- var isLength = _isLength;
86
- var isMap = _isMap;
87
- var isNaN = lodashIsNaN;
88
- var isNil = lodashIsNil;
89
- var isNull = _isNull;
90
- var isNumber = lodashIsNumber;
91
- var isObject = lodashIsObject;
92
- var isObjectLike = _isObjectLike;
93
- var isPlainObject = _isPlainObject;
94
- var isMatch = _isMatch;
95
- var isNative = _isNative;
115
+ return getTag(value) === "[object GeneratorFunction]" || typeof value === "function" && value.constructor.name === "GeneratorFunction";
116
+ }
117
+ /**
118
+ * 检查是否为整数 - 使用 lodash-es 的实现
119
+ */
120
+ const isInteger = isInteger$1;
121
+ /**
122
+ * 检查是否为有限数 - 使用 lodash-es 的实现
123
+ */
124
+ const isFinite = isFinite$1;
125
+ /**
126
+ * 检查是否为有效长度 - 使用 lodash-es 的实现
127
+ */
128
+ const isLength = isLength$1;
129
+ /**
130
+ * 检查是否为 Map - 使用 lodash-es 的实现
131
+ */
132
+ const isMap = isMap$1;
133
+ /**
134
+ * 检查是否为 NaN - 使用 lodash-es 的实现
135
+ */
136
+ const isNaN = isNaN$1;
137
+ /**
138
+ * 检查是否为 null 或 undefined - 使用 lodash-es 的实现
139
+ */
140
+ const isNil = isNil$1;
141
+ /**
142
+ * 检查是否为 null - 使用 lodash-es 的实现
143
+ */
144
+ const isNull = isNull$1;
145
+ /**
146
+ * 检查是否为数字 - 使用 lodash-es 的实现
147
+ */
148
+ const isNumber = isNumber$1;
149
+ /**
150
+ * 检查是否为对象 - 使用 lodash-es 的实现
151
+ */
152
+ const isObject = isObject$1;
153
+ /**
154
+ * 检查是否为类对象 - 使用 lodash-es 的实现
155
+ */
156
+ const isObjectLike = isObjectLike$1;
157
+ /**
158
+ * 检查是否为普通对象 - 使用 lodash-es 的实现
159
+ */
160
+ const isPlainObject = isPlainObject$1;
161
+ /**
162
+ * 检查是否匹配对象 - 使用 lodash-es 的实现
163
+ */
164
+ const isMatch = isMatch$1;
165
+ /**
166
+ * 检查是否为原生函数 - 使用 lodash-es 的实现
167
+ */
168
+ const isNative = isNative$1;
169
+ /**
170
+ * 检查是否为浏览器环境
171
+ */
96
172
  function isBrowser() {
97
- return typeof window !== "undefined" && typeof document !== "undefined";
173
+ return typeof window !== "undefined" && typeof document !== "undefined";
98
174
  }
175
+ /**
176
+ * 检查是否为 Promise
177
+ */
99
178
  function isPromise(value) {
100
- return !!value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
101
- }
102
- var isRegExp = _isRegExp;
103
- var isSafeInteger = _isSafeInteger;
104
- var isSet = _isSet;
105
- var isString = lodashIsString;
106
- var isSymbol = _isSymbol;
107
- var isTypedArray = _isTypedArray;
108
- var isUndefined = lodashIsUndefined;
179
+ return !!value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
180
+ }
181
+ /**
182
+ * 检查是否为 RegExp - 使用 lodash-es 的实现
183
+ */
184
+ const isRegExp = isRegExp$1;
185
+ /**
186
+ * 检查是否为安全整数 - 使用 lodash-es 的实现
187
+ */
188
+ const isSafeInteger = isSafeInteger$1;
189
+ /**
190
+ * 检查是否为 Set - 使用 lodash-es 的实现
191
+ */
192
+ const isSet = isSet$1;
193
+ /**
194
+ * 检查是否为字符串 - 使用 lodash-es 的实现
195
+ */
196
+ const isString = isString$1;
197
+ /**
198
+ * 检查是否为 Symbol - 使用 lodash-es 的实现
199
+ */
200
+ const isSymbol = isSymbol$1;
201
+ /**
202
+ * 检查是否为 TypedArray - 使用 lodash-es 的实现
203
+ */
204
+ const isTypedArray = isTypedArray$1;
205
+ /**
206
+ * 检查是否为 undefined - 使用 lodash-es 的实现
207
+ */
208
+ const isUndefined = isUndefined$1;
209
+ /**
210
+ * 检查是否为 URL 对象(浏览器环境)
211
+ */
109
212
  function isURL(value) {
110
- return typeof URL !== "undefined" && value instanceof URL;
213
+ return typeof URL !== "undefined" && value instanceof URL;
111
214
  }
215
+ /**
216
+ * 检查是否为 URLSearchParams 对象(浏览器环境)
217
+ */
112
218
  function isURLSearchParams(value) {
113
- return typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams;
114
- }
115
- var isWeakMap = _isWeakMap;
116
- var isWeakSet = _isWeakSet;
219
+ return typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams;
220
+ }
221
+ /**
222
+ * 检查是否为 WeakMap - 使用 lodash-es 的实现
223
+ */
224
+ const isWeakMap = isWeakMap$1;
225
+ /**
226
+ * 检查是否为 WeakSet - 使用 lodash-es 的实现
227
+ */
228
+ const isWeakSet = isWeakSet$1;
229
+ /**
230
+ * 检查是否为 Window 对象(浏览器环境)
231
+ */
117
232
  function isWindow(value) {
118
- return isBrowser() && value === window;
233
+ return isBrowser() && value === window;
119
234
  }
235
+ /**
236
+ * 检查是否为 Document 对象(浏览器环境)
237
+ */
120
238
  function isDocument(value) {
121
- return isBrowser() && value === document;
239
+ return isBrowser() && value === document;
122
240
  }
241
+ /**
242
+ * 检查是否为 Event 对象(浏览器环境)
243
+ */
123
244
  function isEvent(value) {
124
- return isBrowser() && value instanceof Event;
245
+ return isBrowser() && value instanceof Event;
125
246
  }
247
+ /**
248
+ * 检查是否为 Primitive 类型
249
+ */
126
250
  function isPrimitive(value) {
127
- return isString(value) || isNumber(value) || isBoolean(value) || isSymbol(value) || isBigInt(value) || isNull(value) || isUndefined(value);
251
+ return isString(value) || isNumber(value) || isBoolean(value) || isSymbol(value) || isBigInt(value) || isNull(value) || isUndefined(value);
128
252
  }
253
+ /**
254
+ * 检查是否为 Iterable 对象
255
+ */
129
256
  function isIterable(value) {
130
- return value != null && typeof value[Symbol.iterator] === "function";
257
+ return value != null && typeof value[Symbol.iterator] === "function";
131
258
  }
259
+ /**
260
+ * 检查是否为 AsyncIterable 对象
261
+ */
132
262
  function isAsyncIterable(value) {
133
- return value != null && typeof value[Symbol.asyncIterator] === "function";
263
+ return value != null && typeof value[Symbol.asyncIterator] === "function";
134
264
  }
265
+ /**
266
+ * 检查是否为 Iterator 对象
267
+ */
135
268
  function isIterator(value) {
136
- return value != null && typeof value.next === "function";
269
+ return value != null && typeof value.next === "function";
137
270
  }
271
+ /**
272
+ * 检查是否为 Array Iterator
273
+ */
138
274
  function isArrayIterator(value) {
139
- return getTag(value) === "[object Array Iterator]";
275
+ return getTag(value) === "[object Array Iterator]";
140
276
  }
277
+ /**
278
+ * 检查是否为 Map Iterator
279
+ */
141
280
  function isMapIterator(value) {
142
- return getTag(value) === "[object Map Iterator]";
281
+ return getTag(value) === "[object Map Iterator]";
143
282
  }
283
+ /**
284
+ * 检查是否为 Set Iterator
285
+ */
144
286
  function isSetIterator(value) {
145
- return getTag(value) === "[object Set Iterator]";
287
+ return getTag(value) === "[object Set Iterator]";
146
288
  }
289
+ /**
290
+ * 检查是否为 String Iterator
291
+ */
147
292
  function isStringIterator(value) {
148
- return getTag(value) === "[object String Iterator]";
293
+ return getTag(value) === "[object String Iterator]";
149
294
  }
295
+ /**
296
+ * 检查是否为可序列化的 JSON 值
297
+ */
150
298
  function isJSONSerializable(value) {
151
- if (isPrimitive(value)) {
152
- return !isUndefined(value);
153
- }
154
- if (isArray(value)) {
155
- return value.every(isJSONSerializable);
156
- }
157
- if (isPlainObject(value)) {
158
- return Object.values(value).every(isJSONSerializable);
159
- }
160
- return false;
161
- }
299
+ if (isPrimitive(value)) return !isUndefined(value);
300
+ if (isArray(value)) return value.every(isJSONSerializable);
301
+ if (isPlainObject(value)) return Object.values(value).every(isJSONSerializable);
302
+ return false;
303
+ }
304
+ /**
305
+ * 检查是否为有效的数组索引
306
+ */
162
307
  function isArrayIndex(value) {
163
- if (!isNumber(value) && !isString(value)) {
164
- return false;
165
- }
166
- const num = Number(value);
167
- return isInteger(num) && num >= 0 && num < Number.MAX_SAFE_INTEGER && String(num) === String(value);
308
+ if (!isNumber(value) && !isString(value)) return false;
309
+ const num = Number(value);
310
+ return isInteger(num) && num >= 0 && num < Number.MAX_SAFE_INTEGER && String(num) === String(value);
168
311
  }
312
+ /**
313
+ * 检查是否为有效的 Email 地址
314
+ */
169
315
  function isEmail(value) {
170
- if (!isString(value)) return false;
171
- const emailRegex = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/;
172
- return emailRegex.test(value);
316
+ if (!isString(value)) return false;
317
+ return /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(value);
173
318
  }
319
+ /**
320
+ * 检查是否为有效的 URL 字符串
321
+ */
174
322
  function isURLString(value) {
175
- if (!isString(value)) return false;
176
- try {
177
- const _ = new URL(value);
178
- return true;
179
- } catch {
180
- return false;
181
- }
182
- }
323
+ if (!isString(value)) return false;
324
+ try {
325
+ new URL(value);
326
+ return true;
327
+ } catch {
328
+ return false;
329
+ }
330
+ }
331
+ /**
332
+ * 检查是否为有效的手机号码(中国)
333
+ */
183
334
  function isChinesePhone(value) {
184
- if (!isString(value)) return false;
185
- const phoneRegex = /^1[3-9]\d{9}$/;
186
- return phoneRegex.test(value);
335
+ if (!isString(value)) return false;
336
+ return /^1[3-9]\d{9}$/.test(value);
187
337
  }
338
+ /**
339
+ * 检查是否为有效的身份证号码(中国)
340
+ */
188
341
  function isChineseIDCard(value) {
189
- if (!isString(value)) return false;
190
- const idCardRegex = /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:[0-2][1-9]|10|20|30|31)\d{3}[0-9X]$/i;
191
- if (!idCardRegex.test(value)) return false;
192
- const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
193
- const checkCodes = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
194
- let sum = 0;
195
- for (let i = 0; i < 17; i++) {
196
- sum += Number.parseInt(value[i]) * weights[i];
197
- }
198
- const checkCode = checkCodes[sum % 11];
199
- return checkCode === value[17].toUpperCase();
200
- }
342
+ if (!isString(value)) return false;
343
+ if (!/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:[0-2][1-9]|10|20|30|31)\d{3}[0-9X]$/i.test(value)) return false;
344
+ const weights = [
345
+ 7,
346
+ 9,
347
+ 10,
348
+ 5,
349
+ 8,
350
+ 4,
351
+ 2,
352
+ 1,
353
+ 6,
354
+ 3,
355
+ 7,
356
+ 9,
357
+ 10,
358
+ 5,
359
+ 8,
360
+ 4,
361
+ 2
362
+ ];
363
+ const checkCodes = [
364
+ "1",
365
+ "0",
366
+ "X",
367
+ "9",
368
+ "8",
369
+ "7",
370
+ "6",
371
+ "5",
372
+ "4",
373
+ "3",
374
+ "2"
375
+ ];
376
+ let sum = 0;
377
+ for (let i = 0; i < 17; i++) sum += Number.parseInt(value[i]) * weights[i];
378
+ return checkCodes[sum % 11] === value[17].toUpperCase();
379
+ }
380
+ /**
381
+ * 检查是否为有效的邮政编码(中国)
382
+ */
201
383
  function isChinesePostalCode(value) {
202
- if (!isString(value)) return false;
203
- const postalCodeRegex = /^[1-9]\d{5}$/;
204
- return postalCodeRegex.test(value);
384
+ if (!isString(value)) return false;
385
+ return /^[1-9]\d{5}$/.test(value);
205
386
  }
387
+ /**
388
+ * 检查是否为有效的 JSON 字符串
389
+ */
206
390
  function isJSONString(value) {
207
- if (!isString(value)) return false;
208
- try {
209
- JSON.parse(value);
210
- return true;
211
- } catch {
212
- return false;
213
- }
214
- }
391
+ if (!isString(value)) return false;
392
+ try {
393
+ JSON.parse(value);
394
+ return true;
395
+ } catch {
396
+ return false;
397
+ }
398
+ }
399
+ /**
400
+ * 检查是否为 Base64 字符串
401
+ */
215
402
  function isBase64(value) {
216
- if (!isString(value)) return false;
217
- const base64Regex = /^(?:[A-Z0-9+/]{4})*(?:[A-Z0-9+/]{2}==|[A-Z0-9+/]{3}=)?$/i;
218
- return base64Regex.test(value);
403
+ if (!isString(value)) return false;
404
+ return /^(?:[A-Z0-9+/]{4})*(?:[A-Z0-9+/]{2}==|[A-Z0-9+/]{3}=)?$/i.test(value);
219
405
  }
406
+ /**
407
+ * 检查是否为 Hex 颜色值
408
+ */
220
409
  function isHexColor(value) {
221
- if (!isString(value)) return false;
222
- const hexColorRegex = /^#?[a-f0-9]{6}$|^#?[a-f0-9]{3}$/i;
223
- return hexColorRegex.test(value);
410
+ if (!isString(value)) return false;
411
+ return /^#?[a-f0-9]{6}$|^#?[a-f0-9]{3}$/i.test(value);
224
412
  }
413
+ /**
414
+ * 检查是否为 RGB 颜色值
415
+ */
225
416
  function isRGBColor(value) {
226
- if (!isString(value)) return false;
227
- const rgbColorRegex = /^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/;
228
- return rgbColorRegex.test(value);
417
+ if (!isString(value)) return false;
418
+ return /^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$/.test(value);
229
419
  }
420
+ /**
421
+ * 检查是否为 HSL 颜色值
422
+ */
230
423
  function isHSLColor(value) {
231
- if (!isString(value)) return false;
232
- const hslColorRegex = /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/;
233
- return hslColorRegex.test(value);
424
+ if (!isString(value)) return false;
425
+ return /^hsl\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*\)$/.test(value);
234
426
  }
427
+ /**
428
+ * 检查是否为有效的日期字符串
429
+ */
235
430
  function isDateString(value) {
236
- if (!isString(value)) return false;
237
- const date = new Date(value);
238
- return !isNaN(date.getTime());
431
+ if (!isString(value)) return false;
432
+ return !isNaN(new Date(value).getTime());
239
433
  }
434
+ /**
435
+ * 检查是否为有效的时间字符串
436
+ */
240
437
  function isTimeString(value) {
241
- if (!isString(value)) return false;
242
- const timeRegex = /^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/;
243
- return timeRegex.test(value);
438
+ if (!isString(value)) return false;
439
+ return /^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/.test(value);
244
440
  }
441
+ /**
442
+ * 检查是否为有效的日期时间字符串
443
+ */
245
444
  function isDateTimeString(value) {
246
- if (!isString(value)) return false;
247
- const dateTimeRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
248
- return dateTimeRegex.test(value) && !isNaN(new Date(value).getTime());
445
+ if (!isString(value)) return false;
446
+ return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/.test(value) && !isNaN(new Date(value).getTime());
249
447
  }
448
+ /**
449
+ * 检查是否为有效的时区
450
+ */
250
451
  function isTimezone(value) {
251
- if (!isString(value)) return false;
252
- try {
253
- Intl.DateTimeFormat(void 0, { timeZone: value });
254
- return true;
255
- } catch {
256
- return false;
257
- }
258
- }
452
+ if (!isString(value)) return false;
453
+ try {
454
+ Intl.DateTimeFormat(void 0, { timeZone: value });
455
+ return true;
456
+ } catch {
457
+ return false;
458
+ }
459
+ }
460
+ /**
461
+ * 检查是否为有效的正则表达式字符串
462
+ */
259
463
  function isRegExpString(value) {
260
- if (!isString(value)) return false;
261
- try {
262
- const _ = new RegExp(value);
263
- return true;
264
- } catch {
265
- return false;
266
- }
267
- }
464
+ if (!isString(value)) return false;
465
+ try {
466
+ new RegExp(value);
467
+ return true;
468
+ } catch {
469
+ return false;
470
+ }
471
+ }
472
+ /**
473
+ * 检查是否为有效的 XML 字符串
474
+ */
268
475
  function isXMLString(value) {
269
- if (!isString(value)) return false;
270
- try {
271
- if (isBrowser()) {
272
- const parser = new DOMParser();
273
- const xmlDoc = parser.parseFromString(value, "application/xml");
274
- return xmlDoc.getElementsByTagName("parsererror").length === 0;
275
- }
276
- return false;
277
- } catch {
278
- return false;
279
- }
280
- }
476
+ if (!isString(value)) return false;
477
+ try {
478
+ if (isBrowser()) return new DOMParser().parseFromString(value, "application/xml").getElementsByTagName("parsererror").length === 0;
479
+ return false;
480
+ } catch {
481
+ return false;
482
+ }
483
+ }
484
+ /**
485
+ * 检查是否为有效的 HTML 字符串
486
+ */
281
487
  function isHTMLString(value) {
282
- if (!isString(value)) return false;
283
- try {
284
- if (isBrowser()) {
285
- const parser = new DOMParser();
286
- const htmlDoc = parser.parseFromString(value, "text/html");
287
- return htmlDoc.body.children.length > 0;
288
- }
289
- return false;
290
- } catch {
291
- return false;
292
- }
488
+ if (!isString(value)) return false;
489
+ try {
490
+ if (isBrowser()) return new DOMParser().parseFromString(value, "text/html").body.children.length > 0;
491
+ return false;
492
+ } catch {
493
+ return false;
494
+ }
293
495
  }
294
496
 
295
- // src/math.ts
296
- var computeTaxAmountFn = (weight, price) => {
297
- if (!isFinite(price) || !isFinite(weight)) return 0;
298
- const weightBig = bignumber(weight);
299
- const priceBig = bignumber(price);
300
- const value = Number(multiply(weightBig, priceBig));
301
- return value;
497
+ //#endregion
498
+ //#region src/math.ts
499
+ const computeTaxAmountFn = (weight, price) => {
500
+ if (!isFinite(price) || !isFinite(weight)) return 0;
501
+ const weightBig = bignumber(weight);
502
+ const priceBig = bignumber(price);
503
+ return Number(multiply(weightBig, priceBig));
302
504
  };
303
- var computeTaxAmount2Fn = (weight, price) => {
304
- if (!isFinite(price) || !isFinite(weight)) return 0;
305
- const weightBig = bignumber(weight);
306
- const priceBig = bignumber(price);
307
- const value = Number(multiply(weightBig, priceBig));
308
- return value;
505
+ const computeTaxAmount2Fn = (weight, price) => {
506
+ if (!isFinite(price) || !isFinite(weight)) return 0;
507
+ const weightBig = bignumber(weight);
508
+ const priceBig = bignumber(price);
509
+ return Number(multiply(weightBig, priceBig));
309
510
  };
310
- var computePriceFn = (taxAmount, weight) => {
311
- if (!isFinite(taxAmount) || !isFinite(weight) || weight <= 0) return 0;
312
- const taxAmountBig = bignumber(taxAmount);
313
- const weightBig = bignumber(weight);
314
- const value = Number(divide(taxAmountBig, weightBig));
315
- return value;
511
+ const computePriceFn = (taxAmount, weight) => {
512
+ if (!isFinite(taxAmount) || !isFinite(weight) || weight <= 0) return 0;
513
+ const taxAmountBig = bignumber(taxAmount);
514
+ const weightBig = bignumber(weight);
515
+ return Number(divide(taxAmountBig, weightBig));
316
516
  };
317
- var computeWeightFn = (taxAmount, price) => {
318
- if (!isFinite(taxAmount) || !isFinite(price) || price <= 0) return 0;
319
- const taxAmountBig = bignumber(taxAmount);
320
- const priceBig = bignumber(price);
321
- const value = Number(divide(taxAmountBig, priceBig));
322
- return value;
517
+ const computeWeightFn = (taxAmount, price) => {
518
+ if (!isFinite(taxAmount) || !isFinite(price) || price <= 0) return 0;
519
+ const taxAmountBig = bignumber(taxAmount);
520
+ const priceBig = bignumber(price);
521
+ return Number(divide(taxAmountBig, priceBig));
323
522
  };
324
- var computePrice2Fn = (noTaxPrice, taxRate) => {
325
- if (!isFinite(noTaxPrice) || !isFinite(taxRate)) return 0;
326
- const noTaxPriceBig = bignumber(noTaxPrice);
327
- const taxRateBig = divide(taxRate, 100);
328
- const value = Number(multiply(noTaxPriceBig, add(1, taxRateBig)));
329
- return value;
523
+ const computePrice2Fn = (noTaxPrice, taxRate) => {
524
+ if (!isFinite(noTaxPrice) || !isFinite(taxRate)) return 0;
525
+ const noTaxPriceBig = bignumber(noTaxPrice);
526
+ const taxRateBig = divide(taxRate, 100);
527
+ return Number(multiply(noTaxPriceBig, add(1, taxRateBig)));
330
528
  };
331
- var computeNoTaxPriceFn = (price, taxRate) => {
332
- if (!isFinite(price) || !isFinite(taxRate)) return 0;
333
- const priceBig = bignumber(price);
334
- const taxRateBig = divide(taxRate, 100);
335
- const value = Number(divide(priceBig, add(1, taxRateBig)));
336
- return value;
529
+ const computeNoTaxPriceFn = (price, taxRate) => {
530
+ if (!isFinite(price) || !isFinite(taxRate)) return 0;
531
+ const priceBig = bignumber(price);
532
+ const taxRateBig = divide(taxRate, 100);
533
+ return Number(divide(priceBig, add(1, taxRateBig)));
337
534
  };
338
- var computeTaxRateFn = (price, noTaxPrice) => {
339
- if (!isFinite(price) || !isFinite(noTaxPrice)) return 0;
340
- const priceBig = bignumber(price);
341
- const noTaxPriceBig = bignumber(noTaxPrice);
342
- const value = Number(subtract(divide(priceBig, noTaxPriceBig), 1));
343
- return value;
535
+ const computeTaxRateFn = (price, noTaxPrice) => {
536
+ if (!isFinite(price) || !isFinite(noTaxPrice)) return 0;
537
+ const priceBig = bignumber(price);
538
+ const noTaxPriceBig = bignumber(noTaxPrice);
539
+ return Number(subtract(divide(priceBig, noTaxPriceBig), 1));
344
540
  };
345
- var computeNoTaxPrice2Fn = (noTaxAmount, weight) => {
346
- if (!isFinite(noTaxAmount) || !isFinite(weight) || weight <= 0) return 0;
347
- const noTaxAmountBig = bignumber(noTaxAmount);
348
- const weightBig = bignumber(weight);
349
- const value = Number(divide(noTaxAmountBig, weightBig));
350
- return value;
541
+ const computeNoTaxPrice2Fn = (noTaxAmount, weight) => {
542
+ if (!isFinite(noTaxAmount) || !isFinite(weight) || weight <= 0) return 0;
543
+ const noTaxAmountBig = bignumber(noTaxAmount);
544
+ const weightBig = bignumber(weight);
545
+ return Number(divide(noTaxAmountBig, weightBig));
351
546
  };
352
- var computeNoTaxAmountFn = (weight, noTaxPrice) => {
353
- if (!isFinite(noTaxPrice) || !isFinite(weight)) return 0;
354
- const weightBig = bignumber(weight);
355
- const noTaxPriceBig = bignumber(noTaxPrice);
356
- const value = Number(multiply(weightBig, noTaxPriceBig));
357
- return value;
547
+ const computeNoTaxAmountFn = (weight, noTaxPrice) => {
548
+ if (!isFinite(noTaxPrice) || !isFinite(weight)) return 0;
549
+ const weightBig = bignumber(weight);
550
+ const noTaxPriceBig = bignumber(noTaxPrice);
551
+ return Number(multiply(weightBig, noTaxPriceBig));
358
552
  };
359
- var computeNoTaxAmount2Fn = (taxAmount, taxRate) => {
360
- if (!isFinite(taxAmount) || !isFinite(taxRate)) return 0;
361
- const taxAmountBig = bignumber(taxAmount);
362
- const taxRateBig = divide(taxRate, 100);
363
- const value = Number(divide(taxAmountBig, add(1, taxRateBig)));
364
- return value;
553
+ const computeNoTaxAmount2Fn = (taxAmount, taxRate) => {
554
+ if (!isFinite(taxAmount) || !isFinite(taxRate)) return 0;
555
+ const taxAmountBig = bignumber(taxAmount);
556
+ const taxRateBig = divide(taxRate, 100);
557
+ return Number(divide(taxAmountBig, add(1, taxRateBig)));
365
558
  };
366
- var computeTaxFn = (taxAmount, noTaxAmount) => {
367
- const taxAmountBig = bignumber(taxAmount || 0);
368
- const noTaxAmountBig = bignumber(noTaxAmount || 0);
369
- const value = Number(subtract(taxAmountBig, noTaxAmountBig));
370
- return value;
559
+ const computeTaxFn = (taxAmount, noTaxAmount) => {
560
+ const taxAmountBig = bignumber(taxAmount || 0);
561
+ const noTaxAmountBig = bignumber(noTaxAmount || 0);
562
+ return Number(subtract(taxAmountBig, noTaxAmountBig));
371
563
  };
372
- var computeGoodsNumFn = (weight, weight1) => {
373
- if (!isFinite(weight1) || !isFinite(weight) || weight1 <= 0) return 0;
374
- const weightBig = bignumber(weight);
375
- const weight1Big = bignumber(weight1);
376
- const value = Number(divide(weightBig, weight1Big));
377
- return value;
564
+ const computeGoodsNumFn = (weight, weight1) => {
565
+ if (!isFinite(weight1) || !isFinite(weight) || weight1 <= 0) return 0;
566
+ const weightBig = bignumber(weight);
567
+ const weight1Big = bignumber(weight1);
568
+ return Number(divide(weightBig, weight1Big));
378
569
  };
379
- var computeGoodsWeightFn = (num, weight1) => {
380
- if (!isFinite(weight1) || !isFinite(num) || weight1 <= 0) return 0;
381
- const numBig = bignumber(num);
382
- const weight1Big = bignumber(weight1);
383
- const value = Number(multiply(numBig, weight1Big));
384
- return value;
570
+ const computeGoodsWeightFn = (num, weight1) => {
571
+ if (!isFinite(weight1) || !isFinite(num) || weight1 <= 0) return 0;
572
+ const numBig = bignumber(num);
573
+ const weight1Big = bignumber(weight1);
574
+ return Number(multiply(numBig, weight1Big));
385
575
  };
386
- var addFn = (a, b) => {
387
- if (!isFinite(a) || !isFinite(b)) return 0;
388
- const aBig = bignumber(a);
389
- const bBig = bignumber(b);
390
- return Number(add(aBig, bBig));
576
+ const addFn = (a, b) => {
577
+ if (!isFinite(a) || !isFinite(b)) return 0;
578
+ const aBig = bignumber(a);
579
+ const bBig = bignumber(b);
580
+ return Number(add(aBig, bBig));
391
581
  };
582
+ /**
583
+ * 合计
584
+ * @param arr 数组
585
+ * @param key 键名
586
+ * @returns 合计值
587
+ */
392
588
  function sumBy(arr, key) {
393
- return arr.reduce((acc, cur) => addFn(acc, Number(cur[key])), 0);
589
+ return arr.reduce((acc, cur) => addFn(acc, Number(cur[key])), 0);
394
590
  }
395
- var subtractFn = (a, b) => {
396
- if (!isFinite(a) || !isFinite(b)) return 0;
397
- const aBig = bignumber(a);
398
- const bBig = bignumber(b);
399
- return Number(subtract(aBig, bBig));
591
+ const subtractFn = (a, b) => {
592
+ if (!isFinite(a) || !isFinite(b)) return 0;
593
+ const aBig = bignumber(a);
594
+ const bBig = bignumber(b);
595
+ return Number(subtract(aBig, bBig));
400
596
  };
401
- var multiplyFn = (a, b) => {
402
- if (!isFinite(a) || !isFinite(b)) return 0;
403
- const aBig = bignumber(a);
404
- const bBig = bignumber(b);
405
- return Number(multiply(aBig, bBig));
597
+ const multiplyFn = (a, b) => {
598
+ if (!isFinite(a) || !isFinite(b)) return 0;
599
+ const aBig = bignumber(a);
600
+ const bBig = bignumber(b);
601
+ return Number(multiply(aBig, bBig));
406
602
  };
407
- var divideFn = (a, b) => {
408
- if (!isFinite(a) || !isFinite(b) || b === 0) return 0;
409
- const aBig = bignumber(a);
410
- const bBig = bignumber(b);
411
- return Number(divide(aBig, bBig));
603
+ const divideFn = (a, b) => {
604
+ if (!isFinite(a) || !isFinite(b) || b === 0) return 0;
605
+ const aBig = bignumber(a);
606
+ const bBig = bignumber(b);
607
+ return Number(divide(aBig, bBig));
412
608
  };
413
609
 
414
- // src/format.ts
610
+ //#endregion
611
+ //#region src/format.ts
612
+ /**
613
+ * 格式化数字
614
+ * @param number 输入的数字
615
+ * @param decimals 保留小数位数
616
+ * @param thousands_sep 千分位分隔符
617
+ * @returns 格式化后的字符串
618
+ */
415
619
  function formatNumber(number, decimals = 2, thousands_sep = ",") {
416
- if (number === null || number === void 0 || number === "") return "";
417
- let num = Number.parseFloat(String(number));
418
- if (Number.isNaN(num)) return "";
419
- num = Math.round(num * 10 ** decimals) / 10 ** decimals;
420
- const numStr = num.toFixed(decimals);
421
- const parts = numStr.split(".");
422
- if (thousands_sep) {
423
- const re = /(-?\d+)(\d{3})/;
424
- while (re.test(parts[0])) {
425
- parts[0] = parts[0].replace(re, `$1${thousands_sep}$2`);
426
- }
427
- }
428
- return parts.join(".");
429
- }
620
+ if (number === null || number === void 0 || number === "") return "";
621
+ let num = Number.parseFloat(String(number));
622
+ if (Number.isNaN(num)) return "";
623
+ num = Math.round(num * 10 ** decimals) / 10 ** decimals;
624
+ const parts = num.toFixed(decimals).split(".");
625
+ if (thousands_sep) {
626
+ const re = /(-?\d+)(\d{3})/;
627
+ while (re.test(parts[0])) parts[0] = parts[0].replace(re, `$1${thousands_sep}$2`);
628
+ }
629
+ return parts.join(".");
630
+ }
631
+ /**
632
+ * 格式化数字
633
+ * @param number 输入的数字
634
+ */
430
635
  function toThousands(number) {
431
- if (number === null || number === void 0 || number === "") return "";
432
- const n = Number(number);
433
- if (Number.isNaN(n)) return "";
434
- return n.toLocaleString("en-US");
636
+ if (number === null || number === void 0 || number === "") return "";
637
+ const n = Number(number);
638
+ if (Number.isNaN(n)) return "";
639
+ return n.toLocaleString("en-US");
435
640
  }
436
641
 
437
- // src/cookie.ts
642
+ //#endregion
643
+ //#region src/cookie.ts
644
+ /**
645
+ * 设置 Cookie
646
+ * @param name Cookie 名称
647
+ * @param value Cookie 值
648
+ * @param days 过期天数,默认 7 天
649
+ * @param path 路径,默认 '/'
650
+ * @param domain 域名
651
+ * @param secure 是否仅在 HTTPS 下传输
652
+ */
438
653
  function setCookie(name, value, days = 1, path = "/", domain, secure = false) {
439
- let expires = "";
440
- if (days) {
441
- const date = /* @__PURE__ */ new Date();
442
- date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
443
- expires = `; expires=${date.toUTCString()}`;
444
- }
445
- let cookieString = `${name}=${encodeURIComponent(value)}${expires}; path=${path}`;
446
- if (domain) {
447
- cookieString += `; domain=${domain}`;
448
- }
449
- if (secure) {
450
- cookieString += "; secure";
451
- }
452
- cookieString += "; SameSite=Lax";
453
- document.cookie = cookieString;
454
- }
654
+ let expires = "";
655
+ if (days) {
656
+ const date = /* @__PURE__ */ new Date();
657
+ date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
658
+ expires = `; expires=${date.toUTCString()}`;
659
+ }
660
+ let cookieString = `${name}=${encodeURIComponent(value)}${expires}; path=${path}`;
661
+ if (domain) cookieString += `; domain=${domain}`;
662
+ if (secure) cookieString += "; secure";
663
+ cookieString += "; SameSite=Lax";
664
+ document.cookie = cookieString;
665
+ }
666
+ /**
667
+ * 获取 Cookie
668
+ * @param name Cookie 名称
669
+ * @returns Cookie 值,如果不存在则返回 null
670
+ */
455
671
  function getCookie(name) {
456
- const nameEQ = `${name}=`;
457
- const ca = document.cookie.split(";");
458
- for (let i = 0; i < ca.length; i++) {
459
- let c = ca[i];
460
- while (c.charAt(0) === " ") {
461
- c = c.substring(1, c.length);
462
- }
463
- if (c.indexOf(nameEQ) === 0) {
464
- return decodeURIComponent(c.substring(nameEQ.length, c.length));
465
- }
466
- }
467
- return null;
468
- }
672
+ const nameEQ = `${name}=`;
673
+ const ca = document.cookie.split(";");
674
+ for (let i = 0; i < ca.length; i++) {
675
+ let c = ca[i];
676
+ while (c.charAt(0) === " ") c = c.substring(1, c.length);
677
+ if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));
678
+ }
679
+ return null;
680
+ }
681
+ /**
682
+ * 删除 Cookie
683
+ * @param name Cookie 名称
684
+ * @param path 路径,默认 '/'
685
+ * @param domain 域名
686
+ */
469
687
  function removeCookie(name, path = "/", domain) {
470
- let cookieString = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=${path}`;
471
- if (domain) {
472
- cookieString += `; domain=${domain}`;
473
- }
474
- document.cookie = cookieString;
475
- }
688
+ let cookieString = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=${path}`;
689
+ if (domain) cookieString += `; domain=${domain}`;
690
+ document.cookie = cookieString;
691
+ }
692
+ /**
693
+ * 检查 Cookie 是否存在
694
+ * @param name Cookie 名称
695
+ * @returns 是否存在
696
+ */
476
697
  function hasCookie(name) {
477
- return getCookie(name) !== null;
698
+ return getCookie(name) !== null;
478
699
  }
479
700
 
480
- // src/function.ts
701
+ //#endregion
702
+ //#region src/function.ts
703
+ /**
704
+ * 生成唯一标识(时间戳 + 随机数)
705
+ * @param prefix 前缀
706
+ * @returns 唯一标识
707
+ */
481
708
  function generateUniqueId(prefix) {
482
- const timestamp = Date.now().toString(36);
483
- const random = Math.random().toString(36).substring(2, 8);
484
- return `${prefix || ""}${timestamp}_${random}`;
485
- }
486
- var noop = () => {
487
- };
709
+ const timestamp = Date.now().toString(36);
710
+ const random = Math.random().toString(36).substring(2, 8);
711
+ return `${prefix || ""}${timestamp}_${random}`;
712
+ }
713
+ /**
714
+ * 空函数
715
+ */
716
+ const noop = () => {};
488
717
 
489
- // src/env.ts
718
+ //#endregion
719
+ //#region src/env.ts
720
+ /**
721
+ * 环境变量
722
+ * @param appEnv 环境变量 import.meta.env.APP_ENV
723
+ * @returns 环境变量对象
724
+ */
490
725
  function env(appEnv) {
491
- const isDev = appEnv === "development";
492
- const isTest = appEnv === "test";
493
- const isPre = appEnv === "pre-release";
494
- const isProd = appEnv === "production";
495
- return {
496
- isDev,
497
- isTest,
498
- isPre,
499
- isProd
500
- };
501
- }
502
- export {
503
- addFn,
504
- computeGoodsNumFn,
505
- computeGoodsWeightFn,
506
- computeNoTaxAmount2Fn,
507
- computeNoTaxAmountFn,
508
- computeNoTaxPrice2Fn,
509
- computeNoTaxPriceFn,
510
- computePrice2Fn,
511
- computePriceFn,
512
- computeTaxAmount2Fn,
513
- computeTaxAmountFn,
514
- computeTaxFn,
515
- computeTaxRateFn,
516
- computeWeightFn,
517
- divideFn,
518
- env,
519
- formatNumber,
520
- generateUniqueId,
521
- getCookie,
522
- hasCookie,
523
- isArguments,
524
- isArray,
525
- isArrayBuffer,
526
- isArrayIndex,
527
- isArrayIterator,
528
- isArrayLike,
529
- isArrayLikeObject,
530
- isAsyncFunction,
531
- isAsyncIterable,
532
- isBase64,
533
- isBigInt,
534
- isBlob,
535
- isBoolean,
536
- isBrowser,
537
- isChineseIDCard,
538
- isChinesePhone,
539
- isChinesePostalCode,
540
- isDate,
541
- isDateString,
542
- isDateTimeString,
543
- isDocument,
544
- isElement,
545
- isEmail,
546
- isEmpty,
547
- isEqual,
548
- isError,
549
- isEvent,
550
- isFile,
551
- isFinite,
552
- isFormData,
553
- isFunction,
554
- isGeneratorFunction,
555
- isHSLColor,
556
- isHTMLString,
557
- isHexColor,
558
- isInteger,
559
- isIterable,
560
- isIterator,
561
- isJSONSerializable,
562
- isJSONString,
563
- isLength,
564
- isMap,
565
- isMapIterator,
566
- isMatch,
567
- isNaN,
568
- isNative,
569
- isNil,
570
- isNull,
571
- isNumber,
572
- isObject,
573
- isObjectLike,
574
- isPlainObject,
575
- isPrimitive,
576
- isPromise,
577
- isRGBColor,
578
- isRegExp,
579
- isRegExpString,
580
- isSafeInteger,
581
- isSameOrAfterDay,
582
- isSameOrBeforeDay,
583
- isSet,
584
- isSetIterator,
585
- isString,
586
- isStringIterator,
587
- isSymbol,
588
- isTimeString,
589
- isTimezone,
590
- isTypedArray,
591
- isURL,
592
- isURLSearchParams,
593
- isURLString,
594
- isUndefined,
595
- isWeakMap,
596
- isWeakSet,
597
- isWindow,
598
- isXMLString,
599
- multiplyFn,
600
- noop,
601
- removeCookie,
602
- setCookie,
603
- subtractFn,
604
- sumBy,
605
- toThousands
606
- };
726
+ return {
727
+ isDev: appEnv === "development",
728
+ isTest: appEnv === "test",
729
+ isPre: appEnv === "pre-release",
730
+ isProd: appEnv === "production"
731
+ };
732
+ }
733
+
734
+ //#endregion
735
+ export { addFn, computeGoodsNumFn, computeGoodsWeightFn, computeNoTaxAmount2Fn, computeNoTaxAmountFn, computeNoTaxPrice2Fn, computeNoTaxPriceFn, computePrice2Fn, computePriceFn, computeTaxAmount2Fn, computeTaxAmountFn, computeTaxFn, computeTaxRateFn, computeWeightFn, divideFn, env, formatNumber, generateUniqueId, getCookie, hasCookie, isArguments, isArray, isArrayBuffer, isArrayIndex, isArrayIterator, isArrayLike, isArrayLikeObject, isAsyncFunction, isAsyncIterable, isBase64, isBigInt, isBlob, isBoolean, isBrowser, isChineseIDCard, isChinesePhone, isChinesePostalCode, isDate, isDateString, isDateTimeString, isDocument, isElement, isEmail, isEmpty, isEqual, isError, isEvent, isFile, isFinite, isFormData, isFunction, isGeneratorFunction, isHSLColor, isHTMLString, isHexColor, isInteger, isIterable, isIterator, isJSONSerializable, isJSONString, isLength, isMap, isMapIterator, isMatch, isNaN, isNative, isNil, isNull, isNumber, isObject, isObjectLike, isPlainObject, isPrimitive, isPromise, isRGBColor, isRegExp, isRegExpString, isSafeInteger, isSameOrAfterDay, isSameOrBeforeDay, isSet, isSetIterator, isString, isStringIterator, isSymbol, isTimeString, isTimezone, isTypedArray, isURL, isURLSearchParams, isURLString, isUndefined, isWeakMap, isWeakSet, isWindow, isXMLString, multiplyFn, noop, removeCookie, setCookie, subtractFn, sumBy, toThousands };
607
736
  //# sourceMappingURL=index.js.map