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/airways

v0.5.0

Published

Airway lookup, traversal, and expansion by designation, fix, or search

Readme

MIT License npm TypeScript

Pure logic library for querying US airway data. Look up airways by designation, expand route segments between fixes, find airways through a specific fix, or fuzzy-search by designation. Contains no bundled data - accepts an array of Airway records at initialization. For zero-config use, pair with @squawk/airway-data.

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

Usage

import { usBundledAirways } from '@squawk/airway-data';
import { createAirwayResolver } from '@squawk/airways';

const resolver = createAirwayResolver({ data: usBundledAirways.records });

// Look up by designation
const v16 = resolver.byDesignation('V16');

// Expand an airway between two fixes
const segment = resolver.expand('J60', 'MERIT', 'MARTN');
if (segment) {
  for (const wp of segment.waypoints) {
    console.log(wp.identifier, wp.mea, 'ft MEA');
  }
}

// Find all airways through a fix
const throughBos = resolver.byFix('BOS');
for (const result of throughBos) {
  console.log(result.airway.designation);
}

// Fuzzy-search by designation (scored, best match first)
const results = resolver.search({ text: 'V1' });
console.log(results[0]?.airway.designation, results[0]?.score);

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

import { createAirwayResolver } from '@squawk/airways';

const resolver = createAirwayResolver({ data: myAirways });

Browser / SPA usage

The resolver factory has no Node-specific imports and ships an explicit /browser subpath for SPAs and edge runtimes. Pair it with @squawk/airway-data/browser:

import { loadUsBundledAirways } from '@squawk/airway-data/browser';
import { createAirwayResolver } from '@squawk/airways/browser';

const dataset = await loadUsBundledAirways();
const resolver = createAirwayResolver({ data: dataset.records });

The /browser entry is identical to the main entry; the separate subpath exists so browser support is an explicit, publint-verified part of the public API surface.

API

createAirwayResolver(options)

Creates a resolver object from an array of Airway records.

Parameters:

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

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

resolver.byDesignation(designation)

Looks up airways by designation (e.g. "V16", "J60", "Q1"). Multiple airways can share the same designation in different regions (e.g. V16 exists in both the contiguous US and Hawaii). Case-insensitive. Returns Airway[].

resolver.expand(designation, entryFix, exitFix)

Expands an airway between two fixes, returning the ordered sequence of waypoints from the entry fix to the exit fix (inclusive). This is the primary use case for flight plan route decoding - given a route string like MERIT J60 MARTN, expand J60 between MERIT and MARTN.

Airways can be traversed in either direction. When the entry fix appears after the exit fix in the stored waypoint order, the returned waypoints are reversed so they always run entry-to-exit.

Returns AirwayExpansionResult | undefined. Returns undefined if:

  • The airway designation is not found
  • Either fix is not on the airway

The result contains:

  • airway - the full Airway record
  • waypoints - the ordered slice of waypoints between the two fixes

resolver.byFix(ident)

Finds all airways that pass through a given fix or navaid identifier. Case-insensitive. Returns AirwayByFixResult[], each containing:

  • airway - the Airway record
  • waypointIndex - the index of the matching waypoint in the airway

resolver.search(query)

Fuzzy-searches airways by designation. Matching is case-insensitive and tolerant of prefixes, substrings, subsequences, and small typos. Results are scored and returned best-match first.

| Property | Type | Description | | ---------- | ------------------------- | ---------------------------------------------------------------------------------------- | | text | string | Search text, matched fuzzily against each airway's designation | | limit | number | Optional. Maximum number of results. Defaults to 20 | | types | ReadonlySet<AirwayType> | Optional. When provided, only these airway types are returned | | minScore | number | Optional. Minimum match score (exclusive) in [0, 1] a result must reach. Defaults to 0 |

Returns AirwaySearchResult[], sorted by descending score, each containing:

  • airway - the matched Airway record
  • score - match strength in [0, 1], where 1 is an exact designation match
  • matchedField - which field produced the best match: 'designation'
  • ranges - matched character ranges within the best-matching field's text, for highlighting
const results = resolver.search({ text: 'V1', limit: 10 });
for (const { airway, score } of results) {
  console.log(airway.designation, score);
}