Server AMD compatibility

In order for the module to work with server AMD, a minor change needs to be made to the environment detection code as attached here.

This is in line with the UMD standard here - https://github.com/umdjs/umd/blob/master/returnExportsGlobal.js.