
Security News
Static vs. Runtime Reachability: Insights from Latio’s On the Record Podcast
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
@metamask/swappable-obj-proxy
Advanced tools
Tools for creating `Proxy`s around objects that are swappable via setTarget
Creates a Proxy
around any object. Retarget the proxy with setTarget
.
yarn add @metamask/swappable-obj-proxy
or
npm install @metamask/swappable-obj-proxy
const { createSwappableProxy } = require('@metamask/swappable-obj-proxy');
const original = { sayHello: () => 'hi' };
const next = { sayHello: () => 'haay' };
const proxy = createEventEmitterProxy(original);
proxy.sayHello(); //=> "hi"
proxy.setTarget(next);
proxy.sayHello(); //=> "haay"
Creates a Proxy
around an EventEmitter
. If the proxy has setTarget
called with a different EventEmitter
, all events will be removed from the old target and transferred to the new EventEmitter.
const { createEventEmitterProxy } = require('@metamask/swappable-obj-proxy');
const original = new EventEmitter();
const next = new EventEmitter();
const proxy = createEventEmitterProxy(original);
proxy.on('event', () => console.log('saw event!'));
// triggers the event handler
original.emit('event');
// moves listeners over to next
proxy.setTarget(next);
// does NOT trigger the event handler
original.emit('event');
// DOES trigger the event handler
next.emit('event');
FAQs
Tools for creating `Proxy`s around objects that are swappable via setTarget
The npm package @metamask/swappable-obj-proxy receives a total of 27,851 weekly downloads. As such, @metamask/swappable-obj-proxy popularity was classified as popular.
We found that @metamask/swappable-obj-proxy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.