Skip to main content

Precise Unit Conversions for TypeScript

Zero-dependency library with a fluent API and fraction-based precision. Convert between 10 unit categories without floating point errors.

TypeScript

Quick Start

Get up and running with Univerto in three simple steps

1

Install the package

Add Univerto to your project using your preferred package manager:
npm install univerto
2

Import a converter

Univerto provides modular exports for optimal tree-shaking. Import only what you need:
import { TimeUnitConverter, TIME_UNIT } from 'univerto/time'
Each unit category has its own export path (e.g., univerto/length, univerto/mass) to keep your bundle size minimal.
3

Convert units

Use the fluent API to perform conversions with a clear, readable syntax:
const result = TimeUnitConverter
  .from(24, TIME_UNIT.HOUR)
  .to(TIME_UNIT.DAY)
  .convert()

console.log(result) // 1
The conversion engine uses fraction-based calculations internally, avoiding floating point precision issues common in JavaScript.

Key Features

Built for modern TypeScript applications with precision and performance in mind

Zero Dependencies

Minimal bundle size with no external dependencies. Tree-shakeable exports ensure you only ship what you use.

Type-Safe

Full TypeScript support with strict type definitions. Catch conversion errors at compile time.

Precise Calculations

Fraction-based arithmetic eliminates floating point errors. Get exact results every time.

Fluent API

Chainable methods create readable conversion pipelines. Write code that’s self-documenting.

Explore Unit Converters

Convert between units across 10 different categories

Length

Nanometers to miles and everything in between

Area

Square millimeters to acres and square miles

Volume

Milliliters to gallons and cubic meters

Mass

Micrograms to metric tons and pounds

Time

Nanoseconds to decades and years

Speed

Meters per second to miles per hour

Data

Bits to petabytes and exabytes

Voltage

Millivolts to megavolts

Current

Milliamperes to kiloamperes

Frequency

Hertz to gigahertz and RPM

Ready to start converting?

Install Univerto today and eliminate floating point errors from your unit conversions

Get Started Now

Build docs developers (and LLMs) love