Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
autoproxy
Advanced tools
Readme
A higher-order decorator to automatically proxy properties from the original function to the decorated one so that higher-order components don't get in the way.
For example, a React component with Redux looks like this:
@connect(data => { size: data.layout.size })
class Box extends React.Component {
static NUMBER_OF_SIDES = 4;
bounce() {
...
}
render() {
...
}
}
This component defines a static property called NUMBER_OF_SIDES
and method called bounce
.
Without autoproxy, to access these properties we have to write code like this:
class Root extends React.Component {
render() {
return <Box ref={component => { this._box = component; }} />;
}
componentDidMount() {
console.log('There are %d sides', Box.WrappedComponent.NUMBER_OF_SIDES);
this._box.getWrappedInstance().bounce();
}
}
See how we need WrappedComponent
and getWrappedInstance()
? This is because the connect
decorator defines Box to wrap the underlying class. As a result Box.NUMBER_OF_SIDES
and this._box.bounce
are both undefined.
With autoproxy
, the wrapper class automatically proxies the underlying class' properties. Use @autoproxy
to decorate a decorator:
@autoproxy(connect(data => { size: data.layout.size }))
class Box extends React.Component {
...
}
Then you can write Box.NUMBER_OF_SIDES
and this._box.bounce
.
FAQs
A higher-order decorator to automatically proxy properties from the original function to the decorated one
The npm package autoproxy receives a total of 9 weekly downloads. As such, autoproxy popularity was classified as not popular.
We found that autoproxy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.