Skip to content

Commit

Permalink
feat(simplified): handle cities alternate names (New York => New York…
Browse files Browse the repository at this point in the history
… City)
  • Loading branch information
vvo committed Jun 17, 2020
1 parent 7848b62 commit ae266f3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ async function run() {
const name = cityFields[1];
const population = parseInt(cityFields[14], 10);
const countryCode = cityFields[8];
const alternateCityNames = cityFields[3].split(",");

const timeZoneName = cityFields[17];

Expand Down Expand Up @@ -96,6 +97,10 @@ async function run() {
cities.push(city);
citiesPopulation[`${countryCode}${name}`] = population;

for (let alternateCityName of alternateCityNames) {
citiesPopulation[`${countryCode}${alternateCityName}`] = population;
}

if (modificationDate > lastIndexUpdate) {
updatedCities.push({
objectID: city.geonameId,
Expand Down

0 comments on commit ae266f3

Please sign in to comment.