replicake
Version:
A javascript library for the creation and manipulate of recipes.
23 lines (19 loc) • 544 B
JavaScript
import Nutrition from './Nutrition.js';
import Quantity from './Quantity.js';
/**
* An ingredient in a recipe, usually with a provided {@link Quantity}.
*/
export default class Ingredient {
constructor(options) {
const defaults = {
name: '',
quantity: {},
nutrition: {},
};
const actual = Object.assign({}, defaults, options);
if (actual.id) this.id = actual.id;
this.name = actual.name;
this.quantity = new Quantity(actual.quantity);
this.nutrition = new Nutrition(actual.nutrition);
}
}