Refactor move docs (#8108)

* feat: [skip] generate readme script

* docs: [skip ci] update READMEs

* docs: [skip ci] fix code block type

* chore: [skip ci] move generator script
This commit is contained in:
Sven SAULEAU
2018-06-04 16:32:39 +02:00
committed by Henry Zhu
parent b6eaaa2496
commit b445b79734
143 changed files with 1286 additions and 11238 deletions

View File

@@ -1,87 +1,19 @@
# @babel/plugin-transform-regenerator
> Transform async/generator functions with [regenerator](https://github.com/facebook/regenerator)
> Explode async and generator functions into a state machine.
## Example
See our website [@babel/plugin-transform-regenerator](https://new.babeljs.io/docs/en/next/babel-plugin-transform-regenerator.html) for more information.
**In**
## Install
```javascript
function* a() {
yield 1;
}
```
**Out**
```javascript
var _marked = [a].map(regeneratorRuntime.mark);
function a() {
return regeneratorRuntime.wrap(function a$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return 1;
case 2:
case "end":
return _context.stop();
}
}
}, _marked[0], this);
}
```
## Installation
Using npm:
```sh
npm install --save-dev @babel/plugin-transform-regenerator
npm install --save @babel/plugin-transform-regenerator
```
## Usage
### Via `.babelrc` (Recommended)
Without options:
```json
{
"plugins": ["@babel/plugin-transform-regenerator"]
}
```
With options:
|name|default value|
|---|---|
|asyncGenerators|true|
|generators|true|
|async|true|
```json
{
"plugins": [
["@babel/plugin-transform-regenerator", {
"asyncGenerators": false,
"generators": false,
"async": false
}]
]
}
```
### Via CLI
or using yarn:
```sh
babel --plugins @babel/plugin-transform-regenerator script.js
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-regenerator"]
});
yarn add --save @babel/plugin-transform-regenerator
```