MiSawa / xq

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

Change indexing string by out of range to emit null #143

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

While the current implementation is same as gojq v0.12.7, I changed in the HEAD version to emit null for indexing string by out of range. This is more consistent with array indexing and behaviors of other languages; in JavaScript "abcde"[10] results in undefined, not "". What do you think?

MiSawa commented 2 years ago

It totally makes sense. I think null is a better value than "" to represent an absence.