UNPKG

@stringsync/vexml

Version:

MusicXML to Vexflow

27 lines (26 loc) 838 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Beam = void 0; const enums_1 = require("./enums"); const util_1 = require("../util"); /** * Beam is a note connector that indicates a rhythmic relationship amongst a group of notes. * * https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/beam/ */ class Beam { element; constructor(element) { this.element = element; } /** Returns the beam level of the beam. */ getNumber() { const number = this.element.attr('number').withDefault(1).int(); return (0, util_1.clamp)(1, 8, number); } /** Returns the beam value of the beam. */ getBeamValue() { return this.element.content().withDefault(enums_1.BEAM_VALUES.values[0]).enum(enums_1.BEAM_VALUES); } } exports.Beam = Beam;