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

array serializer filters out 0 if item serializer is integer #294

Closed
el-ranye opened this issue Mar 12, 2022 · 2 comments
Closed

array serializer filters out 0 if item serializer is integer #294

el-ranye opened this issue Mar 12, 2022 · 2 comments
Labels
bug Something isn't working released

Comments

@el-ranye
Copy link

This Boolean filter is filtering out 0 from the list. It should probably only filter out null and undefined values:

https://github.com/47ng/next-usequerystate/blob/next/src/defs.ts#L200

@franky47
Copy link
Member

franky47 commented Mar 13, 2022

Zero is a falsy value in JavaScript, and I would expect it to parse to a false value, so this is expected.

  • 0 -> false
  • 1 -> true

Also relevant values that should (and do) map to false:

  • '' (empty string)
  • NaN
  • null
  • undefined

Edit: ah my bad, I didn't see you talked about the array serializer. Yes, there it makes sense to only filter out null values (undefined should not be returned by parse).

@franky47 franky47 reopened this Mar 13, 2022
@franky47 franky47 added the bug Something isn't working label Mar 13, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 1.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants