Skip to content

Commit

Permalink
debugger: display array contents in repl
Browse files Browse the repository at this point in the history
This commit allows all array properties to be printed except for
"length". Previously, this filter was applied by checking the
type of each property. However, something changed in V8, and
array elements started coming through as numeric strings, which
stopped them from being displayed.

Fixes: nodejs#6444
PR-URL: nodejs#6448
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
  • Loading branch information
cjihrig committed May 2, 2016
1 parent 8a87b29 commit d2eb935
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
mirrorValue = '[?]';
}

if (Array.isArray(mirror) && typeof prop.name !== 'number') {
// Skip the 'length' property.
// Skip the 'length' property.
if (Array.isArray(mirror) && prop.name === 'length') {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions test/debugger/test-debugger-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ addTest('for (var i in process.env) delete process.env[i]', []);
addTest('process.env', [
/\{\}/
]);

addTest('arr = [{foo: "bar"}]', [
/\[ \{ foo: 'bar' \} \]/
]);

0 comments on commit d2eb935

Please sign in to comment.