0

人気のある JavaScript 難読化ツールで、定数をインライン化したり、オブジェクトのパブリック プロパティ/メソッドの名前を変更したりできるものはありますか?

すなわち。

var CONST1 = 5;
var CONST2 = 10;

function Test() {
    abc = 123;
    this.xyz = 234;
}

Test.prototype = {
    do_it: function(argX, argY) {
        return (argX + abc) / CONST1 + (argY + this.xyz) / CONST2;
    }
};

document.getElementById("button").onclick = function() {
    x = document.getElementById("x").value;
    y = document.getElementById("y").value;
    alert("Done it: " + new Test().do_it(x, y));
}
  • CONST1 と CONST2 を効果的に非表示にして、それらの値をインライン化したいと考えています。

  • すべての名前 (abc、xyz、Test、do_it、argX、argY) を置き換え/マングルしたいと思います。

  • ソース内のオブジェクト/メソッド/定数名に外部から依存するものは何もないと難読化ツールに想定させたいと思います。

Google Closure やその他の難読化ツールでこれを行うことはできますか?

4

2 に答える 2

2

Google Closure は上記のすべてを実行できます。独自のコードでテストできるように、 http://closure-compiler.appspot.com/homeで Web ベースの UI を利用できます。

于 2013-11-01T22:52:22.407 に答える