Allow deepAssign to delete props.
This commit is contained in:
parent
e2de2282c3
commit
0fc2432cdd
@ -26,6 +26,8 @@ export function deepAssign(to, ...rest) {
|
|||||||
const value = src[prop];
|
const value = src[prop];
|
||||||
if (typeof value === 'object' && !Array.isArray(value)) {
|
if (typeof value === 'object' && !Array.isArray(value)) {
|
||||||
to[prop] = deepAssign(to[prop] || {}, value);
|
to[prop] = deepAssign(to[prop] || {}, value);
|
||||||
|
} else if (value === undefined && to[prop] !== undefined) {
|
||||||
|
delete to[prop];
|
||||||
} else {
|
} else {
|
||||||
to[prop] = value;
|
to[prop] = value;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user