Skip to content

Instantly share code, notes, and snippets.

@iokasimov
Created June 20, 2016 11:15
Show Gist options
  • Save iokasimov/193eb271a146b7dca9a850644965a955 to your computer and use it in GitHub Desktop.
Save iokasimov/193eb271a146b7dca9a850644965a955 to your computer and use it in GitHub Desktop.
var path = require('path');
var async = require('async');
var config = require(path.join(process.cwd() + '/src/config'));
var processor = require(path.join(process.cwd() + '/src/processor'));
var continents = ['australia','north-america','europe'];
var p = new processor.Processor();
// asynchonously parsing each continent
var main = function(continets){
var counter = 0;
var agencies = [];
var on_complete = function(err, data){
agencies = agencies.concat(data);
counter++;
}
async.each(continents,
function (url, next) {
p.process(url, on_complete);
},
function (err) {
if (err) {
console.log(err);
}
}
);
if (counter === continents.length){
console.log('done!');
}
}
module.exports = main;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment