UNPKG

807 BMarkdownView Raw
1# babel-plugin-transform-es2015-shorthand-properties
2
3> Compile ES2015 shorthand properties to ES5
4
5## Example
6
7**In**
8
9```js
10var o = { a, b, c };
11```
12
13**Out**
14
15```js
16var o = { a: a, b: b, c: c };
17```
18
19**In**
20
21```js
22var cat = {
23 getName() {
24 return name;
25 }
26};
27```
28
29**Out**
30
31```js
32var cat = {
33 getName: function () {
34 return name;
35 }
36};
37```
38
39## Installation
40
41```sh
42npm install --save-dev babel-plugin-transform-es2015-shorthand-properties
43```
44
45## Usage
46
47### Via `.babelrc` (Recommended)
48
49**.babelrc**
50
51```json
52{
53 "plugins": ["transform-es2015-shorthand-properties"]
54}
55```
56
57### Via CLI
58
59```sh
60babel --plugins transform-es2015-shorthand-properties script.js
61```
62
63### Via Node API
64
65```javascript
66require("babel-core").transform("code", {
67 plugins: ["transform-es2015-shorthand-properties"]
68});
69```