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.

See the very bottom of this file to see the jquery version of this change: http://code.jquery.com/jquery-1.9.1.js

I verified that all tests still pass. Let me know if there anything else I can do.

Thanks,
Ben