babel-plugin-transform-minify-booleans
Example
In
JavaScript
true;
false;
Out
JavaScript
!0;
!1;
Installation
- npm
- Yarn
- pnpm
npm install babel-plugin-transform-minify-booleans --save-dev
yarn add babel-plugin-transform-minify-booleans --dev
pnpm add babel-plugin-transform-minify-booleans --save-dev
Usage
With a configuration file (Recommended)
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"],
});