http.get({}, (res1) => {
...
items.forEach((item) => {
arr[item.id] = item
http.get({}, (subRes) => {
...
subItems.forEach((subItem => {
subArr[subItem.id] = subItem
})
})
})
What's a clean way of creating a single exit point from a construct like this?
@thor If it were Scala, I'd use Futures since they're cleaner syntactically, though I don't know if anyone has created something similar to abstract over time in JS.
@skypage Whatever I end up using, I probably can't use the data passing mechanism it implements, because I'm populating 3 hash maps with what more or less amounts to 3 relational views of the same data. I wish there was a more elegant way of doing it. At least I maintain data integrity, since all JS objects are assigned by reference.