• Converts a numeric value from one unit to another, formats the result, and returns an object containing the converted value, display strings, and the unit.

    Parameters

    • value: number

      The numeric value to convert.

    • from: UnitConversionSource

      The source unit or unit system to convert from.

    • Optional to: UnitConversionSource

      (Optional) The target unit or unit system to convert to. If not provided, uses the default unit system.

    • Optional format: {
          minDecimals?: number;
          maxDecimals?: number;
      }

      (Optional) Formatting options for the output, including minimum and maximum decimal places.

      • Optional minDecimals?: number

        (Optional) Minimum number of decimal places in the formatted output.

      • Optional maxDecimals?: number

        (Optional) Maximum number of decimal places in the formatted output.

    Returns {
        value: string;
        display: string;
        shortDisplay: string;
        unit: string;
    }

    An object containing:

    • value: The converted value as a string.
    • display: The formatted value with unit in long form.
    • shortDisplay: The formatted value with unit in short form.
    • unit: The unit used for the converted value.
    • value: string
    • display: string
    • shortDisplay: string
    • unit: string

    Throws

    If the RegionInfo model is not found.