Skip to content

Commit

Permalink
fix: use existence + comparison check for classes;
Browse files Browse the repository at this point in the history
- fixes non-default value assignments
  • Loading branch information
lukeed committed Jul 4, 2020
1 parent bbcb404 commit 8089f11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function klona(x) {
if (x.constructor !== Object && typeof x.constructor === 'function') {
tmp = new x.constructor();
for (k in x) {
if (tmp[k] === void 0) {
if (tmp.hasOwnProperty(k) && tmp[k] !== x[k]) {
tmp[k] = klona(x[k]);
}
}
Expand Down

0 comments on commit 8089f11

Please sign in to comment.