MiSawa / xq

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

fix indices/1 on empty string #36

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

The indices/1 filter with empty string argument should return an empty array. This PR fixes this behavior.

❯ jq -n '"abc" | indices("")'    
[]

❯ xq --version               
xq 0.1.7-f478cd1ff8459f55fd219c1ca5f9ee84ef459b8e

❯ xq -n '"abc" | indices("")'
[
  0,
  1,
  2,
  3
]
MiSawa commented 2 years ago

Ah wasn't able to notice the semantics, thank you for the contribution!