Make buffer.INSPECT_MAX_BYTES public for mscdex

pull/5370/head
Ryan Dahl 2011-08-08 19:04:24 -07:00
parent 7332c4022f
commit 2689d262ec
2 changed files with 7 additions and 3 deletions

View File

@ -470,3 +470,7 @@ given it will fill the entire buffer.
var b = new Buffer(50);
b.fill("h");
### INSPECT_MAX_BYTES
How many bytes will be returned when `b.inspect()` is called. This can
be overriden by user modules.

View File

@ -22,7 +22,7 @@
var SlowBuffer = process.binding('buffer').SlowBuffer;
var assert = require('assert');
var INSPECT_MAX_BYTES = 50;
exports.INSPECT_MAX_BYTES = 50;
function toHex(n) {
@ -36,7 +36,7 @@ SlowBuffer.prototype.inspect = function() {
len = this.length;
for (var i = 0; i < len; i++) {
out[i] = toHex(this[i]);
if (i == INSPECT_MAX_BYTES) {
if (i == exports.INSPECT_MAX_BYTES) {
out[i + 1] = '...';
break;
}
@ -287,7 +287,7 @@ Buffer.prototype.inspect = function inspect() {
for (var i = 0; i < len; i++) {
out[i] = toHex(this.parent[i + this.offset]);
if (i == INSPECT_MAX_BYTES) {
if (i == exports.INSPECT_MAX_BYTES) {
out[i + 1] = '...';
break;
}