Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isoToCountryCode function will return JS error in case it can't find country related to isoCode #53

Open
1 of 3 tasks
jamilalisgandarov opened this issue Jul 19, 2021 · 0 comments

Comments

@jamilalisgandarov
Copy link

jamilalisgandarov commented Jul 19, 2021

Please check all that apply

  • visual bug
  • functional bug
  • able to consistently reproduce

Expected Behavior

JS error shouldn't break whole application, can return undefined instead of breaking app

Current Behavior

Breaking app in case there is not country related to passed country code

Possible Solution

Issue is here:

))[keyToGet]

Would be better to check if country has found before trying to get [keyToGet]

Steps to Reproduce

Pass unrelated code or GB for UK

Screenshots

image

Context

I am using flagpack-react to render flags based on country code passed by our end. Looks like we have mismatch for some country alpha 2 codes, but instead of breaking applicaiton, it would be better to return null from the Flag component

Your Environment

  • Version used: react-flagpack: ^0.1.1
  • Browser Name and version: Chrome
  • Operating System and version (desktop or mobile): MacOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant