From d330b885565b1af874126953c9668e6eb1cdbfcd Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 21 Apr 2015 03:17:24 -0700 Subject: [PATCH] don't assume ArrayBuffer will exist --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- 2.34.1