Skip to content

@tmlmt/cooklang-parser / ShoppingList

Class: ShoppingList

Defined in: classes/shopping_list.ts:15

Represents a shopping list.

Constructors

Constructor

new ShoppingList(aisle_config_str?): ShoppingList

Defined in: classes/shopping_list.ts:41

Creates a new ShoppingList instance.

Parameters

aisle_config_str?

string

The aisle configuration to parse.

Returns

ShoppingList

Properties

aisle_config?

optional aisle_config: AisleConfig

Defined in: classes/shopping_list.ts:30

The aisle configuration for the shopping list.

See

AisleConfig


categories?

optional categories: CategorizedIngredients

Defined in: classes/shopping_list.ts:35

The categorized ingredients in the shopping list.

See

CategorizedIngredients


ingredients

ingredients: Ingredient[] = []

Defined in: classes/shopping_list.ts:20

The ingredients in the shopping list.

See

Ingredient


recipes

recipes: AddedRecipe[] = []

Defined in: classes/shopping_list.ts:25

The recipes in the shopping list.

See

AddedRecipe

Methods

add_recipe()

add_recipe(recipe, factor): void

Defined in: classes/shopping_list.ts:109

Adds a recipe to the shopping list.

Parameters

recipe

Recipe

The recipe to add.

factor

number = 1

The factor to scale the recipe by.

Returns

void


categorize()

categorize(): void

Defined in: classes/shopping_list.ts:141

Categorizes the ingredients in the shopping list Will use the aisle config if any, otherwise all ingredients will be placed in the "other" category

Returns

void


remove_recipe()

remove_recipe(index): void

Defined in: classes/shopping_list.ts:119

Removes a recipe from the shopping list.

Parameters

index

number

The index of the recipe to remove.

Returns

void


set_aisle_config()

set_aisle_config(config): void

Defined in: classes/shopping_list.ts:132

Sets the aisle configuration for the shopping list.

Parameters

config

string

The aisle configuration to parse.

Returns

void