Skip to content

Commit ff151e5

Browse files
committed
fix issue in deep merging of config files to handle empty source keys
1 parent 12c1505 commit ff151e5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/core/helper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ export default new class {
33
deep_merge(target, source) {
44
if (typeof target === 'object' && target !== null &&
55
typeof source === 'object' && source !== null) {
6+
67
for (const key of Object.keys(source)) {
78
if (typeof source[key] === 'object' && source[key] !== null) {
8-
if (!target[key] || typeof target[key] !== 'object') {
9+
if (!target.hasOwnProperty(key)) {
910
target[key] = Array.isArray(source[key]) ? [] : {};
1011
}
12+
1113
this.deep_merge(target[key], source[key]);
1214
} else {
1315
target[key] = source[key];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@exajs/core",
33
"type": "module",
44
"author": "Brian Seymour <@realtux>",
5-
"version": "0.0.24",
5+
"version": "0.0.25",
66
"description": "modern opinionated node.js framework",
77
"license": "MIT",
88
"homepage": "https://github.com/realtux/exa",

0 commit comments

Comments
 (0)