Closed vweevers closed 6 years ago
Only one left actually:
https://github.com/Level/level-js/blob/3a8b861b550ef18fd0b7055e5eb916a0a1f8c33a/index.js#L128
The other one doesn't matter because it's only used on values coming out the IndexedDB:
What do you mean by cross-realm support and why is instanceof problematic?
So, yeah, feeling pretty hipster right now.
:laughing:
@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?
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.
Rewrite
value instanceof ArrayBuffer
etc.