Switch to jshint and add testing to lib/ and test/

fixes #2