Unify names and declarations
Currently we have :
EachKey
ArrayEach
ObjectEach
ArrayEach and ObjectEach almost do same function, and have same parameters, but the function declarations/def are bit different
Suggest overriding EachKey with KeyEach (or override to EachObject and EachArray whatever sounds more logial) and make the function declaration/parameters as close as possible
Would be greate to have this marked as to-do, so whenever I have time i'll get back to it
The difference between ArrayEach and ObjectEach is an artifact of this library's API evolution over time, unfortunately.
EachKey actually does something fundamentally different from the other two (it's basically a multi-key version of Get). It is named too similarly to the others for my taste, though. Maybe we can turn this issue into a list of suggestions for "jsonparser 2.0" to do breaking API changes all at once?
Sounds like a plan, but lets get all functionality on this version first so we know where we're going in 2.0
@daboyuka @rami-dabain sorry for the delay. I'm obviously very busy, and if some of you want to prepare list of the changes which you want to see in next version, I'm glad for any help :)
@buger Same goes for me, I'll try to do it during my next vacation.
The last argument to the ArrayEach callback is an error which is always guaranteed to be nil since a5d5436d. Maybe the arg should be renamed '_' with a small function documentation change saying the parameter is no longer of use and will be nil. If and when there is a breaking change to the API, this parameter could be dropped and a return value of error could be use to short circuit the iteration.