I am working on some JS that needs to be obfuscated. After mangling the whole thing, suddenly I was gripped with horror: I remembered that GPT is pretty good at deobfuscation.
I put my mangled and minified code in.
What it emits is not only perfectly readable and 95% accurate (the 5% was due to missing context, max input limit)—it was significantly better than my code.
Of course the structure was the same, but ChatGPT chose much more sensible variable names in almost every case. I found it much easier to understand its version of my code than my own.
I guess I accidentally discovered a refactoring technique?
I put my mangled and minified code in.
What it emits is not only perfectly readable and 95% accurate (the 5% was due to missing context, max input limit)—it was significantly better than my code.
Of course the structure was the same, but ChatGPT chose much more sensible variable names in almost every case. I found it much easier to understand its version of my code than my own.
I guess I accidentally discovered a refactoring technique?