I could readily be proved wrong, but I assume the OP actually intends to do
something in addition to printing the data. At least that's why I wrote a
walker...because I wished that util.inspect could take an action on each
node. My 'real' code takes a function which actually rewrites nodes using
a sax-like visitor pattern. Naturally, that's just one example of why
someone might want to traverse an object. And of course my code sees only
enumerable nodes.
On Mar 22, 2012 1:16 PM, "Andy" <[email protected]> wrote:
> node
> > var a = {node: 1, cow: {moo: 'barf'}};
> > require('sys').inspect(a);
> '{ node: 1, cow: { moo: \'barf\' } }'
>
> sys.inspect probably is all you ever need. Also, my logger library does
> auto object inspecting on log, which I find pretty handy.
> https://github.com/DelvarWorld/Simple-Node-Logger
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en