ChemPal Documentation - v1.7.0
    Preparing search index...

    Module helpers/sorting

    Functions - Tanstack Sorting Functions

    quantitySortingFn

    TanStack sorting comparator that orders two product rows by their normalized baseQuantity (a missing quantity sorts as 0).

    matchPercentageSortingFn

    Custom sorting function for match percentage comparison between two product rows. Compares the match percentage of products and returns a sort order value.

    priceSortingFn

    Custom sorting function for price comparison between two product rows. Compares the USD prices of products (falling back to raw price) and returns a sort order value.

    unitPriceSortingFn

    TanStack sorting comparator that orders two product rows by their price per base unit (getUnitPrice). Rows whose unit price can't be computed (missing price/quantity or an unconvertible unit) sort to the bottom rather than appearing as the cheapest.

    puritySortingFn

    TanStack sorting comparator that orders two product rows by purity. The column mixes two kinds of value — a chemical grade ("ACS Grade") and a percentage ("≥99.8%") — so both are put on one numeric scale by sortablePurityGrade. Reads grade ?? purity, the same precedence the purity column's accessor uses, so the sort order matches what the cell shows. A row with neither (or an unrecognized grade, e.g. "Ungraded") sorts as 0.