Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 396942b

Browse files
jahtalabmhevery
authored andcommitted
fix(patchProperty): return null as the default value (#413)
Closes #319
1 parent 3b4c20b commit 396942b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/common/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ export function patchProperty(obj, prop) {
8282
}
8383
};
8484

85+
// The getter would return undefined for unassigned properties but the default value of an unassigned property is null
8586
desc.get = function () {
86-
return this[_prop];
87+
return this[_prop] || null;
8788
};
8889

8990
Object.defineProperty(obj, prop, desc);

0 commit comments

Comments
 (0)