How to test if an object is a Proxy?

后端 未结 13 2182
予麋鹿
予麋鹿 2020-11-30 07:23

I would like to test if a JavaScript object is a Proxy. The trivial approach

if (obj instanceof Proxy) ...

doesn\'t work here, nor does tra

13条回答
  •  [愿得一人]
    2020-11-30 07:54

    From http://www.2ality.com/2014/12/es6-proxies.html:

    It is impossible to determine whether an object is a proxy or not (transparent virtualization).

提交回复
热议问题