Add support for AMD and global definition of module.

(also some linting)
Add unit tests
Travis CI config