Friday, April 20, 2012

online Javascript formatting

Heck... we had to work on a javascript file that was ages old and the entire logic was put in 1 line..
no one could understand anything out of it until we formatted it to have proper structure... the formatted script showed us the original 1 line script had close to 15 functions and several variables declared in between the functions used across the script..

we know its good practice to keep the script in this minified version in production environment.. but in development space, we need to have a better formatted one always...

the online tool we used to format the script was
http://jsbeautifier.org/

this is really quick, has options to specify how you want the formatted script, delivers the formatted script in clear text, easy to copy & re-use...

just though of sharing this, as we the web developers are trying to reuse scripts from one another and if in case we want to understand or extend the scripts which is non readable, this tool is very handy...