make compatible with npm and browserify

used https://github.com/umdjs/umd/blob/master/returnExports.js

also includes #8.