From: Feross Aboukhadijeh Date: Thu, 9 Jan 2014 04:57:32 +0000 (-0800) Subject: Fix new buffer from buffer test for Object implementation X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=7a66ca7b481ad24fe7979c252b18ea978cd97b38;p=buffer.git Fix new buffer from buffer test for Object implementation --- diff --git a/index.js b/index.js index 7124b1a..5d1d4be 100644 --- a/index.js +++ b/index.js @@ -81,7 +81,7 @@ function Buffer (subject, encoding, noZero) { } var i - if (Buffer.isBuffer(subject)) { + if (subject instanceof Uint8Array) { // Speed optimization -- use set if we're copying from a Uint8Array buf.set(subject) } else if (isArrayish(subject)) {