I have an object that has an unknown number of properties, the values of which are non-empty arrays e.g.
const obj = {
c1: ['a', 'b', 'c'],
c2: ['a', 'c', 'b'],
cx: ['a', 'b'],
c3: ['d'],
c4: ['d'],
c5: ['e'],
...
}
I'm looking to find any duplicate properties, where the order of the array items isn't considered, and the result would let me know which properties match e.g. [c1,c2]
, [c3, c4]
I can probably use a combination of Object.entries
, nested forEach
, sort the arrays before comparing.... but was thinking there may be some more concise approach with lodash
that I haven't considered