Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't copy a property which is not a plain object but an object. #4

Closed
sttk opened this issue May 5, 2018 · 1 comment
Closed

Don't copy a property which is not a plain object but an object. #4

sttk opened this issue May 5, 2018 · 1 comment

Comments

@sttk
Copy link
Contributor

sttk commented May 5, 2018

By modification to fix #3, a following bug is included:

function O(v) {
  this.a = { b: { c: v } };
}
var o1 = new O(123);
var o2 = new O(456);
var p1 = { o: o1 };
var p2 = { o: o2 };
copyProps(p1, p2);
console.log(p2.o === o1); // => false, but it should be true!

This bug can be fixed by using isPlainObject to check an empty plain object instead of isObject.

sttk added a commit that referenced this issue May 5, 2018
@sttk
Copy link
Contributor Author

sttk commented May 5, 2018

This issue was fixed in v2.0.3.

@sttk sttk closed this as completed May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant