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

@accelint/formatters

v0.2.0

Published

A set of useful formatting functions for enhancing readability and consistency in your applications.

Readme

@accelint/formatters

A set of useful formatting functions for enhancing readability and consistency in your applications.

Installation

pnpm add @accelint/formatters

Usage

Every formatter is available from the package root or from its own subpath for tree-shaking:

// Import from the package root
import { formatBearing, formatDistance, formatM3A } from '@accelint/formatters';

// Or import from a subpath
import { formatBearing, formatDistance } from '@accelint/formatters/bearing';
import { formatM3A } from '@accelint/formatters/iff';

Formatters

Bearing and Distance

Display helpers for tactical bearing and range readouts.

formatBearing(degrees)

Formats a bearing in degrees as a zero-padded 3-digit string with a degree symbol. Any value is wrapped into the 0–360 range first, and fractional bearings round to the nearest whole degree. Throws a RangeError if degrees is NaN or infinite.

import { formatBearing } from '@accelint/formatters/bearing';

formatBearing(45);    // "045°"
formatBearing(-10);   // "350°"
formatBearing(360);   // "000°"
formatBearing(359.6); // "000°"

formatDistance(meters, units)

Converts a distance in meters to a string with one decimal place and a unit symbol. Pass a single DistanceUnit or an array of one or two units; two units are joined with " / ". Conversion factors come from METERS_PER_UNIT and symbols from DISTANCE_UNIT_SYMBOLS, both in @accelint/constants/units.

Supported units: kilometers, meters, nauticalmiles, miles, feet.

import { formatDistance } from '@accelint/formatters/bearing';

formatDistance(42300, 'kilometers');                    // "42.3 km"
formatDistance(42300, ['kilometers', 'nauticalmiles']); // "42.3 km / 22.8 NM"
formatDistance(1609.344, 'miles');                      // "1.0 mi"

formatDistance(42300, []);                              // Error: formatDistance accepts 1 or 2 units.
formatDistance(42300, ['kilometers', 'miles', 'feet']); // Error: formatDistance accepts 1 or 2 units.
formatDistance(Number.NaN, 'kilometers');               // RangeError: meters must be a finite number.

IFF (Identification Friend or Foe)

Aviation transponder code formatters for military and civilian aircraft identification:

  • formatM1(value?) - Mode 1: 2-digit octal mission/type code (military only)
  • formatM2(value?) - Mode 2: 4-digit octal unit code/tail number (military only)
  • formatM3A(value?) - Mode 3/A: 4-digit octal squawk code (military and civilian)
  • formatM4(value) - Mode 4: 4-digit encrypted challenge (military only)
  • formatM5(value) - Mode 5: 4-digit cryptographic Mode S/ADS-B (military only)

All formatters return zero-padded strings or default values (-- for 2-digit, ---- for 4-digit) when value is unavailable.

Planned

The following formatters are planned for future releases:

  • Altitude formatters
  • Azimuth formatters