build/generate.js
function clean(code) {

    try {
        const ast = babylon.parse(code, {
            // parse in strict mode and allow module declarations
            sourceType: 'module',
            plugins: [
                // enable jsx and flow syntax
                'jsx',
                'flow'
            ]
        });

        const cleanAst = strip(ast).program;

        const resultCode = generate(cleanAst, {}).code;

        return resultCode.replace(/(\/\*\$ | \#\*\/)/g, '');

    } catch (e) {
        console.log(code);
        throw e;
    }
}
function clean(code) {

    try {
        const ast = babylon.parse(code, {
            // parse in strict mode and allow module declarations
            sourceType: 'module',
            plugins: [
                // enable jsx and flow syntax
                'jsx',
                'flow'
            ]
        });

        const cleanAst = strip(ast).program;

        const resultCode = generate(cleanAst, {}).code;

        return resultCode.replace(/(\/\*\$ | \#\*\/)/g, '');

    } catch (e) {
        console.log(code);
        throw e;
    }
}
function clean ( code ) { try { const ast = babylon . parse ( code , { // parse in strict mode and allow module declarations sourceType : 'module' , plugins : [ // enable jsx and flow syntax 'jsx' , 'flow' ] } ) ; const cleanAst = strip ( ast ) . program ; const resultCode = generate ( cleanAst , { } ) . code ; return resultCode . replace ( / (\/\*\$ | \#\*\/) / g , '' ) ; } catch ( e ) { console . log ( code ) ; throw e ; } }
Takes JS code as string, parses it to AST, strips out formating information
And regenerates clean code as a result

@param code
@returns code
Takes JS code as string parses it to AST strips out formating information And regenerates clean code as a result