-
Notifications
You must be signed in to change notification settings - Fork 18
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
Document intentional behavior difference #82
Comments
$ xq -nc '[nan, nan] | group_by(.)'
[[null,null]]
$ jq -nc '[nan, nan] | group_by(.)'
[[null],[null]]
$ xq -nc '[nan < nan, nan > nan]'
[false,false]
$ jq -nc '[nan < nan, nan > nan]'
[true,false] |
Though I might change the |
xq/tests/hand_written/regex.rs Line 138 in e25fa19
|
Also -- we currently use oniguruma (via |
Maybe make Edit: Be consistent about whether or not to handle objects https://twitter.com/itchyny/status/1503756509771354113 |
or change it to match the behavior of |
❯ jq -n '0/0'
null
❯ xq -n '0/0'
Error: DivModByZero
❯ jq -n '1,"",1 | normals'
1
1
❯ xq -n '1,"",1 | normals'
1
Error: InvalidArgType("is_normal", "")
❯ jq -n 'isfinite'
false
❯ xq -n 'isfinite'
Error: InvalidArgType("is_infinite", null)
❯ jq -n 'ltrimstr("")'
null
❯ xq -n 'ltrimstr("")'
Error: InvalidArgType("startswith", null)
❯ jq -n 'rtrimstr("")'
null
❯ xq -n 'rtrimstr("")'
Error: InvalidArgType("endswith", null) |
❯ jq -n '[{"Key":"x","Value":0},{"Name":"y","Value":1}] | from_entries'
{
"x": 0,
"y": 1
}
❯ xq -n '[{"Key":"x","Value":0},{"Name":"y","Value":1}] | from_entries'
Error: ObjectIndexByNonString(null) |
❯ jq -n '[39] | implode | @html'
"'"
❯ xq -n '[39] | implode | @html'
"'"
❯ jq -n '"aGVsbG8====" | @base64d'
"hello"
❯ xq -n '"aGVsbG8====" | @base64d'
Error: InvalidAsBase64(InvalidByte(7, 61)) |
The behavior of ❯ jq -n '{a:{b:"hello world",c:["hello test"]},d:"hello sample"} | .. |= ltrimstr("hello ")'
{
"a": {
"b": "world",
"c": [
"test"
]
},
"d": "sample"
}
❯ xq -n '{a:{b:"hello world",c:["hello test"]},d:"hello sample"} | .. |= ltrimstr("hello ")'
Error: InvalidArgType("startswith", {"d": "hello sample", "a": {"c": ["hello test"], "b": "hello world"}}) When we use ❯ jq -n '{a:{b:"hello world",c:["hello test"]},d:"hello sample"} | .. |= gsub("hello "; "")'
jq: error (at <unknown>): object ({"a":{"b":"...) cannot be matched, as it is not a string
❯ jq -n '{a:{b:"hello world",c:["hello test"]},d:"hello sample"} | (.. | strings) |= gsub("hello "; "")'
{
"a": {
"b": "world",
"c": [
"test"
]
},
"d": "sample"
} |
TODO:
%
behavior and document it. (jq
performs/
as a floating-point-number operation, but%
is something like(x as int) % (y as int)
.)isfinite
andisinfinite
returnfalse
forNaN
NaN
. Maybe also report it tojq
.The text was updated successfully, but these errors were encountered: