Optionally registers as AMD module

As requested by @jashkenas, he wanted to see what adding an optional AMD registration would look like today. This is based on the version used in https://github.com/amdjs/underscore, but more comments to help explain the specific style used.