@whitesev/utils 2.9.7 → 2.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -446,6 +446,9 @@ class CommonUtil {
446
446
  }
447
447
  toJSON(data, errorCallBack) {
448
448
  let result = {};
449
+ if (data == null) {
450
+ return result;
451
+ }
449
452
  if (typeof data === "object") {
450
453
  return data;
451
454
  }
@@ -4315,13 +4318,25 @@ class UtilsDictionary {
4315
4318
  * 获取字典所有的键
4316
4319
  */
4317
4320
  keys() {
4318
- return Array.from(this.items.keys());
4321
+ const keys = this.items.keys();
4322
+ if (typeof keys.toArray === "function") {
4323
+ return keys.toArray();
4324
+ }
4325
+ else {
4326
+ return [...keys];
4327
+ }
4319
4328
  }
4320
4329
  /**
4321
4330
  * 返回字典中的所有值
4322
4331
  */
4323
4332
  values() {
4324
- return Array.from(this.items.values());
4333
+ const values = this.items.values();
4334
+ if (typeof values.toArray === "function") {
4335
+ return values.toArray();
4336
+ }
4337
+ else {
4338
+ return [...values];
4339
+ }
4325
4340
  }
4326
4341
  /**
4327
4342
  * 清空字典
@@ -5498,7 +5513,7 @@ class DOMUtils {
5498
5513
  }
5499
5514
  const domUtils = new DOMUtils();
5500
5515
 
5501
- const version = "2.9.7";
5516
+ const version = "2.9.9";
5502
5517
 
5503
5518
  class Utils {
5504
5519
  windowApi;
@@ -8036,7 +8051,7 @@ class Utils {
8036
8051
  }
8037
8052
  }
8038
8053
  /**
8039
- * 深度获取对象属性
8054
+ * 深度获取对象的某个属性
8040
8055
  * @param target 待获取的对象
8041
8056
  * @param handler 获取属性的回调
8042
8057
  */