跳到主要内容

babel-plugin-transform-minify-booleans

Example

In

JavaScript
true;
false;

Out

JavaScript
!0;
!1;

Installation

npm install babel-plugin-transform-minify-booleans --save-dev

Usage

babel.config.json
{
"plugins": ["transform-minify-booleans"]
}

Via CLI

Shell
babel --plugins transform-minify-booleans script.js

Via Node API

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