recipe-ts-runtime
Version:
TypeScript run-time library for the Recipe framework
28 lines • 702 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const Ingredient_1 = require("./Ingredient");
class KeyedIngredient extends Ingredient_1.Ingredient {
constructor(name, domain) {
super(name, domain);
this.key = null;
}
setKey(key) {
this.key = key;
}
getKey() {
return this.key;
}
keyed(key) {
this.key = key;
return this;
}
toJSON() {
const jsonObj = super.toJSON();
if (this.key) {
jsonObj[this.getIngredientType()].key = this.key;
}
return jsonObj;
}
}
exports.KeyedIngredient = KeyedIngredient;
//# sourceMappingURL=KeyedIngredient.js.map