From 7bc2b953089ae688351b44b81b574636f84fbb9e Mon Sep 17 00:00:00 2001 From: mainframev Date: Thu, 30 Mar 2023 15:08:12 +0200 Subject: [PATCH] fix(CountryFlag): add condition to console.warn --- packages/orbit-components/src/CountryFlag/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/orbit-components/src/CountryFlag/index.tsx b/packages/orbit-components/src/CountryFlag/index.tsx index 7e793cf860..bd2f6480f2 100644 --- a/packages/orbit-components/src/CountryFlag/index.tsx +++ b/packages/orbit-components/src/CountryFlag/index.tsx @@ -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 };