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

coord-zip-city

v1.0.13

Published

Get latitude/longitude for cities & ZIP codes, using a population-weighted centroid. Browser + Node.js, small install, zero dependencies.

Readme

coord-zip-city

  • Get latitude & longitude for a population-weighted centroid of any five-digit US ZIP code
  • Works in browsers & Node.js
  • ~800KB install, no dependencies

Data Source (.gov)

Removed irrelevant fields, rounded coordinates to two decimal places, used regional deltas to reduce size of coordinates

Installation

npm i coord-zip-city

Usage

import { coordZipCity } from 'coord-zip-city';

coordZipCity.zipInfo('30605') // also accepts Number
    // { city: 'ATHENS', state: 'GA', lat: 33.93, lon: -83.34 }
    
coordZipCity.zipCity('30605');
    // 'Athens'

coordZipCity.zipState('30605');
    // 'GA'

coordZipCity.zipCoordinates('30605');
    // {lat: 33.39, lon: -83.34 }
    
coordZipCity.zipCityState('30605');
    // 'ATHENS, GA'

coordZipCity.cityInfo('Athens', 'Georgia'); // case-insensitive, accepts full state name or abbreviation
    // { zip: '30601', lat: 35.96, lon: -78.95 } 
    // returns lowest ZIP code within the city & centroid for that ZIP code
    
coordZipCity.cityZip('Athens', 'Georgia');
    // '30601'
    
coordZipCity.cityCoordinates('Athens', 'Georgia');
    // {lat: 35.96, lon: -78.95 } 

Using with Bundlers

In production builds, the package should work without any additional configuration.

However, in development builds using bundlers, you will need to:

  • Allow the package in the dev server settings, or disable 'strict' mode (or you will see a 403 Forbidden error in the console)
  • Exclude the package from dependency optimization (or you will see undefined value errors in the console)

This ensures the binary containing the coordinate data is authorized to load, and is loaded from the correct relative URL.

An example for Vite (vite.config.js):

export default defineConfig({
  server: {
    fs: {
      allow: [
		  path.resolve('node_modules/coord-zip-city'),
		  ...
	  ]
	  
	  // or
	  
	  strict: false
    }
  },
  optimizeDeps: {
    exclude: ['coord-zip-city'],
  },
  ...

And for Quasar with Vite (quasar.config.js):

export default defineConfig((ctx) => {
  return {
    build: {
	  extendViteConf (viteConf) {
		viteConf.optimizeDeps ??= {};
		viteConf.optimizeDeps.exclude ??= [];
		viteConf.optimizeDeps.exclude.push('coord-zip-city');
	  
	    viteConf.server = viteConf.server || {};
        viteConf.server.fs = viteConf.server.fs || {};
		
		const projectRoot = fileURLToPath(new URL('.', import.meta.url));

        viteConf.server.fs.allow = [
          projectRoot,
          ...(viteConf.server.fs.allow || []),
          path.resolve('node_modules/coord-zip-city')
        ];
		
		// or
		
		viteConf.server.fs.strict = false;
	  },
	  ...
	},
	...
  }
})

License

This package is licensed under the Prosperity License. In short:

  • Non-commercial usage is free.
  • You must redistribute the license with the package and attribute the package's authorship to 'NuCommunity Nonprofit (Jake Ware)'.
  • If you release a modified version of the package, it must be open-source and under the same license.
  • If you wish to use this package in a commercial project, you must contact Jake Ware via email ([email protected]) to negotiate a different license.