From: Feross Aboukhadijeh Date: Tue, 21 Apr 2015 10:17:24 +0000 (-0700) Subject: don't assume ArrayBuffer will exist X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=d330b885565b1af874126953c9668e6eb1cdbfcd;p=buffer.git don't assume ArrayBuffer will exist --- diff --git a/index.js b/index.js index e086c8f..faf3ff8 100644 --- a/index.js +++ b/index.js @@ -118,7 +118,9 @@ function fromObject (that, object) { throw new TypeError('must start with number, buffer, array or string') } - if (object.buffer instanceof ArrayBuffer) return fromTypedArray(that, object) + if (typeof ArrayBuffer !== 'undefined' && object.buffer instanceof ArrayBuffer) { + return fromTypedArray(that, object) + } if (object.length) return fromArrayLike(that, object)