The usual way to check for "is this node" is:

```javascript
if (typeof module !== 'undefined' && module.exports) {...}
```