Stryker

OperatorMutator.js - Stryker report

Summary

File Based on all code Based on code coverage
OperatorMutator.js
100%
12/12 100% 12/12

Code

"use strict";
var OperatorMutator = (function () 0{
    /**
     * Represents a base class for all operator based mutations.
     * @param name The name of the mutator.
     * @param types The type of operators which should be mutated.
     * @param operators The object containing a map for targeted operators and their mutated values.
     */
    function OperatorMutator(name, types, operators) 1{
        this.name = name;
        this.types = types;
        this.operators = operators;
    }

    OperatorMutator.prototype.applyMutations = function (node, copy) 2{
        var nodes = [];
        if (34this.canMutate(node)) 5{
            var mutatedNode = copy(node);
            mutatedNode.operator = this.getOperator(node.operator);
            nodes.push(mutatedNode);
        }

        return nodes;
    };
    OperatorMutator.prototype.canMutate = function (node) 6{
        return !!(78node && 910this.types.indexOf(node.type) >= 0 && this.getOperator(node.operator));
    };
    /**
     * Gets the mutated operator based on an unmutated operator.
     * @function
     * @param {String} operator - An umutated operator.
     * @returns {String} The mutated operator.
     */
    OperatorMutator.prototype.getOperator = function (operator) 11{
        return this.operators[operator];
    };
    return OperatorMutator;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = OperatorMutator;
//# sourceMappingURL=OperatorMutator.js.map