MiSawa / xq

Pure rust implementation of jq
MIT License
318 stars 18 forks source link

Fix contains filter on booleans to be jq compatible #64

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

This PR fixes contains/1 filter to be more jq compatible. This filter on booleans emits error if the values are different.

❯ jq -c '.[] | [contains(.,not)?]' <<< '[false,true]'
[true]
[true]

❯ jq -n 'true | contains(false)'
jq: error (at <unknown>): boolean (true) and boolean (false) cannot have their containment checked

❯ xq -c '.[] | [contains(.,not)?]' <<< '[false,true]'
[true,false]
[true,false]

❯ xq --version
xq 0.2.2-df131ce732645c4c89d9b393404c8fd0be2f08e5
MiSawa commented 2 years ago

LGTM, thank you!