hexo/node_modules/regenerator-transform/README.md

47 lines
770 B
Markdown
Raw Normal View History

2023-10-03 11:14:36 +08:00
# regenerator-transform
Transform async/generator functions with [regenerator](https://github.com/facebook/regenerator)
## Installation
```sh
$ npm install regenerator-transform
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```js
// without options
{
"plugins": ["regenerator-transform"]
}
// with options
{
"plugins": [
["regenerator-transform", {
asyncGenerators: false, // true by default
generators: false, // true by default
async: false // true by default
}]
]
}
```
### Via CLI
```sh
$ babel --plugins regenerator-transform script.js
```
### Via Node API
```javascript
require("@babel/core").transformSync("code", {
plugins: ["regenerator-transform"]
});
```