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

@johnrob1880/conversions

v1.0.2

Published

Utility to ease the pain of converting values from one unit to another. Heavily inspired by [ben-ng/convert-units](https://github.com/ben-ng/convert-units).

Downloads

10

Readme

@johnrob1880/conversions

Utility to ease the pain of converting values from one unit to another. Heavily inspired by ben-ng/convert-units.

Install

Install the conversion library via npm:

npm install @johnrob1880/conversions --save

Install the conversion library via yarn:

yarn add @johnrob1880/conversions

Example

import convert from '@johnrob1880/conversions'
// import conversion systems as needed
import length from '@johnrob1880/conversions/definitions/length'
import volume from '@johnrob1880/conversions/definitions/volume'


let converter = convert().use(volume, length/*, .... */)

// length
console.log(converter.value(1).from('m').to('cm')) // outputs 100

// volume
console.log(converter.value(1).from('gal').to('l', 4 /* optional precision */)) // outputs 3.7854

Available definitions

// g-force, m/s2
import acceleration from '@johnrob1880/conversions/definitions/acceleration'

// rad, deg, grad, arcmin, arcsec
import angle from '@johnrob1880/conversions/definitions/angle'

// VA, mVA, kVA, MVA, GVA
import apparentPower from '@johnrob1880/conversions/definitions/apparentPower'

// metric   ---> mm2, cm2, m2, ha, km2
// imperial ---> in2, yd2, ft2, ac, mi2
import area from '@johnrob1880/conversions/definitions/area'

// c, mC, μC, nC, pC
import charge from '@johnrob1880/conversions/definitions/charge'

// A, mA, kA
import current from '@johnrob1880/conversions/definitions/current'

// bits  ---> b, Kb, Mb, Gb, Tb,
// bytes ---> B, KB, MB, GB, TB, 
import digital from '@johnrob1880/conversions/definitions/digital'

// ea, dz
import each from '@johnrob1880/conversions/definitions/each'

// Wh, mWh, kWh, MWh, GWh, J, kJ
import energy from '@johnrob1880/conversions/definitions/energy'

// N, kN, lbf
import force from '@johnrob1880/conversions/definitions/force'

// mHz, Hz, kHz, MHz, GHz, THz, rpm, deg/s, rad/s
import frequency from '@johnrob1880/conversions/definitions/frequency'

// metric   ---> lx
// imperial ---> ft-cd
import illuminance from '@johnrob1880/conversions/definitions/illuminance'

// metric   ---> mm, cm, m, km
// imperial ---> in, yd, ft-us, ft, fathom, mi, nMi
import length from '@johnrob1880/conversions/definitions/length'

// metric   ---> mcg, mg, g, kg, mt
// imperial ---> oz, lb, t
import mass from '@johnrob1880/conversions/definitions/mass'

// metric   ---> min/km, s/m
// imperial ---> min/mi, s/ft
import pace from '@johnrob1880/conversions/definitions/pace'

// ppm, ppb, ppt, ppq
import partsPer from '@johnrob1880/conversions/definitions/partsPer'

// W, mW, kW, MW, GW
import power from '@johnrob1880/conversions/definitions/power'

// metric   ---> Pa, kPa, MPa, hPa, bar, torr
// imperial ---> psi, ksi
import pressure from '@johnrob1880/conversions/definitions/pressure'

// VARh, mVARh, kVARh, MVARh, GVARh
import reactiveEnergy from '@johnrob1880/conversions/definitions/reactiveEnergy'

// VAR, mVAR, kVAR, MVAR, GVAR
import reactivePower from '@johnrob1880/conversions/definitions/reactivePower'

// metric   ---> m/s, km/h
// imperial ---> m/h, knot, ft/s
import speed from '@johnrob1880/conversions/definitions/speed'

// metric   ---> C, K
// imperial ---> F, R
import temperature from '@johnrob1880/conversions/definitions/temperature'

// ns, mu, ms, s, min, h, d, week, month, year
import time from '@johnrob1880/conversions/definitions/time'

// V, mV, kV
import voltage from '@johnrob1880/conversions/definitions/voltage'

// metric   ---> mm3, cm3, ml, cl, dl, l, kl, m3, km3
// imperial ---> tsp, Tbs, in3, fl-oz, cup, pnt, qt, gal, ft3, yd3
// swedish ---> krm, tsk, msk, kkp, glas, kanna
import volume from '@johnrob1880/conversions/definitions/volume'

// metric   ---> mm3/s, cm3/s, ml/s, cl/s, dl/s, l/s, l/min, l/h, kl/s
//               kl/min, kl/h, m3/s, m3/min, m3/h, km3/s
// imperial ---> tsp/s, Tbs/s, in3/s, in3/min, in3/h, fl-oz/s, fl-oz/min
//               fl-oz/h, cup/s, pnt/s, pnt/min, pnt/h, qt/s
//               gal/s, gal/min, gal/h, ft3/s, ft3/min, ft3/h
//               yd3/s, yd3/min, yd3/h
import volumeFlowRate from '@johnrob1880/conversions/definitions/volumeFlowRate'

License

MIT.