musicxml-io 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -759,13 +759,12 @@ function parseMeasure(elements, attrs) {
759
759
  if (attrs["width"]) measure.width = parseFloat(attrs["width"]);
760
760
  if (attrs["implicit"] === "yes") measure.implicit = true;
761
761
  const barlines = [];
762
- let isFirstAttributes = true;
762
+ let hasSeenNote = false;
763
763
  for (const el of elements) {
764
764
  if (el["attributes"]) {
765
765
  const parsedAttrs = parseAttributes(el["attributes"]);
766
- if (isFirstAttributes) {
766
+ if (!hasSeenNote && !measure.attributes) {
767
767
  measure.attributes = parsedAttrs;
768
- isFirstAttributes = false;
769
768
  } else {
770
769
  const attrEntry = {
771
770
  _id: _chunkLLFU3JZAjs.generateId.call(void 0, ),
@@ -775,6 +774,7 @@ function parseMeasure(elements, attrs) {
775
774
  measure.entries.push(attrEntry);
776
775
  }
777
776
  } else if (el["note"]) {
777
+ hasSeenNote = true;
778
778
  measure.entries.push(parseNote(el["note"], getAttributes(el)));
779
779
  } else if (el["backup"]) {
780
780
  measure.entries.push(parseBackup(el["backup"]));
package/dist/index.mjs CHANGED
@@ -759,13 +759,12 @@ function parseMeasure(elements, attrs) {
759
759
  if (attrs["width"]) measure.width = parseFloat(attrs["width"]);
760
760
  if (attrs["implicit"] === "yes") measure.implicit = true;
761
761
  const barlines = [];
762
- let isFirstAttributes = true;
762
+ let hasSeenNote = false;
763
763
  for (const el of elements) {
764
764
  if (el["attributes"]) {
765
765
  const parsedAttrs = parseAttributes(el["attributes"]);
766
- if (isFirstAttributes) {
766
+ if (!hasSeenNote && !measure.attributes) {
767
767
  measure.attributes = parsedAttrs;
768
- isFirstAttributes = false;
769
768
  } else {
770
769
  const attrEntry = {
771
770
  _id: generateId(),
@@ -775,6 +774,7 @@ function parseMeasure(elements, attrs) {
775
774
  measure.entries.push(attrEntry);
776
775
  }
777
776
  } else if (el["note"]) {
777
+ hasSeenNote = true;
778
778
  measure.entries.push(parseNote(el["note"], getAttributes(el)));
779
779
  } else if (el["backup"]) {
780
780
  measure.entries.push(parseBackup(el["backup"]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musicxml-io",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Parse and serialize MusicXML (.xml/.mxl) and ABC notation with high round-trip fidelity",
5
5
  "author": "tan-z-tan",
6
6
  "license": "MIT",