From: Volker Mische Date: Sat, 20 Jan 2018 22:11:51 +0000 (+0100) Subject: Error message for "size" parameter changed X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=e39a5138c55207a3f6698d1a102068def38f5745;p=buffer.git Error message for "size" parameter changed --- diff --git a/index.js b/index.js index bc48ecc..a4c33f2 100644 --- a/index.js +++ b/index.js @@ -134,7 +134,7 @@ Buffer.__proto__ = Uint8Array function assertSize (size) { if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') + throw new TypeError('"size" argument must be of type number') } else if (size < 0) { throw new RangeError('"size" argument must not be negative') } diff --git a/test/node/test-buffer-alloc.js b/test/node/test-buffer-alloc.js index f8137bd..0eb4f01 100644 --- a/test/node/test-buffer-alloc.js +++ b/test/node/test-buffer-alloc.js @@ -1000,12 +1000,12 @@ assert.doesNotThrow(() => Buffer.from(new ArrayBuffer())); var arrayBuf = vm.runInNewContext('new ArrayBuffer()'); assert.doesNotThrow(() => Buffer.from(arrayBuf)); assert.doesNotThrow(() => Buffer.from({ buffer: arrayBuf })); -/* + assert.throws(() => Buffer.alloc({ valueOf: () => 1 }), /"size" argument must be of type number/); assert.throws(() => Buffer.alloc({ valueOf: () => -1 }), /"size" argument must be of type number/); - +/* assert.strictEqual(Buffer.prototype.toLocaleString, Buffer.prototype.toString); { var buf = Buffer.from('test');