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:
@@ -1,57 +1,19 @@
|
||||
# @babel/plugin-transform-jscript
|
||||
|
||||
> This plugin allows Babel to transform named function expressions into function declarations to get around some [particularly nasty JScript bugs](https://kangax.github.io/nfe/#jscript-bugs) related to name function expressions.
|
||||
> Babel plugin to fix buggy JScript named function expressions
|
||||
|
||||
## Example
|
||||
See our website [@babel/plugin-transform-jscript](https://new.babeljs.io/docs/en/next/babel-plugin-transform-jscript.html) for more information.
|
||||
|
||||
**In**
|
||||
## Install
|
||||
|
||||
```javascript
|
||||
var foo = function bar() {
|
||||
|
||||
};
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
"use strict";
|
||||
|
||||
var foo = (function () {
|
||||
function bar() {}
|
||||
|
||||
return bar;
|
||||
})();
|
||||
```
|
||||
|
||||
## Installation
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-transform-jscript
|
||||
npm install --save @babel/plugin-transform-jscript
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-transform-jscript"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-transform-jscript script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-transform-jscript"]
|
||||
});
|
||||
yarn add --save @babel/plugin-transform-jscript
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user