Fixed Kuwait geo image.
This commit is contained in:
+4
-3
@@ -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!');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user