Skip to content

Function uniq not working as expected #24

Closed

Description

@igor-mariscak

After look at documentation: https://jsonquerylang.org/reference/#uniq
jsonquery([null, false, 0, "", null, false, 0, ""], 'uniq() | size()') // should be 4
It is not ;-)
In javascript [...new Set([null, false, 0, "", null, false, 0, ""])].length working well!

Activity

  1. josdejong commented on May 28, 2025

    @josdejong
    Collaborator

    Thanks for reporting, that's not good. It may be related to the nullish values. I'll work out a fix asap.

  2. added
    bug
    on May 28, 2025
  3. added a commit that references this issue on May 28, 2025
    b6fd569
  4. github-actions commented on May 28, 2025

    @github-actions

    🎉 This issue has been resolved in version 5.0.2 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  5. added a commit that references this issue on May 28, 2025
    e09aeb2
  6. github-actions commented on May 28, 2025

    @github-actions

    🎉 This issue has been resolved in version 5.0.3 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  7. josdejong commented on May 28, 2025

    @josdejong
    Collaborator

    It was a classic JS issue, whoops! The same issue was the case in operators in and not in, fixed now in v5.0.3.

  8. igor-mariscak commented on May 28, 2025

    @igor-mariscak
    Author

    Fast and great fix. Thank you.

  9. changed the title [-]not working as expected[/-] [+]Function `uniq` not working as expected[/+] on May 28, 2025
  10. josdejong commented on May 28, 2025

    @josdejong
    Collaborator

    The Python version had a similar issue (fixed now). It turns out in Python False == 0 returns True, a similar pitfall like JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions