Skip to content

Wrong diff changing an undefined attribute to empty object #66

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

Closed
filipealonso opened this issue Aug 22, 2021 · 2 comments · Fixed by #70
Closed

Wrong diff changing an undefined attribute to empty object #66

filipealonso opened this issue Aug 22, 2021 · 2 comments · Fixed by #70

Comments

@filipealonso
Copy link

When you check against removed or undefined attributes it works fine:
✔️ diff({a:{}}, {a:undefined}) returns {a: undefined}
✔️ diff({a:{}}, {}) returns {a: undefined}

But when you invert and add/change to an empty object it differs depending if it was undefined or nonexistent before:
✔️ diff({}, {a:{}}) returns {a:{}}
diff({a:undefined}, {a:{}}) returns {} instead of {a:{}}

@mattphillips
Copy link
Owner

Thanks @filipealonso I'll get this published shortly

@mattphillips
Copy link
Owner

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

Successfully merging a pull request may close this issue.

2 participants