isProxy() function
Type guard for Proxy values.
Signature:
declare function isProxy<T>(value: T): value is Proxy<T>;
Parameters
Parameter | Type | Description |
---|---|---|
value | T | The value to check is a proxy |
Returns:
value is Proxy<T>
Example
function LogValue(value: unknown) {
if(isProxy(value)) {
print(getProxyValue(value));
} else {
print(value);
}
}
LogValue(5);
LogValue(createProxy({name: "Daymon"}));
Output:
5
{ name: "Daymon" }