title: How do I update this recursive function to check the property name of an object?
body: <p>I found the following snipped of code online, it very accurately and recursively removes properties from an object if the values are null, undefined, or 0</p>
  
  <pre><code>const removeEmpty = (obj) =&gt; {
      Object.keys(obj).forEach(key =&gt;
          (obj[key] &amp;&amp; typeof obj[key] === 'object') &amp;&amp; removeEmpty(obj[key]) ||
          (obj[key] === undefined || obj[key] === null || obj[key] === 0) &amp;&amp; delete obj[key]
      );
      return obj;
  };
  </code></pre>
  
  <p>I'm trying to modify it so that it also check the a property name for a value of "index". If it matches, do not delete the property even if it's value is 0</p>
  
  <p>For example, if the following object is processed</p>
  
  <pre><code>"page": {
   "index": 0,
   "title": "test",
   "credits": undefined 
  }
  </code></pre>
  
  <p>the desired result would be</p>
  
  <pre><code>"page": {
   "index": 0,
   "title": "test"
  }
  </code></pre>
  
  <p>the current actual result is</p>
  
  <pre><code>"page": {
   "title": "test", 
  }
  </code></pre>