Skip to content

Instantly share code, notes, and snippets.

@iokasimov
Created June 20, 2016 12:00
Show Gist options
  • Save iokasimov/35db88b6815d9ce45e68d41590f793aa to your computer and use it in GitHub Desktop.
Save iokasimov/35db88b6815d9ce45e68d41590f793aa to your computer and use it in GitHub Desktop.
// asynchonously parsing each continent
var main = function (continets, on_complete) {
var counter = 0;
var agencies = [];
on_complete = function (err, data) {
agencies = agencies.concat(data);
counter++;
if (counter === continents.length) {
return agencies;
}
}
async.each(continents,
function (url, next) {
p.process(url, on_complete);
},
function (err) {
console.log(agencies);
if (err) {
console.log(err);
}
}
);
}
main(continents, function(err, data){
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment