@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.umd.js CHANGED
@@ -450,6 +450,9 @@
450
450
  }
451
451
  toJSON(data, errorCallBack) {
452
452
  let result = {};
453
+ if (data == null) {
454
+ return result;
455
+ }
453
456
  if (typeof data === "object") {
454
457
  return data;
455
458
  }
@@ -4319,13 +4322,25 @@
4319
4322
  * 获取字典所有的键
4320
4323
  */
4321
4324
  keys() {
4322
- return Array.from(this.items.keys());
4325
+ const keys = this.items.keys();
4326
+ if (typeof keys.toArray === "function") {
4327
+ return keys.toArray();
4328
+ }
4329
+ else {
4330
+ return [...keys];
4331
+ }
4323
4332
  }
4324
4333
  /**
4325
4334
  * 返回字典中的所有值
4326
4335
  */
4327
4336
  values() {
4328
- return Array.from(this.items.values());
4337
+ const values = this.items.values();
4338
+ if (typeof values.toArray === "function") {
4339
+ return values.toArray();
4340
+ }
4341
+ else {
4342
+ return [...values];
4343
+ }
4329
4344
  }
4330
4345
  /**
4331
4346
  * 清空字典
@@ -5502,7 +5517,7 @@
5502
5517
  }
5503
5518
  const domUtils = new DOMUtils();
5504
5519
 
5505
- const version = "2.9.7";
5520
+ const version = "2.9.9";
5506
5521
 
5507
5522
  class Utils {
5508
5523
  windowApi;
@@ -8040,7 +8055,7 @@
8040
8055
  }
8041
8056
  }
8042
8057
  /**
8043
- * 深度获取对象属性
8058
+ * 深度获取对象的某个属性
8044
8059
  * @param target 待获取的对象
8045
8060
  * @param handler 获取属性的回调
8046
8061
  */