@actualwave/with-proxy

0.0.1 • Public • Published

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

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @actualwave/with-proxy

    Weekly Downloads

    1

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    1.74 kB

    Total Files

    3

    Last publish

    Collaborators

    • actualwave