UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

22 lines (21 loc) 414 B
/** * A generic utility for tracking a metric across scopes. */ export 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; } }