Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructor equality fails #158

Open
zhenyulin opened this issue Feb 12, 2018 · 0 comments
Open

constructor equality fails #158

zhenyulin opened this issue Feb 12, 2018 · 0 comments

Comments

@zhenyulin
Copy link

zhenyulin commented Feb 12, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant