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

@edenware/countries

v1.0.0

Published

Country data with query API, distance, nearest countries, and multi-language names (powered by world-countries)

Readme

@edenware/countries

Country data with query API, distance, nearest countries, and multi-language names. Powered by world-countries with a supplemental dataset for timezone offsets and population.

Features

  • Country database: ISO codes, names (da, de, en, es, fr, it, nl, pt), coordinates, languages
  • Timezone: Offsets in minutes per country (from supplement)
  • Population: From supplement data
  • Query API: Filter, order, select fields
  • Distance: Haversine distance between countries; nearest / nearest-by-population
  • Case-insensitive: All country code arguments (getCountry, getCountryName, getNearest, etc.) accept any case ('US', 'us'). Returned objects use lowercase code (e.g. country.code === 'us').

Installation

npm install @edenware/countries

Usage

ESM

import geo from '@edenware/countries';

const country = geo.getCountry('US');
console.log(country?.iso); // United States

const name = geo.getCountryName('US', 'pt');
console.log(name); // Estados Unidos

const us = geo.getCountry('US');
const ca = geo.getCountry('CA');
const distanceKm = geo.getDistance(us, ca);

const nearest = geo.getNearest('US', ['CA', 'MX', 'BR'], 2);

CommonJS

const geo = require('@edenware/countries');

const country = geo.getCountry('us');
console.log(country?.iso);

Custom instance

import geo, { Countries, loadData } from '@edenware/countries';

const data = loadData();
const instance = new Countries(data);

API

  • getCountry(code) – country object by ISO 3166-1 alpha-2 (case-insensitive)
  • getCountryName(code, lang) – name in language (da, de, en, es, fr, it, nl, pt) or iso
  • getCountries() – array of all codes
  • getCountriesFromTZ(tzMins) – codes in that timezone offset (minutes)
  • getCountryLanguages(code) – array of language codes (ISO 639-3)
  • getCountriesFromLanguage(locale) – codes where that language is used
  • query(fields, where, orderBy, desc) – filter/order; fields can be string (e.g. 'code,iso') or empty for all
  • getRow(fields, where, orderBy, desc) – first row of query
  • getVar(field, where, orderBy, desc) – single field value
  • countryCodeExists(code) – boolean
  • orderCodesBy(codes, field, desc) – sort codes by field (default desc)
  • extractCountryCodes(text) – extract valid 2-letter codes from text
  • getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) – Haversine km
  • getDistance(country1, country2) – distance in km
  • getNearest(fromCode, destCodes, amount) – nearest by distance
  • getNearestPopulous(fromCode, destCodes, amount) – nearest by distance + population score

Data

  • Country list and translations: world-countries.
  • Timezone offsets and population: data/supplement.json (shipped with the package).

By Edenware — developing open-source software for simpler digital lives. Multi-platform apps, transparency, and collaboration.