1.0.0 • Published 2 years ago

@fmasclef/units v1.0.0

Weekly downloads
-
License
CC BY-SA 4.0
Repository
github
Last release
2 years ago

Units converter

Convert units with ease using this lib. The following dimensions are available:

  • length
  • volume

compliance codecov code style: prettier

Usage

Method signature is convert(value: number, from: TUnit, to: TUnit). For instance, to convert 1 meter in inches, do the folowing:

ESM

import { convert } from "@fmasclef/units";
const value = convert(1, 'm', 'in');

CJS

const units = require("@fmasclef/units");
const value = units.convert(1, 'm', 'in');

Dimensions

length

systemunitname
metricQmQuettameter
RmRonnameter
YmYottameter
ZmZettameter
EmExameter
PmPetameter
TmTerameter
GmGigameter
MmMegameter
kmKilometer
hmHectometer
damDecameter
mMeter
dmDecimeter
cmCentimeter
mmMillimeter
µmMicrometer
nmNanometer
pmPicometer
fmFemtometer
amAttometer
zmZeptometer
ymYoctometer
rmRontometer
qmQuectometer
imperialmilMil
inInch
ydYard
ft-usUS Survey Foot
ftFoot
fathomFathom
miMile
nMiNautical Mile
printingptPoint

volumes

systemunitname
metricmm3Cubic Millimeter
cm3Cubic Centimeter
mlMillilitre
clCentilitre
dlDecilitre
lLitre
klKilolitre
MlMegalitre
GlGigalitre
m3Cubic meter
km3Cubic kilometer
imperialtspTeaspoon
TbsTablespoon
in3Cubic inch
fl-ozFluid Ounce
cupCup
pntPint
qtQuart
galGallon
ft3Cubic foot
yd3Cubic yard

Made & maintained with ❤️ in Lille. Freely inspired by convert-units.

CC-BY-SA 4.0

1.0.0

2 years ago