1 |
3a515b92
|
cagy
|
# babel-plugin-transform-es2015-spread
|
2 |
|
|
|
3 |
|
|
> Compile ES2015 spread to ES5
|
4 |
|
|
|
5 |
|
|
## Installation
|
6 |
|
|
|
7 |
|
|
```sh
|
8 |
|
|
npm install --save-dev babel-plugin-transform-es2015-spread
|
9 |
|
|
```
|
10 |
|
|
|
11 |
|
|
## Usage
|
12 |
|
|
|
13 |
|
|
### Via `.babelrc` (Recommended)
|
14 |
|
|
|
15 |
|
|
**.babelrc**
|
16 |
|
|
|
17 |
|
|
```js
|
18 |
|
|
// without options
|
19 |
|
|
{
|
20 |
|
|
"plugins": ["transform-es2015-spread"]
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
// with options
|
24 |
|
|
{
|
25 |
|
|
"plugins": [
|
26 |
|
|
["transform-es2015-spread", {
|
27 |
|
|
"loose": true
|
28 |
|
|
}]
|
29 |
|
|
]
|
30 |
|
|
}
|
31 |
|
|
```
|
32 |
|
|
|
33 |
|
|
### Via CLI
|
34 |
|
|
|
35 |
|
|
```sh
|
36 |
|
|
babel --plugins transform-es2015-spread script.js
|
37 |
|
|
```
|
38 |
|
|
|
39 |
|
|
### Via Node API
|
40 |
|
|
|
41 |
|
|
```javascript
|
42 |
|
|
require("babel-core").transform("code", {
|
43 |
|
|
plugins: ["transform-es2015-spread"]
|
44 |
|
|
});
|
45 |
|
|
```
|
46 |
|
|
|
47 |
|
|
## Options
|
48 |
|
|
|
49 |
|
|
* `loose` - All iterables are assumed to be arrays.
|