babel-plugin-minify-flip-comparisons

Example

In

  1. const foo = a === 1;
  2. if (bar !== null) {
  3. var baz = 0;
  4. }

Out

  1. const foo = 1 === a;
  2. if (null !== bar) {
  3. var baz = 0;
  4. }

Installation

  1. npm install babel-plugin-minify-flip-comparisons --save-dev

Usage

  1. {
  2. "plugins": ["minify-flip-comparisons"]
  3. }

Via CLI

  1. babel --plugins minify-flip-comparisons script.js

Via Node API

  1. require("@babel/core").transform("code", {
  2. plugins: ["minify-flip-comparisons"]
  3. });