constructor equality fails
zhenyulin opened this issue · 0 comments
zhenyulin commented
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.