title: Apply filter on multi dimensional array and return filtered data along with parent
body: <p>I have multidimensional array as provided on the code snippet , i want to filter that array with the value of innermost array and then return that value along with parent .
  For example </p>
  
  <p>From </p>
  
  <pre><code>const nodes = [
      {
          value: 'Documents',
          label: 'Documents',
          children: [
              {
                  value: 'Employee Evaluations.zip',
                  label: 'Employee Evaluations.zip',
              },
              {
                  value: 'Expense Report.pdf',
                  label: 'Expense Report.pdf',
              },
              {
                  value: 'notes.txt',
                  label: 'notes.txt',
              },
          ],
      },
      {
          value: 'Photos',
          label: 'Photos',
          children: [
              {
                  value: 'nyan-cat.gif',
                  label: 'nyan-cat.gif',
              },
              {
                  value: 'SpaceX Falcon9 liftoff.jpg',
                  label: 'SpaceX Falcon9 liftoff.jpg',
  
              },
          ],
      },
  ]; 
  </code></pre>
  
  <p>If i filter by "notes.txt" it should yield</p>
  
  <pre><code> [
      {
          value: 'Documents',
          label: 'Documents',
          children: [
  
              {
                  value: 'notes.txt',
                  label: 'notes.txt',
              }
          ]
  ]
  </code></pre>
  
  <p>This is what I tried but it just return the innermost filtered content</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const nodes = [
      {
          value: 'Documents',
          label: 'Documents',
          children: [
              {
                  value: 'Employee Evaluations.zip',
                  label: 'Employee Evaluations.zip',
              },
              {
                  value: 'Expense Report.pdf',
                  label: 'Expense Report.pdf',
              },
              {
                  value: 'notes.txt',
                  label: 'notes.txt',
              },
          ],
      },
      {
          value: 'Photos',
          label: 'Photos',
          children: [
              {
                  value: 'nyan-cat.gif',
                  label: 'nyan-cat.gif',
              },
              {
                  value: 'SpaceX Falcon9 liftoff.jpg',
                  label: 'SpaceX Falcon9 liftoff.jpg',
                 
              },
          ],
      },
  ];
  let key="notes.txt";
  //let filtered=nodes.filter(n=&gt;n.value===key);
  let cfiltered=nodes.map(n=&gt;n.children.filter(n1=&gt;n1.value===key));
  //console.log(filtered);
  console.log(cfiltered);</code></pre>
  </div>
  </div>
  </p>