Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`.
  • Loading branch information
charmander committed Oct 26, 2016
commit 8d3a654949401eba34bc28ad721c2de2bf3dd3a1
4 changes: 2 additions & 2 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ Buffer.prototype.equals = function equals(b) {


// Override how buffers are presented by util.inspect().
Buffer.prototype[internalUtil.inspectSymbol] = function inspect() {
Buffer.prototype[internalUtil.customInspectSymbol] = function inspect() {
var str = '';
var max = exports.INSPECT_MAX_BYTES;
if (this.length > 0) {
Expand All @@ -537,7 +537,7 @@ Buffer.prototype[internalUtil.inspectSymbol] = function inspect() {
}
return '<' + this.constructor.name + ' ' + str + '>';
};
Buffer.prototype.inspect = Buffer.prototype[internalUtil.inspectSymbol];
Buffer.prototype.inspect = Buffer.prototype[internalUtil.customInspectSymbol];

Buffer.prototype.compare = function compare(target,
start,
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-buffer-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ assert.doesNotThrow(function() {
assert.strictEqual(util.inspect(b), expected);
assert.strictEqual(util.inspect(s), expected);
});

b.inspect = undefined;
assert.strictEqual(util.inspect(b), expected);