Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for a tool for unminifying JS and restore variable names [closed]

I'm looking for a tool that unminifies a JS file, while restoring the variable names in the whole document.

For example, after running the minified code at unminify.com, the code itself contains:

W.find("li.patternItem").click(function() {

and at the end of the code there is a reference defining W:

W = $("#pattern1")

So I am looking for a simple script to restore the name inside the code, but can't find one. I understand the auto replace might be harmful for the code, but I guess that there should be some smart way to restore. Right now I'm doing it manually and replacing "W." with "$("#pattern1")." (match case, with dot at the end) so it won't be mixed with any W letter.

Thanks

like image 268
Shir Gans Avatar asked Oct 18 '25 20:10

Shir Gans


1 Answers

This tool may help:

http://www.jsnice.org/

This unminifies your js and will make educated guesses as to what the original variables were for and rename them automatically.
It also allows you to replace them in the final code with what you want in an easy way (use interactive renames in the tools menu).

like image 105
Tims Avatar answered Oct 20 '25 09:10

Tims



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!