We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 143f628 commit 523fc9aCopy full SHA for 523fc9a
src/index.js
@@ -15,13 +15,9 @@ const noop = () => {}
15
// NOTE: I tried doing the "proper thing" using Symbol.hasInstance
16
// but no matter what that did, I couldn't make that work with a SyntaxError
17
// because SyntaxError[Symbol.hasInstance]() returns false. What. The. Heck!?
18
-// So I'm doing this hacky try/catch garbage :-/
+// So I'm doing this .prototype stuff :-/
19
function instanceOf(inst, cls) {
20
- try {
21
- return inst instanceof cls
22
- } catch (error) {
23
- return false
24
- }
+ return cls.prototype !== undefined && inst instanceof cls
25
}
26
27
module.exports = pluginTester
0 commit comments