ChemPare Documentation - v0.0.0
    Preparing search index...

    Function toBaseQuantity

    • Converts a quantity from its current unit to a common unit of mass or volume. This is to make it easier to compare quantities of different units.

      Parameters

      • quantity: number

        The quantity to convert

      • unit: UOM

        The unit of measure of the quantity

      Returns number | void

      The converted quantity in its base unit

      toBaseQuantity(1, UOM.KM) // Returns 1000 (meters)
      toBaseQuantity(1, UOM.LB) // Returns 453.592 (grams)
      toBaseQuantity(1, UOM.G) // Returns 1 (no conversion needed)