packages/solver/lib/solveEquation/EquationOperations.js
function performTermOperationOnEquation(equation, op, term, changeType) {
  const oldEquation = equation.clone();

  const leftTerm = clone(term);
  const rightTerm = clone(term);
  const leftNode = performTermOperationOnExpression(
    equation.leftNode, op, leftTerm);
  const rightNode = performTermOperationOnExpression(
    equation.rightNode, op, rightTerm);

  let comparator = equation.comparator;
  if (Negative.isNegative(term) && (op === '*' || op === '/')) {
    comparator = COMPARATOR_TO_INVERSE[comparator];
  }

  const newEquation = new Equation(leftNode, rightNode, comparator);
  return new EquationStatus(changeType, oldEquation, newEquation);
}
function performTermOperationOnEquation(equation, op, term, changeType) {
  const oldEquation = equation.clone();

  const leftTerm = clone(term);
  const rightTerm = clone(term);
  const leftNode = performTermOperationOnExpression(
    equation.leftNode, op, leftTerm);
  const rightNode = performTermOperationOnExpression(
    equation.rightNode, op, rightTerm);

  let comparator = equation.comparator;
  if (Negative.isNegative(term) && (op === '*' || op === '/')) {
    comparator = COMPARATOR_TO_INVERSE[comparator];
  }

  const newEquation = new Equation(leftNode, rightNode, comparator);
  return new EquationStatus(changeType, oldEquation, newEquation);
}
function performTermOperationOnEquation ( equation , op , term , changeType ) { const oldEquation = equation . clone ( ) ; const leftTerm = clone ( term ) ; const rightTerm = clone ( term ) ; const leftNode = performTermOperationOnExpression ( equation . leftNode , op , leftTerm ) ; const rightNode = performTermOperationOnExpression ( equation . rightNode , op , rightTerm ) ; let comparator = equation . comparator ; if ( Negative . isNegative ( term ) && ( op === '*' || op === '/' ) ) { comparator = COMPARATOR_TO_INVERSE [ comparator ] ; } const newEquation = new Equation ( leftNode , rightNode , comparator ) ; return new EquationStatus ( changeType , oldEquation , newEquation ) ; }
Modifies the left and right sides of an equation by `op`-ing `term` to both sides. Returns an Status object.
Modifies the left and right sides of an equation by op - ing term to both sides . Returns an Status object .