title: Searching from multiple keys inside object in javascript (reactJS)
body: <p>i have the the following array of object which indicated all the possible combination of a product</p>
  <pre><code>[{id:25,attributes:[{id: 0, name: &quot;Weight&quot;, option: &quot;250gr&quot;},{id: 0, name: &quot;Roast&quot;, option: &quot;Medium&quot;},{id: 0, name: &quot;Packaging&quot;, option: &quot;Card&quot;}
  {id:26,attributes:[{id: 0, name: &quot;Weight&quot;, option: &quot;500gr&quot;},{id: 0, name: &quot;Roast&quot;, option: &quot;Medium&quot;},{id: 0, name: &quot;Packaging&quot;, option: &quot;Card&quot;}
  {id:27,attributes:[{id: 0, name: &quot;Weight&quot;, option: &quot;250gr&quot;},{id: 0, name: &quot;Roast&quot;, option: &quot;Light&quot;},{id: 0, name: &quot;Packaging&quot;, option: &quot;Card&quot;}
  {id:28,attributes:[{id: 0, name: &quot;Weight&quot;, option: &quot;250gr&quot;},{id: 0, name: &quot;Roast&quot;, option: &quot;Light&quot;},{id: 0, name: &quot;Packaging&quot;, option: &quot;Tin&quot;}
  ]
  </code></pre>
  <p>On the webpage, options are set via select; the select also set a state component as follow:</p>
  <pre><code>{Weight:&quot;&quot;,Roast:&quot;&quot;,Pakaging:&quot;&quot;}
  </code></pre>
  <p>with the values from the selected option, for example (assuming only weight and roast are selected):</p>
  <pre><code>{Weight:&quot;250gr&quot;,Roast:&quot;Light&quot;,Packaging:&quot;&quot;}
  </code></pre>
  <p>everytime a option is selected i want to narrow down the combination of product (based on the selection) until i finally got only one option available (also the combination are used for dinamically repopulate select, adding or removing available options based on previous selections)</p>
  <p>until now i was using something like (inside the function called by onChange on a select):</p>
  <pre><code>const result = variations.filter((p) =&gt;
    p.attributes.some((c) =&gt; c.option === event.target.value)
  );
  </code></pre>
  <p>but this way it reduces based on the latest selection, so if i start selecting 250gr it gives me a set of 3 (25,27,28)
  then if i select Medium, it give me a set of 2 (25 and 26) filtering only on medium and ignoring Weight</p>
  <p>i'm looking to convert my filter, instead that on event.target.value, on the object but i cant find the right method, anyone can help?</p>