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

@squawk/airports

v0.5.3

Published

Pure logic library for querying US airport data by identifier, location, or name

Downloads

1,455

Readme

MIT License npm TypeScript

Pure logic library for querying US airport data. Look up airports by FAA ID, ICAO code, geographic proximity, or name/city search. Contains no bundled data - accepts an array of Airport records at initialization. For zero-config use, pair with @squawk/airport-data.

Part of the @squawk aviation library suite. See all packages on npm.

Usage

import { usBundledAirports } from '@squawk/airport-data';
import { createAirportResolver } from '@squawk/airports';

const resolver = createAirportResolver({ data: usBundledAirports.records });

// Look up by FAA ID
const jfk = resolver.byFaaId('JFK');

// Look up by ICAO code
const ord = resolver.byIcao('KORD');

// Find nearest airports to a position
const nearby = resolver.nearest({ lat: 40.6413, lon: -73.7781 });
for (const result of nearby) {
  console.log(result.airport.name, result.distanceNm, 'nm');
}

// Search by name or city
const results = resolver.search({ text: 'chicago' });

Consumers who have their own airport data can use this package standalone:

import { createAirportResolver } from '@squawk/airports';

const resolver = createAirportResolver({ data: myAirports });

API

createAirportResolver(options)

Creates a resolver object from an array of Airport records.

Parameters:

  • options.data - an array of Airport objects (from @squawk/types)

Returns: AirportResolver - an object with the lookup methods described below.

resolver.byFaaId(faaId)

Looks up an airport by its FAA location identifier (e.g. "JFK", "LAX", "3N6"). Case-insensitive. Returns Airport | undefined.

resolver.byIcao(icao)

Looks up an airport by its ICAO code (e.g. "KJFK", "KLAX"). Case-insensitive. Returns Airport | undefined.

resolver.nearest(query)

Finds airports nearest to a geographic position, sorted by distance ascending.

| Property | Type | Description | | --------------- | -------------------------- | -------------------------------------------------------------------- | | lat | number | Latitude in decimal degrees (WGS84) | | lon | number | Longitude in decimal degrees (WGS84) | | maxDistanceNm | number | Optional. Maximum distance in nautical miles. Defaults to 30 | | limit | number | Optional. Maximum number of results. Defaults to 10 | | types | ReadonlySet<FacilityType> | Optional. When provided, only facilities of these types are returned |

Returns NearestAirportResult[], each containing:

  • airport - the matched Airport record
  • distanceNm - great-circle distance in nautical miles (rounded to 2 decimal places)
// Find the 5 nearest airports within 50 nm
const nearby = resolver.nearest({
  lat: 40.6413,
  lon: -73.7781,
  maxDistanceNm: 50,
  limit: 5,
});

// Find only nearby heliports
const heliports = resolver.nearest({
  lat: 40.6413,
  lon: -73.7781,
  types: new Set(['HELIPORT']),
});

resolver.search(query)

Searches airports by name or city using case-insensitive substring matching. Results are returned in alphabetical order by name.

| Property | Type | Description | | -------- | -------------------------- | -------------------------------------------------------------------- | | text | string | Case-insensitive substring to match against name or city | | limit | number | Optional. Maximum number of results. Defaults to 20 | | types | ReadonlySet<FacilityType> | Optional. When provided, only facilities of these types are returned |

Returns Airport[].

const results = resolver.search({ text: 'san francisco', limit: 10 });

Local time at an airport

Every airport record carries an IANA timezone field (e.g. America/New_York) resolved from the airport's lat/lon at build time. Combine it with the standard Intl.DateTimeFormat API to format a timestamp in the airport's local time without pulling in a timezone library at runtime:

const jfk = resolver.byIcao('KJFK');
if (jfk) {
  const formatter = new Intl.DateTimeFormat('en-US', {
    timeZone: jfk.timezone,
    dateStyle: 'medium',
    timeStyle: 'short',
  });
  console.log(formatter.format(new Date())); // e.g. "Apr 23, 2026, 3:42 PM"
}

The same field works anywhere an IANA zone is accepted - Temporal, date-fns-tz, luxon, moment-timezone, etc.