Convert code from CoffeeScript to JS

I'm opening this PR for discussion/review of the CoffeeScript -> JS conversion.

So far I've gone over each file and tidied up the code, removing unnecessary "mess" that CoffeeScript generated, and where appropriate used native functions/lo-dash. (Note: lo-dash use is actually limited, so there could be an argument for removing it altogether).

There's probably a lot more tidying that can be done, but for now it's a good base for further development.

Tests all pass (which have also been converted to JS), and manual testing also passes.

Over to you for your thoughts @makeusabrew.
I guess we can use a lodash method for this now :)