From e39a5138c55207a3f6698d1a102068def38f5745 Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Sat, 20 Jan 2018 23:11:51 +0100 Subject: [PATCH] Error message for "size" parameter changed --- index.js | 2 +- test/node/test-buffer-alloc.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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'); -- 2.34.1