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

univerto

v0.4.3

Published

Simple, 0-dependency unit converter with fluent API

Readme

npm version

Univerto

Univerto is a lightweight, zero-dependency, type-safe library for converting units in JavaScript/TypeScript. It provides a fluent API for precise and readable unit conversions.

Installation

Install via your preferred package manager:

# npm
npm install univerto

# yarn
yarn add univerto

# pnpm
pnpm add univerto

Usage

import { TIME_UNIT, TimeUnitConverter } from 'univerto/time'

// Convert 1 hour to milliseconds
const milliseconds = TimeUnitConverter.from(1, TIME_UNIT.HOUR)
  .to(TIME_UNIT.MILLISECOND)
  .convert()

console.log(milliseconds) // 3_600_000

Or you can get the fraction to be able to pass it to your lib of choice do the final math

import { TIME_UNIT, TimeUnitConverter } from 'univerto/time'

// Convert 1 hour to milliseconds
const fraction = TimeUnitConverter.from(1, TIME_UNIT.HOUR)
  .to(TIME_UNIT.MILLISECOND)
  .convertToFraction() // or .convertToRational()

Using with decimal.js for high precision arithmetic:

import { TIME_UNIT, TimeUnitConverter } from 'univerto/time'
import { Decimal } from 'decimal.js'

// Convert 1 hour to milliseconds using decimal.js
const fraction = TimeUnitConverter.from(1, TIME_UNIT.HOUR)
  .to(TIME_UNIT.MILLISECOND)
  .convertToFraction()

const result = new Decimal(fraction.numerator).div(fraction.denominator)

console.log(result.toString()) // "3_600_000"

Features

  • Type-safe: Ensures only valid units are used.
  • Fluent API: Chainable methods for easy conversion.
  • Zero dependencies: Lightweight and easy to include in any project.
  • Precise calculations: The lib represents the numbers as fractions internally to avoid floating point insistencies

Supported Units

Length

import { LENGTH_UNIT, LengthUnitConverter } from 'univerto/length'

Nanometer, Micrometer, Millimeter, Centimeter, Meter, Kilometer, Inch, Hand, Foot, Yard, Chain, Furlong, Mile, League

Area

import { AREA_UNIT, AreaUnitConverter } from 'univerto/area'

Square millimeter, Square centimeter, Square meter, Hectare, Square kilometer, Square inch, Square foot, Acre, Square mile

Volume

import { VOLUME_UNIT, VolumeUnitConverter } from 'univerto/volume'

Cubic millimeter, Cubic centimeter, Cubic meter, Cubic kilometer, Milliliter, Liter, Kiloliter, Megaliter, Gigaliter, Cubic inch, Cubic foot, Cubic yard, Teaspoon, Tablespoon, Fluid ounce, Cup, Pint, Quart, Gallon

Mass

import { MASS_UNIT, MassUnitConverter } from 'univerto/mass'

Microgram, Milligram, Gram, Kilogram, Metric ton, Ounce, Pound, Stone, Short ton, Long ton

Time

import { TIME_UNIT, TimeUnitConverter } from 'univerto/time'

Nanosecond, Microsecond, Millisecond, Second, Minute, Hour, Day, Week, Month, Year, Decade

Speed

import { SPEED_UNIT, SpeedUnitConverter } from 'univerto/speed'

Meter per second, Millimeter per hour, Kilometer per hour, Mile per hour, Knot, Foot per second, Inch per hour

Data Storage

import { DATA_UNIT, DataUnitConverter } from 'univerto/data'

Bit, Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte, Exabyte, Kibibyte, Mebibyte, Gibibyte, Tebibyte, Pebibyte, Exbibyte

Voltage

import { VOLTAGE_UNIT, VoltageUnitConverter } from 'univerto/voltage'

Millivolt, Volt, Kilovolt, Megavolt

Current

import { CURRENT_UNIT, CurrentUnitConverter } from 'univerto/current'

Milliampere, Ampere, Kiloampere

Frequency

import { FREQUENCY_UNIT, FrequencyUnitConverter } from 'univerto/frequency'

Millihertz, Hertz, Kilohertz, Megahertz, Gigahertz, Terahertz, RPM (revolutions per minute), Degree per second

Inspiration

Made with ❤️ and Inspired by convert-units