Skip to content

Commit

Permalink
fix(CountryFlag): add condition to console.warn
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev committed Mar 30, 2023
1 parent b066de8 commit 7bc2b95
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/orbit-components/src/CountryFlag/index.tsx
Expand Up @@ -75,7 +75,8 @@ function getCountryProps(code?: string, name?: string) {
const codeNormalized = code ? code.toUpperCase().replace("-", "_") : "UNDEFINED";
const countryCodeExists = codeNormalized in CODES;

console.warn(`Country code not supported: ${code}`);
if (!countryCodeExists) console.warn(`Country code not supported: ${code}`);

const countryCode = countryCodeExists ? CODES[codeNormalized] : CODES.UNDEFINED;
const countryName = countryCode === CODES.UNDEFINED && !name ? "Undefined" : name;
return { code: countryCode, name: countryName };
Expand Down

0 comments on commit 7bc2b95

Please sign in to comment.