title: How to get nested Javascript object when depth is unknown?
body: <p>Suppose I have these arrays:</p>
  <pre><code>const array1 = [
     {
        data: {
           site: {
              tag: {
                 name: &quot;Bikes&quot;, 
                 posts: { ... }
              }
           }
        },
        errors: {}
     },
     { ... }   
  ]
  
  const array2 = [
     {
        data: {
           category: {
              name: &quot;Cars&quot;, 
              posts: { ... }
           }
        },
        errors: {}
     },
     { ... }   
  ]
  
  const array3 = [
     {
        data: {
           posts: { ... }
        },
        errors: {}
     }, 
     { ... }  
  ]
  </code></pre>
  <p>What function can I use on array 1 and 2 so that I am always left with an array shaped like array 3? How can I always extract <code>posts</code> from <code>data</code> without knowing at what position it is in the nested object?</p>
  <p>I've tried a few things with <code>find</code> or <code>filter</code> or recursive functions but I'm just no good at this, sorry. Hope somebody can help!</p>