Came across a couple web based (yes, no need to download any code -- just copy the compressed code in a textarea, hit Submit and get back nicely indented code) of JavaScript code beautifiers:
- Lorin's simple code beautifier for C++, C#, Java, and Javascript
- Pretty Printer for PHP, Java, C++, C, Perl, JavaScript, CSS
Both did an okay job for a piece of compressed JavScript code I wanted to look at. However, keep in mind that they don't really "parse" the program but simply look at curly braces and insert new lines and indentation. This simple approach yields surprisingly good result most of the time but trips once in a while. For example, if the code has a curly brace within a regular expression (say, something like replace(/..{..}../g, ...)
) then the output will be broken.