A Javascript formatter based on a PEG using PEG.js by David Majda.
Currently, it's tested with Node, but should be compatible with other Javascript environments.
node test.js
Currently, comments are discarded and it may still miss some uncommon Javascript constructs.