There are two arrays of objects in my code, each with dynamic keys whose names I am unsure of. For example:
array1: [
{
level1: 'Shoes',
}
]
array2: [
{
level1: 'Shoes',
level2: 'Sneakers',
},
]
I am looking for a way to find the intersection between array1 and array2 without knowing the key names beforehand. The lodash _.intersectionBy method won't work in this case due to the uncertainty of key names in array1.
The expected result should look like [{ level1: 'Shoes' }]. Any suggestions on how to tackle this problem are highly appreciated!
Thank you very much!