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

unit-converter-js

v2.5.0

Published

Simple, extensible unit conversion library

Readme

Unit Converter

A simple, extensible TypeScript unit conversion library. Convert between units with a clean, intuitive API.

Example UI:

UI Example

Live demo:

Live demo

Installation

npm install unit-converter-js

Quick Start

import convert from 'unit-converter-js'

// Length
convert(5, 'miles').to('kilometers')     // → 8.0467
convert(10, 'feet').to('centimeters')   // → 304.8

// Mass
convert(5, 'kilograms').to('grams')     // → 5000
convert(10, 'pounds').to('kilograms')   // → 4.53592

// Temperature
convert(0, 'celsius').to('fahrenheit')  // → 32
convert(32, 'fahrenheit').to('celsius') // → 0

// Volume
convert(1, 'gallons').to('liters')      // → 3.78541

// Speed
convert(100, 'kilometersperhour').to('meterspersecond') // → 27.78

API

All conversions follow the same simple pattern:

convert(value, unitName).to(targetUnitName)

Examples:

convert(10, 'miles').to('kilometers')           // 16.0934
convert(5, 'kilograms').to('pounds')            // 11.0231
convert(100, 'kilometersperhour').to('meterspersecond')       // 27.78
convert(1, 'gallons').to('liters')              // 3.78541

Supported Units

Length

meterskilometerscentimetersmillimetersmilesfeetinches

Symbols: mkmcmmmmiftin

Mass

kilogramsgramsmilligramspoundsounces

Symbols: kggmglb, lbsoz

Temperature

celsiuskelvinfahrenheit

Symbols: °C, CK°F, F

Volume

litersmillilitersgallonscupspintsfluidounces

Symbols: l, Lml, mLgalcupptfl oz, floz

Area

squaremeterssquarekilometershectaresacressquarefeetsquaremiles

Symbols: , m2km², km2haacft², ft2mi², mi2

Time

secondsmillisecondsminuteshoursdaysweeksyears

Symbols: s, secmsminh, hrdwkyr, y

Speed

meterspersecondkilometersperhourmilesperhourknotsfeetpersecond

Symbols: m/s, mpskm/h, kmhmphktft/s, fps

Pressure

pascalsbarspsiatmospheresmillimetersmercurykilopascals

Symbols: PabarpsiatmmmHgkPa

Data Storage

byteskilobytesmegabytesgigabytesterabytespetabytes

Symbols: BKBMBGBTBPB

Energy

jouleskilojoulescalorieskilocaloriesbtuwatthours

Symbols: JkJcalkcalBTU, BtuWh

Power

wattskilowattsmegawattshorsepowerbtuperhour

Symbols: WkWMWhpBTU/h

Force

newtonskilonewtonsdynespoundsforcekilogramforce

Symbols: NkNdynlbfkgf

Angle

degreesradiansgradiansarcminutesarcseconds

Symbols: °, degradgrad'"

Frequency

hertzkilohertzmegahertzgigahertzrpm

Symbols: HzkHzMHzGHzrpm

Density

kilogramspermetercubedgramspercentimetercubedpoundsperfootpoundspergallon

Symbols: kg/m³, kg/m3g/cm³, g/cm3lb/ft³, lb/ft3lb/gal

Illuminance

luxfootcandleslumenspermetersquared

Symbols: lxfclm/m², lm/m2

Viscosity

centistokesstokescentipoisepoisepascalseconds

Symbols: cStStcPPPa·s, Pas

Concentration

molarityppmppbpercentppt

Symbols: Mppmppb%ppt

Contributing

Want to add more units or categories? Contributions are welcome!

See CONTRIBUTING.md for:

  • How to add a new unit category
  • How to add units to existing categories
  • Testing requirements
  • Code guidelines

License

ISC