I've nested arrays, I'm able to retrieve promises for the 2nd level array but not sure how to implement a then
once top level finishes as well.
result.forEach(function(entity){ // outer list ???
return Promise.all(entity.urls.map(function(item){
return requestURL(item.href);
}));
});
for instance if results
has two or more items and each item
has 10 or more urls to fetch, how would we implement then
of [Promise.all][1]
for all the promises. Native solution please.
Basically to handle nested arrays of promises in a right way.
Data Structure:
var result = [
{
urls: [
{href: "link1"},
{href: "link2"},
{href: "link3"}
]
},
{
urls: [
{href: "link4"},
{href: "link5"},
{href: "link6"}
]
}
];