Sign In

@squawk/units

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
This package has malicious versions linked to the ongoing "Mini Shai-Hulud" supply chain attack.

Affected versions:

0.4.30.4.40.4.5
+2 more
View campaign page

@squawk/units

Aviation-aware unit conversion and formatting utilities

Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
22
-46.34%
Maintainers
1
Weekly downloads
 
Created
Source

squawk logo  @squawk/units

MIT License npm TypeScript

Aviation-aware unit conversion and formatting utilities. Conversions and formatters for speed, distance, altitude, pressure, temperature, and angle—plus ISA standard atmosphere calculations and compressible-flow aerodynamics.

Documentation

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

Installation

npm install @squawk/units

Usage

All exports are organized by domain namespace to keep call sites self-documenting:

import {
  speed,
  distance,
  altitude,
  pressure,
  temperature,
  angle,
  isa,
  format,
} from '@squawk/units';

// Speed conversions
const kmh = speed.knotsToKilometersPerHour(250);

// Distance conversions
const meters = distance.nauticalMilesToMeters(5);

// Altitude conversions
const feet = altitude.metersToFeet(3000);

// Pressure conversions and QNH/QFE
const hpa = pressure.inchesOfMercuryToHectopascals(29.92);
const qfe = pressure.qnhToQfe(1013.25, 5280); // Denver elevation

// Temperature conversions
const celsius = temperature.fahrenheitToCelsius(59);

// Angle conversions
const radians = angle.degreesToRadians(45);

// ISA standard atmosphere
const isaTemp = isa.isaTemperatureCelsius(35000);
const tas = isa.trueAirspeedFromCalibratedKt(250, 35000); // CAS to TAS at altitude
const da = isa.densityAltitudeFt(5000, 30); // Pressure altitude + OAT

// Formatting with locale support
const altLabel = format.formatAltitude(3500); // "3,500 ft"
const flLabel = format.formatAltitude(35000); // "FL350"
const speedLabel = format.formatSpeed(0.82, 'mach'); // "M0.82"
const tempLabel = format.formatTemperature(15, 'C', {
  showISADeviation: true,
  altitudeFt: 0,
}); // "15°C (+0 ISA)"

Key Features

  • Speed: Knots, km/h, mph, m/s
  • Distance: Nautical miles, statute miles, kilometres, metres, feet
  • Altitude: Feet, metres (with flight-level awareness)
  • Pressure: inHg, hPa, mmHg; QNH/QFE conversions; pressure altitude
  • Temperature: Celsius, Fahrenheit, Kelvin
  • Angle: Degrees, radians
  • ISA Atmosphere: Temperature and pressure profiles, TAS/CAS/Mach calculations, density altitude
  • Formatting: Locale-aware number formatting, flight-level conversion, ISA deviation display

Keywords

aviation

FAQs

Package last updated on 13 Apr 2026

Related posts