Closed Jack-Works closed 3 years ago
You can already easily determine if anything is a proxy of any specific builtin, except Error, Function, and Array.
Doesn't that example also return false for regular objects?
Doesn't that example also return false for regular objects?
Yes, I mean the "Proxy of structs".
I agree this isn't a problem because of all those Web APIs that reads internal slots directly.
Not just web; every 262 builtin (besides Error) reads internal slots, and only Function and Array effectively tunnel through proxies.
Proxy is designed to be non-distinguishable from normal objects. If structs are
typeof === "object"
, then the Proxy of structs can be detected with the following code.