Skip to content

Converts between country names, ISO 3166-1 codes and flag emojis.

License

Notifications You must be signed in to change notification settings

leodutra/country-emoji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0d5faff Â· Nov 27, 2021

History

19 Commits
Nov 27, 2021
Oct 24, 2020
Nov 27, 2021
Oct 24, 2020
Oct 26, 2020

Repository files navigation

country-emoji

crate.io

Converts between country names, ISO 3166-1 codes and flag emojis.

Usage

use country_emoji::{flag, code, name, countries};

flag("CL")
 // ~> 🇨🇱

code("🇨🇦")
 // ~> CA

name("🇶🇦")
 // ~> Qatar

// can extract name from string…
flag("Taiwan number one!")
 // ~> 🇹🇼

// …but only if there"s no ambiguity
flag("Congo and Burma")
 // ~> undefined

flag("Republic of Tanzania")
 // ~> 🇹🇿

flag("Tanzania, United Republic of")
 // ~> 🇹🇿

code("Australia")
 // ~> AU

code("UAE")
 // ~> AE

name("AE")
 // ~> United Arab Emirates

code("UK")
 // ~> GB

Don't want Rust?

Check out the following:

Bugs and feedback

If you discover a bug please report it here. Express gratitude here.

Mail me at leodutra.br+foss@gmail.com, or on twitter @leodutra.

Credits

This library is based on the work of two existing library:

Thanks guys for your work!

License

MIT @ Leo Dutra

About

Converts between country names, ISO 3166-1 codes and flag emojis.

Topics

Resources

License

Stars

Watchers

Forks

Languages