UNPKG

899 BMarkdownView Raw
1# babel-plugin-transform-es2015-parameters
2
3> Compile ES2015 default and rest parameters to ES5
4
5This plugin transforms ES2015 parameters to ES5, this includes:
6
7- Destructuring parameters
8- Default parameters
9- Rest parameters
10
11## Installation
12
13```sh
14npm install --save-dev babel-plugin-transform-es2015-parameters
15```
16
17## Caveats
18
19Default parameters desugar into `let` declarations to retain proper semantics. If this is
20not supported in your environment then you'll need the
21[transform-block-scoping](http://babeljs.io/docs/plugins/transform-es2015-block-scoping) plugin.
22
23## Usage
24
25### Via `.babelrc` (Recommended)
26
27**.babelrc**
28
29```json
30{
31 "plugins": ["transform-es2015-parameters"]
32}
33```
34
35### Via CLI
36
37```sh
38babel --plugins transform-es2015-parameters script.js
39```
40
41### Via Node API
42
43```javascript
44require("babel-core").transform("code", {
45 plugins: ["transform-es2015-parameters"]
46});
47```