1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-22 22:39:36 +02:00

Added new regions

This commit is contained in:
Sean Morley 2024-05-25 14:23:59 +00:00
parent 8f0ae40534
commit fb749d0cb2
7 changed files with 188 additions and 61 deletions

View file

@ -1,20 +1,6 @@
import inspirationalQuotes from "./json/quotes.json";
import countryCodes from "./json/countries.json";
import type { Adventure } from "./utils/types";
/**
* Converts a country code to its corresponding country name.
* @param countryCode - The country code to convert.
* @returns The country name if found, otherwise null.
*/
export function countryCodeToName(countryCode: string): string | null {
// Look up the country name using the provided country code
const countryName =
countryCodes[countryCode.toLowerCase() as keyof typeof countryCodes];
// Return the country name if found, otherwise return null
return countryName || null;
}
/**
* Generates the URL for a flag image based on the specified size and country code.
* @param size - The desired height of the flag image. Avaliable sizes: 20, 24, 40, 60, 80, 120, 240.