Added check before forcing JSON.stringify

When starting with the module I was passing already `stringify`'d data through and only getting a `400` code error returned. I realized my issue after a few minutes, however, I could see this being an issue for others.

The changes simply add a check before running `JSON.stringify()` in the `base64Encode` method.