title: Check equality of an objects array property and a nested object property
body: <p>On my app I'm checking the equality between an objects array property and a nested object property - based on the results I return a new objects array.</p>
  <p>The <code>items</code> objects array:</p>
  <pre><code>[{name: 'test345', value: 1, category: 'a'},{name: 'test2high', value: 2, category: 'b'},{name: 'test3low', value: 3, category: 'c'}]
  </code></pre>
  <p>The <code>itemCategories</code> object:</p>
  <pre><code>{testnum1: {name: 'test123', category: 'a', partialName: '345'}, testnum2: {name: 'test234', category: 'b', partialName: 'hight'}
  </code></pre>
  <p>I need to check the equality between the <code>category</code> properties and return the following objects array:</p>
  <pre><code>[{name: 'test', itemCategory: 'testnum1'},{name: 'test2', itemCategory: 'testnum2'}]
  </code></pre>
  <p>Below is what I did, it works fine, now I need to add a second check based on the <code>item</code>'s name: I need to only return the items that their names include the <code>partialName</code>, any idea on how to adjust this?</p>
  <pre><code>export function getCategorizedItems(items) {
    const categories = new Map(
      Object.entries(itemCategories).map(([itemCategory, {category}]) =&gt; [
        category,
        itemCategory
      ])
    )
  
    return items
      .map(item =&gt; ({
        value: item.value,
        category: categories.get(item.category)
      }))
      .filter(({category}) =&gt; category)
  }
  </code></pre>