title: Convert Array to Object with grouping
body: <p>Can you help me?</p>
  <p>I have Array like this :</p>
  <pre class="lang-js prettyprint-override"><code>filter = [
    [&quot;email&quot;, &quot;contains&quot;, &quot;admin@admin.com&quot;], 
    &quot;and&quot;, 
    [&quot;fullname&quot;, &quot;contains&quot;, &quot;admin&quot;], 
    &quot;and&quot;, 
    [&quot;phone_number&quot;, &quot;=&quot;, &quot;0857214440005&quot;]
  ];
  </code></pre>
  
  <p>I will converting this array to object like this :</p>
  <pre class="lang-js prettyprint-override"><code>filter = {
    &quot;contains&quot;: {
      &quot;email&quot;: &quot;admin@admin&quot;,
      &quot;fullname&quot;: &quot;admin&quot;
    },
    &quot;=&quot;: {
      &quot;phone_number&quot;: &quot;&quot;
    }
  }
  </code></pre>
  
  <p>I have tried this method but I am confused :</p>
  <pre><code>let filter = [[&quot;email&quot;, &quot;contains&quot; &quot;admin@admin.com&quot;], &quot;and&quot;, [&quot;fullname&quot;, &quot;contains&quot;, &quot;admin&quot;], &quot;and&quot;, [&quot;phone_number&quot;, &quot;=&quot;, &quot;0857214440005&quot;]];
  
  // chek filter contains object or not
  let boolVar = loadOptions[i].some(  
      value =&gt; { return typeof value === &quot;object&quot; } ); 
  
  // if not contains, generate object and done. else next prosess
  if (!boolVar) {
      let key = {};
      key[filter[0]] = filter[2]
      filter[loadOptions[i][1]] = key
  } else {
       filter.forEach(item =&gt; {
         console.log(item)
       })
  }
  // convert from array to object
  // const entries = new Map(tempFilter);
  // const obj = Object.fromEntries(entries);
  // console.log(obj)
  </code></pre>
  <p>is it possible to change like this ? thank you.</p>