Fixed Kuwait geo image.

This commit is contained in:
Niels Simenon
2022-11-17 22:05:05 +01:00
parent 3a8d040996
commit a13d88ada5
4 changed files with 10 additions and 7 deletions
+4 -3
View File
@@ -35,10 +35,11 @@ async function init() {
const countryImgs = await fs.readdir(`./assets/${type}`);
const countriesByCode = Object.fromEntries(data[type].map((country) => [country.alpha2, country]));
const imgCountries = await Promise.all(countryImgs.map(async (file) => {
const imgCountries = await Promise.all(countryImgs.filter((file) => !['encoded', 'disabled'].includes(file)).map(async (file) => {
const code = file.match(/(\w+).png/)?.[1];
if (!code || !countriesByCode[code]) {
console.warn(`No country for ${file} with code ${code}`);
return null;
}
@@ -51,9 +52,9 @@ async function init() {
code,
...countriesByCode[code],
};
}).filter(Boolean));
}));
await fs.writeFile(`./assets/${type}-curated.json`, JSON.stringify(imgCountries, null, 4));
await fs.writeFile(`./assets/${type}-curated.json`, JSON.stringify(imgCountries.filter(Boolean), null, 4));
console.log('Done!');
}