]> zoso.dev Git - buffer.git/commitdiff
check that ArrayBuffer.isView exists
authorFeross Aboukhadijeh <feross@feross.org>
Wed, 20 Apr 2016 05:45:26 +0000 (22:45 -0700)
committerFeross Aboukhadijeh <feross@feross.org>
Wed, 20 Apr 2016 05:45:26 +0000 (22:45 -0700)
For IE10

index.js

index 27f4fcd440d42cb4db1db53a3581d57768f040d6..12a7190bd501cd0f3c803cff837c040ed9c350d0 100644 (file)
--- a/index.js
+++ b/index.js
@@ -394,7 +394,7 @@ function byteLength (string, encoding) {
   if (Buffer.isBuffer(string)) {
     return string.length
   }
-  if (typeof ArrayBuffer !== 'undefined' &&
+  if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
       (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
     return string.byteLength
   }