title: Filter nested object structure
body: <p>I have an object with keys representing a schema. A schema contains a definition of columns and I want to end up with a list of columns that match a specific condition. I can use a for each but think it should also be possible to achieve with a filter or reduce; however getting stuck accessing the nested portion and accumulate the results.</p>
  <p>I tried a number of variants, with reduce, spread operators but not achieving the desired result.</p>
  <p>Hope anyone can pull me out of the quicksand, I tend to sink deeper with every move I make.</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
  let data = {
      &quot;Schema A&quot; : [{&quot;Id&quot; : &quot;1&quot;, &quot;Type&quot; : &quot;measure&quot;}, {&quot;Id&quot; : &quot;2&quot;, &quot;Type&quot; : &quot;dimension&quot;}, {&quot;Id&quot; : &quot;3&quot;, &quot;Type&quot; : &quot;measure&quot;}],
      &quot;Schema B&quot; : [{&quot;Id&quot; : &quot;4&quot;, &quot;Type&quot; : &quot;measure&quot;}, {&quot;Id&quot; : &quot;5&quot;, &quot;Type&quot; : &quot;dimension&quot;}, {&quot;Id&quot; : &quot;6&quot;, &quot;Type&quot; : &quot;measure&quot;}],
      };
  
  var d = Object.entries(data); // convert to array
  console.log(d);
  
  let result = d.map(val =&gt; {
      return val.filter(x =&gt; x[1].Type === 'measure');
  });
  console.log(result);
  &lt;/script&gt;
  </code></pre>