mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
buffer: allow toString to accept Infinity for end
This commit is contained in:
1 parent
31ce34887f
commit
68bfa91af7
2 files changed
+8
-1
No files matched your search
+1
-1
@@ -208,7 +208,7 @@ Buffer.prototype.toString = function(encoding, start, end) {
|
||||
var loweredCase = false;
|
||||
|
||||
start = start >>> 0;
|
||||
end = util.isUndefined(end) ? this.length : end >>> 0;
|
||||
end = util.isUndefined(end) || end === Infinity ? this.length : end >>> 0;
|
||||
|
||||
if (!encoding) encoding = 'utf8';
|
||||
if (start < 0) start = 0;
|
||||
|
||||
@@ -49,3 +49,10 @@ expected = '<Buffer 31 32>';
|
||||
|
||||
assert.strictEqual(util.inspect(b), expected);
|
||||
assert.strictEqual(util.inspect(s), expected);
|
||||
|
||||
buffer.INSPECT_MAX_BYTES = Infinity;
|
||||
|
||||
assert.doesNotThrow(function() {
|
||||
assert.strictEqual(util.inspect(b), expected);
|
||||
assert.strictEqual(util.inspect(s), expected);
|
||||
});
|
||||
Reference in new issue
Block a user