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

@elitedecode/convertible

v0.0.1

Published

A lightweight TypeScript utility library for common conversion functions

Readme

Convertible

A lightweight, TypeScript-first utility library for common conversion functions.

Features

  • 🌡️ Temperature Conversion - Convert between Celsius and Fahrenheit
  • 💰 Currency Conversion - Convert currency amounts with exchange rates
  • 📁 File Size Conversion - Convert between bytes, KB, MB, GB, and TB
  • 🔒 TypeScript Support - Full type safety with exported types
  • 📦 Zero Dependencies - Lightweight with no external dependencies

Installation

npm install convertible

Usage

Temperature Conversion

import { convertTemperature } from "convertible";
import type { TemperatureUnit } from "convertible";

// Convert 25°C to Fahrenheit
const fahrenheit = convertTemperature(25, "C", "F");
console.log(fahrenheit); // 77

// Convert 68°F to Celsius
const celsius = convertTemperature(68, "F", "C");
console.log(celsius); // 20

Currency Conversion

import { convertCurrency } from "convertible";
import type { CurrencyConversionResult } from "convertible";

// Convert 100 USD to EUR (assuming 0.85 exchange rate)
const result: CurrencyConversionResult = convertCurrency(
  100,
  0.85,
  "USD",
  "EUR"
);

console.log(result);
// {
//   amount: 85,
//   exchangeRate: 0.85,
//   fromCurrency: 'USD',
//   toCurrency: 'EUR'
// }

File Size Conversion

import { convertFileSize } from "convertible";
import type { FileSizeUnit } from "convertible";

// Convert 1024 bytes to KB
const kb = convertFileSize(1024, "B", "KB");
console.log(kb); // 1

// Convert 5 MB to GB
const gb = convertFileSize(5, "MB", "GB");
console.log(gb); // 0.005

API Reference

Functions

convertTemperature(value, from, to)

Converts temperature between Celsius and Fahrenheit.

  • value: number - Temperature value to convert
  • from: TemperatureUnit - Source unit ('C' or 'F')
  • to: TemperatureUnit - Target unit ('C' or 'F')
  • returns: number - Converted temperature

convertCurrency(amount, exchangeRate, fromCurrency, toCurrency)

Converts currency amount using exchange rate.

  • amount: number - Amount to convert
  • exchangeRate: number - Exchange rate (target currency per 1 source currency)
  • fromCurrency: string - Source currency code
  • toCurrency: string - Target currency code
  • returns: CurrencyConversionResult - Object with converted amount and metadata

convertFileSize(size, fromUnit, toUnit)

Converts file size between different units.

  • size: number - Size value to convert
  • fromUnit: FileSizeUnit - Source unit ('B', 'KB', 'MB', 'GB', 'TB')
  • toUnit: FileSizeUnit - Target unit ('B', 'KB', 'MB', 'GB', 'TB')
  • returns: number - Converted size (rounded to 2 decimal places)

Types

TemperatureUnit

type TemperatureUnit = "C" | "F";

FileSizeUnit

type FileSizeUnit = "B" | "KB" | "MB" | "GB" | "TB";

CurrencyConversionResult

interface CurrencyConversionResult {
  amount: number;
  exchangeRate: number;
  fromCurrency: string;
  toCurrency: string;
}

Development

Building

npm run build

TypeScript

This package is written in TypeScript and provides full type definitions. The build process generates both CommonJS and ES modules.

License

MIT © beardedtech_guy