sculp-js 1.8.2 → 1.8.4

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.
Files changed (63) hide show
  1. package/lib/cjs/array.js +2 -3
  2. package/lib/cjs/async.js +1 -1
  3. package/lib/cjs/base64.js +1 -1
  4. package/lib/cjs/clipboard.js +1 -1
  5. package/lib/cjs/cloneDeep.js +117 -0
  6. package/lib/cjs/cookie.js +1 -1
  7. package/lib/cjs/date.js +1 -1
  8. package/lib/cjs/dom.js +1 -1
  9. package/lib/cjs/download.js +29 -5
  10. package/lib/cjs/easing.js +1 -1
  11. package/lib/cjs/file.js +1 -1
  12. package/lib/cjs/func.js +1 -28
  13. package/lib/cjs/index.js +5 -3
  14. package/lib/cjs/isEqual.js +133 -0
  15. package/lib/cjs/math.js +1 -1
  16. package/lib/cjs/number.js +1 -1
  17. package/lib/cjs/object.js +1 -235
  18. package/lib/cjs/path.js +1 -1
  19. package/lib/cjs/qs.js +1 -1
  20. package/lib/cjs/random.js +1 -1
  21. package/lib/cjs/string.js +1 -1
  22. package/lib/cjs/tooltip.js +1 -1
  23. package/lib/cjs/tree.js +1 -1
  24. package/lib/cjs/type.js +1 -1
  25. package/lib/cjs/unique.js +1 -1
  26. package/lib/cjs/url.js +1 -1
  27. package/lib/cjs/validator.js +1 -1
  28. package/lib/cjs/variable.js +3 -2
  29. package/lib/cjs/watermark.js +1 -1
  30. package/lib/cjs/we-decode.js +1 -1
  31. package/lib/es/array.js +2 -3
  32. package/lib/es/async.js +1 -1
  33. package/lib/es/base64.js +1 -1
  34. package/lib/es/clipboard.js +1 -1
  35. package/lib/es/cloneDeep.js +115 -0
  36. package/lib/es/cookie.js +1 -1
  37. package/lib/es/date.js +1 -1
  38. package/lib/es/dom.js +1 -1
  39. package/lib/es/download.js +30 -6
  40. package/lib/es/easing.js +1 -1
  41. package/lib/es/file.js +1 -1
  42. package/lib/es/func.js +1 -28
  43. package/lib/es/index.js +4 -2
  44. package/lib/es/isEqual.js +131 -0
  45. package/lib/es/math.js +1 -1
  46. package/lib/es/number.js +1 -1
  47. package/lib/es/object.js +2 -234
  48. package/lib/es/path.js +1 -1
  49. package/lib/es/qs.js +1 -1
  50. package/lib/es/random.js +1 -1
  51. package/lib/es/string.js +1 -1
  52. package/lib/es/tooltip.js +1 -1
  53. package/lib/es/tree.js +1 -1
  54. package/lib/es/type.js +1 -1
  55. package/lib/es/unique.js +1 -1
  56. package/lib/es/url.js +1 -1
  57. package/lib/es/validator.js +1 -1
  58. package/lib/es/variable.js +4 -3
  59. package/lib/es/watermark.js +1 -1
  60. package/lib/es/we-decode.js +1 -1
  61. package/lib/index.d.ts +32 -21
  62. package/lib/umd/index.js +262 -267
  63. package/package.json +1 -1
package/lib/es/func.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -84,13 +84,10 @@ const once = (func) => {
84
84
  let called = false;
85
85
  let result;
86
86
  return function (...args) {
87
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
88
87
  if (called)
89
88
  return result;
90
89
  called = true;
91
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
92
90
  result = func.call(this, ...args);
93
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
94
91
  return result;
95
92
  };
96
93
  };
