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 🙏

© 2024 – Pkg Stats / Ryan Hefner

easy-converter

v0.5.1

Published

A unit converter for Javascript

Downloads

31

Readme

easy-converter

Build Status npm version license

nodejs minimum version Windows Linux OSX

NPM

The ambitious, easy to use unit converter

Introduction

easy-converter is a unit converter that will handle weight, length, area (..) conversions.

For now it supports:

  • Length (distance)
  • Mass (weight)
  • Area
  • Computer storage

Installation:

npm install --save easy-converter

Test:

npm run test

or

npm test

Example:

var easyconverter = require('easy-converter');
var c = new easyconverter();

c.convert(1, 'cm').to('m');

The converter will return NaN in case of an unauthorized conversion.

c.convert(1, 'cm').to('b');
// => NaN

Supported units :

Distance

Unit | Abbreviation in easy-converter ------------ | :----------------------------: mil | mil inch | in foot | ft yard | yd mile | mi capefoot | cp rod | rd angstrom | A nanometer | n micron | µ millimeter | mm centimeter | cm meter | m kilometer | km light-year | ly light-day | ld light-hour | lh light-minute | lm light-second | ls

Weight

Unit | Abbreviation in easy-converter ----------------------- | :----------------------------: carat (metric) | ct point (metric) | pt dram (avdp) | adr dram (troy) | tdr grain (metric) | mgr grain (troy) | tgr gram | g hundredweight (long) | lhwt hundredweight (short) | shwt kilogram | kg megagram | Mg milligram | mg ounce (avdp) | aoz ounce (troy) | toz pennyweight | dwt pound (avdp) | alb pound (metric) | lb pound (troy) | tlb slug | slug stone | st ton-assay (long) | lAT ton-assay (short) | sAT ton (long) | ltn ton (short) | stn ton-metric | t tonne (U.S. metric ton) | t

Area

Unit | Abbreviation in easy-converter ----------------- | :----------------------------: square inch | in2 square foot | ft2 square yard | yd2 square mile | mi2 acre | ac hectare | ha square millimeter | mm2 square centimeter | cm2 square meter | m2 square kilometer | km2

Computer storage

Unit | Abbreviation in easy-converter --------- | :----------------------------: bit | b kilobit | kb megabit | Mb gigabit | Gb terabit | Tb petabit | Pb exabit | Eb zettabit | Zb yottabit | Yb nibble | nibble byte | B kilobyte | kB megabyte | MB gigabyte | GB terabyte | TB petabyte | PB exabyte | EB zettabyte | ZB yottabyte | YB

How to contribute

Just fork and create a PR! Try to match the coding style and indentation (2 spaces tabs) of the files in this repository.

To add a new converter just add add a module in lib/converters that exports an object containing units as keys and ratios as value the reference unit should have the value of 0.

Example:

module.exports = {
  "a": 1,
  "b": 2,
  "c": 3
}

This means b == 2 a and c == 3 a

Credits

Furey, Edward "Conversion Calculators" From http://www.CalculatorSoup.com - Online Calculator Resource. For the amazing formulas