matthew-andrews/isomorphic-fetch

constructor equality fails

zhenyulin opened this issue · 0 comments

import fetch from 'isomorphic-fetch'; // global bindings
import nodeFetch from 'node-fetch';

const a = new Response();
const b = new nodeFetch.Response();

console.log(a instanceof nodeFetch.Response);
console.log(b instanceof Response);

the above code would output

false
false

use cases of the above check would be in error handling of fetch especially when extracting that to an external package, though instanceof might not be the best way to do the check.