GeezerVison is showing github.com — util: show External values explicitly in inspect · ppaugh/node@3cc3e09
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/util.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -466,6 +466,9 @@ function formatValue(ctx, value, recurseTimes) { |
466 | 466 | return `${constructor.name}` + |
467 | 467 | ` { byteLength: ${formatNumber(ctx, value.byteLength)} }`; |
468 | 468 | } |
| 469 | + if (binding.isExternal(value)) { |
| 470 | + return ctx.stylize('[External]', 'special'); |
| 471 | + } |
469 | 472 | } |
470 | 473 |
|
471 | 474 | var base = ''; |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_util.cc +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -22,6 +22,7 @@ using v8::Value; |
22 | 22 | V(isArrayBuffer, IsArrayBuffer) \ |
23 | 23 | V(isDataView, IsDataView) \ |
24 | 24 | V(isDate, IsDate) \ |
| 25 | + V(isExternal, IsExternal) \ |
25 | 26 | V(isMap, IsMap) \ |
26 | 27 | V(isMapIterator, IsMapIterator) \ |
27 | 28 | V(isPromise, IsPromise) \ |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-util-inspect.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -82,6 +82,9 @@ assert.strictEqual(util.inspect(Object.assign(new String('hello'), |
82 | 82 | { [Symbol('foo')]: 123 }), { showHidden: true }), |
83 | 83 | '{ [String: \'hello\'] [length]: 5, [Symbol(foo)]: 123 }'); |
84 | 84 |
|
| 85 | +assert.strictEqual(util.inspect(process.stdin._handle._externalStream), |
| 86 | + '[External]'); |
| 87 | + |
85 | 88 | { |
86 | 89 | const regexp = /regexp/; |
87 | 90 | regexp.aprop = 42; |
|