parse-ingredient - v3.0.0
    Preparing search index...

    Interface DescriptionMeasurement

    A Measurement found within an Ingredient.description, additionally carrying its position in the original (trimmed) source line.

    interface DescriptionMeasurement {
        endIndex: number;
        quantity: number;
        quantity2: number | null;
        sourceEndIndex: number | null;
        sourceStartIndex: number | null;
        startIndex: number;
        text: string;
        unitOfMeasure: string;
        unitOfMeasureID: string;
        unitType: UnitType | null;
    }

    Hierarchy (View Summary)

    Index
    endIndex: number

    End-exclusive index of the measurement in the scanned text.

    quantity: number

    The primary quantity (the lower quantity in a range, if applicable).

    Always a finite, non-negative number — subject to the same constraints as Ingredient.quantity.

    quantity2: number | null

    The secondary quantity (the upper quantity in a range), or null if the measurement is not a range.

    sourceEndIndex: number | null

    End-exclusive index of the measurement in the trimmed source line, or null. Always null exactly when DescriptionMeasurement.sourceStartIndex is null.

    sourceStartIndex: number | null

    Index of the measurement's first character in the trimmed source line (the string carried by meta.sourceText), or null if the description could not be aligned back onto the line.

    null only when parsing removed text from the middle of the line in a way that cannot be recovered — a two-word trailing unit, a partialUnitMatching splice, or a measurement straddling a splice. startIndex/endIndex remain valid regardless.

    startIndex: number

    Zero-based index of the measurement's first character in the scanned text.

    text: string

    The exact matched text. Always equal to text.slice(startIndex, endIndex) of the scanned text.

    unitOfMeasure: string

    The unit of measure as written, or the canonical ID when normalizeUOM is enabled.

    unitOfMeasureID: string

    The unit of measure identifier. Never null: a measurement is only reported when its unit is recognized.

    unitType: UnitType | null

    The unit's UnitOfMeasure.type, so the measurement can be filtered without a second lookup. null when the definition declares no type.