UNPKG

libvegetable

Version:

Interacting with vegetables from JS

17 lines (14 loc) 392 B
const Fruit = require("jsfruit"); const Guacamole = require("libguacamole"); class VegetablesDoNotTalkError extends Error {} module.exports = class Vegetable extends Fruit { constructor(...opts) { super(...opts); } greet() { throw new VegetablesDoNotTalkError("vegetables can not talk"); } intoGuacamole() { return new Guacamole(Math.floor(this.capacity / 2)); } };