I have an npm library that is made to work in a browser and in a Node environment.

When used in a node environment it checks if the `require` function exists, and requires modules such as `fs`.

```
var fs = null;
if (typeof require !== 'undefined') {
  fs = require('fs');
}

```

Such modules do not exist in react native and therefore when I use this library in react native, I get an error.

What's the best way to know if we're in a react native context vs node ?