@@ -100,24 +97,12 @@ const once = (func) => {
100
97
  * @param val
101
98
  */
102
99
  function setGlobal(key, val) {
103
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
104
- // @ts-ignore
105
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
106
100
  if (typeof globalThis !== 'undefined')
107
101
  globalThis[key] = val;
108
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
109
- // @ts-ignore
110
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
111
102
  else if (typeof window !== 'undefined')
112
103
  window[key] = val;
113
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
114
- // @ts-ignore
115
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
116
104
  else if (typeof global !== 'undefined')
117
105
  global[key] = val;
118
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
119
- // @ts-ignore
120
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
121
106
  else if (typeof self !== 'undefined')
122
107
  self[key] = val;
123
108
  else
@@ -129,24 +114,12 @@ function setGlobal(key, val) {
129
114
  * @param val
130
115
  */
131
116
  function getGlobal(key) {
132
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
133
- // @ts-ignore
134
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
135
117
  if (typeof globalThis !== 'undefined')
136
118
  return globalThis[key];
137
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
138
- // @ts-ignore
139
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
140
119
  else if (typeof window !== 'undefined')
141
120
  return window[key];
142
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
143
- // @ts-ignore
144
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
145
121
  else if (typeof global !== 'undefined')
146
122
  return global[key];
147
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
148
- // @ts-ignore
149
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
150
123
  else if (typeof self !== 'undefined')
151
124
  return self[key];
152
125
  }
package/lib/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -10,7 +10,7 @@ export { cookieDel, cookieGet, cookieSet } from './cookie.js';
10
10
  export { calculateDate, calculateDateTime, dateParse, dateToEnd, dateToStart, formatDate, isValidDate } from './date.js';
11
11
  export { addClass, getComputedCssVal, getStrWidthPx, getStyle, hasClass, removeClass, setStyle, smoothScroll } from './dom.js';
12
12
  export { crossOriginDownload, downloadBlob, downloadData, downloadHref, downloadURL } from './download.js';
13
- export { cloneDeep, isEqual, isPlainObject, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectMap, objectAssign as objectMerge, objectOmit, objectPick } from './object.js';
13
+ export { isPlainObject, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectMap, objectAssign as objectMerge, objectOmit, objectPick } from './object.js';
14
14
  export { pathJoin, pathNormalize } from './path.js';
15
15
  export { qsParse, qsStringify } from './qs.js';
16
16
  export { STRING_ARABIC_NUMERALS, STRING_LOWERCASE_ALPHA, STRING_UPPERCASE_ALPHA, parseQueryParams, stringAssign, stringCamelCase, stringEscapeHtml, stringFill, stringFormat, stringKebabCase } from './string.js';
@@ -30,3 +30,5 @@ export { weAtob, weBtoa } from './we-decode.js';
30
30
  export { decodeFromBase64, encodeToBase64 } from './base64.js';
31
31
  export { EMAIL_REGEX, HTTP_URL_REGEX, IPV4_REGEX, IPV6_REGEX, PHONE_REGEX, URL_REGEX, isDigit, isEmail, isFloat, isIdNo, isInteger, isIpV4, isIpV6, isNumerical, isPhone, isUrl } from './validator.js';
32
32
  export { escapeRegExp, executeInScope, parseVarFromString, replaceVarFromString, uniqueSymbol } from './variable.js';
33
+ export { cloneDeep } from './cloneDeep.js';
34
+ export { isEqual } from './isEqual.js';
@@ -0,0 +1,131 @@
1
+ /*!
2
+ * sculp-js v1.8.4
3
+ * (c) 2023-present chandq
4
+ * Released under the MIT License.
5
+ */
6
+
7
+ import { isObject } from './type.js';
8
+
9
+ /**
10
+ * 比较两值是否相等,适用所有数据类型
11
+ * @param {Comparable} a
12
+ * @param {Comparable} b
13
+ * @returns {boolean}
14
+ */
15
+ function isEqual(a, b) {
16
+ return deepEqual(a, b);
17
+ }
18
+ function deepEqual(a, b, compared = new WeakMap()) {
19
+ // 相同值快速返回
20
+ if (Object.is(a, b))
21
+ return true;
22
+ // 类型不同直接返回false
23
+ const typeA = Object.prototype.toString.call(a);
24
+ const typeB = Object.prototype.toString.call(b);
25
+ if (typeA !== typeB)
26
+ return false;
27
+ // 只缓存对象类型
28
+ if (isObject(a) && isObject(b)) {
29
+ if (compared.has(a))
30
+ return compared.get(a) === b;
31
+ compared.set(a, b);
32
+ compared.set(b, a);
33
+ }
34
+ // 处理特殊对象类型
35
+ switch (typeA) {
36
+ case '[object Date]':
37
+ return a.getTime() === b.getTime();
38
+ case '[object RegExp]':
39
+ return a.toString() === b.toString();
40
+ case '[object Map]':
41
+ return compareMap(a, b, compared);
42
+ case '[object Set]':
43
+ return compareSet(a, b, compared);
44
+ case '[object ArrayBuffer]':
45
+ return compareArrayBuffer(a, b);
46
+ case '[object DataView]':
47
+ return compareDataView(a, b, compared);
48
+ case '[object Int8Array]':
49
+ case '[object Uint8Array]':
50
+ case '[object Uint8ClampedArray]':
51
+ case '[object Int16Array]':
52
+ case '[object Uint16Array]':
53
+ case '[object Int32Array]':
54
+ case '[object Uint32Array]':
55
+ case '[object Float32Array]':
56
+ case '[object Float64Array]':
57
+ return compareTypedArray(a, b, compared);
58
+ case '[object Object]':
59
+ return compareObjects(a, b, compared);
60
+ case '[object Array]':
61
+ return compareArrays(a, b, compared);
62
+ }
63
+ return false;
64
+ }
65
+ // 辅助比较函数
66
+ function compareMap(a, b, compared) {
67
+ if (a.size !== b.size)
68
+ return false;
69
+ for (const [key, value] of a) {
70
+ if (!b.has(key) || !deepEqual(value, b.get(key), compared))
71
+ return false;
72
+ }
73
+ return true;
74
+ }
75
+ function compareSet(a, b, compared) {
76
+ if (a.size !== b.size)
77
+ return false;
78
+ for (const value of a) {
79
+ let found = false;
80
+ for (const bValue of b) {
81
+ if (deepEqual(value, bValue, compared)) {
82
+ found = true;
83
+ break;
84
+ }
85
+ }
86
+ if (!found)
87
+ return false;
88
+ }
89
+ return true;
90
+ }
91
+ function compareArrayBuffer(a, b) {
92
+ if (a.byteLength !== b.byteLength)
93
+ return false;
94
+ return new DataView(a).getInt32(0) === new DataView(b).getInt32(0);
95
+ }
96
+ function compareDataView(a, b, compared) {
97
+ return a.byteLength === b.byteLength && deepEqual(new Uint8Array(a.buffer), new Uint8Array(b.buffer), compared);
98
+ }
99
+ function compareTypedArray(a, b, compared) {
100
+ return a.byteLength === b.byteLength && deepEqual(Array.from(a), Array.from(b), compared);
101
+ }
102
+ function compareObjects(a, b, compared) {
103
+ const keysA = Reflect.ownKeys(a);
104
+ const keysB = Reflect.ownKeys(b);
105
+ if (keysA.length !== keysB.length)
106
+ return false;
107
+ for (const key of keysA) {
108
+ if (!keysB.includes(key))
109
+ return false;
110
+ if (!deepEqual(a[key], b[key], compared))
111
+ return false;
112
+ }
113
+ // 原型链比较
114
+ return Object.getPrototypeOf(a) === Object.getPrototypeOf(b);
115
+ }
116
+ function compareArrays(a, b, compared) {
117
+ // 增加有效索引检查
118
+ const keysA = Object.keys(a).map(Number);
119
+ const keysB = Object.keys(b).map(Number);
120
+ if (keysA.length !== keysB.length)
121
+ return false;
122
+ // 递归比较每个元素
123
+ for (let i = 0, len = a.length; i < len; i++) {
124
+ if (!deepEqual(a[i], b[i], compared))
125
+ return false;
126
+ }
127
+ // 比较数组对象的其他属性
128
+ return compareObjects(a, b, compared);
129
+ }
130
+
131
+ export { isEqual };
package/lib/es/math.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/number.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/object.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -58,7 +58,6 @@ function objectMap(obj, iterator) {
58
58
  for (const key in obj) {
59
59
  if (!objectHas(obj, key))
60
60
  continue;
61
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
62
61
  obj2[key] = iterator(obj[key], key);
63
62
  }
64
63
  return obj2;
@@ -73,7 +72,6 @@ function objectPick(obj, keys) {
73
72
  const obj2 = {};
74
73
  objectEach(obj, (v, k) => {
75
74
  if (keys.includes(k)) {
76
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
77
75
  // @ts-ignore
78
76
  obj2[k] = v;
79
77
  }
@@ -90,7 +88,6 @@ function objectOmit(obj, keys) {
90
88
  const obj2 = {};
91
89
  objectEach(obj, (v, k) => {
92
90
  if (!keys.includes(k)) {
93
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
94
91
  // @ts-ignore
95
92
  obj2[k] = v;
96
93
  }
@@ -143,7 +140,6 @@ function objectAssign(source, ...targets) {
143
140
  const map = new Map();
144
141
  for (let i = 0, len = targets.length; i < len; i++) {
145
142
  const target = targets[i];
146
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
147
143
  // @ts-ignore
148
144
  source = merge(map, source, target);
149
145
  }
@@ -201,233 +197,5 @@ function objectGet(obj, path, strict = false) {
201
197
  v: tempObj ? tempObj[keyArr[i]] : undefined
202
198
  };
203
199
  }
204
- /**
205
- * 深拷贝堪称完全体 即:任何类型的数据都会被深拷贝
206
- *
207
- * 包含对null、原始值、对象循环引用的处理
208
- *
209
- * 对Map、Set、ArrayBuffer、Date、RegExp、Array、Object及原型链属性方法执行深拷贝
210
- * @param {T} source
211
- * @param {WeakMap} map
212
- * @returns {T}
213
- */
214
- function cloneDeep(source, map = new WeakMap()) {
215
- // 处理原始类型和 null/undefined
216
- if (source === null || typeof source !== 'object') {
217
- return source;
218
- }
219
- // 处理循环引用
220
- if (map.has(source)) {
221
- return map.get(source);
222
- }
223
- // 处理 ArrayBuffer
224
- if (source instanceof ArrayBuffer) {
225
- const copy = new ArrayBuffer(source.byteLength);
226
- new Uint8Array(copy).set(new Uint8Array(source));
227
- map.set(source, copy);
228
- return copy;
229
- }
230
- // 处理 DataView 和 TypedArray (Uint8Array 等)
231
- if (ArrayBuffer.isView(source)) {
232
- const constructor = source.constructor;
233
- const bufferCopy = cloneDeep(source.buffer, map);
234
- return new constructor(bufferCopy, source.byteOffset, source.length);
235
- }
236
- // 处理 Date 对象
237
- if (source instanceof Date) {
238
- const copy = new Date(source.getTime());
239
- map.set(source, copy);
240
- return copy;
241
- }
242
- // 处理 RegExp 对象
243
- if (source instanceof RegExp) {
244
- const copy = new RegExp(source.source, source.flags);
245
- copy.lastIndex = source.lastIndex; // 保留匹配状态
246
- map.set(source, copy);
247
- return copy;
248
- }
249
- // 处理 Map
250
- if (source instanceof Map) {
251
- const copy = new Map();
252
- map.set(source, copy);
253
- source.forEach((value, key) => {
254
- copy.set(cloneDeep(key, map), cloneDeep(value, map));
255
- });
256
- return copy;
257
- }
258
- // 处理 Set
259
- if (source instanceof Set) {
260
- const copy = new Set();
261
- map.set(source, copy);
262
- source.forEach(value => {
263
- copy.add(cloneDeep(value, map));
264
- });
265
- return copy;
266
- }
267
- // 处理数组 (包含稀疏数组)
268
- if (Array.isArray(source)) {
269
- const copy = new Array(source.length);
270
- map.set(source, copy);
271
- // 克隆所有有效索引
272
- for (let i = 0, len = source.length; i < len; i++) {
273
- if (i in source) {
274
- // 保留空位
275
- copy[i] = cloneDeep(source[i], map);
276
- }
277
- }
278
- // 克隆数组的自定义属性
279
- const descriptors = Object.getOwnPropertyDescriptors(source);
280
- for (const key of Reflect.ownKeys(descriptors)) {
281
- Object.defineProperty(copy, key, {
282
- ...descriptors[key],
283
- value: cloneDeep(descriptors[key].value, map)
284
- });
285
- }
286
- return copy;
287
- }
288
- // 处理普通对象和类实例
289
- const copy = Object.create(Object.getPrototypeOf(source));
290
- map.set(source, copy);
291
- const descriptors = Object.getOwnPropertyDescriptors(source);
292
- for (const key of Reflect.ownKeys(descriptors)) {
293
- const descriptor = descriptors[key];
294
- if ('value' in descriptor) {
295
- // 克隆数据属性
296
- descriptor.value = cloneDeep(descriptor.value, map);
297
- }
298
- else {
299
- // 处理访问器属性 (getter/setter)
300
- if (descriptor.get) {
301
- descriptor.get = cloneDeep(descriptor.get, map);
302
- }
303
- if (descriptor.set) {
304
- descriptor.set = cloneDeep(descriptor.set, map);
305
- }
306
- }
307
- Object.defineProperty(copy, key, descriptor);
308
- }
309
- return copy;
310
- }
311
- /**
312
- * 比较两值是否相等,适用所有数据类型
313
- * @param {Comparable} a
314
- * @param {Comparable} b
315
- * @returns {boolean}
316
- */
317
- function isEqual(a, b) {
318
- return deepEqual(a, b);
319
- }
320
- function deepEqual(a, b, compared = new WeakMap()) {
321
- // 相同值快速返回
322
- if (Object.is(a, b))
323
- return true;
324
- // 类型不同直接返回false
325
- const typeA = Object.prototype.toString.call(a);
326
- const typeB = Object.prototype.toString.call(b);
327
- if (typeA !== typeB)
328
- return false;
329
- // 只缓存对象类型
330
- if (isObject(a) && isObject(b)) {
331
- if (compared.has(a))
332
- return compared.get(a) === b;
333
- compared.set(a, b);
334
- compared.set(b, a);
335
- }
336
- // 处理特殊对象类型
337
- switch (typeA) {
338
- case '[object Date]':
339
- return a.getTime() === b.getTime();
340
- case '[object RegExp]':
341
- return a.toString() === b.toString();
342
- case '[object Map]':
343
- return compareMap(a, b, compared);
344
- case '[object Set]':
345
- return compareSet(a, b, compared);
346
- case '[object ArrayBuffer]':
347
- return compareArrayBuffer(a, b);
348
- case '[object DataView]':
349
- return compareDataView(a, b, compared);
350
- case '[object Int8Array]':
351
- case '[object Uint8Array]':
352
- case '[object Uint8ClampedArray]':
353
- case '[object Int16Array]':
354
- case '[object Uint16Array]':
355
- case '[object Int32Array]':
356
- case '[object Uint32Array]':
357
- case '[object Float32Array]':
358
- case '[object Float64Array]':
359
- return compareTypedArray(a, b, compared);
360
- case '[object Object]':
361
- return compareObjects(a, b, compared);
362
- case '[object Array]':
363
- return compareArrays(a, b, compared);
364
- }
365
- return false;
366
- }
367
- // 辅助比较函数
368
- function compareMap(a, b, compared) {
369
- if (a.size !== b.size)
370
- return false;
371
- for (const [key, value] of a) {
372
- if (!b.has(key) || !deepEqual(value, b.get(key), compared))
373
- return false;
374
- }
375
- return true;
376
- }
377
- function compareSet(a, b, compared) {
378
- if (a.size !== b.size)
379
- return false;
380
- for (const value of a) {
381
- let found = false;
382
- for (const bValue of b) {
383
- if (deepEqual(value, bValue, compared)) {
384
- found = true;
385
- break;
386
- }
387
- }
388
- if (!found)
389
- return false;
390
- }
391
- return true;
392
- }
393
- function compareArrayBuffer(a, b) {
394
- if (a.byteLength !== b.byteLength)
395
- return false;
396
- return new DataView(a).getInt32(0) === new DataView(b).getInt32(0);
397
- }
398
- function compareDataView(a, b, compared) {
399
- return a.byteLength === b.byteLength && deepEqual(new Uint8Array(a.buffer), new Uint8Array(b.buffer), compared);
400
- }
401
- function compareTypedArray(a, b, compared) {
402
- return a.byteLength === b.byteLength && deepEqual(Array.from(a), Array.from(b), compared);
403
- }
404
- function compareObjects(a, b, compared) {
405
- const keysA = Reflect.ownKeys(a);
406
- const keysB = Reflect.ownKeys(b);
407
- if (keysA.length !== keysB.length)
408
- return false;
409
- for (const key of keysA) {
410
- if (!keysB.includes(key))
411
- return false;
412
- if (!deepEqual(a[key], b[key], compared))
413
- return false;
414
- }
415
- // 原型链比较
416
- return Object.getPrototypeOf(a) === Object.getPrototypeOf(b);
417
- }
418
- function compareArrays(a, b, compared) {
419
- // 增加有效索引检查
420
- const keysA = Object.keys(a).map(Number);
421
- const keysB = Object.keys(b).map(Number);
422
- if (keysA.length !== keysB.length)
423
- return false;
424
- // 递归比较每个元素
425
- for (let i = 0, len = a.length; i < len; i++) {
426
- if (!deepEqual(a[i], b[i], compared))
427
- return false;
428
- }
429
- // 比较数组对象的其他属性
430
- return compareObjects(a, b, compared);
431
- }
432
200
 
433
- export { cloneDeep, isEqual, isPlainObject, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectMap, objectAssign as objectMerge, objectOmit, objectPick };
201
+ export { isPlainObject, objectAssign, objectEach, objectEachAsync, objectFill, objectGet, objectMap, objectAssign as objectMerge, objectOmit, objectPick };
package/lib/es/path.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/qs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/random.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/string.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/tooltip.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/tree.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/type.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/unique.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/lib/es/url.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
- import { objectHas } from './type.js';
7
+ import { isNullOrUnDef, objectHas } from './type.js';
8
8
 
9
9
  /**
10
10
  * 去除字符串中重复字符
@@ -47,7 +47,8 @@ function parseVariableRegExp(leftMatchSymbol, rightMatchSymbol) {
47
47
  * default match symbol {} same as /{\s*([^{}\s]*)\s*}/g
48
48
  */
49
49
  function parseVarFromString(str, leftMatchSymbol = '{', rightMatchSymbol = '}') {
50
- return Array.from(str.matchAll(parseVariableRegExp(leftMatchSymbol, rightMatchSymbol))).map(el => el?.[1]);
50
+ // @ts-ignore
51
+ return Array.from(str.matchAll(parseVariableRegExp(leftMatchSymbol, rightMatchSymbol))).map(el => isNullOrUnDef(el) ? void 0 : el[1]);
51
52
  }
52
53
  /**
53
54
  * 替换字符串中的插值变量
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.8.1
2
+ * sculp-js v1.8.4
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */