Skip to content

Commit 8f39b80

Browse files
committed
Fix
1 parent 2b72057 commit 8f39b80

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.changeset/chilly-icons-guess.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Fix the bug in `mergeDeep`;
66

77
The following inputs and outputs are corrected;
88

9-
- `mergeDeep([{a:2} undefined])` - Any nullish values should be ignored so it should return `{a:2}`
9+
- `mergeDeep([{a:2}, undefined])` - Any nullish values should be ignored so it should return `{a:2}`
1010
- `mergeDeep([])` - no sources should return `undefined`
1111
- `mergeDeep([undefined])` - no sources should return `undefined`

packages/utils/src/mergeDeep.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ export function mergeDeep<S extends any[]>(
5252
let firstObjectSource: any;
5353
if (respectPrototype) {
5454
firstObjectSource = sources.find(source => isObject(source));
55-
if (output == null) {
56-
output = {};
57-
}
5855
if (firstObjectSource) {
56+
if (output == null) {
57+
output = {};
58+
}
5959
Object.setPrototypeOf(output, Object.create(Object.getPrototypeOf(firstObjectSource)));
6060
}
6161
}

0 commit comments

Comments
 (0)