-
Notifications
You must be signed in to change notification settings - Fork 221
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
$boolean(arg) when arg is no-match #433
Comments
Using a double not (e.g.
Most JSONata functions are designed so that when evaluated against an unset/undefined value, they also return unset/undefined. |
Ok thanks for your reply. I guess then it will be consistent with Jsonata behaviour of other coercive (typecast) functions like At the very least, the (already excellent, I must add) documentation should be updated to add to note that |
Hmm, I think you're right, there is an inconsistency here. I think that |
I think this introduces a breaking change with how the sift function is working correct me if I am wrong. Since before the change we can write something like:
And now we need to have an additional check:
I am also making the assumption that jsonata is following semantic versioning conventions. |
Sorry this is breaking your expression, but I consider the previous inconsistent behaviour of the |
Thanks for the response! Just wanted to make sure you were aware of some of the differences. |
Thanks. I'd probably remove the
|
Just a query. I wanted something that returns "true" if a arg path evaluates to truthy, and "false" if falsey or not found (no match).
data:
Jsonata expressiosn:
$not(_formValues.test)
returnsfalse
$not(_formValues.test2)
returnstrue
But:
$boolean(_formValues.test)
returnstrue
$boolean(_formValues.test2)
returns*no match*
I found it a bit inconsistent that a
$boolean(arg)
can return*no match*
. Should it be returningfalse
instead when hit against a no match? Or perhaps someone can explain why this is perfectly good and logical :)Using: Jsonata 1.8.2 (as in the exerciser)
The text was updated successfully, but these errors were encountered: