You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
logformat assumes innerVal is not an Object. Does not process innerVal if innerVal is an Object. This doesn't provide a deep reformat of JSON to key-value pairs
Take for example: {"date":"2015-11-19","client":{"agent":"firefox","ip":"10.1.32.1"},"server":{"windows":{"ip":"192.168.2.222"}}}
Parse JSON to the last primitive/simple value
The text was updated successfully, but these errors were encountered:
The implementation is simpler because it doesn't have to worry about detecting circular references.
It is safer because there isn't a chance of blowing the stack like there would be with a recursive function.
It is faster and uses less memory when transforming large/complex objects because it doesn't traverse very deep.
That said, I think traversing deeper into the object could be a useful feature if done right. I think the right way here would be to follow the lead of util.inspect(): add an optional options parameter that can set a depth which defaults to 2. If depth is null the function will recurse indefinitely. Some mechanism for detecting circular references would need to be implemented as well. Above all, the changes shouldn't change existing behaviour.
I'm labelling this as an 'enhancement' and not a 'bug' as the current implementation does what it is designed to do. I don't have an immediate need for this functionality, so it may be some time before I implement it. In the meantime, feel free to submit a pull request.
logformat assumes innerVal is not an Object. Does not process innerVal if innerVal is an Object. This doesn't provide a deep reformat of JSON to key-value pairs
Take for example: {"date":"2015-11-19","client":{"agent":"firefox","ip":"10.1.32.1"},"server":{"windows":{"ip":"192.168.2.222"}}}
Parse JSON to the last primitive/simple value
The text was updated successfully, but these errors were encountered: