@babel/plugin-codemod-object-assign-to-object-spread
Transforms Object.assign into object spread syntax
Last updated 5 months ago by jlhwung .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @babel/plugin-codemod-object-assign-to-object-spread 
SYNC missed versions from official npm registry.

@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"]
});

Current Tags

  • 7.10.4                                ...           latest (5 months ago)

18 Versions

  • 7.10.4                                ...           5 months ago
  • 7.7.4                                ...           a year ago
  • 7.0.0                                ...           2 years ago
  • 7.0.0-rc.4                                ...           2 years ago
  • 7.0.0-rc.3                                ...           2 years ago
  • 7.0.0-rc.2                                ...           2 years ago
  • 7.0.0-rc.1                                ...           2 years ago
  • 7.0.0-rc.0                                ...           2 years ago
  • 7.0.0-beta.56                                ...           2 years ago
  • 7.0.0-beta.55                                ...           2 years ago
  • 7.0.0-beta.54                                ...           2 years ago
  • 7.0.0-beta.53                                ...           2 years ago
  • 7.0.0-beta.52                                ...           2 years ago
  • 7.0.0-beta.51                                ...           2 years ago
  • 7.0.0-beta.50                                ...           2 years ago
  • 7.0.0-beta.49                                ...           2 years ago
  • 7.0.0-beta.48                                ...           3 years ago
  • 7.0.0-beta.47                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 38
Last Day 0
Last Week 19
Last Month 2
Dependencies (1)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |