@stringsync/vexml
Version:
MusicXML to Vexflow
29 lines (28 loc) • 835 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Key = void 0;
const enums_1 = require("./enums");
/**
* Key represents a key signature.
*
* See https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/key/
*/
class Key {
element;
constructor(element) {
this.element = element;
}
/** Returns the fifths count of the key. Defaults to 0. */
getFifthsCount() {
return this.element.first('fifths')?.content().int() ?? 0;
}
/** Returns the mode of the key. Defaults to 'none'. */
getMode() {
return this.element.first('mode')?.content().enum(enums_1.KEY_MODES) ?? 'none';
}
/** Returns the stave number this key belongs to. */
getStaveNumber() {
return this.element.attr('number').int();
}
}
exports.Key = Key;