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

    Module helpers/quantity

    Functions - Helpers

    parseQuantity

    Parses a quantity string into a structured object containing the numeric value and unit of measure. Handles various formats including foreign number formats (e.g., 1.234,56). Uses regex pattern matching to extract quantity and unit information.

    stripQuantityFromString

    Strips the quantity from a string. This is useful for when some suppliers don't have products listed as variants, but instead have multiple products with a quantity in the name. Using this function, we can get the name of the product without the quantity, which may be identical to the other variations. Making it easy to group the products into a single listing with multiple variants.

    isQuantityObject

    Checks if a value is a QuantityObject.

    standardizeUom

    Standardizes a unit of measure (UOM) to its canonical form. Uses the uomAliases mapping to convert various representations to standard forms.

    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.