support for node js

This PR adds:
* small modification to work in both browser and node.js (both tested)
* Readme example
* package.js (this allows you to simply run `npm publish`)