MiSawa / xq

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

Fix index and slice with large numbers #78

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

jq allows to use large numbers, or infinities in indexing and slicing.

❯ jq -nc '[range(3)] | .[1e300], .[:1e300], .[1e300:]'
null
[0,1,2]
[]

❯ xq -nc '[range(3)] | .[1e300], .[:1e300], .[1e300:]'
Error: NonIndexableNumber(1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
MiSawa commented 2 years ago

Awesome, thank you!