This reverts commit e8dac621de9dba27b47646169562c0a0c2e02c96. Fixes installs when using npm <= 3.9.5 (Node.js <= 6.2.2)
@babel/plugin-codemod-object-assign-to-object-spread
Transforms old code that uses Object.assign with an Object Literal as
the first param to use Object Spread syntax.
Examples
const obj = Object.assign({
test1: 1,
}, other, {
test2: 2,
}, other2);
Is transformed to:
const obj = {
test1: 1,
...other,
test2: 2,
...other2,
};
Installation
npm install --save-dev @babel/plugin-codemod-object-assign-to-object-spread
Usage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["@babel/plugin-codemod-object-assign-to-object-spread"]
}
Via CLI
babel --plugins @babel/plugin-codemod-object-assign-to-object-spread script.js
Via Node API
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-codemod-object-assign-to-object-spread"]
});