joshbuddy / jsonpath

Ruby implementation of http://goessner.net/articles/JsonPath/
MIT License
447 stars 72 forks source link

skip when node size is zero #154

Closed a5-stable closed 1 year ago

a5-stable commented 1 year ago
JsonPath.on({}, "[*]")
#-> lib/jsonpath/enumerable.rb:88:in `%': divided by 0 (ZeroDivisionError)

Greetings, I got an error as above and I fixed it in this pr. this happens when node size is zero in jsonpath enumerable.

start_idx %= node.size
end_idx %= node.size
joshbuddy commented 1 year ago

Thanks @a5-stable