November 4th 2018
programming, javascript, prettier, unminify

Unmangle your javascript variables

There are many tools you can find for unminifying javascript code. However, most of these tools just add proper formatting and call it a day. Considering many minifiers mangle local identifiers to one or two characters and reuse those identifiers frequently, this can result in some code that is still quite painful to read. I think we can do better.

I've created this online tool to not only format code (using prettier), but also go one step further by marking global variables and renaming mangled variables to be globally unique. It does this by renaming each variable to its type and the line number where it was defined (e.g. let let99 = 10; if defined on line 99). It's not the best, but it's better.

Give it a shot below. I've also made a redirect to this page at richsnapp.com/unminify for convenience. If you think there's a better way to do this, found a bug, or think a feature would be easy to add, send a comment or pull-request my way!

unmangle as a