]> zoso.dev Git - buffer.git/commitdiff
Fix isInstance() in IE11
authorFeross Aboukhadijeh <feross@feross.org>
Fri, 16 Feb 2018 09:27:35 +0000 (01:27 -0800)
committerFeross Aboukhadijeh <feross@feross.org>
Fri, 16 Feb 2018 09:27:35 +0000 (01:27 -0800)
Confirm that function.name is not undefined

index.js

index 0327f29d0c7385dbd39faff7ac4f68e6aa3749e4..bedaa69ae4b5f4a2400bc3ccab2f18a33ee1c14a 100644 (file)
--- a/index.js
+++ b/index.js
@@ -1768,7 +1768,8 @@ function blitBuffer (src, dst, offset, length) {
 // See: https://github.com/feross/buffer/issues/166
 function isInstance (obj, type) {
   return obj instanceof type ||
-    (obj != null && obj.constructor != null && obj.constructor.name === type.name)
+    (obj != null && obj.constructor != null && obj.constructor.name != null &&
+      obj.constructor.name === type.name)
 }
 function numberIsNaN (obj) {
   // For IE11 support