Rewrite exporter code based on Universal Module Definition pattern.

https://github.com/umdjs/umd
Refactor documentation