country-emoji

Crates.iocountry-emoji
lib.rscountry-emoji
version0.2.0
sourcesrc
created_at2020-10-26 07:35:11.736708
updated_at2021-11-27 22:48:39.155714
descriptionConverts between country names, ISO 3166-1 codes and flag emojis.
homepage
repositoryhttps://github.com/leodutra/country-emoji
max_upload_size
id305514
size26,043
Leo Dutra (leodutra)

documentation

README

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

Commit count: 19

cargo fmt