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

@brmorillo/global-locations

v5.0.0

Published

Production-ready library for global location data — countries, states and cities behind one type-safe API. Dual CJS + ESM build.

Readme

@brmorillo/global-locations

npm version CI Downloads Bundle size Node.js TypeScript License: LGPL-3.0

Library for accessing global location data such as countries, states, and cities.

Installation

npm install @brmorillo/global-locations

Usage

import { GlobalLocations } from '@brmorillo/global-locations';

// Get all countries
const countries = GlobalLocations.Countries.getAllCountries();

// Get a specific country by ID
const brazil = GlobalLocations.Countries.getCountryBy({
  property: 'id',
  value: 'BR',
  selectStates: true
});

// Get states of a country
const brazilStates = GlobalLocations.Countries.getStatesByCountryId('BR');

// Get cities of a state
const saoPauloCities = GlobalLocations.Countries.getCitiesByStateId({
  countryId: 'BR',
  stateId: '35'
});

API

Countries

  • findCountryByProperty(property, value): Finds a country by an arbitrary property
  • getAllCountriesAndData(): Returns all countries with complete data
  • getAllCountries(): Returns all countries without state data
  • getCountryBy({ property, value, selectStates }): Returns a specific country
  • getAllStates(): Returns all states from all countries
  • getStatesByCountryId(countryId): Returns states of a specific country
  • getStateByParams({ countryId, params }): Searches for a specific state
  • isStateInCountry({ countryId, stateId }): Checks if a state belongs to a country
  • getAllCities({ countryId }): Returns all cities of a country
  • getCitiesByStateId({ countryId, stateId }): Returns cities of a specific state
  • getCitiesByParams({ countryId, stateId, params }): Searches for a specific city
  • getCityById(cityId): Finds a city by its numeric id across all countries
  • searchCitiesByName(name, caseSensitive?): Searches cities by (partial) name
  • getCountriesByContinent(continent, includeStates?): Filters countries by continent
  • getCountriesByEconomicGroup(group, includeStates?): Filters countries by economic group

Quality & testing

  • Dual build: ships CommonJS (require) and ESM (import) plus its own .d.ts.
  • TypeScript strict end to end.
  • 92 tests (unit + integration) on jest, 100% coverage (statements, branches, functions, lines).
  • External consumer smoke test validates the published artifact via both require and import — see CONTRIBUTING.md.
bun install
bun run test          # unit + integration + benchmark
bun run test:coverage # coverage report
bun run build         # CJS + ESM + d.ts

Documentation

Contributing & security

  • CONTRIBUTING.md — setup, workflow, testing, release flow.
  • SECURITY.md — supported versions and how to report a vulnerability.
  • CLAUDE.md — architecture, conventions and context for contributors/AI assistants.

License

LGPL-3.0-only © Bruno Morillo