JSPM

  • Created
  • Published
  • Downloads 35511222
  • Score
    100M100P100Q261268F
  • License MIT

Compile ES2015 shorthand properties to ES5

Package Exports

  • @babel/plugin-transform-shorthand-properties

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@babel/plugin-transform-shorthand-properties) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@babel/plugin-transform-shorthand-properties

Compile ES2015 shorthand properties to ES5

Example

In

var o = { a, b, c };

Out

var o = { a: a, b: b, c: c };

In

var cat = {
  getName() {
    return name;
  }
};

Out

var cat = {
  getName: function () {
    return name;
  }
};

Installation

npm install --save-dev @babel/plugin-transform-shorthand-properties

Usage

.babelrc

{
  "plugins": ["@babel/plugin-transform-shorthand-properties"]
}

Via CLI

babel --plugins @babel/plugin-transform-shorthand-properties script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@babel/plugin-transform-shorthand-properties"]
});