]> zoso.dev Git - buffer.git/commitdiff
don't assume ArrayBuffer will exist
authorFeross Aboukhadijeh <feross@feross.org>
Tue, 21 Apr 2015 10:17:24 +0000 (03:17 -0700)
committerFeross Aboukhadijeh <feross@feross.org>
Tue, 21 Apr 2015 10:17:24 +0000 (03:17 -0700)
index.js

index e086c8f756f1e55548a7b472541324f0b211439f..faf3ff8c918c04fa58be672c1e451ec6a8e942c0 100644 (file)
--- 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)