parse-ingredient - v1.2.1
    Preparing search index...

    Interface ParseIngredientOptions

    Options available to parseIngredient.

    interface ParseIngredientOptions {
        additionalUOMs?: UnitOfMeasureDefinitions;
        allowLeadingOf?: boolean;
        ignoreUOMs?: string[];
        normalizeUOM?: boolean;
    }
    Index

    Properties

    additionalUOMs?: UnitOfMeasureDefinitions

    An object that matches the format of unitsOfMeasure. Keys that match any in unitsOfMeasure will be used instead of the default, and any others will be added to the list of known units of measure when parsing ingredients.

    {}
    
    allowLeadingOf?: boolean

    If true, ingredient descriptions that start with "of " will not be modified. (By default, a leading "of " will be removed from all descriptions.)

    false
    
    ignoreUOMs?: string[]

    An array of strings to ignore as units of measure when parsing ingredients.

    parseIngredient('2 small eggs', {
    ignoreUOMs: ['small', 'medium', 'large']
    })
    // [
    // {
    // quantity: 2,
    // quantity2: null,
    // unitOfMeasure: null,
    // unitOfMeasureID: null,
    // description: 'small eggs',
    // isGroupHeader: false,
    // }
    // ]
    []
    
    normalizeUOM?: boolean

    Converts the unit of measure (unitOfMeasure property) of each ingredient to its long, singular form. For example, "ml" becomes "milliliter" and "cups" becomes "cup".

    false