2 comments

[ 5.1 ms ] story [ 13.7 ms ] thread
I'll admit I'm having trouble imagining a use case for this but I must ask:

What happens with arrays?

What happens with deeply nested objects?

Also if you don't mind me asking what case might you want something like this where you don't seem to care about the context of the key and value (i.e. top level key and top level value version deeply nested key of, potentially, the same name.)?

The use case is quite simple, I want to iterate over all values in an object (and possibly manipulate it, that is why the visitor function has access to the parent)

Array members will be visited individually.

The entire object tree will be visited in a depth first order

hope that answers your questions.