mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 12:20:04 +02:00
50 lines
711 B
Markdown
50 lines
711 B
Markdown
# babel-plugin-transform-simplify-comparison-operators
|
|
|
|
Convert `===` and `!==` to `==` and `!=` if their types are inferred to be the same.
|
|
|
|
## Example
|
|
|
|
**In**
|
|
|
|
```javascript
|
|
typeof foo === "object";
|
|
```
|
|
|
|
**Out**
|
|
|
|
```javascript
|
|
typeof foo == "object";
|
|
```
|
|
|
|
## Installation
|
|
|
|
```sh
|
|
npm install babel-plugin-transform-simplify-comparison-operators
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Via `.babelrc` (Recommended)
|
|
|
|
**.babelrc**
|
|
|
|
```json
|
|
{
|
|
"plugins": ["transform-simplify-comparison-operators"]
|
|
}
|
|
```
|
|
|
|
### Via CLI
|
|
|
|
```sh
|
|
babel --plugins transform-simplify-comparison-operators script.js
|
|
```
|
|
|
|
### Via Node API
|
|
|
|
```javascript
|
|
require("@babel/core").transform("code", {
|
|
plugins: ["transform-simplify-comparison-operators"]
|
|
});
|
|
```
|