Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
babel-plugin-transform-proto-to-assign
Advanced tools
Readme
This plugin allows Babel to transform all
__proto__
assignments to a method that will do a shallow copy of all properties.
This means that the following will work:
var foo = { a: 1 };
var bar = { b: 2 };
bar.__proto__ = foo;
bar.a; // 1
bar.b; // 2
however the following will not:
var foo = { a: 1 };
var bar = { b: 2 };
bar.__proto__ = foo;
bar.a; // 1
foo.a = 2;
bar.a; // 1 - should be 2 but remember that nothing is bound and it's a straight copy
This is a case that you have to be aware of if you intend to use this plugin.
In
bar.__proto__ = foo;
Out
var _defaults = ...;
_defaults(bar, foo);
npm install --save-dev babel-plugin-transform-proto-to-assign
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-proto-to-assign"]
}
babel --plugins transform-proto-to-assign script.js
require("babel-core").transform("code", {
plugins: ["transform-proto-to-assign"]
});
FAQs
Babel plugin for turning __proto__ into a shallow property clone
We found that babel-plugin-transform-proto-to-assign demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).