packages/babel-plugin-minify-simplify/src/if-statement.js
function toTernary(path) {
    const { node } = path;
    if (
      t.isExpressionStatement(node.consequent) &&
      t.isExpressionStatement(node.alternate)
    ) {
      path.replaceWith(
        t.conditionalExpression(
          node.test,
          node.consequent.expression,
          node.alternate.expression
        )
      );
      return REPLACED;
    }
  }
function toTernary(path) {
    const { node } = path;
    if (
      t.isExpressionStatement(node.consequent) &&
      t.isExpressionStatement(node.alternate)
    ) {
      path.replaceWith(
        t.conditionalExpression(
          node.test,
          node.consequent.expression,
          node.alternate.expression
        )
      );
      return REPLACED;
    }
  }
function toTernary ( path ) { const { node } = path ; if ( t . isExpressionStatement ( node . consequent ) && t . isExpressionStatement ( node . alternate ) ) { path . replaceWith ( t . conditionalExpression ( node . test , node . consequent . expression , node . alternate . expression ) ) ; return REPLACED ; } }
both consequent and alternate are expressions, turn into ternary
both consequent and alternate are expressions turn into ternary