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/flight-math

v0.5.9

Published

Aviation flight computer calculations - the programmatic equivalent of an E6B

Downloads

369

Readme

MIT License npm TypeScript

Aviation flight computer calculations - the programmatic equivalent of an E6B flight computer. Pure functions for wind triangles, altitude corrections, airspeed conversions, and more.

Documentation

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

Installation

npm install @squawk/flight-math

Usage

All exports are organized by domain namespace, following the same pattern as @squawk/units:

import { atmosphere, airspeed, wind } from '@squawk/flight-math';

// Density altitude from field observations
const da = atmosphere.densityAltitude(5000, 29.92, 35); // field elev, altimeter, OAT

// True altitude corrected for non-standard temperature
const ta = atmosphere.trueAltitude(10000, 29.85, -10);

// CAS from TAS (inverse of isa.trueAirspeedFromCalibratedKt in @squawk/units)
const cas = airspeed.calibratedAirspeedFromTrueAirspeed(250, 20000);

// E6B wind triangle: find heading and groundspeed for a desired course
const wt = wind.solveWindTriangle(150, 270, 310, 25); // TAS, course, wind dir, wind speed
// wt.trueHeadingDeg, wt.windCorrectionAngleDeg, wt.groundSpeedKt

// Headwind and crosswind components for a runway
const hw = wind.headwindCrosswind(310, 15, 280); // wind dir, wind speed, runway heading
// hw.headwindKt, hw.crosswindKt

// Absolute crosswind for limit checking
const xw = wind.crosswindComponent(310, 15, 280);

// Reverse wind triangle: find the wind from observed flight data
const w = wind.findWind(135, 150, 275, 270); // GS, TAS, heading, track
// w.directionDeg, w.speedKt

Relationship to @squawk/units

This package complements @squawk/units, which provides unit conversions, formatting, and the ISA standard atmosphere model. @squawk/flight-math provides higher-level computations that combine multiple inputs (wind triangles, density altitude from field observations, etc.) and uses @squawk/units internally.

Functions that already exist in @squawk/units are not re-exported. Import them directly:

| Calculation | Package | | ------------------------------------------ | --------------------------------------------------------------------- | | Pressure altitude from indicated alt + QNH | @squawk/units (pressure.pressureAltitudeFt) | | Density altitude from PA + OAT | @squawk/units (isa.densityAltitudeFt) | | TAS from CAS | @squawk/units (isa.trueAirspeedFromCalibratedKt) | | Mach from TAS | @squawk/units (isa.machFromTrueAirspeedKt) | | TAS from Mach | @squawk/units (isa.trueAirspeedFromMachKt) | | Density altitude from field observations | @squawk/flight-math (atmosphere.densityAltitude) | | True altitude correction | @squawk/flight-math (atmosphere.trueAltitude) | | CAS from TAS | @squawk/flight-math (airspeed.calibratedAirspeedFromTrueAirspeed) | | Wind triangle / components | @squawk/flight-math (wind.*) |

Namespaces

  • atmosphere - Altitude calculations combining multiple field inputs
  • airspeed - Airspeed conversions not covered by @squawk/units
  • wind - E6B wind triangle, headwind/crosswind components, reverse wind triangle
  • descent - Top of descent, required descent/climb rate, gradient conversions, VDP
  • navigation - Holding pattern entry, DME arc lead, 1-in-60 rule
  • turn - Standard rate bank angle, turn radius, time to turn, load factor
  • glide - Glide distance with and without wind correction
  • pivotal - Pivotal altitude for ground reference maneuvers
  • solar - Sunrise/sunset, civil twilight, day/night determination (NOAA algorithm)
  • magnetic - Magnetic declination and field components (WMM2025), true/magnetic bearing conversion
  • planning - Fuel required, endurance, point of no return, equal time point