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 🙏

© 2026 – Pkg Stats / Ryan Hefner

nation-code-lib

v1.10.0

Published

library of codes countries and flags

Readme

nation-code-lib

Una librería TypeScript para acceder y filtrar información de países, incluyendo códigos, banderas, idiomas, monedas y más.

Instalación

npm install nation-code-lib

Uso

import { NationAPI } from 'nation-code-lib';

// Obtener todos los países
const allCountries = NationAPI.getAllCountries();

// Buscar país por código
const spain = NationAPI.getCountryByCode('ESP');

// Buscar país por nombre
const mexico = NationAPI.getCountryByName('Mexico');

// Obtener países por región
const southAmericanCountries = NationAPI.getCountriesByRegion('South America');

// Obtener países por continente
const europeanCountries = NationAPI.getCountriesByContinent('Europe');

// Obtener código telefónico
const phoneCode = NationAPI.getPhoneCode('ESP'); // +34

// Obtener países por idioma
const spanishSpeakingCountries = NationAPI.getCountriesByLanguage('Spanish');

// Obtener países por moneda
const euroCountries = NationAPI.getCountriesByCurrency('EUR');

// Obtener datos simplificados de países
const simplifiedCountries = NationAPI.getSimplifiedCountries();

// Obtener datos simplificados con nombres oficiales en español
const spanishCountries = NationAPI.getSimplifiedCountries('spa');

API Reference

getAllCountries()

Retorna un array con todos los países disponibles.

getCountryByCode(code: string)

Busca un país por su código (cca2, cca3, o ccn3).

  • Parámetros: code - Código del país
  • Retorna: País encontrado o undefined

getCountryByName(name: string)

Busca un país por su nombre (común u oficial).

  • Parámetros: name - Nombre del país
  • Retorna: País encontrado o undefined

getCountriesByRegion(region: string)

Retorna todos los países en una región específica.

  • Parámetros: region - Nombre de la región
  • Retorna: Array de países en la región especificada

getCountriesByContinent(continent: string)

Retorna todos los países en un continente específico.

  • Parámetros: continent - Nombre del continente
  • Retorna: Array de países en el continente especificado

getPhoneCode(code: string)

Obtiene el código telefónico de un país.

  • Parámetros: code - Código del país
  • Retorna: Código telefónico o undefined

getCountriesByLanguage(language: string)

Retorna todos los países que usan un idioma específico.

  • Parámetros: language - Idioma a buscar
  • Retorna: Array de países que usan el idioma especificado

getCountriesByCurrency(currencyCode: string)

Retorna todos los países que usan una moneda específica.

  • Parámetros: currencyCode - Código de la moneda
  • Retorna: Array de países que usan la moneda especificada

getSimplifiedCountries(lang?: string)

Retorna una versión simplificada de los datos de los países.

  • Parámetros: lang - (Opcional) Código del idioma para la traducción del nombre oficial (ej: 'spa' para español)
  • Retorna: Array de países con datos simplificados (MappedCountry[])

Estructura de Datos

Cada país contiene la siguiente información:

  • Códigos (cca2, cca3, ccn3)
  • Nombres (común y oficial)
  • Región y subregión
  • Continentes
  • Banderas
  • Idiomas
  • Monedas
  • Códigos telefónicos

Contribución

Si deseas contribuir a este proyecto:

  1. Haz un Fork del repositorio
  2. Crea una rama para tu feature (git checkout -b feature/AmazingFeature)
  3. Realiza tus cambios y haz commit (git commit -m 'Add some AmazingFeature')
  4. Push a la rama (git push origin feature/AmazingFeature)
  5. Abre un Pull Request

Licencia

Este proyecto está bajo la licencia ISC. Ver el archivo LICENSE para más detalles.