Ignore "document is not defined" error
<p>The following line belongs to a 3rd party library I'm using in a Nodejs script:</p>

<pre><code>if (document === undefined) return false;
</code></pre>

<p><a href="https://github.com/photonstorm/phaser/blob/8399073fde8e242ef0a5beddcf165bc0c7fc84f0/src/pixi/utils/Utils.js#L33" rel="nofollow">source</a></p>

<p>it is raising </p>

<blockquote>
  <p>ReferenceError: document is not defined</p>
</blockquote>

<p>I could get around it by wrapping the if statement in a try catch block:</p>

<pre><code>try {
  if (document === undefined) return false;
} catch (e) {
  return false;
}
</code></pre>

<p>Is there another option that doesn't require modifying the library code?</p>