From 2689d262ec4b0daa5050c50873d89b00cf22b7a5 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 8 Aug 2011 19:04:24 -0700 Subject: [PATCH] Make buffer.INSPECT_MAX_BYTES public for mscdex --- doc/api/buffers.markdown | 4 ++++ lib/buffer.js | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/api/buffers.markdown b/doc/api/buffers.markdown index 0238b764101..9ebf5a9f3cc 100644 --- a/doc/api/buffers.markdown +++ b/doc/api/buffers.markdown @@ -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. diff --git a/lib/buffer.js b/lib/buffer.js index 2510d9c223c..b9c86b9058b 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -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; }