So right now I have an object with the following shape and the task is to loop over every item in all of the arrays and compare each one to all of the other items in all of the arrays.
things: Things = {
"Type1Things": [],
"Type2Things": [],
"Type3Things": [],
}
Here's how I currently have it written:
Object.keys(things).forEach( (key: string) => {
things[key].forEach( ( outerThing: Overlay ) => {
Object.keys(things).forEach( (key1: string) => {
things[key1].forEach( ( innerThing: Overlay ) => {
// compare inner and outer things
})
})
})
})
Is there a better method to perform this task, or at least a more readable way of writing it? Could a recursive function better accomplish this?