Skip to content

Latest commit

 

History

History
 
 

babel-plugin-minify-guarded-expressions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

babel-plugin-minify-guarded-expressions

Example

In

!x && foo();
alert(0 && new Foo());

Out

x || foo();
alert(0);

Installation

npm install babel-plugin-minify-guarded-expressions --save-dev

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["minify-guarded-expressions"]
}

Via CLI

babel --plugins minify-guarded-expressions script.js

Via Node API

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