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

Get continent code by name #133

Open
aniito opened this issue Feb 29, 2024 · 0 comments
Open

Get continent code by name #133

aniito opened this issue Feb 29, 2024 · 0 comments

Comments

@aniito
Copy link

aniito commented Feb 29, 2024

this feature is a need i think not only on my project;
what i did :

function getCodeFromName(name: string): keyof typeof continents | boolean {
      const entry = Object.entries(continents).find(([_, continentName]) => continentName === name);
      return entry ? (entry[0] as keyof typeof continents) : false;
}
    
@dmythro dmythro closed this as completed Mar 4, 2024
@dmythro dmythro reopened this Mar 5, 2024
@dmythro dmythro changed the title Feature : GetContinentCode Get continent code by name Mar 5, 2024
@dmythro dmythro moved this from Todo to New in Countries Project Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants