@fmasclef/units
v1.0.0
Published
Units converter
Downloads
2
Maintainers
Readme
Units converter
Convert units with ease using this lib. The following dimensions are available:
- length
- volume
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
| system | unit | name | | -------- | ------ | -------------- | | metric | Qm | Quettameter | | | Rm | Ronnameter | | | Ym | Yottameter | | | Zm | Zettameter | | | Em | Exameter | | | Pm | Petameter | | | Tm | Terameter | | | Gm | Gigameter | | | Mm | Megameter | | | km | Kilometer | | | hm | Hectometer | | | dam | Decameter | | | m | Meter | | | dm | Decimeter | | | cm | Centimeter | | | mm | Millimeter | | | µm | Micrometer | | | nm | Nanometer | | | pm | Picometer | | | fm | Femtometer | | | am | Attometer | | | zm | Zeptometer | | | ym | Yoctometer | | | rm | Rontometer | | | qm | Quectometer | | imperial | mil | Mil | | | in | Inch | | | yd | Yard | | | ft-us | US Survey Foot | | | ft | Foot | | | fathom | Fathom | | | mi | Mile | | | nMi | Nautical Mile | | printing | pt | Point |
volumes
| system | unit | name | | -------- | ----- | ---------------- | | metric | mm3 | Cubic Millimeter | | | cm3 | Cubic Centimeter | | | ml | Millilitre | | | cl | Centilitre | | | dl | Decilitre | | | l | Litre | | | kl | Kilolitre | | | Ml | Megalitre | | | Gl | Gigalitre | | | m3 | Cubic meter | | | km3 | Cubic kilometer | | imperial | tsp | Teaspoon | | | Tbs | Tablespoon | | | in3 | Cubic inch | | | fl-oz | Fluid Ounce | | | cup | Cup | | | pnt | Pint | | | qt | Quart | | | gal | Gallon | | | ft3 | Cubic foot | | | yd3 | Cubic yard |
Made & maintained with ❤️ in Lille. Freely inspired by convert-units.