Checks whether a value is a proxy object
Install using npm:
npm install --save is-proxy
or using yarn
yarn add is-proxy
In order for this library to track when a Proxy object is created, it has to either mutate global Proxy constructor or enforce usage of its own Proxy constructor.
Note: In this case you must include this library at the top of your entry point, so it can pick up Proxy creation properly.
// At the top of your entry point
import 'is-proxy';
// Later
import { isProxy } from 'is-proxy';
const myProxy = new Proxy({}, {});
const myRevocableProxy = Proxy.revocable({}, {});
isProxy(myProxy); // ~> true
isProxy(myRevocableProxy.proxy); // ~> true
import { isProxy, Proxy } from 'is-proxy/pure';
const myProxy = new Proxy({}, {});
const myRevocableProxy = Proxy.revocable({}, {});
isProxy(myProxy); // ~> true
isProxy(myRevocableProxy.proxy); // ~> true
isProxy(o: any): boolean - returns true if o
is a proxy object, false if it is not.
Proxy - JavaScript Proxy
, with proxy creation tracking.
Max Kanaradze