js-proxy
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -23,9 +23,8 @@ 'use strict'; | ||
const ws = handlers.get(handler) || set(handlers, handler); | ||
if (!ws.has(target)) { | ||
ws.add(target); | ||
setPrototypeOf(target, new Proxy(getPrototypeOf(target), handler)); | ||
} | ||
return target; | ||
return ws.has(target) ? target : ( | ||
ws.add(target), | ||
setPrototypeOf(target, new Proxy(getPrototypeOf(target), handler)) | ||
); | ||
}; | ||
module.exports = mitm; |
@@ -22,9 +22,8 @@ const { getPrototypeOf, setPrototypeOf } = Object; | ||
const ws = handlers.get(handler) || set(handlers, handler); | ||
if (!ws.has(target)) { | ||
ws.add(target); | ||
setPrototypeOf(target, new Proxy(getPrototypeOf(target), handler)); | ||
} | ||
return target; | ||
return ws.has(target) ? target : ( | ||
ws.add(target), | ||
setPrototypeOf(target, new Proxy(getPrototypeOf(target), handler)) | ||
); | ||
}; | ||
export default mitm; |
{ | ||
"name": "js-proxy", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "The one-stop shop solution for JS Proxies and FFI APIs", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
@@ -308,5 +308,5 @@ [![build status](https://github.com/WebReflection/js-proxy/actions/workflows/node.js.yml/badge.svg)](https://github.com/WebReflection/js-proxy/actions) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/js-proxy/badge.svg?branch=main)](https://coveralls.io/github/WebReflection/js-proxy?branch=main) | ||
* `typeof` or `isArray` or anything else drilling the proxied type might reveal the proxy or fail | ||
* references need to be proxied before others can consume these, as opposite of hook any extra feature/utility/observability without requiring 3rd party to change their reference to the real target | ||
* references need to be proxied before others can consume these, as opposite of hooking any extra feature/utility/observability without requiring 3rd party to change their reference to the real target | ||
Accordingly, the *MITM* export allows anything to have a proxy between its reference and its prototype, which requires extra careful handling, but it can summarized as such: | ||
Accordingly, the *MITM* export allows anything to have a proxy between its reference and its prototype, which requires extra careful handling, but it can be summarized as such: | ||
@@ -313,0 +313,0 @@ ```js |
29308
385