@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.umd.js CHANGED
@@ -3467,13 +3467,20 @@
3467
3467
  return source;
3468
3468
  }
3469
3469
  }
3470
+ if (source == null) {
3471
+ return target;
3472
+ }
3473
+ if (target == null) {
3474
+ target = {};
3475
+ }
3470
3476
  if (isAdd) {
3471
3477
  for (const sourceKeyName in source) {
3472
3478
  const targetKeyName = sourceKeyName;
3473
3479
  let targetValue = target[targetKeyName];
3474
3480
  let sourceValue = source[sourceKeyName];
3475
- if (sourceKeyName in target &&
3476
- typeof sourceValue === "object" &&
3481
+ if (typeof sourceValue === "object" &&
3482
+ sourceValue != null &&
3483
+ sourceKeyName in target &&
3477
3484
  !UtilsContext.isDOM(sourceValue)) {
3478
3485
  /* 源端的值是object类型,且不是元素节点 */
3479
3486
  target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
@@ -3488,6 +3495,7 @@
3488
3495
  let targetValue = target[targetKeyName];
3489
3496
  let sourceValue = source[targetKeyName];
3490
3497
  if (typeof sourceValue === "object" &&
3498
+ sourceValue != null &&
3491
3499
  !UtilsContext.isDOM(sourceValue) &&
3492
3500
  Object.keys(sourceValue).length) {
3493
3501
  /* 源端的值是object类型,且不是元素节点 */