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

unitease

v1.0.0

Published

A lightweight JavaScript library for unit conversions, supporting length, weight, temperature, and time.

Readme

UnitEase

A lightweight JavaScript library for unit conversion.

  • Converts units for length, weight, temperature, and more.
  • Supports both metric and imperial systems.

Example:

unitEase.convert(10, "meters", "feet");

Features

  • Convert between various units for length, weight, temperature, and time.
  • Check if a conversion is supported between two units.

Installation

UnitEase can be installed via npm:

npm install unitease

Usage

Import UnitEase

const UnitEase = require("unitease");

Convert Units

// Convert 10 kilograms to feet
const result = UnitEase.convert(10, "kilograms", "pounds");
console.log(result); // Output: 22.0462

Add Custom Conversion Definitions

// Add custom units and conversion factor.
// Add the factor for only one way calculation!
// Reverse factor will be automatically calculated.
UnitEase.addConversion("lightyears", "parsecs", 0.306601);
console.log(UnitEase.convert(2, "lightyears", "parsecs")); // Output: 0.613202

console.log(UnitEase.convert(2, "parsecs", "lightyears")); // Output: 6.5137

Add Custom Aliases

// Add custom aliases for any unit
UnitEase.addAlias("kilograms", "kg");
console.log(UnitEase.convert(5, "kg", "pounds")); // Output: 11.0231

Check Possible Conversions

// Get possible conversions for a temperature unit
console.log(UnitEase.getPossibleConversions("celsius"));
// Output: ['fahrenheit', 'kelvin']

Example Scenerios

  1. Find all the valid conversions for a specific unit:

    const possibilities = UnitEase.getPossibleConversions("meters");
    console.log(`You can convert meters to: ${possibilities.join(", ")}`);
    // Output: You can convert meters to: feet, inches
  2. Handle unsupported units gracefully:

    const possibilities = UnitEase.getPossibleConversions("lightyears");
    if (possibilities.length === 0) {
      console.log("No conversions available for this unit.");
    }
    // Output: No conversions available for this unit.

Check Conversion Support

// Check if a conversion from meters to feet is supported
const isSupported = UnitEase.supports("meters", "feet");
console.log(isSupported); // Output: true

Examples

// Length
console.log(UnitEase.convert(100, "meters", "feet")); // 328.084

// Weight
console.log(UnitEase.convert(5, "kilograms", "pounds")); // 11.0231

// Temperature
console.log(UnitEase.convert(100, "celsius", "fahrenheit")); // 212

// Time
console.log(UnitEase.convert(2, "hours", "minutes")); // 120

// Unsupported conversion
console.log(UnitEase.supports("kilograms", "miles")); // false

Supported Units

Length

  • feet
  • inches
  • yards
  • miles
  • meters
  • kilometers
  • centimeters
  • millimeters

Weight

  • kilograms
  • milligrams
  • grams
  • pounds
  • ounces

Temperature

  • celsius
  • fahrenheit
  • kelvin

Time

  • seconds
  • minutes
  • hours
  • days
  • weeks
  • years

How It Works

  1. The convert function checks the relevant unit type (length, weight, temperature, or time) and performs the conversion.

  2. The supports function verifies if a conversion between the given units is possible.

  3. The getPossibleConversions function lists all the units that a given unit can be converted to.


Contributing

Contributions are welcome! If you want to fix a bug, add more units for conversion or just improve UnitEase, feel free to create a pull request!


License

MIT License


Made with ❤️ by Irtaza