Options
All
  • Public
  • Public/Protected
  • All
Menu

convert

Index

References

default

Renames and re-exports convert

Type aliases

Angle

Valid angle units.

Area

Valid area units.

Data

Valid data units.

Force

Valid force units.

GetAliases

GetAliases<T>: FamilyToUnit[T]

A string literal type for all units belonging to a given conversion family.

internal

Type parameters

Length

Valid length units.

Mass

Valid mass units.

Pressure

Pressure: GetAliases<Pressure>

Valid pressure units.

Temperature

Temperature: GetAliases<Temperature>

Valid temperature units.

Time

Valid time units.

Unit

A supported unit you can convert.

Volume

Valid volume units.

Functions

convert

  • convert<Q>(angle: Q, from: "radian" | "radians" | "rad" | "rads" | "r" | "turn" | "turns" | "degree" | "degrees" | "deg" | "degs" | "°" | "gradian" | "gradians" | "gon" | "gons" | "grad" | "grads" | "grade" | "grades"): Converter<Q, Angle>
  • convert<Q>(quantity: Q, from: "square meter" | "square meters" | "square metre" | "square metres" | "m²" | "m2" | "square petameter" | "square petametre" | "square petameters" | "square petametres" | "Pm²" | "Pm2" | "square terameter" | "square terametre" | "square terameters" | "square terametres" | "Tm²" | "Tm2" | "square gigameter" | "square gigametre" | "square gigameters" | "square gigametres" | "Gm²" | "Gm2" | "square megameter" | "square megametre" | "square megameters" | "square megametres" | "Mm²" | "Mm2" | "square kilometer" | "square kilometre" | "square kilometers" | "square kilometres" | "km²" | "km2" | "square hectometer" | "square hectometre" | "square hectometers" | "square hectometres" | "hm²" | "hm2" | "square decameter" | "square decametre" | "square decameters" | "square decametres" | "dam²" | "dam2" | "square decimeter" | "square decimetre" | "square decimeters" | "square decimetres" | "dm²" | "dm2" | "square centimeter" | "square centimetre" | "square centimeters" | "square centimetres" | "cm²" | "cm2" | "square millimeter" | "square millimetre" | "square millimeters" | "square millimetres" | "mm²" | "mm2" | "square micrometer" | "square micrometre" | "square micrometers" | "square micrometres" | "μm²" | "μm2" | "square nanometer" | "square nanometre" | "square nanometers" | "square nanometres" | "nm²" | "nm2" | "square picometer" | "square picometre" | "square picometers" | "square picometres" | "pm²" | "pm2" | "square femtometer" | "square femtometre" | "square femtometers" | "square femtometres" | "fm²" | "fm2" | "acre" | "acres" | "ac" | "centiare" | "centiares" | "ca" | "deciare" | "deciares" | "da" | "are" | "ares" | "decare" | "decares" | "daa" | "hectare" | "hectares" | "ha" | "square foot" | "square feet" | "sq ft" | "square inch" | "square inches" | "sq in" | "square yard" | "square yards" | "sq yd" | "square mile" | "square miles" | "sq mi"): Converter<Q, Area>
  • convert<Q>(quantity: Q, from: "bit" | "bits" | "b" | "pebibit" | "pebibits" | "Pib" | "tebibit" | "tebibits" | "Tib" | "gibibit" | "gibibits" | "Gib" | "mebibit" | "mebibits" | "Mib" | "kibibit" | "kibibits" | "Kib" | "petabit" | "petabits" | "Pb" | "terabit" | "terabits" | "Tb" | "gigabit" | "gigabits" | "Gb" | "megabit" | "megabits" | "Mb" | "kilobit" | "kilobits" | "kb" | "hectobit" | "hectobits" | "hb" | "decabit" | "decabits" | "dab" | "decibit" | "decibits" | "db" | "centibit" | "centibits" | "cb" | "millibit" | "millibits" | "mb" | "microbit" | "microbits" | "μb" | "nanobit" | "nanobits" | "nb" | "picobit" | "picobits" | "pb" | "femtobit" | "femtobits" | "fb" | "nibble" | "nibbles" | "semioctet" | "semioctets" | "halfbyte" | "halfbytes" | "byte" | "bytes" | "octect" | "octects" | "B" | "pebibyte" | "pebibytes" | "PiB" | "tebibyte" | "tebibytes" | "TiB" | "gibibyte" | "gibibytes" | "GiB" | "mebibyte" | "mebibytes" | "MiB" | "kibibyte" | "kibibytes" | "KiB" | "petabyte" | "petabytes" | "PB" | "terabyte" | "terabytes" | "TB" | "gigabyte" | "gigabytes" | "GB" | "megabyte" | "megabytes" | "MB" | "kilobyte" | "kilobytes" | "kB" | "hectobyte" | "hectobytes" | "hB" | "decabyte" | "decabytes" | "daB" | "decibyte" | "decibytes" | "dB" | "centibyte" | "centibytes" | "cB" | "millibyte" | "millibytes" | "mB" | "microbyte" | "microbytes" | "μB" | "nanobyte" | "nanobytes" | "nB" | "picobyte" | "picobytes" | "pB" | "femtobyte" | "femtobytes" | "fB" | "hextet" | "hextets"): Converter<Q, Data>
  • convert<Q>(quantity: Q, from: "newton" | "newtons" | "N" | "dyne" | "dynes" | "dyn" | "kilogram-force" | "kgf" | "kilopond" | "kiloponds" | "kp" | "pound of force" | "pound-force" | "lbf" | "poundal" | "poundals" | "pdl"): Converter<Q, Force>
  • convert<Q>(length: Q, from: "meter" | "meters" | "metre" | "metres" | "m" | "petameter" | "petametre" | "petameters" | "petametres" | "Pm" | "terameter" | "terametre" | "terameters" | "terametres" | "Tm" | "gigameter" | "gigametre" | "gigameters" | "gigametres" | "Gm" | "megameter" | "megametre" | "megameters" | "megametres" | "Mm" | "kilometer" | "kilometre" | "kilometers" | "kilometres" | "km" | "hectometer" | "hectometre" | "hectometers" | "hectometres" | "hm" | "decameter" | "decametre" | "decameters" | "decametres" | "dam" | "decimeter" | "decimetre" | "decimeters" | "decimetres" | "dm" | "centimeter" | "centimetre" | "centimeters" | "centimetres" | "cm" | "millimeter" | "millimetre" | "millimeters" | "millimetres" | "mm" | "micrometer" | "micrometre" | "micrometers" | "micrometres" | "μm" | "nanometer" | "nanometre" | "nanometers" | "nanometres" | "nm" | "picometer" | "picometre" | "picometers" | "picometres" | "pm" | "femtometer" | "femtometre" | "femtometers" | "femtometres" | "fm" | "foot" | "feet" | "ft" | "'" | "inch" | "inches" | "in" | "\"" | "yard" | "yards" | "yd" | "mile" | "miles" | "mi" | "nautical mile" | "nautical miles" | "M" | "NM" | "nmi"): Converter<Q, Length>
  • convert<Q>(quantity: Q, from: "gram" | "grams" | "g" | "petagram" | "petagrams" | "Pg" | "teragram" | "teragrams" | "Tg" | "gigagram" | "gigagrams" | "Gg" | "megagram" | "megagrams" | "Mg" | "kilogram" | "kilograms" | "kg" | "hectogram" | "hectograms" | "hg" | "decagram" | "decagrams" | "dag" | "decigram" | "decigrams" | "dg" | "centigram" | "centigrams" | "cg" | "milligram" | "milligrams" | "mg" | "microgram" | "micrograms" | "μg" | "nanogram" | "nanograms" | "ng" | "picogram" | "picograms" | "pg" | "femtogram" | "femtograms" | "fg" | "tonne" | "tonnes" | "metric ton" | "metric tons" | "t" | "pound" | "pounds" | "lb" | "stone" | "stones" | "st" | "ounce" | "ounces" | "oz" | "℥" | "short ton" | "short tons" | "US ton" | "US tons" | "long ton" | "long tons" | "imperial ton" | "imperial tons" | "displacement ton" | "displacement tons"): Converter<Q, Mass>
  • convert<Q>(quantity: Q, from: "pascal" | "pascals" | "Pa" | "petapascal" | "petapascals" | "PPa" | "terapascal" | "terapascals" | "TPa" | "gigapascal" | "gigapascals" | "GPa" | "megapascal" | "megapascals" | "MPa" | "kilopascal" | "kilopascals" | "kPa" | "hectopascal" | "hectopascals" | "hPa" | "decapascal" | "decapascals" | "daPa" | "decipascal" | "decipascals" | "dPa" | "centipascal" | "centipascals" | "cPa" | "millipascal" | "millipascals" | "mPa" | "micropascal" | "micropascals" | "μPa" | "nanopascal" | "nanopascals" | "nPa" | "picopascal" | "picopascals" | "pPa" | "femtopascal" | "femtopascals" | "fPa" | "bar" | "bars" | "petabar" | "petabars" | "Pbar" | "terabar" | "terabars" | "Tbar" | "gigabar" | "gigabars" | "Gbar" | "megabar" | "megabars" | "Mbar" | "kilobar" | "kilobars" | "kbar" | "hectobar" | "hectobars" | "hbar" | "decabar" | "decabars" | "dabar" | "decibar" | "decibars" | "dbar" | "centibar" | "centibars" | "cbar" | "millibar" | "millibars" | "mbar" | "microbar" | "microbars" | "μbar" | "nanobar" | "nanobars" | "nbar" | "picobar" | "picobars" | "pbar" | "femtobar" | "femtobars" | "fbar" | "torr" | "torrs" | "Torr" | "millitorr" | "mTorr" | "atmosphere" | "atmospheres" | "atm"): Converter<Q, Pressure>
  • convert<Q>(quantity: Q, from: "kelvin" | "kelvins" | "K" | "petakelvin" | "petakelvins" | "PK" | "terakelvin" | "terakelvins" | "TK" | "gigakelvin" | "gigakelvins" | "GK" | "megakelvin" | "megakelvins" | "MK" | "kilokelvin" | "kilokelvins" | "kK" | "hectokelvin" | "hectokelvins" | "hK" | "decakelvin" | "decakelvins" | "daK" | "decikelvin" | "decikelvins" | "dK" | "centikelvin" | "centikelvins" | "cK" | "millikelvin" | "millikelvins" | "mK" | "microkelvin" | "microkelvins" | "μK" | "nanokelvin" | "nanokelvins" | "nK" | "picokelvin" | "picokelvins" | "pK" | "femtokelvin" | "femtokelvins" | "fK" | "fahrenheit" | "F" | "celsius" | "C" | "rankine" | "R"): Converter<Q, Temperature>
  • convert<Q>(duration: Q, from: "second" | "seconds" | "s" | "petasecond" | "petaseconds" | "Ps" | "terasecond" | "teraseconds" | "Ts" | "gigasecond" | "gigaseconds" | "Gs" | "megasecond" | "megaseconds" | "Ms" | "kilosecond" | "kiloseconds" | "ks" | "hectosecond" | "hectoseconds" | "hs" | "decasecond" | "decaseconds" | "das" | "decisecond" | "deciseconds" | "ds" | "centisecond" | "centiseconds" | "cs" | "millisecond" | "milliseconds" | "ms" | "microsecond" | "microseconds" | "μs" | "nanosecond" | "nanoseconds" | "ns" | "picosecond" | "picoseconds" | "ps" | "femtosecond" | "femtoseconds" | "fs" | "minute" | "minutes" | "min" | "hour" | "hours" | "h" | "milliday" | "millidays" | "md" | "day" | "days" | "d" | "week" | "weeks" | "wk" | "fortnight" | "fortnights" | "fn" | "month" | "months" | "mo" | "year" | "years" | "a" | "y" | "yr" | "decade" | "decades" | "dec" | "century" | "centuries" | "millennium" | "millennia" | "moment" | "moments" | "shake" | "shakes" | "time unit" | "TU" | "svedberg" | "svedbergs" | "S"): Converter<Q, Time>
  • convert<Q>(quantity: Q, from: "cubic meter" | "cubic meters" | "cubic metre" | "cubic metres" | "stere" | "steres" | "m³" | "m3" | "cubic petameter" | "cubic petameters" | "Pm3" | "Pm³" | "cubic terameter" | "cubic terameters" | "Tm3" | "Tm³" | "cubic gigameter" | "cubic gigameters" | "Gm3" | "Gm³" | "cubic megameter" | "cubic megameters" | "Mm3" | "Mm³" | "cubic kilometer" | "cubic kilometers" | "km3" | "km³" | "cubic hectometer" | "cubic hectometers" | "hm3" | "hm³" | "cubic decameter" | "cubic decameters" | "dam3" | "dam³" | "cubic decimeter" | "cubic decimeters" | "dm3" | "dm³" | "cubic centimeter" | "cubic centimeters" | "cm3" | "cm³" | "cubic millimeter" | "cubic millimeters" | "mm3" | "mm³" | "cubic micrometer" | "cubic micrometers" | "μm3" | "μm³" | "cubic nanometer" | "cubic nanometers" | "nm3" | "nm³" | "cubic picometer" | "cubic picometers" | "pm3" | "pm³" | "cubic femtometer" | "cubic femtometers" | "fm3" | "fm³" | "liter" | "liters" | "litre" | "litres" | "l" | "L" | "petaliter" | "petaliters" | "petalitre" | "petalitres" | "Pl" | "PL" | "teraliter" | "teraliters" | "teralitre" | "teralitres" | "Tl" | "TL" | "gigaliter" | "gigaliters" | "gigalitre" | "gigalitres" | "Gl" | "GL" | "megaliter" | "megaliters" | "megalitre" | "megalitres" | "Ml" | "ML" | "kiloliter" | "kiloliters" | "kilolitre" | "kilolitres" | "kl" | "kL" | "hectoliter" | "hectoliters" | "hectolitre" | "hectolitres" | "hl" | "hL" | "decaliter" | "decaliters" | "decalitre" | "decalitres" | "dal" | "daL" | "deciliter" | "deciliters" | "decilitre" | "decilitres" | "dl" | "dL" | "centiliter" | "centiliters" | "centilitre" | "centilitres" | "cl" | "cL" | "milliliter" | "milliliters" | "millilitre" | "millilitres" | "ml" | "mL" | "microliter" | "microliters" | "microlitre" | "microlitres" | "μl" | "μL" | "nanoliter" | "nanoliters" | "nanolitre" | "nanolitres" | "nl" | "nL" | "picoliter" | "picoliters" | "picolitre" | "picolitres" | "pl" | "pL" | "femtoliter" | "femtoliters" | "femtolitre" | "femtolitres" | "fl" | "fL" | "cubic mile" | "cubic miles" | "cu mi" | "mi3" | "mi³" | "acre-foot" | "acre-feet" | "ac⋅ft" | "ac ft" | "cubic yard" | "cubic yards" | "cu yd" | "yd3" | "yd³" | "cubic foot" | "cubic feet" | "cu ft" | "ft3" | "ft³" | "board foot" | "board feet" | "cubic inch" | "cubic inches" | "cu in" | "in3" | "in³" | "measurement ton" | "measurement tons" | "MTON" | "imperial barrel" | "imperial barrels" | "imp bbl" | "imperial bushel" | "imperial bushels" | "imp bsh" | "imp bu" | "imperial peck" | "imperial pecks" | "pk" | "imp pk" | "imperial gallon" | "imperial gallons" | "imp gal" | "imperial quart" | "imperial quarts" | "imp qt" | "imperial pint" | "imperial pints" | "imp pt" | "imperial fluid ounce" | "imperial fluid ounces" | "imp fl oz" | "teaspoon" | "teaspoons" | "US teaspoon" | "US teaspoons" | "tsp" | "tablespoon" | "tablespoons" | "US tablespoon" | "US tablespoons" | "tbsp" | "US fluid ounce" | "US fluid ounces" | "fl oz" | "fl. oz." | "oz. fl." | "cup" | "cups" | "US legal cup" | "US legal cups" | "c" | "pint" | "pints" | "US liquid pint" | "US liquid pints" | "pt" | "p" | "quart" | "quarts" | "US liquid quart" | "US liquid quarts" | "qt" | "gallon" | "gallons" | "US liquid gallon" | "US liquid gallons" | "gal" | "US dry barrel" | "US dry barrels" | "US dry bbl" | "US bushel" | "US bushels" | "US bsh" | "US bu" | "US peck" | "US pk" | "US dry gallon" | "US dry gal" | "US dry quart" | "US dry qt" | "US dry pint" | "US dry pt"): Converter<Q, Volume>
  • Convert a given angle into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • angle: Q

      The angle you want to convert

    • from: "radian" | "radians" | "rad" | "rads" | "r" | "turn" | "turns" | "degree" | "degrees" | "deg" | "degs" | "°" | "gradian" | "gradians" | "gon" | "gons" | "grad" | "grads" | "grade" | "grades"

      The angle type you are converting from

    Returns Converter<Q, Angle>

    An object you can use to convert the provided quantity

  • Convert a given area into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • quantity: Q

      The area you want to convert

    • from: "square meter" | "square meters" | "square metre" | "square metres" | "m²" | "m2" | "square petameter" | "square petametre" | "square petameters" | "square petametres" | "Pm²" | "Pm2" | "square terameter" | "square terametre" | "square terameters" | "square terametres" | "Tm²" | "Tm2" | "square gigameter" | "square gigametre" | "square gigameters" | "square gigametres" | "Gm²" | "Gm2" | "square megameter" | "square megametre" | "square megameters" | "square megametres" | "Mm²" | "Mm2" | "square kilometer" | "square kilometre" | "square kilometers" | "square kilometres" | "km²" | "km2" | "square hectometer" | "square hectometre" | "square hectometers" | "square hectometres" | "hm²" | "hm2" | "square decameter" | "square decametre" | "square decameters" | "square decametres" | "dam²" | "dam2" | "square decimeter" | "square decimetre" | "square decimeters" | "square decimetres" | "dm²" | "dm2" | "square centimeter" | "square centimetre" | "square centimeters" | "square centimetres" | "cm²" | "cm2" | "square millimeter" | "square millimetre" | "square millimeters" | "square millimetres" | "mm²" | "mm2" | "square micrometer" | "square micrometre" | "square micrometers" | "square micrometres" | "μm²" | "μm2" | "square nanometer" | "square nanometre" | "square nanometers" | "square nanometres" | "nm²" | "nm2" | "square picometer" | "square picometre" | "square picometers" | "square picometres" | "pm²" | "pm2" | "square femtometer" | "square femtometre" | "square femtometers" | "square femtometres" | "fm²" | "fm2" | "acre" | "acres" | "ac" | "centiare" | "centiares" | "ca" | "deciare" | "deciares" | "da" | "are" | "ares" | "decare" | "decares" | "daa" | "hectare" | "hectares" | "ha" | "square foot" | "square feet" | "sq ft" | "square inch" | "square inches" | "sq in" | "square yard" | "square yards" | "sq yd" | "square mile" | "square miles" | "sq mi"

      The unit of area you are converting from

    Returns Converter<Q, Area>

    An object you can use to convert the provided quantity

  • Convert a given quantity of data into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • quantity: Q

      The quantity of data you want to convert

    • from: "bit" | "bits" | "b" | "pebibit" | "pebibits" | "Pib" | "tebibit" | "tebibits" | "Tib" | "gibibit" | "gibibits" | "Gib" | "mebibit" | "mebibits" | "Mib" | "kibibit" | "kibibits" | "Kib" | "petabit" | "petabits" | "Pb" | "terabit" | "terabits" | "Tb" | "gigabit" | "gigabits" | "Gb" | "megabit" | "megabits" | "Mb" | "kilobit" | "kilobits" | "kb" | "hectobit" | "hectobits" | "hb" | "decabit" | "decabits" | "dab" | "decibit" | "decibits" | "db" | "centibit" | "centibits" | "cb" | "millibit" | "millibits" | "mb" | "microbit" | "microbits" | "μb" | "nanobit" | "nanobits" | "nb" | "picobit" | "picobits" | "pb" | "femtobit" | "femtobits" | "fb" | "nibble" | "nibbles" | "semioctet" | "semioctets" | "halfbyte" | "halfbytes" | "byte" | "bytes" | "octect" | "octects" | "B" | "pebibyte" | "pebibytes" | "PiB" | "tebibyte" | "tebibytes" | "TiB" | "gibibyte" | "gibibytes" | "GiB" | "mebibyte" | "mebibytes" | "MiB" | "kibibyte" | "kibibytes" | "KiB" | "petabyte" | "petabytes" | "PB" | "terabyte" | "terabytes" | "TB" | "gigabyte" | "gigabytes" | "GB" | "megabyte" | "megabytes" | "MB" | "kilobyte" | "kilobytes" | "kB" | "hectobyte" | "hectobytes" | "hB" | "decabyte" | "decabytes" | "daB" | "decibyte" | "decibytes" | "dB" | "centibyte" | "centibytes" | "cB" | "millibyte" | "millibytes" | "mB" | "microbyte" | "microbytes" | "μB" | "nanobyte" | "nanobytes" | "nB" | "picobyte" | "picobytes" | "pB" | "femtobyte" | "femtobytes" | "fB" | "hextet" | "hextets"

      The unit of data you are converting from

    Returns Converter<Q, Data>

    An object you can use to convert the provided quantity

  • Convert a given quantity of force into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • quantity: Q

      The quantity of force you want to convert

    • from: "newton" | "newtons" | "N" | "dyne" | "dynes" | "dyn" | "kilogram-force" | "kgf" | "kilopond" | "kiloponds" | "kp" | "pound of force" | "pound-force" | "lbf" | "poundal" | "poundals" | "pdl"

      The unit of force you are converting from

    Returns Converter<Q, Force>

    An object you can use to convert the provided quantity

  • Convert a given length into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • length: Q

      The length you want to convert

    • from: "meter" | "meters" | "metre" | "metres" | "m" | "petameter" | "petametre" | "petameters" | "petametres" | "Pm" | "terameter" | "terametre" | "terameters" | "terametres" | "Tm" | "gigameter" | "gigametre" | "gigameters" | "gigametres" | "Gm" | "megameter" | "megametre" | "megameters" | "megametres" | "Mm" | "kilometer" | "kilometre" | "kilometers" | "kilometres" | "km" | "hectometer" | "hectometre" | "hectometers" | "hectometres" | "hm" | "decameter" | "decametre" | "decameters" | "decametres" | "dam" | "decimeter" | "decimetre" | "decimeters" | "decimetres" | "dm" | "centimeter" | "centimetre" | "centimeters" | "centimetres" | "cm" | "millimeter" | "millimetre" | "millimeters" | "millimetres" | "mm" | "micrometer" | "micrometre" | "micrometers" | "micrometres" | "μm" | "nanometer" | "nanometre" | "nanometers" | "nanometres" | "nm" | "picometer" | "picometre" | "picometers" | "picometres" | "pm" | "femtometer" | "femtometre" | "femtometers" | "femtometres" | "fm" | "foot" | "feet" | "ft" | "'" | "inch" | "inches" | "in" | "\"" | "yard" | "yards" | "yd" | "mile" | "miles" | "mi" | "nautical mile" | "nautical miles" | "M" | "NM" | "nmi"

      The unit of length you are converting from

    Returns Converter<Q, Length>

    An object you can use to convert the provided quantity

  • Convert a given quantity of mass into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • quantity: Q

      The quantity of mass you want to convert

    • from: "gram" | "grams" | "g" | "petagram" | "petagrams" | "Pg" | "teragram" | "teragrams" | "Tg" | "gigagram" | "gigagrams" | "Gg" | "megagram" | "megagrams" | "Mg" | "kilogram" | "kilograms" | "kg" | "hectogram" | "hectograms" | "hg" | "decagram" | "decagrams" | "dag" | "decigram" | "decigrams" | "dg" | "centigram" | "centigrams" | "cg" | "milligram" | "milligrams" | "mg" | "microgram" | "micrograms" | "μg" | "nanogram" | "nanograms" | "ng" | "picogram" | "picograms" | "pg" | "femtogram" | "femtograms" | "fg" | "tonne" | "tonnes" | "metric ton" | "metric tons" | "t" | "pound" | "pounds" | "lb" | "stone" | "stones" | "st" | "ounce" | "ounces" | "oz" | "℥" | "short ton" | "short tons" | "US ton" | "US tons" | "long ton" | "long tons" | "imperial ton" | "imperial tons" | "displacement ton" | "displacement tons"

      The unit of mass you are converting from

    Returns Converter<Q, Mass>

    An object you can use to convert the provided quantity

  • Convert a given quantity of pressure into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • quantity: Q

      The quantity of pressure you want to convert

    • from: "pascal" | "pascals" | "Pa" | "petapascal" | "petapascals" | "PPa" | "terapascal" | "terapascals" | "TPa" | "gigapascal" | "gigapascals" | "GPa" | "megapascal" | "megapascals" | "MPa" | "kilopascal" | "kilopascals" | "kPa" | "hectopascal" | "hectopascals" | "hPa" | "decapascal" | "decapascals" | "daPa" | "decipascal" | "decipascals" | "dPa" | "centipascal" | "centipascals" | "cPa" | "millipascal" | "millipascals" | "mPa" | "micropascal" | "micropascals" | "μPa" | "nanopascal" | "nanopascals" | "nPa" | "picopascal" | "picopascals" | "pPa" | "femtopascal" | "femtopascals" | "fPa" | "bar" | "bars" | "petabar" | "petabars" | "Pbar" | "terabar" | "terabars" | "Tbar" | "gigabar" | "gigabars" | "Gbar" | "megabar" | "megabars" | "Mbar" | "kilobar" | "kilobars" | "kbar" | "hectobar" | "hectobars" | "hbar" | "decabar" | "decabars" | "dabar" | "decibar" | "decibars" | "dbar" | "centibar" | "centibars" | "cbar" | "millibar" | "millibars" | "mbar" | "microbar" | "microbars" | "μbar" | "nanobar" | "nanobars" | "nbar" | "picobar" | "picobars" | "pbar" | "femtobar" | "femtobars" | "fbar" | "torr" | "torrs" | "Torr" | "millitorr" | "mTorr" | "atmosphere" | "atmospheres" | "atm"

      The unit of pressure you are converting from

    Returns Converter<Q, Pressure>

    An object you can use to convert the provided quantity

  • Convert a given temperature into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • quantity: Q

      The quantity of temperature you want to convert

    • from: "kelvin" | "kelvins" | "K" | "petakelvin" | "petakelvins" | "PK" | "terakelvin" | "terakelvins" | "TK" | "gigakelvin" | "gigakelvins" | "GK" | "megakelvin" | "megakelvins" | "MK" | "kilokelvin" | "kilokelvins" | "kK" | "hectokelvin" | "hectokelvins" | "hK" | "decakelvin" | "decakelvins" | "daK" | "decikelvin" | "decikelvins" | "dK" | "centikelvin" | "centikelvins" | "cK" | "millikelvin" | "millikelvins" | "mK" | "microkelvin" | "microkelvins" | "μK" | "nanokelvin" | "nanokelvins" | "nK" | "picokelvin" | "picokelvins" | "pK" | "femtokelvin" | "femtokelvins" | "fK" | "fahrenheit" | "F" | "celsius" | "C" | "rankine" | "R"

      The unit of temperature are converting from

    Returns Converter<Q, Temperature>

    An object you can use to convert the provided quantity

  • Convert a given duration of time into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • duration: Q

      The duration of time you want to convert

    • from: "second" | "seconds" | "s" | "petasecond" | "petaseconds" | "Ps" | "terasecond" | "teraseconds" | "Ts" | "gigasecond" | "gigaseconds" | "Gs" | "megasecond" | "megaseconds" | "Ms" | "kilosecond" | "kiloseconds" | "ks" | "hectosecond" | "hectoseconds" | "hs" | "decasecond" | "decaseconds" | "das" | "decisecond" | "deciseconds" | "ds" | "centisecond" | "centiseconds" | "cs" | "millisecond" | "milliseconds" | "ms" | "microsecond" | "microseconds" | "μs" | "nanosecond" | "nanoseconds" | "ns" | "picosecond" | "picoseconds" | "ps" | "femtosecond" | "femtoseconds" | "fs" | "minute" | "minutes" | "min" | "hour" | "hours" | "h" | "milliday" | "millidays" | "md" | "day" | "days" | "d" | "week" | "weeks" | "wk" | "fortnight" | "fortnights" | "fn" | "month" | "months" | "mo" | "year" | "years" | "a" | "y" | "yr" | "decade" | "decades" | "dec" | "century" | "centuries" | "millennium" | "millennia" | "moment" | "moments" | "shake" | "shakes" | "time unit" | "TU" | "svedberg" | "svedbergs" | "S"

      The unit of time you are converting from

    Returns Converter<Q, Time>

    An object you can use to convert the provided quantity

  • Convert a given quantity of volume into another unit.

    Type parameters

    • Q: number | bigint

    Parameters

    • quantity: Q

      The quantity of volume you want to convert

    • from: "cubic meter" | "cubic meters" | "cubic metre" | "cubic metres" | "stere" | "steres" | "m³" | "m3" | "cubic petameter" | "cubic petameters" | "Pm3" | "Pm³" | "cubic terameter" | "cubic terameters" | "Tm3" | "Tm³" | "cubic gigameter" | "cubic gigameters" | "Gm3" | "Gm³" | "cubic megameter" | "cubic megameters" | "Mm3" | "Mm³" | "cubic kilometer" | "cubic kilometers" | "km3" | "km³" | "cubic hectometer" | "cubic hectometers" | "hm3" | "hm³" | "cubic decameter" | "cubic decameters" | "dam3" | "dam³" | "cubic decimeter" | "cubic decimeters" | "dm3" | "dm³" | "cubic centimeter" | "cubic centimeters" | "cm3" | "cm³" | "cubic millimeter" | "cubic millimeters" | "mm3" | "mm³" | "cubic micrometer" | "cubic micrometers" | "μm3" | "μm³" | "cubic nanometer" | "cubic nanometers" | "nm3" | "nm³" | "cubic picometer" | "cubic picometers" | "pm3" | "pm³" | "cubic femtometer" | "cubic femtometers" | "fm3" | "fm³" | "liter" | "liters" | "litre" | "litres" | "l" | "L" | "petaliter" | "petaliters" | "petalitre" | "petalitres" | "Pl" | "PL" | "teraliter" | "teraliters" | "teralitre" | "teralitres" | "Tl" | "TL" | "gigaliter" | "gigaliters" | "gigalitre" | "gigalitres" | "Gl" | "GL" | "megaliter" | "megaliters" | "megalitre" | "megalitres" | "Ml" | "ML" | "kiloliter" | "kiloliters" | "kilolitre" | "kilolitres" | "kl" | "kL" | "hectoliter" | "hectoliters" | "hectolitre" | "hectolitres" | "hl" | "hL" | "decaliter" | "decaliters" | "decalitre" | "decalitres" | "dal" | "daL" | "deciliter" | "deciliters" | "decilitre" | "decilitres" | "dl" | "dL" | "centiliter" | "centiliters" | "centilitre" | "centilitres" | "cl" | "cL" | "milliliter" | "milliliters" | "millilitre" | "millilitres" | "ml" | "mL" | "microliter" | "microliters" | "microlitre" | "microlitres" | "μl" | "μL" | "nanoliter" | "nanoliters" | "nanolitre" | "nanolitres" | "nl" | "nL" | "picoliter" | "picoliters" | "picolitre" | "picolitres" | "pl" | "pL" | "femtoliter" | "femtoliters" | "femtolitre" | "femtolitres" | "fl" | "fL" | "cubic mile" | "cubic miles" | "cu mi" | "mi3" | "mi³" | "acre-foot" | "acre-feet" | "ac⋅ft" | "ac ft" | "cubic yard" | "cubic yards" | "cu yd" | "yd3" | "yd³" | "cubic foot" | "cubic feet" | "cu ft" | "ft3" | "ft³" | "board foot" | "board feet" | "cubic inch" | "cubic inches" | "cu in" | "in3" | "in³" | "measurement ton" | "measurement tons" | "MTON" | "imperial barrel" | "imperial barrels" | "imp bbl" | "imperial bushel" | "imperial bushels" | "imp bsh" | "imp bu" | "imperial peck" | "imperial pecks" | "pk" | "imp pk" | "imperial gallon" | "imperial gallons" | "imp gal" | "imperial quart" | "imperial quarts" | "imp qt" | "imperial pint" | "imperial pints" | "imp pt" | "imperial fluid ounce" | "imperial fluid ounces" | "imp fl oz" | "teaspoon" | "teaspoons" | "US teaspoon" | "US teaspoons" | "tsp" | "tablespoon" | "tablespoons" | "US tablespoon" | "US tablespoons" | "tbsp" | "US fluid ounce" | "US fluid ounces" | "fl oz" | "fl. oz." | "oz. fl." | "cup" | "cups" | "US legal cup" | "US legal cups" | "c" | "pint" | "pints" | "US liquid pint" | "US liquid pints" | "pt" | "p" | "quart" | "quarts" | "US liquid quart" | "US liquid quarts" | "qt" | "gallon" | "gallons" | "US liquid gallon" | "US liquid gallons" | "gal" | "US dry barrel" | "US dry barrels" | "US dry bbl" | "US bushel" | "US bushels" | "US bsh" | "US bu" | "US peck" | "US pk" | "US dry gallon" | "US dry gal" | "US dry quart" | "US dry qt" | "US dry pint" | "US dry pt"

      The unit of volume you are converting from

    Returns Converter<Q, Volume>

    An object you can use to convert the provided quantity

convertMany

  • Convert several values in a string into a single unit.

    example
    convertMany('1d 12h').to('hours') === 36;
    

    Parameters

    • value: string

      The string to parse as values

    Returns Converter<number, Unit>

ms

  • ms(value: string): number
  • Convert a duration string to a duration in milliseconds.

    You can use this function as a replacement for the duration string to millisecond duration number that the popular ms package provides.

    If you really care about performance you should just use convertMany directly.

    example
    ms('1d 2h 30min'); // 95400000
    

    Parameters

    • value: string

      Duration string to convert

    Returns number

    A duration in milliseconds

Generated using TypeDoc