parent
9a576ca932
commit
505d639da7
@ -65,9 +65,9 @@ babel.transformFileSync("filename.js", options).code;
|
|||||||
Given, an [AST](https://astexplorer.net/), transform it.
|
Given, an [AST](https://astexplorer.net/), transform it.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const string = "if (true) return;";
|
const sourceCode = "if (true) return;";
|
||||||
const parsedAst = babylon.parse(string, { allowReturnOutsideFunction: true });
|
const generatedCode = babylon.parse(sourceCode, { allowReturnOutsideFunction: true });
|
||||||
const { code, map, ast } = babel.transformFromAst(parsedAst, string, options);
|
const { code, map, ast } = babel.transformFromAst(generatedCode, sourceCode, options);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user