INNER CODE UNIT · JavaScript

BabelEqEqEqPlugin

standard-things/esm · .babel.config.js:6

function BabelEqEqEqPlugin() {
  return {
    visitor: {
      BinaryExpression({ node }) {
        const { operator } = node

        if ((operator === "==" ||
             operator === "!=") &&
            node.left.type !== "NullLiteral" &&
            node.right.type !== "NullLiteral") {
          node.operator += "="
        }
      }
    }
  }
}

function BabelModePlugin({ types }) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…