Preparing search index...

    Function formatIngredientForCallback

    • Formats ingredient data into a serialized string for storage/callback.

      Creates a formatted string with quantity, unit, name, and optional note using the standard separators defined in typography:

      • unitySeparator (@@) between quantity and unit
      • textSeparator (--) between unit and name
      • noteSeparator (%%) between name and note (if present)

      Parameters

      • quantity: number

        Numeric quantity (defaultValueNumber treated as empty string)

      • unit: string

        Unit of measurement (e.g., "g", "ml", "cups")

      • name: string

        Ingredient name

      • Optionalnote: string

        Optional usage note/context (e.g., "for the sauce")

      Returns string

      Formatted string like "100@@g--Rice" or "100@@g--Rice%%for the sauce"

      formatIngredientForCallback(100, "g", "Rice") // returns "100@@g--Rice"
      formatIngredientForCallback(2, "cups", "Flour", "sifted") // returns "2@@cups--Flour%%sifted"
      formatIngredientForCallback(defaultValueNumber, "g", "Salt") // returns "@@g--Salt"