question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoid instanceof (for cross-realm support)

See original GitHub issue

Rewrite value instanceof ArrayBuffer etc.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
vweeverscommented, May 27, 2018

It depends on the likelihood that the value was created in a different realm. For keys and values coming straight out of IndexedDB it doesn’t matter - as we know they come from the current realm (where IndexedDB and the structured clone algorithm lives).

It pretty much only matters for user input. When a user does db.get(date), that date key might have come from a different realm.

0reactions
ralphtheninjacommented, May 27, 2018

@vweevers Are there any rules on when it is important and not important, e.g. why isn’t instanceof in the constructor and the Uint8Array important?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the best way doing cross-realm type checking in ...
I'm currently building a type checking library that supports checking variables from another realm (a.k.a. different context).
Read more >
Java “instanceOf”: Why And How To Avoid It In Code - Armedia
The java “instanceof” operator is used to test whether the object is an instance of the specified type (class or subclass or interface)....
Read more >
Script not being executed but rendered instead - Spring 17
The fix for this instanceof specific issue has been released to all instances running Spring'17 and moment.js etc should be functioning ...
Read more >
level-js | Yarn - Package Manager
Background; Example; Browser Support; Type Support; Install; API ... Avoid instanceof Date for cross-realm support (#129 (@vweevers); Fix wrong release date ...
Read more >
Filtered Promise#catch - ESDiscuss.org
You get to support the basic instanceof case with inheritance, etc, ... is to avoid overloading catch (which I don't mind either way, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found