MiSawa / xq

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

Implement indexing by array and object #142

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

I implemented indexing array by array (=indices), array by object (=slicing), string by object (=slicing).

❯ jq -nc '[0,1,0,2,0] | .[[0]]'
[0,2,4]

❯ jq -nc '[0,1,0,2,0] | .[{start:1, end:4}]'
[1,0,2]

❯ jq -nc '"abcde" | .[{start:1, end:4}]'
"bcd"
MiSawa commented 2 years ago

LGTM, thank you!