lib/integral.js
function(expr, context, subIntegral) {
      if(expr.type === "OperatorNode" && expr.op === '*') {
        var constantFactors = [];
        var nonConstantFactors = [];
        expr.args.forEach(function(expr) {
          if(context.isConstant(expr)) {
            constantFactors.push(expr);
          } else {
            nonConstantFactors.push(expr);
          }
        });

        if(constantFactors.length !== 0) {
          var constantNode = factorsToNode(constantFactors);
          var nonConstantNode = factorsToNode(nonConstantFactors);

          var nonConstantIntegral = subIntegral(nonConstantNode, context, "multiplication by constant");
          if(nonConstantIntegral) {
            return new OperatorNode('*', 'multiply', [constantNode, nonConstantIntegral]);
          }
        }

        function factorsToNode(factors) {
          if(factors.length === 1) {
            return factors[0];
          } else {
            return new OperatorNode('*', 'multiply', factors);
          }
        }
      }
    }
function(expr, context, subIntegral) {
      if(expr.type === "OperatorNode" && expr.op === '*') {
        var constantFactors = [];
        var nonConstantFactors = [];
        expr.args.forEach(function(expr) {
          if(context.isConstant(expr)) {
            constantFactors.push(expr);
          } else {
            nonConstantFactors.push(expr);
          }
        });

        if(constantFactors.length !== 0) {
          var constantNode = factorsToNode(constantFactors);
          var nonConstantNode = factorsToNode(nonConstantFactors);

          var nonConstantIntegral = subIntegral(nonConstantNode, context, "multiplication by constant");
          if(nonConstantIntegral) {
            return new OperatorNode('*', 'multiply', [constantNode, nonConstantIntegral]);
          }
        }

        function factorsToNode(factors) {
          if(factors.length === 1) {
            return factors[0];
          } else {
            return new OperatorNode('*', 'multiply', factors);
          }
        }
      }
    }
integral(c*f(x), x) = c*integral(f(x), x)