跳到主要内容

babel-plugin-transform-simplify-comparison-operators

Example

In

JavaScript
typeof foo === "object";

Out

JavaScript
typeof foo == "object";

Installation

npm install babel-plugin-transform-simplify-comparison-operators --save-dev

Usage

babel.config.json
{
"plugins": ["transform-simplify-comparison-operators"]
}

Via CLI

Shell
babel --plugins transform-simplify-comparison-operators script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["transform-simplify-comparison-operators"],
});