GitHub · npm · Edit this page
In
!x && foo();
alert(0 && new Foo());
Out
x || foo();
alert(0);
npm install babel-plugin-minify-guarded-expressions
.babelrc
(Recommended).babelrc
{
"plugins": ["minify-guarded-expressions"]
}
babel --plugins minify-guarded-expressions script.js
require("babel-core").transform("code", {
plugins: ["minify-guarded-expressions"]
});