github/fetch — pull request #50 by matthew-andrews (2014-12-24 18:11:48+00:00)
Title: Put back window object as 'this' is unoverrideable in node

Because `this` cannot be overridden inside node context (node is silly an 'this' _isn't_ the global object, as per frontend JS) [this PR](https://github.com/github/fetch/pull/48) breaks https://github.com/matthew-andrews/isomorphic-fetch (and this fetch in Node in general by making fetch a private method).

You know I really don't like polluting front end modules with server side stuff but otherwise PR 48 renders this library unusable which has to be worse than a little pollution… :disappointed:

This line will detect the Node specific 'global' object and add itself to that if it detects it.

I've prepared two PRs with two possible solutions, this one is slightly better from a frontend point of view because it sort of at least does _something_ in the front end, even if that thing is a bit pointless… the other one is a bit nicer from a node point of view and allows the isomorphic fetch library to do slightly less.