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

fix: Fix issue with unwind and empty arrays creating an extra column #496

Merged
merged 2 commits into from
Nov 10, 2020
Merged

fix: Fix issue with unwind and empty arrays creating an extra column #496

merged 2 commits into from
Nov 10, 2020

Conversation

juanjoDiaz
Copy link
Collaborator

Fixes #494 in v5

@coveralls
Copy link

coveralls commented Nov 9, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling e3d845d on juanjoDiaz:fix_unwind_bug_v5 into b37e242 on zemirco:v5.

lib/utils.js Outdated Show resolved Hide resolved
@martinfrancois
Copy link

I actually tested this in our codebase and can confirm that it fixes #494, thanks a lot for the great work @juanjoDiaz !

@knownasilya knownasilya merged commit 0b331fc into zemirco:v5 Nov 10, 2020
@knownasilya
Copy link
Collaborator

Released as v5.0.4

@martinfrancois
Copy link

Thanks a lot @juanjoDiaz and @knownasilya you are awesome! 👍

@martinfrancois
Copy link

@juanjoDiaz I'm not sure if this is intended behavior or not, I just noticed the new introduced code modifies the objects directly, we are using TypeScript and our data is marked as readonly, which is why we noticed this part of the code:

    if (pathArray.length === 1) {
      delete obj[key];
      return obj;
    }

The operation delete obj[key]; seems to delete this on the original object as well. You can reproduce this by making a copy of the data that you pass into parse in a test before running parse, then after running parse, compare the copy with the object that was passed in. Then you will see that the empty array has been removed from the original data as well in a case like it was described in the issue.

@juanjoDiaz
Copy link
Collaborator Author

juanjoDiaz commented Nov 10, 2020

Dammit!
Sometimes too fast is not too good...

This highlights that we should really move to typescript and avoid this type of thing...

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 this pull request may close these issues.

None yet

4 participants