Update jsonapi-v2.js

Check for window while require some tools.
So we can use require in browser.
Merge pull request #286 from StevenKleist/patch-1

Update jsonapi-v2.js