virtual-proxy
Advanced tools
+9
-13
@@ -5,2 +5,3 @@ const { | ||
| String, | ||
| TypeError, | ||
| JSON: { stringify }, | ||
@@ -67,11 +68,6 @@ Object: { hasOwn }, | ||
| * handler: import(".").VirtualHandler<V>, | ||
| * TypeError: new (message: string) => unknown, | ||
| * }, | ||
| * ) => boolean} | ||
| */ | ||
| const preventExtensionHelper = ( | ||
| origin, | ||
| $target, | ||
| { target, handler, TypeError }, | ||
| ) => { | ||
| const preventExtensionHelper = (origin, $target, { target, handler }) => { | ||
| const keys = handler.ownKeys(target); | ||
@@ -126,3 +122,3 @@ for (let index = 0, length = keys.length; index < length; index++) { | ||
| isExtensible($target) { | ||
| const { handler, target, TypeError } = this; | ||
| const { handler, target } = this; | ||
| const extensible = handler.isExtensible(target); | ||
@@ -144,3 +140,3 @@ // a) | ||
| preventExtensions($target) { | ||
| const { handler, target, TypeError } = this; | ||
| const { handler, target } = this; | ||
| const success = handler.preventExtensions(target); | ||
@@ -179,3 +175,3 @@ // a) | ||
| defineProperty($target, key, descriptor) { | ||
| const { handler, target, TypeError } = this; | ||
| const { handler, target } = this; | ||
| // b) + c) + d) | ||
@@ -213,3 +209,3 @@ const success = handler.defineProperty(target, key, descriptor); | ||
| getOwnPropertyDescriptor($target, key) { | ||
| const { handler, target, TypeError } = this; | ||
| const { handler, target } = this; | ||
| const descriptor = handler.getOwnPropertyDescriptor(target, key); | ||
@@ -237,3 +233,3 @@ // c) | ||
| deleteProperty($target, key) { | ||
| const { handler, target, TypeError } = this; | ||
| const { handler, target } = this; | ||
| const success = handler.deleteProperty(target, key); | ||
@@ -257,3 +253,3 @@ // b) | ||
| ownKeys($target) { | ||
| const { handler, target, TypeError } = this; | ||
| const { handler, target } = this; | ||
| const keys = handler.ownKeys(target); | ||
@@ -283,3 +279,3 @@ // f) | ||
| has($target, key) { | ||
| const { handler, target, TypeError } = this; | ||
| const { handler, target } = this; | ||
| const existent = handler.has(target, key); | ||
@@ -286,0 +282,0 @@ // b) |
+1
-1
| { | ||
| "name": "virtual-proxy", | ||
| "description": "More permisive proxy objects by separating invariant bookkeeping from the target object.", | ||
| "version": "0.2.0", | ||
| "version": "0.3.0", | ||
| "author": { | ||
@@ -6,0 +6,0 @@ "name": "Laurent Christophe", |
+0
-18
@@ -1,9 +0,1 @@ | ||
| export type Options = { | ||
| /** | ||
| * The constructor to use to create a TypeError. Useful when dealing with | ||
| * multiple realms to ensure errors are created in the correct realm. | ||
| */ | ||
| TypeError?: new (message: string) => unknown; | ||
| }; | ||
| /** | ||
@@ -21,3 +13,2 @@ * Main export of the library, it creates an handler object that should be | ||
| * a regular proxy handler object. | ||
| * @param options Optional object to configure the actual handler object. | ||
| * @returns An (actual) handler object that should be passed to the proxy | ||
@@ -29,3 +20,2 @@ * constructor. | ||
| handler: ProxyHandler<V>, | ||
| options?: Options, | ||
| ) => ProxyHandler<T>; | ||
@@ -42,3 +32,2 @@ | ||
| * a regular proxy handler object. | ||
| * @param options Optional object to configure the actual handler object. | ||
| * @returns A virtual proxy object. | ||
@@ -50,3 +39,2 @@ */ | ||
| handler: ProxyHandler<V>, | ||
| options?: Options, | ||
| ) => T; | ||
@@ -67,3 +55,2 @@ | ||
| handler: ProxyHandler<V>, | ||
| options?: Options, | ||
| ) => { proxy: T; revoke: () => void }; | ||
@@ -75,3 +62,2 @@ | ||
| * @param handler The virtual handler object. | ||
| * @param options Optional object to configure the actual handler object. | ||
| * @returns A plain virtual proxy object. | ||
@@ -82,3 +68,2 @@ */ | ||
| handler: ProxyHandler<V>, | ||
| options?: Options, | ||
| ) => T; | ||
@@ -90,3 +75,2 @@ | ||
| * @param handler The virtual handler object. | ||
| * @param options Optional object to configure the actual handler object. | ||
| * @returns A virtual proxy array. | ||
@@ -97,3 +81,2 @@ */ | ||
| handler: ProxyHandler<V>, | ||
| options?: Options, | ||
| ) => T; | ||
@@ -111,3 +94,2 @@ | ||
| handler: ProxyHandler<V>, | ||
| options?: Options, | ||
| ) => T; |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
20818
-3.67%488
-4.13%