title: How to make a javascript comparison more concise?
body: <p>Consider the following two javascript objects:</p>
  <p>Object A:</p>
  <pre><code>{
    specialPropertyA: string,
    partTime: boolean,
    role: { key: string, label: string }
  }
  </code></pre>
  <p>Object B:</p>
  <pre><code>{
    specialPropertyB: string,
    partTime: boolean,
    role: { key: number, label: string }
  }
  </code></pre>
  <p>Now, consider an <code>arrayA: ObjectA[]</code> and an <code>arrayB: ObjectB[]</code>.</p>
  <p>I am looking for a concise way to determine:</p>
  <p>If any of the ObjectA's have <code>partTime === true</code> AND <code>role.key === 1</code>, are there any ObjectBs, which fulfill the same requirements? I want to check the same for <code>role.key === 2</code>.</p>
  <p>I know I could do sth like:</p>
  <pre><code>if(
      arrayA.filter(objectA =&gt; objectA.partTime === true &amp;&amp; objectA.role.key === 1) 
      &amp;&amp; arrayB.filter(objectB =&gt; objectB.partTime === true &amp;&amp; objectB.role.key === 1) 
      || arrayA.filter(objectA =&gt; objectA.partTime === true &amp;&amp; objectA.role.key === 2)
      &amp;&amp; arrayB.filter(objectB =&gt; objectB.partTime === true &amp;&amp; objectB.role.key === 2)
    )
  </code></pre>
  <p>But I don't like this solution at all, especially since I am repeating the same code for key 2. Any suggestions as on how to make this more concise?</p>