Prevent sweet.js from adding numbers to variables

43 Views Asked by At

Sweet.js always adds numbers to the end of the output. In most of the javascript I am generating, this is not necessary. Is there a way to configure sweet.js to not add numbers to the end of the parameters?

    // Example Output
    module.exports = multiply;
    function multiply(a_31, b_32, c_33) {
        console.log('hey')
        if (Object.prototype.toString.call(a_31) !== "[object Array]") throw new Error("Must be array:" + a_31);
        if (Object.prototype.toString.call(c_33) !== "[object Array]") throw new Error("Must be array:" + c_33);
        return a_31 * c_33;
    }
1

There are 1 best solutions below

0
Gabe Johnson On BEST ANSWER

Sweet.js currently does very aggressive variable renaming. There's an issue to limit the renaming to only the cases where there are multiple bindings with the same name.