Added AMD Support using a UMD pattern

Applied a variation of the [returnExportsGlobal](https://github.com/umdjs/umd/blob/master/returnExportsGlobal.js) [UMD](https://github.com/umdjs/umd) pattern to add [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) support while retaining Node and browser global support. Also added an AMD test file.