Skip to content

Invert operator broken for longhand version #31

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
toddbaert opened this issue May 23, 2024 · 4 comments
Closed

Invert operator broken for longhand version #31

toddbaert opened this issue May 23, 2024 · 4 comments

Comments

@toddbaert
Copy link
Member

toddbaert commented May 23, 2024

As per the examples in the JsonLogic site, unary operators should accept an array with a single argument (longhand), or a shorthand version where the array is omitted and just the argument is passed. Unfortunately, the longhand doesn't seem to work in this implementation:

{
    "!": false
}

This returns true (inversion working as expected) 👍

{
    "!": [
        false
    ]
}

This returns false (inversion not working) 👎

Please note that this isn't a question of type coercion. The argument being passed in the second case is not the array itself, it's the first element in the array (the false) as in other operations. This bug may impact other operators. I have not tested further.

The JsonLogic website examples make this clear: https://jsonlogic.com/operations.html#logic-and-boolean-operations

image

@TotalTechGeek
Copy link
Member

Hey @toddbaert ; good catch, will take a look ASAP.

Will see if I can get this fixed in the half-hour

@toddbaert
Copy link
Member Author

🙏 Thanks for the support! Let me know if I can help.

@TotalTechGeek
Copy link
Member

Release 1.3.3 should be available now! :)

@toddbaert
Copy link
Member Author

It's available and I can confirm the issue is resolved with 1.3.3. Thanks again!

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

No branches or pull requests

2 participants