GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — util: fix inspect indentation of detached DataView · nodejs/node@5d68405

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/util
    • inspect.js
  • test/parallel
    • test-util-inspect.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/util/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2545,8 +2545,11 @@ function formatPromise(ctx, value, recurseTimes) {
25452545
}
25462546

25472547
function formatExtraProperties(ctx, value, recurseTimes, key, typedArray) {
2548+
// Read the value before indenting: the getter throws for a detached
2549+
// DataView, and formatRaw() then retries with a fallback value.
2550+
const extraValue = value[key];
25482551
ctx.indentationLvl += 2;
2549-
const str = formatValue(ctx, value[key], recurseTimes, typedArray);
2552+
const str = formatValue(ctx, extraValue, recurseTimes, typedArray);
25502553
ctx.indentationLvl -= 2;
25512554

25522555
// These entries are mainly getters. Should they be formatted like getters?
Collapse file

‎test/parallel/test-util-inspect.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-util-inspect.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ assert.doesNotMatch(
217217
assert.strictEqual(
218218
util.inspect(dv),
219219
'DataView {\n' +
220-
' [byteLength]: 0,\n' +
221-
' [byteOffset]: undefined,\n' +
222-
' [buffer]: ArrayBuffer { (detached), [byteLength]: 0 }\n' +
223-
' }',
220+
' [byteLength]: 0,\n' +
221+
' [byteOffset]: undefined,\n' +
222+
' [buffer]: ArrayBuffer { (detached), [byteLength]: 0 }\n' +
223+
'}',
224224
);
225225
}
226226

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.