JSPM

@actualwave/with-proxy

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q36546F
  • License MIT

Wrapper over new Proxy() that adds handlers for apply and construct traps for function targets.

Package Exports

  • @actualwave/with-proxy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@actualwave/with-proxy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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