FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

debugger: display array contents in repl · nodejs/node@2d503b1 · GitHub

/ node Public

Commit 2d503b1

Browse files
authored andcommitted
debugger: display array contents in repl
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: #6444 PR-URL: #6448 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
1 parent 5fe5fa2 commit 2d503b1

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎lib/_debugger.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
548548
mirrorValue = '[?]';
549549
}
550550

551-
if (Array.isArray(mirror) && typeof prop.name !== 'number') {
552-
// Skip the 'length' property.
551+
// Skip the 'length' property.
552+
if (Array.isArray(mirror) && prop.name === 'length') {
553553
return;
554554
}
555555

‎test/debugger/test-debugger-repl.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ addTest('for (var i in process.env) delete process.env[i]', []);
7575
addTest('process.env', [
7676
/\{\}/
7777
]);
78+
79+
addTest('arr = [{foo: "bar"}]', [
80+
/\[ \{ foo: 'bar' \} \]/
81+
]);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL