@stringsync/vexml
Version:
MusicXML to Vexflow
21 lines (20 loc) • 657 B
JavaScript
import { Measure } from './measure';
/**
* The top level of musical organization below the Score that contains a sequence of Measures.
*
* See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/part-partwise/
*/
export class Part {
element;
constructor(element) {
this.element = element;
}
/** Returns the ID of the part or an empty string if missing. */
getId() {
return this.element.attr('id').withDefault('').str();
}
/** Returns an array of measures in the order they appear. */
getMeasures() {
return this.element.all('measure').map((element) => new Measure(element));
}
}