Apply standard formatting.

Let the minifier take care of multiple var statements and removing unnecessary brackets.
Remove dependency on Array.prototype.reduce().
Unit tests.

Added Jasmine and created some specs.
Grunt is used as the runner so I also included uglify for the .min.js