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 (#222): sorting object keys with not traversable values #223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sebslon
Copy link

@sebslon sebslon commented Apr 22, 2024

fixes #222

@balupton
Copy link
Member

We should check if this package is used on class instances in the wild, as this would break sorting them. Perhaps an alternative would be Object.keys(value).length !== 0. However, I agree your approach makes the most sense.

@sebslon
Copy link
Author

sebslon commented Apr 23, 2024

Hey, thank you for your feedback. I see, checked and understand your concern and I agree that it breaks class instances when sorting.

Object.keys(value).length !== 0 unfortunately also leaves pure JS objects (instead of class instances) if they have properties (X { y: 2 } -> { y: 2 }).

@sebslon
Copy link
Author

sebslon commented Apr 23, 2024

Hey @balupton, I've added additional handling for cases when there are class instances.

Please take a look and let me know if you see any issues ;)

Thanks again for your response!

  • npm run our:compile ✅
  • npm run our:test ✅

@sebslon
Copy link
Author

sebslon commented May 8, 2024

Hey @balupton any opinions on this one or should I close this PR? :)

Thanks!

@balupton
Copy link
Member

balupton commented May 9, 2024

Back to work from backpacking, give me a few weeks to catch up

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.

[BUG]: When sorting object with Date, Set (JS objects) they are vanished
2 participants