Class: Ingredient

Ingredient()

Base class for all ingredients

Constructor

new Ingredient()

Source:

Members

density

Properties:
Name Type Description
density number
Source:

type

Properties:
Name Type Description
type IngredientType
Source:

Methods

attr(name, valueopt) → {this}

Shorthand getter/setter for attributes

Parameters:
Name Type Attributes Description
name Object.<string, any> | string
value any <optional>
Source:
Returns:
Type
this
Example
ingredient.attr({ name: 'syrup', type: 'fruit' }); // set multiple
ingredient.attr('name', 'syrup'); // set
ingredient.attr('name'); // get

fget(measure, precisionopt) → {string}

Get human-readable Ingredient measurment with a given precision

Parameters:
Name Type Attributes Default Description
measure MeasureVariant
precision number <optional>
0.01
Source:
Returns:
Type
string

get(measure) → {number}

Get ingredient measurement

Available measures:

  • Measure.DENSITY
  • Measure.CW
Parameters:
Name Type Description
measure MeasureVariant
Source:
Returns:
Type
number