reformat code, using 2-space indent
added globals for nodejs, leading comma option
added jshint directives