
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
@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 25,924 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.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.