This plugin will transform all `Object.setPrototypeOf` calls to a method that will do a shallow defaults of all properties.
GitHub · npm · Edit this page
NOTE: There are some caveats when using this plugin, see the babel-plugin-transform-proto-to-assign
README for more information..
NOTE: There are some caveats when using this plugin, see the babel-plugin-transform-proto-to-assign
README for more information..
In
Object.setPrototypeOf(bar, foo);
Out
var _defaults = ...;
_defaults(bar, foo);
npm install --save-dev babel-plugin-transform-object-set-prototype-of-to-assign
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-object-set-prototype-of-to-assign"]
}
babel --plugins transform-object-set-prototype-of-to-assign script.js
require("babel-core").transform("code", {
plugins: ["transform-object-set-prototype-of-to-assign"]
});