Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vtex/country-codes

Package Overview
Dependencies
Maintainers
53
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vtex/country-codes

Utilities for managing country codes and translations

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
215
increased by64.12%
Maintainers
53
Weekly downloads
 
Created
Source

country-codes

Country codes, translations and utilities

Setup

Through NPM:

$ npm install @vtex/country-codes
import toAlpha3 from '@vtex/country-codes/modules/toAlpha3'

Through vtex.io:

Add vtex.country-codes to your manifest.json dependencies

import { modules } from 'vtex.country-codes'
const { toAlpha2 } = modules

API

toAlpha2

Converts an ISOAlpha3 country code to its ISOAlpha2 version (such as BRA -> BR)

toAlpha3

Does the inverse procedure of the above function (BR -> BRA)

countryCodes

This entrypoint provides a list of all countries in the world, as an array where each country is also an array, whose first element is the alpha2 code and second element is the alpha3 code. You can use this together with the imported locales to display a full list of countries.

Locales

This library provides translations for country names in a large list of languages. The translation ID for a country is its ISOAlpha3 code preffixed by country (example: **country.BRA**). If using the vtex.io app, the translations will be imported automatically. Otherwise, you should import the appropriate locale from the locales folder.

Important: When using vtex.io, if you do not import any component from the library, Render will not copy the translations into your app. In such case, you need to import the special locales entrypoint somewhere:

import 'vtex.country-codes/locales'

It is just an empty object and has no effect in your app.


Author: Gustavo Silva (@​​​​​​​​​​​​​​​​​​​​​a​​kaFTS), with codes and translations obtained from michaelwittig/node-i18n-iso-countries

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 12 Jul 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc