title: How to quickly test the existence and value of a nested boolean with Node?
body: <p>Often times, I have to check an object's deeply nested boolean value to see whether it exists and if so, whether it is <code>true</code> or <code>false</code>.</p>
  
  <p>Let's say, I want to check if <code>payload.options.save</code> is set to <code>false</code>, but I do not know if <code>document</code> and <code>options</code> even exist in the <code>payload</code> object.</p>
  
  <p>Currently, I do that:</p>
  
  <pre><code>if (payload &amp;&amp; payload.document &amp;&amp; payload.document.options &amp;&amp; payload.document.options.save &amp;&amp; payload.document.options.save === false) {
      resolve(payload);
      return;
  }
  </code></pre>
  
  <p>Is there a shorter way to check that?</p>