Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Converter<Q, U>

The return value from calling a conversion function.

internal

Type parameters

  • Q: number | bigint

  • U: Unit

Hierarchy

  • Converter

Index

Methods

Methods

to

  • to(to: U): SimplifyQuantity<Q>
  • to<B, K>(to: "best", kind?: K): BestConversion<Q, B>
  • Convert a quantity of one unit into a new unit

    Parameters

    • to: U

      The unit you want to convert to

    Returns SimplifyQuantity<Q>

    The converted value

  • Convert a measurement to the best unit for display.

    Type parameters

    • B: "deg" | "m2" | "km2" | "cm2" | "mm2" | "ac" | "sq ft" | "sq in" | "sq mi" | "bits" | "B" | "PiB" | "TiB" | "GiB" | "MiB" | "KiB" | "N" | "lbf" | "m" | "km" | "cm" | "mm" | "ft" | "in" | "yd" | "mi" | "g" | "kg" | "mg" | "lb" | "oz" | "Pa" | "F" | "C" | "s" | "ms" | "μs" | "ns" | "min" | "h" | "d" | "y" | "L" | "mL" | "tsp" | "tbsp" | "fl oz" | "cup" | "pt" | "qt" | "gal"

    • K: BestConversionKind = BestConversionKind

    Parameters

    • to: "best"

      The string best

    • Optional kind: K

      The set of units to use (defaults to 'metric')

    Returns BestConversion<Q, B>

    An object with a quantity property of the unit unit, which can be casted to a string using the toString() method

Generated using TypeDoc