replicake
Version:
A javascript library for the creation and manipulate of recipes.
19 lines (15 loc) • 376 B
JavaScript
import Units from './Units.js';
/**
* Represent an amount with a specific {@link Units} (e.g '30 grams').
*/
export default class Quantity {
constructor(options) {
const defaults = {
amount: 0,
units: '',
};
const actual = Object.assign({}, defaults, options);
this.amount = actual.amount;
this.units = Units.Lookup(actual.units);
}
}