esmangle
esmangle copied to clipboard
Mangle object properties
Hi there, Thanks for your AMAZING work ;) In future, do you plan to mangle object properties ? I use the application from the git repository.
With the following code:
let u = (function(){
let my_huge_function = function() { return 'test'; };
Object.defineProperties(my_huge_function, {
very_long_name: { value: "hello", writable: false } } );
my_huge_function.other_very_long_name = "hello 2?";
return my_huge_function.other_very_long_name;
})();
alert(u); // print "hello 2?";
I get:
let u=function(){let a=function(){return'test'};return Object.defineProperties(a,{very_long_name:{value:'hello',writable:!1}}),a.other_very_long_name='hello 2?',a.other_very_long_name}();alert(u)
How would that work? (wrt []
etc).
@Nami-Doc: The Google Closure Compiler guys don't allow dynamic member access and actually believe that's an acceptable restriction. Hey, to each his own.
Yes, and the compiler totally fails at it, giving everybody strange issues.
There is an error in my exemple sorry :'( And I use 'let' keyword
There real code is following
let u = (function(){
let my_huge_function = function() { return 'test'; };
Object.defineProperties(my_huge_function, {
very_long_name: { value: "hello", writable: false } } );
my_huge_function.other_very_long_name = "hello 2?";
return my_huge_function.other_very_long_name;
})();
alert(u); // print "hello 2?";
and the mangler result :
let u=function(){let a=function(){return'test'};return Object.defineProperties(a,{very_long_name:{value:'hello',writable:!1}}),a.other_very_long_name='hello 2?',a.other_very_long_name}();alert(u)
esmangle is a really nice soft for javascript 1.7.
How would that work? (wrt [] etc).
Do you think disallowing dynamic member access is an acceptable restriction?
In some cases.. Example of use Object.defineProperties I create application in xulrunner environment