make compatible with npm and browserify

used https://github.com/umdjs/umd/blob/master/returnExports.js

also includes #8.
Don't include this in the same PR. There's already other PRs to fix this issue.