From f1a9e11e4813d63a54b7097414d26cd21bce6a89 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 14 Jul 2016 23:55:51 -0700 Subject: [PATCH] Fix TypeError: Could not convert argument 1 to a number (fix #123) --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 933a972..f04a7dd 100644 --- a/index.js +++ b/index.js @@ -252,7 +252,9 @@ function fromArrayBuffer (that, array, byteOffset, length) { throw new RangeError('\'length\' is out of bounds') } - if (length === undefined) { + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array) + } else if (length === undefined) { array = new Uint8Array(array, byteOffset) } else { array = new Uint8Array(array, byteOffset, length) -- 2.34.1