diff --git a/lib/addressFilter.js b/lib/addressFilter.js index d989351..fc37223 100644 --- a/lib/addressFilter.js +++ b/lib/addressFilter.js @@ -32,7 +32,7 @@ function run({coordinates=[], addresses=[]}=args={}, cb) { //Iterate over array of addresses, asyncronously calling Google's API //for each address to determine it's lat/lng coordinates - async.each(addresses, (address, eachNext) => { + async.eachSeries(addresses, (address, eachNext) => { googleMapsClient.geocode({address}, (err, response) => { @@ -54,12 +54,6 @@ function run({coordinates=[], addresses=[]}=args={}, cb) { eachNext(); }); }, (err) => { - - //Because we're asyncronously calling Google's API, return order can't be - //guaranteed. As a result, let's sort the array just so it always comes out - //the same way - withinRegionArr.sort(); - return cb(err, withinRegionArr); }); }