Skip to content

Invert operator broken for longhand version #31

Closed
@toddbaert

Description

@toddbaert

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions