@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.amd.js +10 -2
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +10 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +10 -2
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +10 -2
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +10 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/Utils.ts +9 -1
package/package.json
CHANGED
package/src/Utils.ts
CHANGED
|
@@ -119,14 +119,21 @@ class Utils {
|
|
|
119
119
|
return source;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
if (source == null) {
|
|
123
|
+
return target;
|
|
124
|
+
}
|
|
125
|
+
if (target == null) {
|
|
126
|
+
target = {};
|
|
127
|
+
}
|
|
122
128
|
if (isAdd) {
|
|
123
129
|
for (const sourceKeyName in source) {
|
|
124
130
|
const targetKeyName = sourceKeyName;
|
|
125
131
|
let targetValue = (target as any)[targetKeyName];
|
|
126
132
|
let sourceValue = (source as any)[sourceKeyName];
|
|
127
133
|
if (
|
|
128
|
-
sourceKeyName in target &&
|
|
129
134
|
typeof sourceValue === "object" &&
|
|
135
|
+
sourceValue != null &&
|
|
136
|
+
sourceKeyName in target &&
|
|
130
137
|
!UtilsContext.isDOM(sourceValue)
|
|
131
138
|
) {
|
|
132
139
|
/* 源端的值是object类型,且不是元素节点 */
|
|
@@ -146,6 +153,7 @@ class Utils {
|
|
|
146
153
|
let sourceValue = (source as any)[targetKeyName];
|
|
147
154
|
if (
|
|
148
155
|
typeof sourceValue === "object" &&
|
|
156
|
+
sourceValue != null &&
|
|
149
157
|
!UtilsContext.isDOM(sourceValue) &&
|
|
150
158
|
Object.keys(sourceValue).length
|
|
151
159
|
) {
|