Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
country-locale-map
Advanced tools
Provides mapping between country codes and provides default country locals
Provides easy conversion between country codes and names as well as a default locale for each country
const clm = require(country-locale-map);
clm.getAlpha3ByAlpha2('CA'); //returns 'CAN'
clm.getAlpha3ByAlpha2('CA'); //returns 'CAN'
clm.getLocaleByAlpha2('CA'); //returns 'en_CA'
clm.getCountryNameByAlpha2('CA'); //returns 'Canada'
clm.getCountryNameByAlpha2('CA'); //returns '124'
clm.getCurrencyByAlpha2('CA'); //returns 'CAD'
clm.getCountryNameByAlpha2('CA');
/*returns
{
"name":"Canada",
"alpha2":"CA",
"alpha3":"CAN",
"numeric":"124",
"locales":["en_CA","fr_CA"],
"default_locale":"en_CA",
"currency":"CAD",
"languages":["en","fr"],
"capital":"Ottawa",
"emoji":"🇨🇦",
"emojiU":"U+1F1E8 U+1F1E6"
}
*/
clm.getAlpha3ByAlpha2('CAN'); //returns 'CA'
clm.getLocaleByAlpha3('CAN'); //returns 'en_CA'
clm.getCountryNameByAlpha3('CAN'); //returns 'Canada'
clm.getNumericByAlpha3('CAN'); //returns '124'
clm.getCurrencyByAlpha3('CAN'); //returns 'CAD'
clm.getCountryByAlpha3('CAN');
/*returns
{
"name":"Canada",
"alpha2":"CA",
"alpha3":"CAN",
"numeric":"124",
"locales":["en_CA","fr_CA"],
"default_locale":"en_CA",
"currency":"CAD",
"languages":["en","fr"],
"capital":"Ottawa",
"emoji":"🇨🇦",
"emojiU":"U+1F1E8 U+1F1E6"
}
*/
clm.getAlpha2ByNumeric('123'); //returns 'CA'
clm.getAlpha3ByNumeric('124'); //returns 'CAN'
clm.getLocaleByNumeric('124'); //returns 'en_CA'
clm.getCountryNameByNumeric('124'); //returns 'Canada'
clm.getCurrencyByNumeric('124'); //returns 'CAD'
clm.getCountryByNumeric('124');
/*returns
{
"name":"Canada",
"alpha2":"CA",
"alpha3":"CAN",
"numeric":"124",
"locales":["en_CA","fr_CA"],
"default_locale":"en_CA",
"currency":"CAD",
"languages":["en","fr"],
"capital":"Ottawa",
"emoji":"🇨🇦",
"emojiU":"U+1F1E8 U+1F1E6"
}
*/
clm.getAlpha2ByName('Canada'); //returns 'CA'
clm.getAlpha3ByName('Canada'); //returns 'CAN'
clm.getLocaleByName('Canada'); //returns 'en_CA'
clm.getNumericByName('Canada'); //returns '124'
clm.getCurrencyByName('Canada'); //returns 'CAD'
clm.getCountryByName('Canada');
/*returns
{
"name":"Canada",
"alpha2":"CA",
"alpha3":"CAN",
"numeric":"124",
"locales":["en_CA","fr_CA"],
"default_locale":"en_CA",
"currency":"CAD",
"languages":["en","fr"],
"capital":"Ottawa",
"emoji":"🇨🇦",
"emojiU":"U+1F1E8 U+1F1E6"
}
*/
FAQs
Provides mapping between country codes and provides default country locales. Includes optional fuzzy matching for country name.
The npm package country-locale-map receives a total of 42,503 weekly downloads. As such, country-locale-map popularity was classified as popular.
We found that country-locale-map demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.