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

View File

@ -571,16 +571,18 @@
"alpha2": "KP",
"name": "North Korea"
},
{
"file": "e7d0.png",
"code": "KQ"
},
{
"file": "38dd.png",
"code": 410,
"alpha2": "KR",
"name": "South Korea"
},
{
"file": "cd37.png",
"code": 414,
"alpha2": "KW",
"name": "Kuwait"
},
{
"file": "4ace.png",
"code": 398,

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!');
}

View File

Before

Width:  |  Height:  |  Size: 341 KiB

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB