Expose as an AMD module if AMD loader (like requireJS) is present

This is the same approach used by jQuery to make this usable in AMD-loaders like requirejs. Without this change, this library can't be optimized in a requirejs build process.

I verified that all tests still pass. Let me know if there anything else I can do.

Thanks,
Ben