packages/babel-plugin-minify-simplify/src/if-statement.js
function switchConsequent(path) {
    const { node } = path;

    if (!node.alternate) {
      return;
    }

    if (!t.isIfStatement(node.consequent)) {
      return;
    }

    if (t.isIfStatement(node.alternate)) {
      return;
    }

    node.test = t.unaryExpression("!", node.test, true);
    [node.alternate, node.consequent] = [node.consequent, node.alternate];
  }
function switchConsequent(path) {
    const { node } = path;

    if (!node.alternate) {
      return;
    }

    if (!t.isIfStatement(node.consequent)) {
      return;
    }

    if (t.isIfStatement(node.alternate)) {
      return;
    }

    node.test = t.unaryExpression("!", node.test, true);
    [node.alternate, node.consequent] = [node.consequent, node.alternate];
  }
function switchConsequent ( path ) { const { node } = path ; if ( ! node . alternate ) { return ; } if ( ! t . isIfStatement ( node . consequent ) ) { return ; } if ( t . isIfStatement ( node . alternate ) ) { return ; } node . test = t . unaryExpression ( "!" , node . test , true ) ; [ node . alternate , node . consequent ] = [ node . consequent , node . alternate ] ; }
If the consequent is if and the altenrate is not then switch them out. That way we know we don't have to print a block.x
If the consequent is if and the altenrate is not then switch them out . That way we know we don t have to print a block . x