Tony J Watson
Tony J Watson

Reputation: 709

Prevent sweet.js from adding numbers to variables

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;
    }

Upvotes: 0

Views: 42

Answers (1)

Gabe Johnson
Gabe Johnson

Reputation: 66

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.

Upvotes: 1

Related Questions