amd support

Hello!

This PR adds amd support (requirejs + commonjs) to the library. 
If you have any questions - don't hesitate to ask.