I have an array like this
arr1 =
[
{A: \'red\', B: \'blue\'},
{Q: \'green\', R: \'blue\'},
{B: \'green\', M: \'red\'},
{Q: \'white\', R: \'blue\
You could use a Set for the property names and filter the array.
var array = [{ A: 'red', B: 'blue' }, { Q: 'green', R: 'blue' }, { B: 'green', M: 'red' }, { Q: 'white', R: 'blue' }],
filter = [{ A: 'val', B: 'someval' }, { B: 'anothervalue', M: 'value' }],
getKey = o => Object.keys(o).sort().join('|'),
result = array.filter((s => o => s.has(getKey(o)))(new Set(filter.map(getKey))));
console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }