diff options
author | Tim Cooijmans <tim@aapopfiets.nl> | 2010-11-17 21:26:08 +0100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-11-17 16:06:17 -0800 |
commit | d4b726a1a6e62c0d3a218d2f14a37b76d0878d4b (patch) | |
tree | cd868ca16a6016dde6505bfa762a98407ad7d8ee /lib/util.js | |
parent | 9da29a61094e12511d628046676700e120cc0670 (diff) | |
download | node-new-d4b726a1a6e62c0d3a218d2f14a37b76d0878d4b.tar.gz |
fix utils.inspect's detection of circular structures
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/util.js b/lib/util.js index ac051c34d9..372fc00d72 100644 --- a/lib/util.js +++ b/lib/util.js @@ -145,8 +145,6 @@ exports.inspect = function (obj, showHidden, depth, colors) { base = ' ' + value.toUTCString(); } - seen.push(value); - if (keys.length === 0) { return braces[0] + base + braces[1]; } @@ -159,6 +157,8 @@ exports.inspect = function (obj, showHidden, depth, colors) { } } + seen.push(value); + var output = keys.map(function (key) { var name, str; if (value.__lookupGetter__) { @@ -218,6 +218,8 @@ exports.inspect = function (obj, showHidden, depth, colors) { return name + ": " + str; }); + seen.pop(); + var numLinesEst = 0; var length = output.reduce(function(prev, cur) { numLinesEst++; |