Skip to content

Commit 2a7b25c

Browse files
fix(*): Fix Blob detection for iOS 8/9
1 parent c7de6e3 commit 2a7b25c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
var isArray = require('isarray');
88

9+
var toString = Object.prototype.toString;
10+
var withNativeBlob = typeof global.Blob === 'function' || toString.call(global.Blob) === '[object BlobConstructor]';
11+
var withNativeFile = typeof global.File === 'function' || toString.call(global.File) === '[object FileConstructor]';
12+
913
/**
1014
* Module exports.
1115
*/
@@ -37,8 +41,8 @@ function hasBinary (obj) {
3741

3842
if ((typeof global.Buffer === 'function' && global.Buffer.isBuffer && global.Buffer.isBuffer(obj)) ||
3943
(typeof global.ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||
40-
(typeof global.Blob === 'function' && obj instanceof Blob) ||
41-
(typeof global.File === 'function' && obj instanceof File)
44+
(withNativeBlob && obj instanceof Blob) ||
45+
(withNativeFile && obj instanceof File)
4246
) {
4347
return true;
4448
}

0 commit comments

Comments
 (0)