From 2f31a4e8f782e4d6ba5b1e0d27af71cabb693209 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Tue, 25 Apr 2017 00:21:17 +0200 Subject: [PATCH] [fix] Ensure globals are functions before running `instanceof` (#68) Following https://github.com/socketio/has-binary/pull/4. --- binary.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binary.js b/binary.js index 38a3578..89e52cf 100644 --- a/binary.js +++ b/binary.js @@ -97,8 +97,8 @@ exports.removeBlobs = function(data, callback) { if (!obj) return obj; // convert any blob - if ((global.Blob && obj instanceof Blob) || - (global.File && obj instanceof File)) { + if ((typeof global.Blob === 'function' && obj instanceof Blob) || + (typeof global.File === 'function' && obj instanceof File)) { pendingBlobs++; // async filereader