Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
724 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | # regenerator-transform
|
---|
| 2 |
|
---|
| 3 | Transform async/generator functions with [regenerator](https://github.com/facebook/regenerator)
|
---|
| 4 |
|
---|
| 5 | ## Installation
|
---|
| 6 |
|
---|
| 7 | ```sh
|
---|
| 8 | $ npm install regenerator-transform
|
---|
| 9 | ```
|
---|
| 10 |
|
---|
| 11 | ## Usage
|
---|
| 12 |
|
---|
| 13 | ### Via `.babelrc` (Recommended)
|
---|
| 14 |
|
---|
| 15 | **.babelrc**
|
---|
| 16 |
|
---|
| 17 | ```js
|
---|
| 18 | // without options
|
---|
| 19 | {
|
---|
| 20 | "plugins": ["regenerator-transform"]
|
---|
| 21 | }
|
---|
| 22 | // with options
|
---|
| 23 | {
|
---|
| 24 | "plugins": [
|
---|
| 25 | ["regenerator-transform", {
|
---|
| 26 | asyncGenerators: false, // true by default
|
---|
| 27 | generators: false, // true by default
|
---|
| 28 | async: false // true by default
|
---|
| 29 | }]
|
---|
| 30 | ]
|
---|
| 31 | }
|
---|
| 32 | ```
|
---|
| 33 |
|
---|
| 34 | ### Via CLI
|
---|
| 35 |
|
---|
| 36 | ```sh
|
---|
| 37 | $ babel --plugins regenerator-transform script.js
|
---|
| 38 | ```
|
---|
| 39 |
|
---|
| 40 | ### Via Node API
|
---|
| 41 |
|
---|
| 42 | ```javascript
|
---|
| 43 | require("@babel/core").transformSync("code", {
|
---|
| 44 | plugins: ["regenerator-transform"]
|
---|
| 45 | });
|
---|
| 46 | ```
|
---|
Note:
See
TracBrowser
for help on using the repository browser.