@stringsync/vexml
Version:
MusicXML to Vexflow
26 lines (25 loc) • 534 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Budget = void 0;
/**
* A generic utility for tracking a metric across scopes.
*/
class Budget {
amount = 0;
constructor(initial) {
this.amount = initial;
}
static unlimited() {
return new Budget(Infinity);
}
isUnlimited() {
return this.amount === Infinity;
}
remaining() {
return this.amount;
}
spend(amount) {
this.amount -= amount;
}
}
exports.Budget = Budget;