@actualwave/with-proxy
v0.0.1
Published
Wrapper over new Proxy() that adds handlers for apply and construct traps for function targets.
Maintainers
Readme
withProxy
Factory generator for wrapping objects with Proxy. Applies construct and apply traps to function targets.
const myFactory = withProxy({
get: myGetHandler,
set: mySetHandler,
apply: myApplyHandler,
construct: myConstructHandler,
});
const myWrappedFunction = myFactory(() => null); // gets all traps
const myWrappedObject = myFactory({}); // does not get "apply" and "construct" traps