benhartley/mutant

View on GitHub
src/lib/binary-expression-operator-replace.js

Summary

Maintainability
A
35 mins
Test Coverage
module.exports = (mutation, from, to) => stateMask => {
    return {
        BinaryExpression(path) {
            if (path.node.operator === from) {
                if (mutation.shouldMutate(stateMask)) {
                    path.node.operator = to;
                }
                mutation.increaseNodeCount();
            }
        }
    };
};