Skip to content

Commit 212da12

Browse files
charmanderevanlucas
authored andcommitted
buffer: use correct name for custom inspect symbol
59714cb introduced the `util.inspect.custom` symbol, but it was exported as `customInspectSymbol` by `internal/util.js` and referenced as `inspectSymbol` by `buffer.js`. PR-URL: #9289 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 0ab008e commit 212da12

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎lib/buffer.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ Buffer.prototype.equals = function equals(b){
527527

528528

529529
// Override how buffers are presented by util.inspect().
530-
Buffer.prototype[internalUtil.inspectSymbol]=functioninspect(){
530+
Buffer.prototype[internalUtil.customInspectSymbol]=functioninspect(){
531531
varstr='';
532532
varmax=exports.INSPECT_MAX_BYTES;
533533
if(this.length>0){
@@ -537,7 +537,7 @@ Buffer.prototype[internalUtil.inspectSymbol] = function inspect(){
537537
}
538538
return'<'+this.constructor.name+' '+str+'>';
539539
};
540-
Buffer.prototype.inspect=Buffer.prototype[internalUtil.inspectSymbol];
540+
Buffer.prototype.inspect=Buffer.prototype[internalUtil.customInspectSymbol];
541541

542542
Buffer.prototype.compare=functioncompare(target,
543543
start,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ assert.doesNotThrow(function(){
3434
assert.strictEqual(util.inspect(b),expected);
3535
assert.strictEqual(util.inspect(s),expected);
3636
});
37+
38+
b.inspect=undefined;
39+
assert.strictEqual(util.inspect(b),expected);

0 commit comments

Comments
(0)