title: es6 filter an array of objects by an array of filter objects
body: <p>given the following structure:</p>
  
  <pre><code>let filteredTasks = [
    {status: 'done', other: true},
    {status: 'nope', other: false},
    {status: 'done', other: true},
    {status: 'done', other: true},
    {status: 'done', other: false},
    {status: 'done', other: false},
    {status: 'started', other: false}
  ]
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>let availableFilters = [{status: 'done'}, {other: false}]
  </code></pre>
  
  <p>how can I filter this array to get the following results:</p>
  
  <pre><code>filteredTasks =
  [{status: 'done', other: false}, {status: 'done', other: false}]
  </code></pre>
  
  <p>my thoughts and attempts:</p>
  
  <pre><code>let filteredTasks = [
    {status: 'done', other: true},
    {status: 'nope', other: false},
    {status: 'done', other: true},
    {status: 'done', other: true},
    {status: 'done', other: false},
    {status: 'done', other: false},
    {status: 'started', other: false}
  ]
  
  let availableFilters = [{status: 'done'}, {other: false}]
  
  let filteredTasksList = availableFilters.map(item =&gt; {
      return runFilter(item)
  })
  
  function runFilter(currentFilter) {
    return filteredTasks.filter(item =&gt; {
      for (var key in currentFilter) {
          if (item[key] === undefined || item[key] !== currentFilter[key])
          return false
      }
      return true;
    })
  }
  </code></pre>
  
  <p>...but obviously this is overriding each pass.</p>
  
  <p>As always any feedback and help is greatly appreciated, so thanks in advance.</p>
  
  <p>EDIT:
  accepted the initial comment as the solution as it fits my needs.  I used that to take it a step further:</p>
  
  <pre><code>let filterTaskList = (list, filters) =&gt; {
    let entries = Object.entries(Object.assign(...filters))
    return list.filter(task =&gt; {
      return entries.every(([key, val]) =&gt; {
        return task[key] === val
       })
    })
  }
  </code></pre>