Skip to content

Commit d93b69e

Browse files
charmanderMyles Borins
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 1213152 commit d93b69e

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
@@ -509,7 +509,7 @@ Buffer.prototype.equals = function equals(b){
509509

510510

511511
// Override how buffers are presented by util.inspect().
512-
Buffer.prototype[internalUtil.inspectSymbol]=functioninspect(){
512+
Buffer.prototype[internalUtil.customInspectSymbol]=functioninspect(){
513513
varstr='';
514514
varmax=exports.INSPECT_MAX_BYTES;
515515
if(this.length>0){
@@ -519,7 +519,7 @@ Buffer.prototype[internalUtil.inspectSymbol] = function inspect(){
519519
}
520520
return'<'+this.constructor.name+' '+str+'>';
521521
};
522-
Buffer.prototype.inspect=Buffer.prototype[internalUtil.inspectSymbol];
522+
Buffer.prototype.inspect=Buffer.prototype[internalUtil.customInspectSymbol];
523523

524524
Buffer.prototype.compare=functioncompare(target,
525525
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)