buffer: alias toLocaleString to toString
Make Buffer.prototype.toLocaleString an alias of Buffer.prototype.toString so that the output is actually useful. Fixes: https://github.com/nodejs/node/issues/8147 PR-URL: https://github.com/nodejs/node/pull/8148 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
0764bc4711
commit
9cee8b1b62
@ -1332,3 +1332,5 @@ Buffer.prototype.swap64 = function swap64() {
|
|||||||
}
|
}
|
||||||
return swap64n(this);
|
return swap64n(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Buffer.prototype.toLocaleString = Buffer.prototype.toString;
|
||||||
|
@ -1502,3 +1502,9 @@ assert.throws(() => Buffer.alloc({ valueOf: () => 1 }),
|
|||||||
/"size" argument must be a number/);
|
/"size" argument must be a number/);
|
||||||
assert.throws(() => Buffer.alloc({ valueOf: () => -1 }),
|
assert.throws(() => Buffer.alloc({ valueOf: () => -1 }),
|
||||||
/"size" argument must be a number/);
|
/"size" argument must be a number/);
|
||||||
|
|
||||||
|
assert.strictEqual(Buffer.prototype.toLocaleString, Buffer.prototype.toString);
|
||||||
|
{
|
||||||
|
const buf = Buffer.from('test');
|
||||||
|
assert.strictEqual(buf.toLocaleString(), buf.toString());
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user