UNPKG

libguacamole

Version:

Interacting with guacamole

13 lines (10 loc) 389 B
const isPositiveInteger = require("is-positive-integer"); class PortionsError extends Error {} module.exports = class Guacamole { constructor(portions) { if (!isPositiveInteger(portions)) throw new PortionsError("Portion size expected to be a positive integer"); if (portions > 1000) throw new PortionsError("Too many portions"); this.portionsLeft = portions; } };