npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vtex/country-codes

v1.1.2

Published

Utilities for managing country codes and translations

Downloads

281

Readme

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.