Skip to content

jayPare/CountryCodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

CountryCodes

A simple Javascript UMD tool for ISO country codes.

Usage

<script
  crossorigin
  src="https://raw.githubusercontent.com/jayPare/CountryCodes/main/countryCodes.js"
></script>

Country name to 2-digits code:

code = countryCodes.countryToCode("Canada"); // code == "CA"

Country name to 3-digits code:

code = countryCodes.countryToCode3("Canada"); // code == "CAN"

2-digits code to 3-digits code:

code = countryCodes.codeToCode3("CA"); // code == "CAN"

3-digits code to 2-digits code:

code = countryCodes.codeToCode3("CAN"); // code == "CA"

2-digits code to country name:

code = countryCodes.codeToCountry("CA"); // code == "Canada"

3-digits code to country name:

code = countryCodes.code3ToCountry("CAN"); // code == "Canada"

Notes

  • Missing countries coming soon.

License

MIT © JayPare

About

Javascript UMD for ISO country codes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published