@whitesev/utils 1.5.9 → 1.6.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.esm.js CHANGED
@@ -3461,13 +3461,20 @@ class Utils {
3461
3461
  return source;
3462
3462
  }
3463
3463
  }
3464
+ if (source == null) {
3465
+ return target;
3466
+ }
3467
+ if (target == null) {
3468
+ target = {};
3469
+ }
3464
3470
  if (isAdd) {
3465
3471
  for (const sourceKeyName in source) {
3466
3472
  const targetKeyName = sourceKeyName;
3467
3473
  let targetValue = target[targetKeyName];
3468
3474
  let sourceValue = source[sourceKeyName];
3469
- if (sourceKeyName in target &&
3470
- typeof sourceValue === "object" &&
3475
+ if (typeof sourceValue === "object" &&
3476
+ sourceValue != null &&
3477
+ sourceKeyName in target &&
3471
3478
  !UtilsContext.isDOM(sourceValue)) {
3472
3479
  /* 源端的值是object类型,且不是元素节点 */
3473
3480
  target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
@@ -3482,6 +3489,7 @@ class Utils {
3482
3489
  let targetValue = target[targetKeyName];
3483
3490
  let sourceValue = source[targetKeyName];
3484
3491
  if (typeof sourceValue === "object" &&
3492
+ sourceValue != null &&
3485
3493
  !UtilsContext.isDOM(sourceValue) &&
3486
3494
  Object.keys(sourceValue).length) {
3487
3495
  /* 源端的值是object类型,且不是元素节点 */