Forráskód Böngészése

refactor: improve most undefined checks to also check null (#783)

part of #783

there are still some === undefined checks missing,
but !== undefined checks should all be checked now.

(some !== undefined checks should not be changed,
because they behaves differently for numbers and bools)

visual regression tests show only 4 changes, mostly positive.
sschmid 5 éve
szülő
commit
31fd7e6056
53 módosított fájl, 407 hozzáadás és 407 törlés
  1. 4 4
      demo/index.js
  2. 1 1
      src/Common/DataObjects/Fraction.ts
  3. 1 1
      src/Common/DataObjects/MusicSheetErrors.ts
  4. 1 1
      src/Common/DataObjects/Pitch.ts
  5. 2 2
      src/Common/FileIO/Xml.ts
  6. 1 1
      src/MusicalScore/Exceptions.ts
  7. 1 1
      src/MusicalScore/Graphical/AccidentalCalculator.ts
  8. 7 7
      src/MusicalScore/Graphical/BoundingBox.ts
  9. 1 1
      src/MusicalScore/Graphical/EngravingRules.ts
  10. 1 1
      src/MusicalScore/Graphical/GraphicalContinuousDynamicExpression.ts
  11. 1 1
      src/MusicalScore/Graphical/GraphicalLyricWord.ts
  12. 8 8
      src/MusicalScore/Graphical/GraphicalMeasure.ts
  13. 27 27
      src/MusicalScore/Graphical/GraphicalMusicSheet.ts
  14. 3 3
      src/MusicalScore/Graphical/GraphicalNote.ts
  15. 19 19
      src/MusicalScore/Graphical/GraphicalSlur.ts
  16. 8 8
      src/MusicalScore/Graphical/GraphicalStaffEntry.ts
  17. 2 2
      src/MusicalScore/Graphical/GraphicalStaffEntryLink.ts
  18. 36 36
      src/MusicalScore/Graphical/MusicSheetCalculator.ts
  19. 9 9
      src/MusicalScore/Graphical/MusicSheetDrawer.ts
  20. 5 5
      src/MusicalScore/Graphical/MusicSystem.ts
  21. 11 11
      src/MusicalScore/Graphical/MusicSystemBuilder.ts
  22. 1 1
      src/MusicalScore/Graphical/VerticalGraphicalStaffEntryContainer.ts
  23. 1 1
      src/MusicalScore/Graphical/VexFlow/CanvasVexFlowBackend.ts
  24. 1 1
      src/MusicalScore/Graphical/VexFlow/SvgVexFlowBackend.ts
  25. 4 4
      src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts
  26. 8 8
      src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts
  27. 12 12
      src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts
  28. 1 1
      src/MusicalScore/Graphical/VexFlow/VexFlowSlur.ts
  29. 1 1
      src/MusicalScore/Graphical/VexFlow/VexFlowTabMeasure.ts
  30. 1 1
      src/MusicalScore/MusicParts/MusicPartManager.ts
  31. 13 13
      src/MusicalScore/MusicParts/MusicPartManagerIterator.ts
  32. 12 12
      src/MusicalScore/MusicSheet.ts
  33. 1 1
      src/MusicalScore/MusicSource/MappingSourceMusicPart.ts
  34. 4 4
      src/MusicalScore/MusicSource/Repetition.ts
  35. 49 49
      src/MusicalScore/ScoreIO/InstrumentReader.ts
  36. 32 32
      src/MusicalScore/ScoreIO/MusicSheetReader.ts
  37. 8 8
      src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts
  38. 5 5
      src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts
  39. 24 24
      src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts
  40. 12 12
      src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts
  41. 6 6
      src/MusicalScore/ScoreIO/MusicSymbolModules/RepetitionInstructionReader.ts
  42. 2 2
      src/MusicalScore/ScoreIO/MusicSymbolModules/SlurReader.ts
  43. 37 37
      src/MusicalScore/ScoreIO/VoiceGenerator.ts
  44. 1 1
      src/MusicalScore/VoiceData/Beam.ts
  45. 4 4
      src/MusicalScore/VoiceData/ChordSymbolContainer.ts
  46. 1 1
      src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/ContinuousDynamicExpression.ts
  47. 1 1
      src/MusicalScore/VoiceData/Expressions/MultiExpression.ts
  48. 2 2
      src/MusicalScore/VoiceData/HelperObjects/DynamicsContainer.ts
  49. 2 2
      src/MusicalScore/VoiceData/Instructions/RepetitionInstruction.ts
  50. 2 2
      src/MusicalScore/VoiceData/Note.ts
  51. 6 6
      src/MusicalScore/VoiceData/SourceMeasure.ts
  52. 3 3
      src/MusicalScore/VoiceData/SourceStaffEntry.ts
  53. 1 1
      src/MusicalScore/VoiceData/VoiceEntry.ts

+ 4 - 4
demo/index.js

@@ -136,19 +136,19 @@ import { OpenSheetMusicDisplay } from '../src/OpenSheetMusicDisplay/OpenSheetMus
 
         showHeader = (paramShowHeader !== '0');
         showControls = false;
-        if (paramEmbedded !== undefined) {
+        if (paramEmbedded) {
             showControls = paramShowControls !== '0';
             showZoomControl = paramShowZoomControl !== '0';
             showPageFormatControl = paramShowPageFormatControl !== '0';
             showExportPdfControl = paramShowExportPdfControl !== '0';
         }
 
-        if (paramZoom !== undefined) {
+        if (paramZoom) {
             if (paramZoom > 0.1 && paramZoom < 5.0) {
                 zoom = paramZoom;
             }
         }
-        if (paramOverflow !== undefined && typeof paramOverflow === 'string') {
+        if (paramOverflow && typeof paramOverflow === 'string') {
             if (paramOverflow === 'hidden' || paramOverflow === 'auto' || paramOverflow === 'scroll' || paramOverflow === 'visible') {
                 document.body.style.overflow = paramOverflow;
             }
@@ -500,7 +500,7 @@ import { OpenSheetMusicDisplay } from '../src/OpenSheetMusicDisplay/OpenSheetMus
             // selectSampleOnChange();
         });
 
-        if (paramOpenUrl !== undefined) {
+        if (paramOpenUrl) {
             if (openSheetMusicDisplay.getLogLevel() < 2) { // debug or trace
                 console.log("[OSMD] selectSampleOnChange with " + paramOpenUrl);
             }

+ 1 - 1
src/Common/DataObjects/Fraction.ts

@@ -418,7 +418,7 @@ export class Fraction {
   //public static bool operator === (Fraction f1, Fraction f2)
   //{
   //    // code enhanced for performance
-  //    // System.Object.ReferenceEquals(f1, undefined) is better than if (f1 === undefined)
+  //    // System.Object.ReferenceEquals(f1, undefined) is better than if (f1)
   //    // and comparisons between booleans are quick
   //    bool f1IsNull = System.Object.ReferenceEquals(f1, undefined);
   //    bool f2IsNull = System.Object.ReferenceEquals(f2, undefined);

+ 1 - 1
src/Common/DataObjects/MusicSheetErrors.ts

@@ -8,7 +8,7 @@ export class MusicSheetErrors {
 
     public finalizeMeasure(measureNumber: number): void {
         let list: string[] = this.measureErrors[measureNumber];
-        if (list === undefined) {
+        if (!list) {
             list = [];
         }
         this.measureErrors[measureNumber] = list.concat(this.tempErrors);

+ 1 - 1
src/Common/DataObjects/Pitch.ts

@@ -352,7 +352,7 @@ export class Pitch {
         // if (ReferenceEquals(p1, p2)) {
         //     return true;
         // }
-        if ((<Object>p1 === undefined) || (<Object>p2 === undefined)) {
+        if (!p1 || !p2) {
             return false;
         }
         return (p1.FundamentalNote === p2.FundamentalNote && p1.Octave === p2.Octave && p1.Accidental === p2.Accidental);

+ 2 - 2
src/Common/FileIO/Xml.ts

@@ -22,7 +22,7 @@ export class IXmlElement {
      * @param elem
      */
     constructor(elem: Element) {
-        if (elem === undefined) {
+        if (!elem) {
             throw new Error("IXmlElement: expected Element, got undefined");
         }
         this.elem = elem;
@@ -89,7 +89,7 @@ export class IXmlElement {
     public elements(nodeName?: string): IXmlElement[] {
         const nodes: NodeList = this.elem.childNodes;
         const ret: IXmlElement[] = [];
-        const nameUnset: boolean = nodeName === undefined;
+        const nameUnset: boolean = !nodeName;
         if (!nameUnset) {
             nodeName = nodeName.toLowerCase();
         }

+ 1 - 1
src/MusicalScore/Exceptions.ts

@@ -5,7 +5,7 @@ export class MusicSheetReadingException implements Error {
     constructor(message: string, e?: Error) {
         //super(message);
         this.message = message;
-        if (e !== undefined) {
+        if (e) {
             this.message += " " + e.toString();
         }
     }

+ 1 - 1
src/MusicalScore/Graphical/AccidentalCalculator.ts

@@ -37,7 +37,7 @@ export class AccidentalCalculator {
     }
 
     public checkAccidental(graphicalNote: GraphicalNote, pitch: Pitch): void {
-        if (pitch === undefined) {
+        if (!pitch) {
             return;
         }
         const pitchKey: number = <number>pitch.FundamentalNote + pitch.Octave * 12;

+ 7 - 7
src/MusicalScore/Graphical/BoundingBox.ts

@@ -48,7 +48,7 @@ export class BoundingBox {
         this.isSymbol = isSymbol;
         this.xBordersHaveBeenSet = false;
         this.yBordersHaveBeenSet = false;
-        if (parent !== undefined) {
+        if (parent) {
             this.Parent = parent;
         }
     }
@@ -203,7 +203,7 @@ export class BoundingBox {
     }
 
     public set Parent(value: BoundingBox) {
-        if (this.parent !== undefined) {
+        if (this.parent) {
             // remove from old parent
             const index: number = this.parent.ChildElements.indexOf(this, 0);
             if (index > -1) {
@@ -235,7 +235,7 @@ export class BoundingBox {
     }
 
     public setAbsolutePositionFromParent(): void {
-        if (this.parent !== undefined) {
+        if (this.parent) {
             this.absolutePosition.x = this.parent.AbsolutePosition.x + this.relativePosition.x;
             this.absolutePosition.y = this.parent.AbsolutePosition.y + this.relativePosition.y;
         } else {
@@ -250,7 +250,7 @@ export class BoundingBox {
       this.absolutePosition.x = this.relativePosition.x;
       this.absolutePosition.y = this.relativePosition.y;
       let parent: BoundingBox = this.parent;
-      while (parent !== undefined) {
+      while (parent) {
         this.absolutePosition.x += parent.relativePosition.x;
         this.absolutePosition.y += parent.relativePosition.y;
         parent = parent.parent;
@@ -559,13 +559,13 @@ export class BoundingBox {
 
     public getClickedObjectOfType<T>(clickPosition: PointF2D): T {
         const obj: Object = this.dataObject;
-        if (this.pointLiesInsideBorders(clickPosition) && (<T>obj !== undefined)) {
+        if (this.pointLiesInsideBorders(clickPosition) && (<T>obj)) {
             return (obj as T);
         }
         for (let idx: number = 0, len: number = this.childElements.length; idx < len; ++idx) {
             const psi: BoundingBox = this.childElements[idx];
             const innerObject: Object = psi.getClickedObjectOfType<T>(clickPosition);
-            if (innerObject !== undefined) {
+            if (innerObject) {
                 return (innerObject as T);
             }
         }
@@ -573,7 +573,7 @@ export class BoundingBox {
     }
 
     public getObjectsInRegion<T>(region: BoundingBox, liesInside: boolean = true): T[] {
-        if (<T>this.dataObject !== undefined) {
+        if (<T>this.dataObject) {
             if (liesInside) {
                 if (region.liesInsideBorders(this)) {
                     return [this.dataObject as T];

+ 1 - 1
src/MusicalScore/Graphical/EngravingRules.ts

@@ -485,7 +485,7 @@ export class EngravingRules {
         this.populateDictionaries();
         try {
             this.maxInstructionsConstValue = this.ClefLeftMargin + this.ClefRightMargin + this.KeyRightMargin + this.RhythmRightMargin + 11;
-            //if (FontInfo.Info !== undefined) {
+            //if (FontInfo.Info) {
             //    this.maxInstructionsConstValue += FontInfo.Info.getBoundingBox(MusicSymbol.G_CLEF).width
             //        + FontInfo.Info.getBoundingBox(MusicSymbol.FOUR).width
             //        + 7 * FontInfo.Info.getBoundingBox(MusicSymbol.SHARP).width;

+ 1 - 1
src/MusicalScore/Graphical/GraphicalContinuousDynamicExpression.ts

@@ -50,7 +50,7 @@ export class GraphicalContinuousDynamicExpression extends AbstractGraphicalExpre
     public get IsSplittedPart(): boolean { return this.isSplittedPart; }
     public set IsSplittedPart(value: boolean) { this.isSplittedPart = value; }
     /**  Is true if the dynamic is not a symbol but a text instruction. E.g. "decrescendo" */
-    public get IsVerbal(): boolean { return this.ContinuousDynamic.Label !== undefined && this.ContinuousDynamic.Label.length > 0; }
+    public get IsVerbal(): boolean { return this.ContinuousDynamic.Label && this.ContinuousDynamic.Label.length > 0; }
     /** True if this expression should not be removed if re-rendered */
     public get NotToBeRemoved(): boolean { return this.notToBeRemoved; }
     public set NotToBeRemoved(value: boolean) { this.notToBeRemoved = value; }

+ 1 - 1
src/MusicalScore/Graphical/GraphicalLyricWord.ts

@@ -27,7 +27,7 @@ export class GraphicalLyricWord {
 
     public isFilled(): boolean {
         for (let i: number = 0; i < this.graphicalLyricsEntries.length; i++) {
-            if (this.graphicalLyricsEntries[i] === undefined) {
+            if (!this.graphicalLyricsEntries[i]) {
                 return false;
             }
         }

+ 8 - 8
src/MusicalScore/Graphical/GraphicalMeasure.ts

@@ -26,14 +26,14 @@ export abstract class GraphicalMeasure extends GraphicalObject {
         this.parentStaff = staff;
         this.parentSourceMeasure = parentSourceMeasure;
         this.parentStaffLine = staffLine;
-        if (staffLine !== undefined) {
+        if (staffLine) {
             this.parentStaff = staffLine.ParentStaff;
             this.PositionAndShape = new BoundingBox(this, staffLine.PositionAndShape);
         } else {
             this.PositionAndShape = new BoundingBox(this);
         }
         this.PositionAndShape.BorderBottom = 4;
-        if (this.parentSourceMeasure !== undefined) {
+        if (this.parentSourceMeasure) {
             this.measureNumber = this.parentSourceMeasure.MeasureNumber;
         }
 
@@ -103,7 +103,7 @@ export abstract class GraphicalMeasure extends GraphicalObject {
 
     public set ParentStaffLine(value: StaffLine) {
         this.parentStaffLine = value;
-        if (this.parentStaffLine !== undefined) {
+        if (this.parentStaffLine) {
             this.PositionAndShape.Parent = this.parentStaffLine.PositionAndShape;
         }
     }
@@ -291,7 +291,7 @@ export abstract class GraphicalMeasure extends GraphicalObject {
      * @param staffEntry
      */
     public addGraphicalStaffEntryAtTimestamp(staffEntry: GraphicalStaffEntry): void {
-        if (staffEntry !== undefined) {
+        if (staffEntry) {
             if (this.staffEntries.length === 0 || this.staffEntries[this.staffEntries.length - 1].relInMeasureTimestamp.lt(staffEntry.relInMeasureTimestamp)) {
                 this.staffEntries.push(staffEntry);
             } else {
@@ -310,7 +310,7 @@ export abstract class GraphicalMeasure extends GraphicalObject {
 
     public beginsWithLineRepetition(): boolean {
         const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
-        if (sourceMeasure === undefined) {
+        if (!sourceMeasure) {
             return false;
         }
         return sourceMeasure.beginsWithLineRepetition();
@@ -322,7 +322,7 @@ export abstract class GraphicalMeasure extends GraphicalObject {
      */
     public endsWithLineRepetition(): boolean {
         const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
-        if (sourceMeasure === undefined) {
+        if (!sourceMeasure) {
             return false;
         }
         return sourceMeasure.endsWithLineRepetition();
@@ -334,7 +334,7 @@ export abstract class GraphicalMeasure extends GraphicalObject {
      */
     public beginsWithWordRepetition(): boolean {
         const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
-        if (sourceMeasure === undefined) {
+        if (!sourceMeasure) {
             return false;
         }
         return sourceMeasure.beginsWithWordRepetition();
@@ -345,7 +345,7 @@ export abstract class GraphicalMeasure extends GraphicalObject {
      */
     public endsWithWordRepetition(): boolean {
         const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
-        if (sourceMeasure === undefined) {
+        if (!sourceMeasure) {
             return false;
         }
         return sourceMeasure.endsWithWordRepetition();

+ 27 - 27
src/MusicalScore/Graphical/GraphicalMusicSheet.ts

@@ -288,10 +288,10 @@ export class GraphicalMusicSheet {
     public initializeActiveClefs(): ClefInstruction[] {
         const activeClefs: ClefInstruction[] = [];
         const firstSourceMeasure: SourceMeasure = this.musicSheet.getFirstSourceMeasure();
-        if (firstSourceMeasure !== undefined) {
+        if (firstSourceMeasure) {
             for (let i: number = 0; i < firstSourceMeasure.CompleteNumberOfStaves; i++) {
                 let clef: ClefInstruction = new ClefInstruction();
-                if (firstSourceMeasure.FirstInstructionsStaffEntries[i] !== undefined) {
+                if (firstSourceMeasure.FirstInstructionsStaffEntries[i]) {
                     for (let idx: number = 0, len: number = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions.length; idx < len; ++idx) {
                         const abstractNotationInstruction: AbstractNotationInstruction = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions[idx];
                         if (abstractNotationInstruction instanceof ClefInstruction) {
@@ -308,7 +308,7 @@ export class GraphicalMusicSheet {
 
     public GetMainKey(): KeyInstruction {
         const firstSourceMeasure: SourceMeasure = this.musicSheet.getFirstSourceMeasure();
-        if (firstSourceMeasure !== undefined) {
+        if (firstSourceMeasure) {
             for (let i: number = 0; i < firstSourceMeasure.CompleteNumberOfStaves; i++) {
                 for (let idx: number = 0, len: number = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions.length; idx < len; ++idx) {
                     const abstractNotationInstruction: AbstractNotationInstruction = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions[idx];
@@ -498,7 +498,7 @@ export class GraphicalMusicSheet {
             const graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
             const entries: GraphicalNote[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalNote>(region);
             //let entriesArr: GraphicalNote[] = __as__<GraphicalNote[]>(entries, GraphicalNote[]) ? ? entries;
-            if (entries === undefined) {
+            if (!entries) {
                 continue;
             } else {
                 for (let idx2: number = 0, len2: number = entries.length; idx2 < len2; ++idx2) {
@@ -518,7 +518,7 @@ export class GraphicalMusicSheet {
             if (closest === undefined) {
                 closest = note;
             } else {
-                if (note.parentVoiceEntry.parentStaffEntry.relInMeasureTimestamp === undefined) {
+                if (!note.parentVoiceEntry.parentStaffEntry.relInMeasureTimestamp) {
                     continue;
                 }
                 const deltaNew: number = this.CalculateDistance(note.PositionAndShape.AbsolutePosition, clickPosition);
@@ -528,7 +528,7 @@ export class GraphicalMusicSheet {
                 }
             }
         }
-        if (closest !== undefined) {
+        if (closest) {
             return closest;
         }
         // TODO No staff entry was found. Feedback?
@@ -575,7 +575,7 @@ export class GraphicalMusicSheet {
         for (let idx: number = 0, len: number = this.MusicPages.length; idx < len; ++idx) {
             const graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
             const entries: GraphicalStaffEntry[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalStaffEntry>(region, false);
-            if (entries === undefined || entries.length === 0) {
+            if (!entries || entries.length === 0) {
                 continue;
             } else {
                 for (let idx2: number = 0, len2: number = entries.length; idx2 < len2; ++idx2) {
@@ -591,7 +591,7 @@ export class GraphicalMusicSheet {
             if (closest === undefined) {
                 closest = gse;
             } else {
-                if (gse.relInMeasureTimestamp === undefined) {
+                if (!gse.relInMeasureTimestamp) {
                     continue;
                 }
                 const deltaNew: number = this.CalculateDistance(gse.PositionAndShape.AbsolutePosition, clickPosition);
@@ -601,7 +601,7 @@ export class GraphicalMusicSheet {
                 }
             }
         }
-        if (closest !== undefined) {
+        if (closest) {
             return closest;
         }
         // TODO No staff entry was found. Feedback?
@@ -611,7 +611,7 @@ export class GraphicalMusicSheet {
 
     public GetPossibleCommentAnchor(clickPosition: PointF2D): SourceStaffEntry {
         const entry: GraphicalStaffEntry = this.GetNearestStaffEntry(clickPosition);
-        if (entry === undefined) {
+        if (!entry) {
             return undefined;
         }
         return entry.sourceStaffEntry;
@@ -621,7 +621,7 @@ export class GraphicalMusicSheet {
         for (let idx: number = 0, len: number = this.musicPages.length; idx < len; ++idx) {
             const page: GraphicalMusicPage = this.musicPages[idx];
             const o: Object = page.PositionAndShape.getClickedObjectOfType<T>(positionOnMusicSheet);
-            if (o !== undefined) {
+            if (o) {
                 return (o as T);
             }
         }
@@ -630,7 +630,7 @@ export class GraphicalMusicSheet {
 
     public tryGetTimestampFromPosition(positionOnMusicSheet: PointF2D): Fraction {
         const entry: GraphicalStaffEntry = this.getClickedObjectOfType<GraphicalStaffEntry>(positionOnMusicSheet);
-        if (entry === undefined) {
+        if (!entry) {
             return undefined;
         }
         return entry.getAbsoluteTimestamp();
@@ -649,7 +649,7 @@ export class GraphicalMusicSheet {
     public tryGetTimeStampFromPosition(positionOnMusicSheet: PointF2D): Fraction {
         try {
             const entry: GraphicalStaffEntry = this.GetNearestStaffEntry(positionOnMusicSheet);
-            if (entry === undefined) {
+            if (!entry) {
                 return undefined;
             }
             return entry.getAbsoluteTimestamp();
@@ -674,12 +674,12 @@ export class GraphicalMusicSheet {
         try {
             for (let idx: number = 0, len: number = container.StaffEntries.length; idx < len; ++idx) {
                 const entry: GraphicalStaffEntry = container.StaffEntries[idx];
-                if (entry === undefined || !entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                if (!entry || !entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     continue;
                 }
-                if (staffEntry === undefined) {
+                if (!staffEntry) {
                     staffEntry = entry;
-                } else if (entry.PositionAndShape !== undefined && staffEntry.PositionAndShape !== undefined) {
+                } else if (entry.PositionAndShape && staffEntry.PositionAndShape) {
                     if (staffEntry.PositionAndShape.RelativePosition.x > entry.PositionAndShape.RelativePosition.x) {
                         staffEntry = entry;
                     }
@@ -703,7 +703,7 @@ export class GraphicalMusicSheet {
             const entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
             for (let idx: number = 0, len: number = entries.length; idx < len; ++idx) {
                 const entry: GraphicalStaffEntry = entries[idx];
-                if (entry !== undefined && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                if (entry && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     return i;
                 }
             }
@@ -722,7 +722,7 @@ export class GraphicalMusicSheet {
             const entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
             for (let idx: number = 0, len: number = entries.length; idx < len; ++idx) {
                 const entry: GraphicalStaffEntry = entries[idx];
-                if (entry !== undefined && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
+                if (entry && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     return i;
                 }
             }
@@ -736,7 +736,7 @@ export class GraphicalMusicSheet {
         leftIndex = Math.min(this.VerticalGraphicalStaffEntryContainers.length - 1, leftIndex);
         for (let i: number = leftIndex; i >= 0; i--) {
             foundEntry = this.getStaffEntry(i);
-            if (foundEntry !== undefined) {
+            if (foundEntry) {
                 if (searchOnlyVisibleEntries) {
                     if (foundEntry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                         return foundEntry;
@@ -754,7 +754,7 @@ export class GraphicalMusicSheet {
         const rightIndex: number = Math.max(0, Math.ceil(fractionalIndex));
         for (let i: number = rightIndex; i < this.VerticalGraphicalStaffEntryContainers.length; i++) {
             foundEntry = this.getStaffEntry(i);
-            if (foundEntry !== undefined) {
+            if (foundEntry) {
                 if (returnOnlyVisibleEntries) {
                     if (foundEntry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                         return foundEntry;
@@ -771,7 +771,7 @@ export class GraphicalMusicSheet {
         const result: [number, MusicSystem] = this.calculateXPositionFromTimestamp(musicTimestamp);
         const xPos: number = result[0];
         const correspondingMusicSystem: MusicSystem = result[1];
-        if (correspondingMusicSystem === undefined || correspondingMusicSystem.StaffLines.length === 0) {
+        if (!correspondingMusicSystem || correspondingMusicSystem.StaffLines.length === 0) {
             return undefined;
         }
         const yCoordinate: number = correspondingMusicSystem.PositionAndShape.AbsolutePosition.y;
@@ -785,18 +785,18 @@ export class GraphicalMusicSheet {
         const previousStaffEntry: GraphicalStaffEntry = this.findClosestLeftStaffEntry(fractionalIndex, true);
         const nextStaffEntry: GraphicalStaffEntry = this.findClosestRightStaffEntry(fractionalIndex, true);
         const currentTimeStamp: number = timeStamp.RealValue;
-        if (previousStaffEntry === undefined && nextStaffEntry === undefined) {
+        if (!previousStaffEntry && !nextStaffEntry) {
             return [0, undefined];
         }
         let previousStaffEntryMusicSystem: MusicSystem = undefined;
-        if (previousStaffEntry !== undefined) {
+        if (previousStaffEntry) {
             // TODO sometimes one of these ParentStaffLine is undefined, either fix this or handle it here
             previousStaffEntryMusicSystem = previousStaffEntry.parentMeasure.ParentStaffLine?.ParentMusicSystem;
         } else {
             previousStaffEntryMusicSystem = nextStaffEntry.parentMeasure.ParentStaffLine?.ParentMusicSystem;
         }
         let nextStaffEntryMusicSystem: MusicSystem = undefined;
-        if (nextStaffEntry !== undefined) {
+        if (nextStaffEntry) {
             nextStaffEntryMusicSystem = nextStaffEntry.parentMeasure.ParentStaffLine?.ParentMusicSystem;
         } else {
             nextStaffEntryMusicSystem = previousStaffEntry.parentMeasure.ParentStaffLine?.ParentMusicSystem;
@@ -806,10 +806,10 @@ export class GraphicalMusicSheet {
             let fraction: number;
             let previousStaffEntryPositionX: number;
             let nextStaffEntryPositionX: number;
-            if (previousStaffEntry === undefined) {
+            if (!previousStaffEntry) {
                 previousStaffEntryPositionX = nextStaffEntryPositionX = nextStaffEntry.PositionAndShape.AbsolutePosition.x;
                 fraction = 0;
-            } else if (nextStaffEntry === undefined) {
+            } else if (!nextStaffEntry) {
                 previousStaffEntryPositionX = previousStaffEntry.PositionAndShape.AbsolutePosition.x;
                 nextStaffEntryPositionX = currentMusicSystem.GetRightBorderAbsoluteXPosition();
                 const sm: SourceMeasure = previousStaffEntry.parentMeasure.parentSourceMeasure;
@@ -899,7 +899,7 @@ export class GraphicalMusicSheet {
     private getLongestStaffEntryDuration(index: number): Fraction {
         let maxLength: Fraction = new Fraction(0, 1);
         for (const graphicalStaffEntry of this.verticalGraphicalStaffEntryContainers[index].StaffEntries) {
-            if (graphicalStaffEntry === undefined) {
+            if (!graphicalStaffEntry) {
                 continue;
             }
             const maxLengthInStaffEntry: Fraction = graphicalStaffEntry.findStaffEntryMaxNoteLength();

+ 3 - 3
src/MusicalScore/Graphical/GraphicalNote.ts

@@ -19,7 +19,7 @@ export class GraphicalNote extends GraphicalObject {
         this.sourceNote = note;
         this.parentVoiceEntry = parent;
         this.PositionAndShape = new BoundingBox(this, parent.PositionAndShape);
-        if (graphicalNoteLength !== undefined) {
+        if (graphicalNoteLength) {
             this.graphicalNoteLength = graphicalNoteLength;
         } else {
             this.graphicalNoteLength = note.Length;
@@ -35,7 +35,7 @@ export class GraphicalNote extends GraphicalObject {
 
     public Transpose(keyInstruction: KeyInstruction, activeClef: ClefInstruction, halfTones: number, octaveEnum: OctaveEnum): Pitch {
         let transposedPitch: Pitch = this.sourceNote.Pitch;
-        if (MusicSheetCalculator.transposeCalculator !== undefined) {
+        if (MusicSheetCalculator.transposeCalculator) {
             transposedPitch = MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch, keyInstruction, halfTones);
         }
         return transposedPitch;
@@ -50,7 +50,7 @@ export class GraphicalNote extends GraphicalObject {
       let num: number = 1;
       let product: number = 2;
       const expandedNumerator: number = fraction.GetExpandedNumerator();
-      if (this.sourceNote === undefined || this.sourceNote.NoteTuplet === undefined) {
+      if (!this.sourceNote || !this.sourceNote.NoteTuplet) {
         while (product < expandedNumerator) {
           num++;
           product = Math.pow(2, num);

+ 19 - 19
src/MusicalScore/Graphical/GraphicalSlur.ts

@@ -68,14 +68,14 @@ export class GraphicalSlur extends GraphicalCurve {
 
         // where the Slur (not the graphicalObject) starts and ends (could belong to another StaffLine)
         let slurStartNote: GraphicalNote = startStaffEntry.findGraphicalNoteFromNote(this.slur.StartNote);
-        if (slurStartNote === undefined && this.graceStart) {
+        if (!slurStartNote && this.graceStart) {
             slurStartNote = startStaffEntry.findGraphicalNoteFromGraceNote(this.slur.StartNote);
         }
-        if (slurStartNote === undefined) {
+        if (!slurStartNote) {
             slurStartNote = startStaffEntry.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote, this.slur);
         }
         let slurEndNote: GraphicalNote = endStaffEntry.findGraphicalNoteFromNote(this.slur.EndNote);
-        if (slurEndNote === undefined && this.graceEnd) {
+        if (!slurEndNote && this.graceEnd) {
             slurEndNote = endStaffEntry.findGraphicalNoteFromGraceNote(this.slur.EndNote);
         }
 
@@ -105,7 +105,7 @@ export class GraphicalSlur extends GraphicalCurve {
             const startUpperRight: PointF2D = new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x
                                                            + this.staffEntries[0].PositionAndShape.RelativePosition.x,
                                                            startY);
-            if (slurStartNote !== undefined) {
+            if (slurStartNote) {
                     startUpperRight.x += this.staffEntries[0].PositionAndShape.BorderRight;
             } else  {
                     // continuing Slur from previous StaffLine - must start after last Instruction of first Measure
@@ -120,7 +120,7 @@ export class GraphicalSlur extends GraphicalCurve {
             const endUpperLeft: PointF2D = new PointF2D(this.staffEntries[this.staffEntries.length - 1].parentMeasure.PositionAndShape.RelativePosition.x
                                                         + this.staffEntries[this.staffEntries.length - 1].PositionAndShape.RelativePosition.x,
                                                         endY);
-            if (slurEndNote !== undefined) {
+            if (slurEndNote) {
                     endUpperLeft.x += this.staffEntries[this.staffEntries.length - 1].PositionAndShape.BorderLeft;
             } else {
                     // Slur continues to next StaffLine - must reach the end of current StaffLine
@@ -248,7 +248,7 @@ export class GraphicalSlur extends GraphicalCurve {
             const startLowerRight: PointF2D = new PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x
                                                            + this.staffEntries[0].PositionAndShape.RelativePosition.x,
                                                            startY);
-            if (slurStartNote !== undefined) {
+            if (slurStartNote) {
                 startLowerRight.x += this.staffEntries[0].PositionAndShape.BorderRight;
             } else {
                 // continuing Slur from previous StaffLine - must start after last Instruction of first Measure
@@ -262,7 +262,7 @@ export class GraphicalSlur extends GraphicalCurve {
             const endLowerLeft: PointF2D = new PointF2D(this.staffEntries[this.staffEntries.length - 1].parentMeasure.PositionAndShape.RelativePosition.x
                                                         + this.staffEntries[this.staffEntries.length - 1].PositionAndShape.RelativePosition.x,
                                                         endY);
-            if (slurEndNote !== undefined) {
+            if (slurEndNote) {
                 endLowerLeft.x += this.staffEntries[this.staffEntries.length - 1].PositionAndShape.BorderLeft;
             } else {
                 // Slur continues to next StaffLine - must reach the end of current StaffLine
@@ -404,7 +404,7 @@ export class GraphicalSlur extends GraphicalCurve {
         let endX: number = 0;
         let endY: number = 0;
 
-        if (slurStartNote !== undefined) {
+        if (slurStartNote) {
             // must be relative to StaffLine
             startX = slurStartNote.PositionAndShape.RelativePosition.x + slurStartNote.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x
                                             + slurStartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x;
@@ -433,12 +433,12 @@ export class GraphicalSlur extends GraphicalCurve {
             if (slurStartVE.parentVoiceEntry.StemDirection === StemDirectionType.Up && this.placement === PlacementEnum.Above) {
                 startX += 0.5;
             }
-            // if (first.NoteStem !== undefined && first.NoteStem.Direction === StemEnum.StemUp && this.placement === PlacementEnum.Above) {
+            // if (first.NoteStem && first.NoteStem.Direction === StemEnum.StemUp && this.placement === PlacementEnum.Above) {
             //     startX += first.NoteStem.PositionAndShape.RelativePosition.x;
             //     startY = skyBottomLineCalculator.getSkyLineMinAtPoint(staffLine, startX);
             // } else {
             //     const last: GraphicalNote = <GraphicalNote>slurStartNote[slurEndNote.parentVoiceEntry.notes.length - 1];
-            //     if (last.NoteStem !== undefined && last.NoteStem.Direction === StemEnum.StemDown && this.placement === PlacementEnum.Below) {
+            //     if (last.NoteStem && last.NoteStem.Direction === StemEnum.StemDown && this.placement === PlacementEnum.Below) {
             //         startX += last.NoteStem.PositionAndShape.RelativePosition.x;
             //         startY = skyBottomLineCalculator.getBottomLineMaxAtPoint(staffLine, startX);
             //     } else {
@@ -448,7 +448,7 @@ export class GraphicalSlur extends GraphicalCurve {
             startX = staffLine.Measures[0].beginInstructionsWidth;
         }
 
-        if (slurEndNote !== undefined) {
+        if (slurEndNote) {
             endX = slurEndNote.PositionAndShape.RelativePosition.x + slurEndNote.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x
                 + slurEndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x;
 
@@ -473,26 +473,26 @@ export class GraphicalSlur extends GraphicalCurve {
                 endX += 0.5;
             }
             // const first: GraphicalNote = <GraphicalNote>slurEndNote.parentVoiceEntry.notes[0];
-            // if (first.NoteStem !== undefined && first.NoteStem.Direction === StemEnum.StemUp && this.placement === PlacementEnum.Above) {
+            // if (first.NoteStem && first.NoteStem.Direction === StemEnum.StemUp && this.placement === PlacementEnum.Above) {
             //     endX += first.NoteStem.PositionAndShape.RelativePosition.x;
             //     endY = skyBottomLineCalculator.getSkyLineMinAtPoint(staffLine, endX);
             // } else {
             //     const last: GraphicalNote = <GraphicalNote>slurEndNote.parentVoiceEntry.notes[slurEndNote.parentVoiceEntry.notes.length - 1];
-            //     if (last.NoteStem !== undefined && last.NoteStem.Direction === StemEnum.StemDown && this.placement === PlacementEnum.Below) {
+            //     if (last.NoteStem && last.NoteStem.Direction === StemEnum.StemDown && this.placement === PlacementEnum.Below) {
             //         endX += last.NoteStem.PositionAndShape.RelativePosition.x;
             //         endY = skyBottomLineCalculator.getBottomLineMaxAtPoint(staffLine, endX);
             //     } else {
             //         if (this.placement === PlacementEnum.Above) {
             //             const highestNote: GraphicalNote = last;
             //             endY = highestNote.PositionAndShape.RelativePosition.y;
-            //             if (highestNote.NoteHead !== undefined) {
+            //             if (highestNote.NoteHead) {
             //                 endY += highestNote.NoteHead.PositionAndShape.BorderMarginTop;
             //             } else { endY += highestNote.PositionAndShape.BorderTop; }
             //         } else {
             //             const lowestNote: GraphicalNote = first;
             //             endY = lowestNote.parentVoiceEntry
             //             lowestNote.PositionAndShape.RelativePosition.y;
-            //             if (lowestNote.NoteHead !== undefined) {
+            //             if (lowestNote.NoteHead) {
             //                 endY += lowestNote.NoteHead.PositionAndShape.BorderMarginBottom;
             //             } else { endY += lowestNote.PositionAndShape.BorderBottom; }
             //         }
@@ -503,14 +503,14 @@ export class GraphicalSlur extends GraphicalCurve {
         }
 
         // if GraphicalSlur breaks over System, then the end/start of the curve is at the corresponding height with the known start/end
-        if (slurStartNote === undefined && slurEndNote === undefined) {
+        if (!slurStartNote && !slurEndNote) {
             startY = 0;
             endY = 0;
         }
-        if (slurStartNote === undefined) {
+        if (!slurStartNote) {
             startY = endY;
         }
-        if (slurEndNote === undefined) {
+        if (!slurEndNote) {
             endY = startY;
         }
 
@@ -536,7 +536,7 @@ export class GraphicalSlur extends GraphicalCurve {
      */
     private calculatePlacement(skyBottomLineCalculator: SkyBottomLineCalculator, staffLine: StaffLine): void {
         // old version: when lyrics are given place above:
-        // if ( !this.slur.StartNote.ParentVoiceEntry.LyricsEntries.isEmpty || (this.slur.EndNote !== undefined
+        // if ( !this.slur.StartNote.ParentVoiceEntry.LyricsEntries.isEmpty || (this.slur.EndNote
         //                                     && !this.slur.EndNote.ParentVoiceEntry.LyricsEntries.isEmpty) ) {
         //     this.placement = PlacementEnum.Above;
         //     return;

+ 8 - 8
src/MusicalScore/Graphical/GraphicalStaffEntry.ts

@@ -27,14 +27,14 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
         this.parentMeasure = parentMeasure;
         this.graphicalVoiceEntries = [];
         this.sourceStaffEntry = sourceStaffEntry;
-        if (staffEntryParent !== undefined) {
+        if (staffEntryParent) {
             this.staffEntryParent = staffEntryParent;
             this.parentVerticalContainer = staffEntryParent.parentVerticalContainer;
             this.PositionAndShape = new BoundingBox(this, staffEntryParent.PositionAndShape);
         } else {
             this.PositionAndShape = new BoundingBox(this, parentMeasure.PositionAndShape);
         }
-        if (sourceStaffEntry !== undefined) {
+        if (sourceStaffEntry) {
             this.relInMeasureTimestamp = sourceStaffEntry.Timestamp;
         }
     }
@@ -77,7 +77,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      */
     public getAbsoluteTimestamp(): Fraction {
         const result: Fraction = this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();
-        if (this.relInMeasureTimestamp !== undefined) {
+        if (this.relInMeasureTimestamp) {
             result.Add(this.relInMeasureTimestamp);
         }
         return result;
@@ -110,7 +110,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      * @returns {any}
      */
     public findEndTieGraphicalNoteFromNoteWithStartingSlur(tieNote: Note, slur: Slur): GraphicalNote {
-        if (tieNote === undefined) {
+        if (!tieNote) {
             return undefined;
         }
         for (const gve of this.graphicalVoiceEntries) {
@@ -119,7 +119,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
             }
             for (const graphicalNote of gve.notes) {
                 const note: Note = graphicalNote.sourceNote;
-                if (note.NoteTie !== undefined && note.NoteSlurs.indexOf(slur) !== -1) {
+                if (note.NoteTie && note.NoteSlurs.indexOf(slur) !== -1) {
                     return graphicalNote;
                 }
             }
@@ -128,7 +128,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
     }
 
     public findGraphicalNoteFromGraceNote(graceNote: Note): GraphicalNote {
-        if (graceNote === undefined) {
+        if (!graceNote) {
             return undefined;
         }
         for (const gve of this.graphicalVoiceEntries) {
@@ -145,7 +145,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
     }
 
     public findGraphicalNoteFromNote(note: Note): GraphicalNote {
-        if (note === undefined) {
+        if (!note) {
             return undefined;
         }
         for (const gve of this.graphicalVoiceEntries) {
@@ -191,7 +191,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      * @returns {boolean}
      */
     public isVoiceEntryPartOfLinkedVoiceEntry(voiceEntry: VoiceEntry): boolean {
-        if (this.sourceStaffEntry.Link !== undefined) {
+        if (this.sourceStaffEntry.Link) {
             for (let idx: number = 0, len: number = this.sourceStaffEntry.Link.LinkStaffEntries.length; idx < len; ++idx) {
                 const sEntry: SourceStaffEntry = this.sourceStaffEntry.Link.LinkStaffEntries[idx];
                 if (sEntry.VoiceEntries.indexOf(voiceEntry) !== -1 && sEntry !== this.sourceStaffEntry) {

+ 2 - 2
src/MusicalScore/Graphical/GraphicalStaffEntryLink.ts

@@ -24,7 +24,7 @@ export class GraphicalStaffEntryLink {
     }
     public isFilled(): boolean {
         for (let i: number = 0; i < this.graphicalLinkedStaffEntries.length; i++) {
-            if (this.graphicalLinkedStaffEntries[i] === undefined) {
+            if (!this.graphicalLinkedStaffEntries[i]) {
                 return false;
             }
         }
@@ -43,7 +43,7 @@ export class GraphicalStaffEntryLink {
                 const graphicalLinkedStaffEntry: GraphicalStaffEntry = this.graphicalLinkedStaffEntries[idx];
                 for (const gve of graphicalLinkedStaffEntry.graphicalVoiceEntries) {
                     for (const graphicalNote of gve.notes) {
-                        if (graphicalNote.sourceNote.ParentStaffEntry.Link !== undefined
+                        if (graphicalNote.sourceNote.ParentStaffEntry.Link
                             && graphicalNote.sourceNote.ParentVoiceEntry === this.staffEntryLink.GetVoiceEntry) {
                             notes.push(graphicalNote);
                         }

+ 36 - 36
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -514,7 +514,7 @@ export abstract class MusicSheetCalculator {
             for (let i: number = 0; i < staffEntry.LyricsEntries.length; i++) {
                 const lyricEntry: GraphicalLyricEntry = staffEntry.LyricsEntries[i];
                 // calculate LyricWord's Dashes and underscoreLine
-                if (lyricEntry.ParentLyricWord !== undefined &&
+                if (lyricEntry.ParentLyricWord &&
                     lyricEntry.ParentLyricWord.GraphicalLyricsEntries[lyricEntry.ParentLyricWord.GraphicalLyricsEntries.length - 1] !== lyricEntry) {
                     this.calculateSingleLyricWord(lyricEntry);
                 }
@@ -633,12 +633,12 @@ export abstract class MusicSheetCalculator {
      * Store the newly computed [[Measure]]s in newly created [[MusicSystem]]s.
      */
     protected calculateMusicSystems(): void {
-        if (this.graphicalMusicSheet.MeasureList === undefined) {
+        if (!this.graphicalMusicSheet.MeasureList) {
             return;
         }
 
         const allMeasures: GraphicalMeasure[][] = this.graphicalMusicSheet.MeasureList;
-        if (allMeasures === undefined) {
+        if (!allMeasures) {
             return;
         }
         if (this.rules.MinMeasureToDrawIndex > allMeasures.length - 1) {
@@ -946,7 +946,7 @@ export abstract class MusicSheetCalculator {
         const endStaffLine: StaffLine = endMeasure.ParentStaffLine;
 
         // check if Expression spreads over the same StaffLine or not
-        const sameStaffLine: boolean = endStaffLine !== undefined && staffLine === endStaffLine;
+        const sameStaffLine: boolean = endStaffLine && staffLine === endStaffLine;
 
         let isPartOfMultiStaffInstrument: boolean = false;
         if (endStaffLine) { // unfortunately we can't do something like (endStaffLine?.check() || staffLine?.check()) in this typescript version
@@ -1428,7 +1428,7 @@ export abstract class MusicSheetCalculator {
                     }
 
                     const graphicalTempoExpr: GraphicalInstantaneousTempoExpression = new GraphicalInstantaneousTempoExpression(entry.Expression, graphLabel);
-                    if (graphicalTempoExpr.ParentStaffLine === undefined) {
+                    if (!graphicalTempoExpr.ParentStaffLine) {
                         log.warn("Adding staffline didn't work");
                         // I am actually fooling the linter here and use the created object. This method needs refactoring,
                         // all graphical expression creations should be in one place and have basic stuff like labels, lines, ...
@@ -1478,7 +1478,7 @@ export abstract class MusicSheetCalculator {
                     const staffLine: StaffLine = musicSystem.StaffLines[idx3];
                     for (let idx4: number = 0, len4: number = staffLine.Measures.length; idx4 < len4; ++idx4) {
                         const graphicalMeasure: GraphicalMeasure = staffLine.Measures[idx4];
-                        if (graphicalMeasure.FirstInstructionStaffEntry !== undefined) {
+                        if (graphicalMeasure.FirstInstructionStaffEntry) {
                             const index: number = graphicalMeasure.PositionAndShape.ChildElements.indexOf(
                                 graphicalMeasure.FirstInstructionStaffEntry.PositionAndShape
                             );
@@ -1488,7 +1488,7 @@ export abstract class MusicSheetCalculator {
                             graphicalMeasure.FirstInstructionStaffEntry = undefined;
                             graphicalMeasure.beginInstructionsWidth = 0.0;
                         }
-                        if (graphicalMeasure.LastInstructionStaffEntry !== undefined) {
+                        if (graphicalMeasure.LastInstructionStaffEntry) {
                             const index: number = graphicalMeasure.PositionAndShape.ChildElements.indexOf(
                                 graphicalMeasure.LastInstructionStaffEntry.PositionAndShape
                             );
@@ -1530,7 +1530,7 @@ export abstract class MusicSheetCalculator {
         // check for Tabs:
         const tabStaffEntry: GraphicalStaffEntry = graphicalStaffEntry.tabStaffEntry;
         let graphicalTabVoiceEntry: GraphicalVoiceEntry;
-        if (tabStaffEntry !== undefined) {
+        if (tabStaffEntry) {
             graphicalTabVoiceEntry = tabStaffEntry.findOrCreateGraphicalVoiceEntry(voiceEntry);
         }
 
@@ -1550,7 +1550,7 @@ export abstract class MusicSheetCalculator {
                 const staffLineCount: number = voiceEntry.ParentSourceStaffEntry.ParentStaff.StafflineCount;
                 graphicalNote = MusicSheetCalculator.stafflineNoteCalculator.positionNote(graphicalNote, activeClef, staffLineCount);
             }
-            if (note.Pitch !== undefined) {
+            if (note.Pitch) {
                 this.checkNoteForAccidental(graphicalNote, accidentalCalculator, activeClef, octaveShiftValue);
             }
             this.resetYPositionForLeadSheet(graphicalNote.PositionAndShape);
@@ -1592,7 +1592,7 @@ export abstract class MusicSheetCalculator {
         if (voiceEntry.LyricsEntries.size() > 0) {
             this.handleVoiceEntryLyrics(voiceEntry, graphicalStaffEntry, openLyricWords);
         }
-        if (voiceEntry.OrnamentContainer !== undefined) {
+        if (voiceEntry.OrnamentContainer) {
             this.handleVoiceEntryOrnaments(voiceEntry.OrnamentContainer, voiceEntry, graphicalStaffEntry);
         }
         return octaveShiftValue;
@@ -1757,7 +1757,7 @@ export abstract class MusicSheetCalculator {
         }
         leftStaffEntry = this.getFirstLeftNotNullStaffEntryFromContainer(leftIndex, verticalIndex, multiStaffInstrument);
         rightStaffEntry = this.getFirstRightNotNullStaffEntryFromContainer(rightIndex, verticalIndex, multiStaffInstrument);
-        if (leftStaffEntry !== undefined && rightStaffEntry !== undefined) {
+        if (leftStaffEntry && rightStaffEntry) {
             let measureRelativeX: number = leftStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x;
             if (firstVisibleMeasureRelativeX > 0) {
                 measureRelativeX = firstVisibleMeasureRelativeX;
@@ -1809,7 +1809,7 @@ export abstract class MusicSheetCalculator {
             firstSystemAbsoluteTopMargin = firstMusicSystem.PositionAndShape.RelativePosition.y + firstMusicSystem.PositionAndShape.BorderTop;
         }
         //const firstStaffLine: StaffLine = this.graphicalMusicSheet.MusicPages[0].MusicSystems[0].StaffLines[0];
-        if (this.graphicalMusicSheet.Title !== undefined) {
+        if (this.graphicalMusicSheet.Title) {
             const title: GraphicalLabel = this.graphicalMusicSheet.Title;
             title.PositionAndShape.Parent = page.PositionAndShape;
             //title.PositionAndShape.Parent = firstStaffLine.PositionAndShape;
@@ -1820,7 +1820,7 @@ export abstract class MusicSheetCalculator {
             title.PositionAndShape.RelativePosition = relative;
             page.Labels.push(title);
         }
-        if (this.graphicalMusicSheet.Subtitle !== undefined) {
+        if (this.graphicalMusicSheet.Subtitle) {
             const subtitle: GraphicalLabel = this.graphicalMusicSheet.Subtitle;
             //subtitle.PositionAndShape.Parent = firstStaffLine.PositionAndShape;
             subtitle.PositionAndShape.Parent = page.PositionAndShape;
@@ -1832,7 +1832,7 @@ export abstract class MusicSheetCalculator {
             page.Labels.push(subtitle);
         }
         const composer: GraphicalLabel = this.graphicalMusicSheet.Composer;
-        if (composer !== undefined) {
+        if (composer) {
             composer.PositionAndShape.Parent = page.PositionAndShape; // if using pageWidth. (which can currently be too wide) TODO fix pageWidth (#578)
             //composer.PositionAndShape.Parent = firstStaffLine.PositionAndShape; if using firstStaffLine...width.
             //      y-collision problems, harder to y-align with lyrics
@@ -1854,7 +1854,7 @@ export abstract class MusicSheetCalculator {
             page.Labels.push(composer);
         }
         const lyricist: GraphicalLabel = this.graphicalMusicSheet.Lyricist;
-        if (lyricist !== undefined) {
+        if (lyricist) {
             lyricist.PositionAndShape.Parent = page.PositionAndShape;
             lyricist.setLabelPositionAndShapeBorders();
             const relative: PointF2D = new PointF2D();
@@ -1872,7 +1872,7 @@ export abstract class MusicSheetCalculator {
             for (let staffIndex: number = 0; staffIndex < sourceMeasure.CompleteNumberOfStaves; staffIndex++) {
                 for (let j: number = 0; j < sourceMeasure.VerticalSourceStaffEntryContainers.length; j++) {
                     const sourceStaffEntry: SourceStaffEntry = sourceMeasure.VerticalSourceStaffEntryContainers[j].StaffEntries[staffIndex];
-                    if (sourceStaffEntry !== undefined) {
+                    if (sourceStaffEntry) {
                         const startStaffEntry: GraphicalStaffEntry = this.graphicalMusicSheet.findGraphicalStaffEntryFromMeasureList(
                             staffIndex, measureIndex, sourceStaffEntry
                         );
@@ -1880,7 +1880,7 @@ export abstract class MusicSheetCalculator {
                             const voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[idx];
                             for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
                                 const note: Note = voiceEntry.Notes[idx2];
-                                if (note.NoteTie !== undefined) {
+                                if (note.NoteTie) {
                                     const tie: Tie = note.NoteTie;
                                     this.handleTie(tie, startStaffEntry, staffIndex, measureIndex);
                                 }
@@ -1904,7 +1904,7 @@ export abstract class MusicSheetCalculator {
                 continue;
             }
             endNote = endGse.findEndTieGraphicalNoteFromNote(tie.Notes[i]);
-            if (startNote !== undefined && endNote !== undefined && endGse !== undefined) {
+            if (startNote !== undefined && endNote !== undefined && endGse) {
                 if (!startNote.sourceNote.PrintObject || !endNote.sourceNote.PrintObject) {
                     continue;
                 }
@@ -1921,11 +1921,11 @@ export abstract class MusicSheetCalculator {
     private createAccidentalCalculators(): AccidentalCalculator[] {
         const accidentalCalculators: AccidentalCalculator[] = [];
         const firstSourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
-        if (firstSourceMeasure !== undefined) {
+        if (firstSourceMeasure) {
             for (let i: number = 0; i < firstSourceMeasure.CompleteNumberOfStaves; i++) {
                 const accidentalCalculator: AccidentalCalculator = new AccidentalCalculator();
                 accidentalCalculators.push(accidentalCalculator);
-                if (firstSourceMeasure.FirstInstructionsStaffEntries[i] !== undefined) {
+                if (firstSourceMeasure.FirstInstructionsStaffEntries[i]) {
                     for (let idx: number = 0, len: number = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions.length; idx < len; ++idx) {
                         const abstractNotationInstruction: AbstractNotationInstruction = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions[idx];
                         if (abstractNotationInstruction instanceof KeyInstruction) {
@@ -1948,7 +1948,7 @@ export abstract class MusicSheetCalculator {
                     const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx];
                     const verticalContainer: VerticalGraphicalStaffEntryContainer =
                         this.graphicalMusicSheet.getOrCreateVerticalContainer(graphicalStaffEntry.getAbsoluteTimestamp());
-                    if (verticalContainer !== undefined) {
+                    if (verticalContainer) {
                         verticalContainer.StaffEntries[j] = graphicalStaffEntry;
                         graphicalStaffEntry.parentVerticalContainer = verticalContainer;
                     }
@@ -2011,14 +2011,14 @@ export abstract class MusicSheetCalculator {
         }
         measure.hasError = sourceMeasure.getErrorInMeasure(staffIndex);
         // check for key instruction changes
-        if (sourceMeasure.FirstInstructionsStaffEntries[staffIndex] !== undefined) {
+        if (sourceMeasure.FirstInstructionsStaffEntries[staffIndex]) {
             for (let idx: number = 0, len: number = sourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions.length; idx < len; ++idx) {
                 const instruction: AbstractNotationInstruction = sourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[idx];
                 if (instruction instanceof KeyInstruction) {
                     const key: KeyInstruction = KeyInstruction.copy(instruction);
                     if (this.graphicalMusicSheet.ParentMusicSheet.Transpose !== 0 &&
                         measure.ParentStaff.ParentInstrument.MidiInstrumentId !== MidiInstrument.Percussion &&
-                        MusicSheetCalculator.transposeCalculator !== undefined) {
+                        MusicSheetCalculator.transposeCalculator) {
                         MusicSheetCalculator.transposeCalculator.transposeKey(
                             key, this.graphicalMusicSheet.ParentMusicSheet.Transpose
                         );
@@ -2030,7 +2030,7 @@ export abstract class MusicSheetCalculator {
         // check for octave shifts
         for (let idx: number = 0, len: number = sourceMeasure.StaffLinkedExpressions[staffIndex].length; idx < len; ++idx) {
             const multiExpression: MultiExpression = sourceMeasure.StaffLinkedExpressions[staffIndex][idx];
-            if (multiExpression.OctaveShiftStart !== undefined) {
+            if (multiExpression.OctaveShiftStart) {
                 const openOctaveShift: OctaveShift = multiExpression.OctaveShiftStart;
                 openOctaveShifts[staffIndex] = new OctaveShiftParams(
                     openOctaveShift, multiExpression.AbsoluteTimestamp,
@@ -2043,7 +2043,7 @@ export abstract class MusicSheetCalculator {
         for (let entryIndex: number = 0; entryIndex < sourceMeasure.VerticalSourceStaffEntryContainers.length; entryIndex++) {
             const sourceStaffEntry: SourceStaffEntry = sourceMeasure.VerticalSourceStaffEntryContainers[entryIndex].StaffEntries[staffIndex];
             // is there a SourceStaffEntry at this Index
-            if (sourceStaffEntry !== undefined) {
+            if (sourceStaffEntry) {
                 // a SourceStaffEntry exists
                 // is there an inStaff ClefInstruction? -> update activeClef
                 for (let idx: number = 0, len: number = sourceStaffEntry.Instructions.length; idx < len; ++idx) {
@@ -2062,13 +2062,13 @@ export abstract class MusicSheetCalculator {
                 }
 
                 const linkedNotes: Note[] = [];
-                if (sourceStaffEntry.Link !== undefined) {
+                if (sourceStaffEntry.Link) {
                     sourceStaffEntry.findLinkedNotes(linkedNotes);
                     this.handleStaffEntryLink(graphicalStaffEntry, staffEntryLinks);
                 }
                 // check for possible OctaveShift
                 let octaveShiftValue: OctaveEnum = OctaveEnum.NONE;
-                if (openOctaveShifts[staffIndex] !== undefined) {
+                if (openOctaveShifts[staffIndex]) {
                     if (openOctaveShifts[staffIndex].getAbsoluteStartTimestamp.lte(sourceStaffEntry.AbsoluteTimestamp) &&
                         sourceStaffEntry.AbsoluteTimestamp.lte(openOctaveShifts[staffIndex].getAbsoluteEndTimestamp)) {
                         octaveShiftValue = openOctaveShifts[staffIndex].getOpenOctaveShift.Type;
@@ -2104,7 +2104,7 @@ export abstract class MusicSheetCalculator {
 
         accidentalCalculator.doCalculationsAtEndOfMeasure();
         // update activeClef given at end of measure if needed
-        if (sourceMeasure.LastInstructionsStaffEntries[staffIndex] !== undefined) {
+        if (sourceMeasure.LastInstructionsStaffEntries[staffIndex]) {
             const lastStaffEntry: SourceStaffEntry = sourceMeasure.LastInstructionsStaffEntries[staffIndex];
             for (let idx: number = 0, len: number = lastStaffEntry.Instructions.length; idx < len; ++idx) {
                 const abstractNotationInstruction: AbstractNotationInstruction = lastStaffEntry.Instructions[idx];
@@ -2264,7 +2264,7 @@ export abstract class MusicSheetCalculator {
                         const graphicalStaffEntry: GraphicalStaffEntry = measure.staffEntries[idx5];
                         for (let idx6: number = 0, len6: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx6 < len6; ++idx6) {
                             const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx6];
-                            if (voiceEntry.OrnamentContainer !== undefined) {
+                            if (voiceEntry.OrnamentContainer) {
                                 if (voiceEntry.hasTie() && !graphicalStaffEntry.relInMeasureTimestamp.Equals(voiceEntry.Timestamp)) {
                                     continue;
                                 }
@@ -2423,7 +2423,7 @@ export abstract class MusicSheetCalculator {
         if (index >= 0) {
             nextLyricEntry = graphicalLyricWord.GraphicalLyricsEntries[index + 1];
         }
-        if (nextLyricEntry === undefined) {
+        if (!nextLyricEntry) {
             return;
         }
         const startStaffLine: StaffLine = <StaffLine>lyricEntry.StaffEntryParent.parentMeasure.ParentStaffLine;
@@ -2697,7 +2697,7 @@ export abstract class MusicSheetCalculator {
             for (let j: number = 0; j < sourceMeasure.StaffLinkedExpressions.length; j++) {
                 if (this.graphicalMusicSheet.MeasureList[i][j].ParentStaff.ParentInstrument.Visible) {
                     for (let k: number = 0; k < sourceMeasure.StaffLinkedExpressions[j].length; k++) {
-                        if ((sourceMeasure.StaffLinkedExpressions[j][k].OctaveShiftStart !== undefined)) {
+                        if ((sourceMeasure.StaffLinkedExpressions[j][k].OctaveShiftStart)) {
                             this.calculateSingleOctaveShift(sourceMeasure, sourceMeasure.StaffLinkedExpressions[j][k], i, j);
                         }
                     }
@@ -2707,11 +2707,11 @@ export abstract class MusicSheetCalculator {
     }
 
     private getFirstLeftNotNullStaffEntryFromContainer(horizontalIndex: number, verticalIndex: number, multiStaffInstrument: boolean): GraphicalStaffEntry {
-        if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[horizontalIndex].StaffEntries[verticalIndex] !== undefined) {
+        if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[horizontalIndex].StaffEntries[verticalIndex]) {
             return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[horizontalIndex].StaffEntries[verticalIndex];
         }
         for (let i: number = horizontalIndex - 1; i >= 0; i--) {
-            if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex] !== undefined) {
+            if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex]) {
                 return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex];
             }
         }
@@ -2719,11 +2719,11 @@ export abstract class MusicSheetCalculator {
     }
 
     private getFirstRightNotNullStaffEntryFromContainer(horizontalIndex: number, verticalIndex: number, multiStaffInstrument: boolean): GraphicalStaffEntry {
-        if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[horizontalIndex].StaffEntries[verticalIndex] !== undefined) {
+        if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[horizontalIndex].StaffEntries[verticalIndex]) {
             return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[horizontalIndex].StaffEntries[verticalIndex];
         }
         for (let i: number = horizontalIndex + 1; i < this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length; i++) {
-            if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex] !== undefined) {
+            if (this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex]) {
                 return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[i].StaffEntries[verticalIndex];
             }
         }
@@ -2820,7 +2820,7 @@ export abstract class MusicSheetCalculator {
         if (voiceEntry.WantedStemDirection === StemDirectionType.Undefined &&
             voiceEntry.Notes.length > 0) {
             const beam: Beam = voiceEntry.Notes[0].NoteBeam;
-            if (beam !== undefined) {
+            if (beam) {
                 // if there is a beam, find any already set stemDirection in the beam:
                 for (const note of beam.Notes) {
                     if (note.ParentVoiceEntry === voiceEntry) {

+ 9 - 9
src/MusicalScore/Graphical/MusicSheetDrawer.ts

@@ -423,7 +423,7 @@ export abstract class MusicSheetDrawer {
     }
 
     protected drawStaffLines(staffLine: StaffLine): void {
-        if (staffLine.StaffLines !== undefined) {
+        if (staffLine.StaffLines) {
             const position: PointF2D = staffLine.PositionAndShape.AbsolutePosition;
             for (let i: number = 0; i < 5; i++) {
                 this.drawLineAsHorizontalRectangleWithOffset(staffLine.StaffLines[i], position, <number>GraphicalLayers.Notes);
@@ -530,17 +530,17 @@ export abstract class MusicSheetDrawer {
 
     private drawMarkedAreas(system: MusicSystem): void {
         for (const markedArea of system.GraphicalMarkedAreas) {
-            if (markedArea !== undefined) {
-                if (markedArea.systemRectangle !== undefined) {
+            if (markedArea) {
+                if (markedArea.systemRectangle) {
                     this.drawRectangle(markedArea.systemRectangle, <number>GraphicalLayers.Background);
                 }
-                if (markedArea.settings !== undefined) {
+                if (markedArea.settings) {
                     this.drawLabel(markedArea.settings, <number>GraphicalLayers.Comment);
                 }
-                if (markedArea.labelRectangle !== undefined) {
+                if (markedArea.labelRectangle) {
                     this.drawRectangle(markedArea.labelRectangle, <number>GraphicalLayers.Background);
                 }
-                if (markedArea.label !== undefined) {
+                if (markedArea.label) {
                     this.drawLabel(markedArea.label, <number>GraphicalLayers.Comment);
                 }
             }
@@ -549,11 +549,11 @@ export abstract class MusicSheetDrawer {
 
     private drawComment(system: MusicSystem): void {
         for (const comment of system.GraphicalComments) {
-            if (comment !== undefined) {
-                if (comment.settings !== undefined) {
+            if (comment) {
+                if (comment.settings) {
                     this.drawLabel(comment.settings, <number>GraphicalLayers.Comment);
                 }
-                if (comment.label !== undefined) {
+                if (comment.label) {
                     this.drawLabel(comment.label, <number>GraphicalLayers.Comment);
                 }
             }

+ 5 - 5
src/MusicalScore/Graphical/MusicSystem.ts

@@ -59,7 +59,7 @@ export abstract class MusicSystem extends GraphicalObject {
 
     public set Parent(value: GraphicalMusicPage) {
         // remove from old page
-        if (this.parent !== undefined) {
+        if (this.parent) {
             const index: number = this.parent.MusicSystems.indexOf(this, 0);
             if (index > -1) {
                 this.parent.MusicSystems.splice(index, 1);
@@ -236,7 +236,7 @@ export abstract class MusicSystem extends GraphicalObject {
                         lastStaffLine = staffLine;
                     }
                 }
-                if (firstStaffLine !== undefined && lastStaffLine !== undefined) {
+                if (firstStaffLine && lastStaffLine) {
                     this.createInstrumentBracket(firstStaffLine, lastStaffLine);
                 }
             }
@@ -271,7 +271,7 @@ export abstract class MusicSystem extends GraphicalObject {
                     lastStaffLine = staffLine;
                 }
             }
-            if (firstStaffLine !== undefined && lastStaffLine !== undefined) {
+            if (firstStaffLine && lastStaffLine) {
                 this.createGroupBracket(firstStaffLine, lastStaffLine, recursionDepth);
             }
             if (instrumentGroup.InstrumentalGroups.length < 1) {
@@ -371,7 +371,7 @@ export abstract class MusicSystem extends GraphicalObject {
                 const measure: GraphicalMeasure = this.staffLines[i].Measures[idx];
                 for (let idx2: number = 0, len2: number = measure.staffEntries.length; idx2 < len2; ++idx2) {
                     const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
-                    if (staffEntry.sourceStaffEntry.Link !== undefined) {
+                    if (staffEntry.sourceStaffEntry.Link) {
                         first = true;
                     }
                 }
@@ -380,7 +380,7 @@ export abstract class MusicSystem extends GraphicalObject {
                 const measure: GraphicalMeasure = this.staffLines[i + 1].Measures[idx];
                 for (let idx2: number = 0, len2: number = measure.staffEntries.length; idx2 < len2; ++idx2) {
                     const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
-                    if (staffEntry.sourceStaffEntry.Link !== undefined) {
+                    if (staffEntry.sourceStaffEntry.Link) {
                         second = true;
                     }
                 }

+ 11 - 11
src/MusicalScore/Graphical/MusicSystemBuilder.ts

@@ -327,7 +327,7 @@ export class MusicSystemBuilder {
      * @param staff
      */
     protected addStaffLineToMusicSystem(musicSystem: MusicSystem, relativeYPosition: number, staff: Staff): void {
-        if (musicSystem !== undefined) {
+        if (musicSystem) {
             const staffLine: StaffLine = MusicSheetCalculator.symbolFactory.createStaffLine(musicSystem, staff);
             musicSystem.StaffLines.push(staffLine);
             const boundingBox: BoundingBox = staffLine.PositionAndShape;
@@ -366,7 +366,7 @@ export class MusicSystemBuilder {
      */
     protected initializeActiveInstructions(measureList: GraphicalMeasure[]): void {
         const firstSourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
-        if (firstSourceMeasure !== undefined) {
+        if (firstSourceMeasure) {
             this.visibleStaffIndices = this.graphicalMusicSheet.getVisibleStavesIndicesFromSourceMeasure(measureList);
             for (let i: number = 0, len: number = this.visibleStaffIndices.length; i < len; i++) {
                 const staffIndex: number = this.visibleStaffIndices[i];
@@ -451,7 +451,7 @@ export class MusicSystemBuilder {
         let currentClef: ClefInstruction = undefined;
         let currentKey: KeyInstruction = undefined;
         let currentRhythm: RhythmInstruction = undefined;
-        if (firstEntry !== undefined) {
+        if (firstEntry) {
             for (let idx: number = 0, len: number = firstEntry.Instructions.length; idx < len; ++idx) {
                 const abstractNotationInstruction: AbstractNotationInstruction = firstEntry.Instructions[idx];
                 if (abstractNotationInstruction instanceof ClefInstruction) {
@@ -477,13 +477,13 @@ export class MusicSystemBuilder {
         let clefAdded: boolean = false;
         let keyAdded: boolean = false;
         let rhythmAdded: boolean = false;
-        if (currentClef !== undefined) {
+        if (currentClef) {
             measure.addClefAtBegin(currentClef);
             clefAdded = true;
         } else {
             currentClef = this.activeClefs[visibleStaffIdx];
         }
-        if (currentKey !== undefined) {
+        if (currentKey) {
             currentKey = this.transposeKeyInstruction(currentKey, measure);
             const previousKey: KeyInstruction = isSystemStartMeasure ? undefined : this.activeKeys[visibleStaffIdx];
             measure.addKeyAtBegin(currentKey, previousKey, currentClef);
@@ -527,7 +527,7 @@ export class MusicSystemBuilder {
         for (let visStaffIdx: number = 0, len: number = graphicalMeasures.length; visStaffIdx < len; visStaffIdx++) {
             const staffIndex: number = this.visibleStaffIndices[visStaffIdx];
             const firstEntry: SourceStaffEntry = measure.FirstInstructionsStaffEntries[staffIndex];
-            if (firstEntry !== undefined) {
+            if (firstEntry) {
                 for (let idx: number = 0, len2: number = firstEntry.Instructions.length; idx < len2; ++idx) {
                     const abstractNotationInstruction: AbstractNotationInstruction = firstEntry.Instructions[idx];
                     if (abstractNotationInstruction instanceof ClefInstruction) {
@@ -542,7 +542,7 @@ export class MusicSystemBuilder {
             const entries: SourceStaffEntry[] = measure.getEntriesPerStaff(staffIndex);
             for (let idx: number = 0, len2: number = entries.length; idx < len2; ++idx) {
                 const staffEntry: SourceStaffEntry = entries[idx];
-                if (staffEntry.Instructions !== undefined) {
+                if (staffEntry.Instructions) {
                     for (let idx2: number = 0, len3: number = staffEntry.Instructions.length; idx2 < len3; ++idx2) {
                         const abstractNotationInstruction: AbstractNotationInstruction = staffEntry.Instructions[idx2];
                         if (abstractNotationInstruction instanceof ClefInstruction) {
@@ -552,7 +552,7 @@ export class MusicSystemBuilder {
                 }
             }
             const lastEntry: SourceStaffEntry = measure.LastInstructionsStaffEntries[staffIndex];
-            if (lastEntry !== undefined) {
+            if (lastEntry) {
                 const instructions: AbstractNotationInstruction[] = lastEntry.Instructions;
                 for (let idx: number = 0, len3: number = instructions.length; idx < len3; ++idx) {
                     const abstractNotationInstruction: AbstractNotationInstruction = instructions[idx];
@@ -593,7 +593,7 @@ export class MusicSystemBuilder {
                     rhythmInstruction = <RhythmInstruction>instruction;
                 }
             }
-            if (keyInstruction !== undefined || rhythmInstruction !== undefined) {
+            if (keyInstruction !== undefined || rhythmInstruction) {
                 const measureWidth: number = this.addExtraInstructionMeasure(visStaffIdx, keyInstruction, rhythmInstruction);
                 maxMeasureWidth = Math.max(maxMeasureWidth, measureWidth);
             }
@@ -613,7 +613,7 @@ export class MusicSystemBuilder {
         const measures: GraphicalMeasure[] = [];
         const measure: GraphicalMeasure = MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(currentSystem.StaffLines[visStaffIdx]);
         measures.push(measure);
-        if (keyInstruction !== undefined) {
+        if (keyInstruction) {
             measure.addKeyAtBegin(keyInstruction, this.activeKeys[visStaffIdx], this.activeClefs[visStaffIdx]);
         }
         if (rhythmInstruction !== undefined && rhythmInstruction.PrintObject) {
@@ -633,7 +633,7 @@ export class MusicSystemBuilder {
      * @param graphicalMeasures
      */
     protected addStaveMeasuresToSystem(graphicalMeasures: GraphicalMeasure[]): void {
-        if (graphicalMeasures[0] !== undefined) {
+        if (graphicalMeasures[0]) {
             const gmeasures: GraphicalMeasure[] = [];
             for (let i: number = 0; i < graphicalMeasures.length; i++) {
                 gmeasures.push(graphicalMeasures[i]);

+ 1 - 1
src/MusicalScore/Graphical/VerticalGraphicalStaffEntryContainer.ts

@@ -57,7 +57,7 @@ export class VerticalGraphicalStaffEntryContainer {
     public getFirstNonNullStaffEntry(): GraphicalStaffEntry {
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
             const graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
-            if (graphicalStaffEntry !== undefined) {
+            if (graphicalStaffEntry) {
                 return graphicalStaffEntry;
             }
         }

+ 1 - 1
src/MusicalScore/Graphical/VexFlow/CanvasVexFlowBackend.ts

@@ -66,7 +66,7 @@ export class CanvasVexFlowBackend extends VexFlowBackend {
         (<any>this.ctx).clearRect(0, 0, (<any>this.canvas).width, (<any>this.canvas).height);
 
         // set background color if not transparent
-        if (this.rules.PageBackgroundColor !== undefined) {
+        if (this.rules.PageBackgroundColor) {
             this.ctx.save();
             // note that this will hide the cursor
             this.ctx.setFillStyle(this.rules.PageBackgroundColor);

+ 1 - 1
src/MusicalScore/Graphical/VexFlow/SvgVexFlowBackend.ts

@@ -58,7 +58,7 @@ export class SvgVexFlowBackend extends VexFlowBackend {
         }
 
         // set background color if not transparent
-        if (this.rules.PageBackgroundColor !== undefined) {
+        if (this.rules.PageBackgroundColor) {
             this.ctx.save();
             // note that this will hide the cursor
             this.ctx.setFillStyle(this.rules.PageBackgroundColor);

+ 4 - 4
src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts

@@ -117,7 +117,7 @@ export class VexFlowConverter {
         const octave: number = pitch.Octave - note.Clef().OctaveOffset + 3;
         const notehead: Notehead = note.sourceNote.Notehead;
         let noteheadCode: string = "";
-        if (notehead !== undefined) {
+        if (notehead) {
             noteheadCode = this.NoteHeadCode(notehead);
         }
         return [fund + "n/" + octave + noteheadCode, acc, note.Clef()];
@@ -318,7 +318,7 @@ export class VexFlowConverter {
             // when the stem is connected to a beamed main note (e.g. Haydn Concertante bar 57)
             gve.parentVoiceEntry.WantedStemDirection = gve.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection;
         }
-        if (gve.parentVoiceEntry !== undefined) {
+        if (gve.parentVoiceEntry) {
             const wantedStemDirection: StemDirectionType = gve.parentVoiceEntry.WantedStemDirection;
             switch (wantedStemDirection) {
                 case(StemDirectionType.Up):
@@ -433,7 +433,7 @@ export class VexFlowConverter {
                     break;
                 }
             }
-            if (vfArt !== undefined) {
+            if (vfArt) {
                 vfArt.setPosition(vfArtPosition);
                 (vfnote as StaveNote).addModifier(0, vfArt);
             }
@@ -488,7 +488,7 @@ export class VexFlowConverter {
                 return;
             }
         }
-        if (vfOrna !== undefined) {
+        if (vfOrna) {
             if (oContainer.AccidentalBelow !== AccidentalEnum.NONE) {
                 vfOrna.setLowerAccidental(Pitch.accidentalVexflow(oContainer.AccidentalBelow));
             }

+ 8 - 8
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -108,7 +108,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
             space_below_staff_ln: 0,
         });
 
-        if (this.ParentStaff !== undefined) {
+        if (this.ParentStaff) {
             this.setLineNumber(this.ParentStaff.StafflineCount);
         }
         // constructor sets beginning and end bar type to standard
@@ -367,7 +367,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
           default:
             break;
         }
-        if (instruction !== undefined) {
+        if (instruction) {
             this.stave.addModifier(new Vex.Flow.Repetition(instruction, 0, 0), position);
             return;
         }
@@ -440,14 +440,14 @@ export class VexFlowMeasure extends GraphicalMeasure {
                 if(measures !== undefined && measures.length > 0){
                     for (let idx: number = 0, len: number = measures.length; idx < len; ++idx) {
                         const graphicalMeasure: VexFlowMeasure = measures[idx];
-                        if (graphicalMeasure.ParentStaffLine !== undefined && graphicalMeasure.ParentStaff.ParentInstrument.Visible) {
+                        if (graphicalMeasure.ParentStaffLine && graphicalMeasure.ParentStaff.ParentInstrument.Visible) {
                             prevMeasure = <VexFlowMeasure>graphicalMeasure;
                         break;
                         }
                     }
                 }
 
-                if(prevMeasure !== undefined){
+                if(prevMeasure){
                     let prevStaveModifiers = prevMeasure.stave.getModifiers();
                     for(let i = 0; i < prevStaveModifiers.length; i++){
                         let nextStaveModifier = prevStaveModifiers[i];
@@ -765,7 +765,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
                     const stemColors: string[] = [];
                     for (const entry of voiceEntries) {
                         const note: Vex.Flow.StaveNote = ((<VexFlowVoiceEntry>entry).vfStaveNote as StaveNote);
-                        if (note !== undefined) {
+                        if (note) {
                           notes.push(note);
                           beamedNotes.push(note);
                         }
@@ -1081,7 +1081,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
                 // only add clefs in main voice (to not add them twice)
                 if (isMainVoice) {
                     const vfse: VexFlowStaffEntry = vexFlowVoiceEntry.parentStaffEntry as VexFlowStaffEntry;
-                    if (vfse && vfse.vfClefBefore !== undefined) {
+                    if (vfse && vfse.vfClefBefore) {
                         // add clef as NoteSubGroup so that we get modifier layouting
                         const clefModifier: NoteSubGroup = new NoteSubGroup( [vfse.vfClefBefore] );
                         // The cast is necesary because...vexflow -> see types
@@ -1098,7 +1098,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
                 }
 
                 // add Arpeggio
-                if (voiceEntry.parentVoiceEntry && voiceEntry.parentVoiceEntry.Arpeggio !== undefined) {
+                if (voiceEntry.parentVoiceEntry && voiceEntry.parentVoiceEntry.Arpeggio) {
                     const arpeggio: Arpeggio = voiceEntry.parentVoiceEntry.Arpeggio;
                     // TODO right now our arpeggio object has all arpeggio notes from arpeggios across all voices.
                     // see VoiceGenerator. Doesn't matter for Vexflow for now though
@@ -1184,7 +1184,7 @@ export class VexFlowMeasure extends GraphicalMeasure {
                 if (gvoices.hasOwnProperty(voiceID)) {
                     const vfStaveNote: StemmableNote = (gvoices[voiceID] as VexFlowVoiceEntry).vfStaveNote;
                     const ornamentContainer: OrnamentContainer = gvoices[voiceID].notes[0].sourceNote.ParentVoiceEntry.OrnamentContainer;
-                    if (ornamentContainer !== undefined) {
+                    if (ornamentContainer) {
                         VexFlowConverter.generateOrnaments(vfStaveNote, ornamentContainer);
                     }
                 }

+ 12 - 12
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -297,7 +297,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
           const staffEntryXPosition: number = (staffEntry as VexFlowStaffEntry).PositionAndShape.RelativePosition.x;
           const lyricsXPosition: number = staffEntryXPosition + lyricsBbox.BorderMarginLeft;
 
-          if (lastLyricEntryDict[j] !== undefined) {
+          if (lastLyricEntryDict[j]) {
             if (lastLyricEntryDict[j].extend) {
               // TODO handle extend of last entry (extend is stored in lyrics entry of preceding syllable)
               // only necessary for center alignment
@@ -441,14 +441,14 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
 
     let vfStartNote: Vex.Flow.StaveNote = undefined;
     let startNoteIndexInTie: number = 0;
-    if (startNote !== undefined && startNote.vfnote !== undefined && startNote.vfnote.length >= 2) {
+    if (startNote && startNote.vfnote && startNote.vfnote.length >= 2) {
       vfStartNote = startNote.vfnote[0];
       startNoteIndexInTie = startNote.vfnote[1];
     }
 
     let vfEndNote: Vex.Flow.StaveNote = undefined;
     let endNoteIndexInTie: number = 0;
-    if (endNote !== undefined && endNote.vfnote !== undefined && endNote.vfnote.length >= 2) {
+    if (endNote && endNote.vfnote && endNote.vfnote.length >= 2) {
       vfEndNote = endNote.vfnote[0];
       endNoteIndexInTie = endNote.vfnote[1];
     }
@@ -583,12 +583,12 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     const maxMeasureToDrawIndex: number = this.rules.MaxMeasureToDrawIndex;
 
     let startStaffLine: StaffLine = this.graphicalMusicSheet.MeasureList[measureIndex][staffIndex].ParentStaffLine;
-    if (startStaffLine === undefined) { // fix for rendering range set. all of these can probably done cleaner.
+    if (!startStaffLine) { // fix for rendering range set. all of these can probably done cleaner.
       startStaffLine = this.graphicalMusicSheet.MeasureList[minMeasureToDrawIndex][staffIndex].ParentStaffLine;
     }
 
     let endMeasure: GraphicalMeasure = undefined;
-    if (octaveShift.ParentEndMultiExpression !== undefined) {
+    if (octaveShift.ParentEndMultiExpression) {
       endMeasure = this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(octaveShift.ParentEndMultiExpression.SourceMeasureParent,
                                                                                          staffIndex);
     } else {
@@ -598,7 +598,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
       endMeasure = this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(staffIndex, true);
     }
     let startMeasure: GraphicalMeasure = undefined;
-    if (octaveShift.ParentEndMultiExpression !== undefined) {
+    if (octaveShift.ParentEndMultiExpression) {
       startMeasure = this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(octaveShift.ParentStartMultiExpression.SourceMeasureParent,
                                                                                            staffIndex);
     } else {
@@ -617,11 +617,11 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     }
 
     let endStaffLine: StaffLine = endMeasure.ParentStaffLine;
-    if (endStaffLine === undefined) {
+    if (!endStaffLine) {
       endStaffLine = startStaffLine;
     }
 
-    if (endMeasure !== undefined && startStaffLine !== undefined && endStaffLine !== undefined) {
+    if (endMeasure && startStaffLine && endStaffLine) {
       // calculate GraphicalOctaveShift and RelativePositions
       const graphicalOctaveShift: VexFlowOctaveShift = new VexFlowOctaveShift(octaveShift, startStaffLine.PositionAndShape);
       if (graphicalOctaveShift.getStartNote() === undefined) { // fix for rendering range set
@@ -712,7 +712,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     const measures: VexFlowMeasure[] = <VexFlowMeasure[]>this.graphicalMusicSheet.MeasureList[measureIndex];
     for (let idx: number = 0, len: number = measures.length; idx < len; ++idx) {
       const graphicalMeasure: VexFlowMeasure = measures[idx];
-      if (graphicalMeasure.ParentStaffLine !== undefined && graphicalMeasure.ParentStaff.ParentInstrument.Visible) {
+      if (graphicalMeasure.ParentStaffLine && graphicalMeasure.ParentStaff.ParentInstrument.Visible) {
         uppermostMeasure = <VexFlowMeasure>graphicalMeasure;
         break;
       }
@@ -720,7 +720,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     // ToDo: feature/Repetitions
     // now create corresponding graphical symbol or Text in VexFlow:
     // use top measure and staffline for positioning.
-    if (uppermostMeasure !== undefined) {
+    if (uppermostMeasure) {
       uppermostMeasure.addWordRepetition(repetitionInstruction);
     }
   }
@@ -785,7 +785,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
       const graphicalLabel: GraphicalLabel = graphicalLyricEntry.GraphicalLabel;
       graphicalLabel.setLabelPositionAndShapeBorders();
 
-      if (lyricsEntry.Word !== undefined) {
+      if (lyricsEntry.Word) {
         const lyricsEntryIndex: number = lyricsEntry.Word.Syllables.indexOf(lyricsEntry);
         let index: number = lyricWords.indexOf(lyricsEntry.Word);
         if (index === -1) {
@@ -933,7 +933,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
                     }
                     // add new VexFlowSlur to List
                     if (slur.StartNote === graphicalNote.sourceNote) {
-                      if (graphicalNote.sourceNote.NoteTie !== undefined) {
+                      if (graphicalNote.sourceNote.NoteTie) {
                         if (graphicalNote.parentVoiceEntry.parentStaffEntry.getAbsoluteTimestamp() !==
                           graphicalNote.sourceNote.NoteTie.StartNote.getAbsoluteTimestamp()) {
                           break;

+ 1 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowSlur.ts

@@ -55,7 +55,7 @@ export class VexFlowSlur {
     }
 
     // public createVexFlowCurve(): void {
-    //     if (this.voiceentrySlurStart !== undefined || this.voiceentrySlurEnd !== undefined) {
+    //     if (this.voiceentrySlurStart || this.voiceentrySlurEnd) {
     //         this.vfCurve = new Vex.Flow.Curve( (this.voiceentrySlurStart as VexFlowVoiceEntry).vfStaveNote,
     //                                            (this.voiceentrySlurEnd as VexFlowVoiceEntry).vfStaveNote,
     //                                            this.curve_Options()

+ 1 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowTabMeasure.ts

@@ -84,7 +84,7 @@ export class VexFlowTabMeasure extends VexFlowMeasure {
                 }
 
                 // add Arpeggio
-                if (voiceEntry.parentVoiceEntry && voiceEntry.parentVoiceEntry.Arpeggio !== undefined) {
+                if (voiceEntry.parentVoiceEntry && voiceEntry.parentVoiceEntry.Arpeggio) {
                     const arpeggio: Arpeggio = voiceEntry.parentVoiceEntry.Arpeggio;
                     // TODO right now our arpeggio object has all arpeggio notes from arpeggios across all voices.
                     // see VoiceGenerator. Doesn't matter for Vexflow for now though

+ 1 - 1
src/MusicalScore/MusicParts/MusicPartManager.ts

@@ -89,7 +89,7 @@ export class MusicPartManager /*implements ISelectionListener*/ {
                     curTimestampTransform.curRepetition = jumpRep;
                     curTimestampTransform.curRepetitionIteration = iterator.CurrentJumpResponsibleRepetitionIterationBeforeJump;
                     for (let i: number = this.timestamps.length - 2; i >= 0; i--) {
-                        if (timestamps[i].to.lt(jumpRep.AbsoluteTimestamp) || timestamps[i].curRepetition !== undefined) {
+                        if (timestamps[i].to.lt(jumpRep.AbsoluteTimestamp) || timestamps[i].curRepetition) {
                             break;
                         }
                         timestamps[i].nextBackJump = curTimestampTransform.nextBackJump;

+ 13 - 13
src/MusicalScore/MusicParts/MusicPartManagerIterator.ts

@@ -33,7 +33,7 @@ export class MusicPartManagerIterator {
                 this.moveToNext();
             } while ((this.currentVoiceEntries === undefined || this.currentTimeStamp.lt(startTimestamp)) && !this.endReached);
             for (let staffIndex: number = 0; staffIndex < this.activeDynamicExpressions.length; staffIndex++) {
-                if (this.activeDynamicExpressions[staffIndex] !== undefined) {
+                if (this.activeDynamicExpressions[staffIndex]) {
                     if (this.activeDynamicExpressions[staffIndex] instanceof ContinuousDynamicExpression) {
                         const continuousDynamic: ContinuousDynamicExpression =
                             <ContinuousDynamicExpression>this.activeDynamicExpressions[staffIndex];
@@ -90,13 +90,13 @@ export class MusicPartManagerIterator {
         return this.currentRepetition;
     }
     public get CurrentRepetitionIteration(): number {
-        if (this.CurrentRepetition !== undefined) {
+        if (this.CurrentRepetition) {
             return this.getRepetitionIterationCount(this.CurrentRepetition);
         }
         return 0;
     }
     public get CurrentJumpResponsibleRepetitionIterationBeforeJump(): number {
-        if (this.jumpResponsibleRepetition !== undefined) {
+        if (this.jumpResponsibleRepetition) {
             return this.getRepetitionIterationCount(this.jumpResponsibleRepetition) - 1;
         }
         return 0;
@@ -156,7 +156,7 @@ export class MusicPartManagerIterator {
         if (this.currentVoiceEntries === undefined) {
             return voiceEntries;
         }
-        if (instrument !== undefined) {
+        if (instrument) {
             for (const entry of this.currentVoiceEntries) {
                 if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
                     this.getVisibleEntries(entry, voiceEntries);
@@ -181,7 +181,7 @@ export class MusicPartManagerIterator {
         if (this.currentVoiceEntries === undefined) {
             return voiceEntries;
         }
-        if (instrument !== undefined) {
+        if (instrument) {
             for (const entry of this.currentVoiceEntries) {
                 if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
                     this.getAudibleEntries(entry, voiceEntries);
@@ -215,7 +215,7 @@ export class MusicPartManagerIterator {
         if (this.currentVoiceEntries === undefined) {
             return voiceEntries;
         }
-        if (instrument !== undefined) {
+        if (instrument) {
             for (const entry of this.currentVoiceEntries) {
                 if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
                     this.getScoreFollowingEntries(entry, voiceEntries);
@@ -236,7 +236,7 @@ export class MusicPartManagerIterator {
     public moveToNext(): void {
         this.forwardJumpOccurred = this.backJumpOccurred = false;
         if (this.endReached) { return; }
-        if (this.currentVoiceEntries !== undefined) {
+        if (this.currentVoiceEntries) {
             this.currentVoiceEntries = [];
         }
         this.recursiveMove();
@@ -428,9 +428,9 @@ export class MusicPartManagerIterator {
             const dynamicsContainer: DynamicsContainer = timeSortedDynamics[this.currentDynamicEntryIndex];
             const staffIndex: number = dynamicsContainer.staffNumber;
             if (this.CurrentSourceTimestamp.Equals(dynamicsContainer.parMultiExpression().AbsoluteTimestamp)) {
-                if (dynamicsContainer.continuousDynamicExpression !== undefined) {
+                if (dynamicsContainer.continuousDynamicExpression) {
                     this.activeDynamicExpressions[staffIndex] = dynamicsContainer.continuousDynamicExpression;
-                } else if (dynamicsContainer.instantaneousDynamicExpression !== undefined) {
+                } else if (dynamicsContainer.instantaneousDynamicExpression) {
                     this.activeDynamicExpressions[staffIndex] = dynamicsContainer.instantaneousDynamicExpression;
                 }
             }
@@ -438,7 +438,7 @@ export class MusicPartManagerIterator {
         }
         this.currentDynamicChangingExpressions = [];
         for (let staffIndex: number = 0; staffIndex < this.activeDynamicExpressions.length; staffIndex++) {
-            if (this.activeDynamicExpressions[staffIndex] !== undefined) {
+            if (this.activeDynamicExpressions[staffIndex]) {
                 let startTime: Fraction;
                 let endTime: Fraction;
                 if (this.activeDynamicExpressions[staffIndex] instanceof ContinuousDynamicExpression) {
@@ -480,9 +480,9 @@ export class MusicPartManagerIterator {
             this.currentTempoEntryIndex++;
         }
         this.currentTempoChangingExpression = undefined;
-        if (this.activeTempoExpression !== undefined) {
+        if (this.activeTempoExpression) {
             let endTime: Fraction = this.activeTempoExpression.AbsoluteTimestamp;
-            if (this.activeTempoExpression.ContinuousTempo !== undefined) {
+            if (this.activeTempoExpression.ContinuousTempo) {
                 endTime = this.activeTempoExpression.ContinuousTempo.AbsoluteEndTimestamp;
             }
             if (   this.activeTempoExpression.AbsoluteTimestamp.lte(this.CurrentSourceTimestamp)
@@ -539,7 +539,7 @@ export class MusicPartManagerIterator {
             if (!notesOnly) { return true; }
             for (let idx: number = 0, len: number = tlist.length; idx < len; ++idx) {
                 const entry: VoiceEntry = tlist[idx];
-                if (entry.Notes[0].Pitch !== undefined) { return true; }
+                if (entry.Notes[0].Pitch) { return true; }
             }
         }
         return false;

+ 12 - 12
src/MusicalScore/MusicSheet.ts

@@ -158,28 +158,28 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
         return this.staves;
     }
     public get TitleString(): string {
-        if (this.title !== undefined) {
+        if (this.title) {
             return this.title.text;
         } else {
             return "";
         }
     }
     public get SubtitleString(): string {
-        if (this.subtitle !== undefined) {
+        if (this.subtitle) {
             return this.subtitle.text;
         } else {
             return "";
         }
     }
     public get ComposerString(): string {
-        if (this.composer !== undefined) {
+        if (this.composer) {
             return this.composer.text;
         } else {
             return "";
         }
     }
     public get LyricistString(): string {
-        if (this.lyricist !== undefined) {
+        if (this.lyricist) {
             return this.lyricist.text;
         } else {
             return "";
@@ -339,7 +339,7 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     }
     public resetAllNoteStates(): void {
         const iterator: MusicPartManagerIterator = this.MusicPartManager.getIterator();
-        while (!iterator.EndReached && iterator.CurrentVoiceEntries !== undefined) {
+        while (!iterator.EndReached && iterator.CurrentVoiceEntries) {
             for (let idx: number = 0, len: number = iterator.CurrentVoiceEntries.length; idx < len; ++idx) {
                 const voiceEntry: VoiceEntry = iterator.CurrentVoiceEntries[idx];
                 for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
@@ -427,9 +427,9 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     //public GetExpressionsStartTempoInBPM(): number {
     //    if (this.TimestampSortedTempoExpressionsList.length > 0) {
     //        let me: MultiTempoExpression = this.TimestampSortedTempoExpressionsList[0];
-    //        if (me.InstantaneousTempo !== undefined) {
+    //        if (me.InstantaneousTempo) {
     //            return me.InstantaneousTempo.TempoInBpm;
-    //        } else if (me.ContinuousTempo !== undefined) {
+    //        } else if (me.ContinuousTempo) {
     //            return me.ContinuousTempo.StartTempo;
     //        }
     //    }
@@ -470,22 +470,22 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     }
     // (*)
     //public SetMusicSheetParameter(parameter: MusicSheetParameters, value: Object): void {
-    //    if (this.PhonicScoreInterface !== undefined) {
+    //    if (this.PhonicScoreInterface) {
     //        this.PhonicScoreInterface.RequestMusicSheetParameter(parameter, value);
     //    } else {
     //        let oldValue: Object = 0;
-    //        if (parameter === undefined) { // FIXME MusicSheetParameters.MusicSheetTranspose) {
+    //        if (!parameter) { // FIXME MusicSheetParameters.MusicSheetTranspose) {
     //            oldValue = this.Transpose;
     //            this.Transpose = value;
     //        }
-    //        if (parameter === undefined) { // FIXME MusicSheetParameters.StartTempoInBPM) {
+    //        if (!parameter) { // FIXME MusicSheetParameters.StartTempoInBPM) {
     //            oldValue = this.UserStartTempoInBPM;
     //            this.UserStartTempoInBPM = value;
     //        }
-    //        if (parameter === undefined) { // FIXME MusicSheetParameters.HighlightErrors) {
+    //        if (!parameter) { // FIXME MusicSheetParameters.HighlightErrors) {
     //            oldValue = value;
     //        }
-    //        if (this.MusicSheetParameterChanged !== undefined) {
+    //        if (this.MusicSheetParameterChanged) {
     //            this.musicSheetParameterChangedDelegate(undefined, parameter, value, oldValue);
     //        }
     //    }

+ 1 - 1
src/MusicalScore/MusicSource/MappingSourceMusicPart.ts

@@ -46,7 +46,7 @@ export class MappingSourceMusicPart /* implements IComparable, IComparable<Mappi
     }
     public CompareTo(comp: MappingSourceMusicPart): number {
         //let comp: MappingSourceMusicPart = <MappingSourceMusicPart>(obj, MappingSourceMusicPart);
-        if (comp !== undefined) {
+        if (comp) {
             return this.startTimestamp.CompareTo(comp.startTimestamp);
         } else { return 1; }
     }

+ 4 - 4
src/MusicalScore/MusicSource/Repetition.ts

@@ -65,7 +65,7 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
     }
     public getForwardJumpTargetForIteration(iteration: number): number {
         const endingIndex: number = this.repetitonIterationOrder[iteration - 1];
-        if (this.endingIndexDict[endingIndex] !== undefined) {
+        if (this.endingIndexDict[endingIndex]) {
             return this.endingIndexDict[endingIndex].part.StartIndex;
         }
         return -1;
@@ -99,7 +99,7 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
     //    }
     //}
     public setEndingEndIndex(endingNumber: number, endIndex: number): void {
-        if (this.endingIndexDict[endingNumber] !== undefined) {
+        if (this.endingIndexDict[endingNumber]) {
             this.endingIndexDict[endingNumber].part.setEndIndex(endIndex);
         }
     }
@@ -123,7 +123,7 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
             return this.StartIndex;
         }
         let result: number = this.backwardJumpInstructions[this.backwardJumpInstructions.length - 1].measureIndex;
-        if (this.endingIndexDict[this.NumberOfEndings] !== undefined) {
+        if (this.endingIndexDict[this.NumberOfEndings]) {
             result = Math.max(this.endingIndexDict[this.NumberOfEndings].part.EndIndex, result);
         }
         return result;
@@ -136,7 +136,7 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
             const sourceMeasure: SourceMeasure = this.musicSheet2.SourceMeasures[measureIndex];
             for (let i: number = 0; i < sourceMeasure.CompleteNumberOfStaves; i++) {
                 for (const sourceStaffEntry of sourceMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries) {
-                    if (sourceStaffEntry !== undefined) {
+                    if (sourceStaffEntry) {
                         let verses: number = 0;
                         for (const voiceEntry of sourceStaffEntry.VoiceEntries) {
                             verses += Object.keys(voiceEntry.LyricsEntries).length;

+ 49 - 49
src/MusicalScore/ScoreIO/InstrumentReader.ts

@@ -124,7 +124,7 @@ export class InstrumentReader {
     }
     this.currentMeasure = currentMeasure;
     this.inSourceMeasureInstrumentIndex = this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument);
-    if (this.repetitionInstructionReader !== undefined) {
+    if (this.repetitionInstructionReader) {
      this.repetitionInstructionReader.prepareReadingMeasure(currentMeasure, this.currentXmlMeasureIndex);
     }
     let currentFraction: Fraction = new Fraction(0, 1);
@@ -155,7 +155,7 @@ export class InstrumentReader {
           }
           let noteStaff: number = 1;
           if (this.instrument.Staves.length > 1) {
-            if (xmlNode.element("staff") !== undefined) {
+            if (xmlNode.element("staff")) {
               noteStaff = parseInt(xmlNode.element("staff").value, 10);
               if (isNaN(noteStaff)) {
                 log.debug("InstrumentReader.readNextXmlMeasure.get staff number");
@@ -166,7 +166,7 @@ export class InstrumentReader {
 
           this.currentStaff = this.instrument.Staves[noteStaff - 1];
           const isChord: boolean = xmlNode.element("chord") !== undefined;
-          if (xmlNode.element("voice") !== undefined) {
+          if (xmlNode.element("voice")) {
             const noteVoice: number = parseInt(xmlNode.element("voice").value, 10);
             this.currentVoiceGenerator = this.getOrCreateVoiceGenerator(noteVoice, noteStaff - 1);
           } else {
@@ -179,7 +179,7 @@ export class InstrumentReader {
           let normalNotes: number = 2;
           let typeDuration: Fraction = undefined;
           let isTuplet: boolean = false;
-          if (xmlNode.element("duration") !== undefined) {
+          if (xmlNode.element("duration")) {
             noteDivisions = parseInt(xmlNode.element("duration").value, 10);
             if (!isNaN(noteDivisions)) {
               noteDuration = new Fraction(noteDivisions, 4 * this.divisions);
@@ -188,11 +188,11 @@ export class InstrumentReader {
               } else {
                 typeDuration = this.getNoteDurationFromTypeNode(xmlNode);
               }
-              if (xmlNode.element("time-modification") !== undefined) {
+              if (xmlNode.element("time-modification")) {
                 noteDuration = this.getNoteDurationForTuplet(xmlNode);
                 const time: IXmlElement = xmlNode.element("time-modification");
-                if (time !== undefined) {
-                  if (time.element("normal-notes") !== undefined) {
+                if (time) {
+                  if (time.element("normal-notes")) {
                     normalNotes = parseInt(time.element("normal-notes").value, 10);
                   }
                 }
@@ -228,8 +228,8 @@ export class InstrumentReader {
             noteDuration = this.getNoteDurationFromTypeNode(xmlNode);
 
             const notationNode: IXmlElement = xmlNode.element("notations");
-            if (notationNode !== undefined) {
-              if (notationNode.element("slur") !== undefined) {
+            if (notationNode) {
+              if (notationNode.element("slur")) {
                 graceSlur = true;
                 // grace slurs could be non-binary, but VexFlow.GraceNoteGroup modifier system is currently only boolean for slurs.
               }
@@ -239,13 +239,13 @@ export class InstrumentReader {
           // check for cue note
           let isCueNote: boolean = false;
           const cueNode: IXmlElement = xmlNode.element("cue");
-          if (cueNode !== undefined) {
+          if (cueNode) {
             isCueNote = true;
           }
           // alternative: check for <type size="cue">
           const typeNode: IXmlElement = xmlNode.element("type");
           let noteTypeXml: NoteType = NoteType.UNDEFINED;
-          if (typeNode !== undefined) {
+          if (typeNode) {
             const sizeAttr: Attr = typeNode.attribute("size");
             if (sizeAttr !== undefined && sizeAttr !== null) {
               if (sizeAttr.value === "cue") {
@@ -259,7 +259,7 @@ export class InstrumentReader {
           let stemDirectionXml: StemDirectionType = StemDirectionType.Undefined;
           let stemColorXml: string;
           const stemNode: IXmlElement = xmlNode.element("stem");
-          if (stemNode !== undefined) {
+          if (stemNode) {
             switch (stemNode.value) {
               case "down":
                 stemDirectionXml = StemDirectionType.Down;
@@ -285,11 +285,11 @@ export class InstrumentReader {
 
           // check Tremolo
           let tremoloStrokes: number = 0;
-          if (notationsNode !== undefined) {
+          if (notationsNode) {
             const ornamentsNode: IXmlElement = notationsNode.element("ornaments");
-            if (ornamentsNode !== undefined) {
+            if (ornamentsNode) {
               const tremoloNode: IXmlElement = ornamentsNode.element("tremolo");
-              if (tremoloNode !== undefined) {
+              if (tremoloNode) {
                 const tremoloType: Attr = tremoloNode.attribute("type");
                 if (tremoloType && tremoloType.value === "single") {
                   const tremoloStrokesGiven: number = parseInt(tremoloNode.value, 10);
@@ -368,7 +368,7 @@ export class InstrumentReader {
             // TODO handle multiple chords on one note/staffentry
             this.openChordSymbolContainers = [];
           }
-          if (this.activeRhythm !== undefined) {
+          if (this.activeRhythm) {
             // (*) this.musicSheet.SheetPlaybackSetting.Rhythm = this.activeRhythm.Rhythm;
           }
           if (!isTuplet && !isGraceNote) {
@@ -383,9 +383,9 @@ export class InstrumentReader {
           );
 
           // notationsNode created further up for multiple checks
-          if (notationsNode !== undefined && notationsNode.element("dynamics") !== undefined) {
+          if (notationsNode !== undefined && notationsNode.element("dynamics")) {
             const expressionReader: ExpressionReader = this.expressionReaders[this.readExpressionStaffNumber(xmlNode) - 1];
-            if (expressionReader !== undefined) {
+            if (expressionReader) {
              expressionReader.readExpressionParameters(
                xmlNode, this.instrument, this.divisions, currentFraction, previousFraction, this.currentMeasure.MeasureNumber, false
              );
@@ -397,7 +397,7 @@ export class InstrumentReader {
           lastNoteWasGrace = isGraceNote;
         } else if (xmlNode.name === "attributes") {
           const divisionsNode: IXmlElement = xmlNode.element("divisions");
-          if (divisionsNode !== undefined) {
+          if (divisionsNode) {
             this.divisions = parseInt(divisionsNode.value, 10);
             if (isNaN(this.divisions)) {
               const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError",
@@ -464,11 +464,11 @@ export class InstrumentReader {
           const directionTypeNode: IXmlElement = xmlNode.element("direction-type");
           // (*) MetronomeReader.readMetronomeInstructions(xmlNode, this.musicSheet, this.currentXmlMeasureIndex);
           let relativePositionInMeasure: number = Math.min(1, currentFraction.RealValue);
-          if (this.activeRhythm !== undefined && this.activeRhythm.Rhythm !== undefined) {
+          if (this.activeRhythm !== undefined && this.activeRhythm.Rhythm) {
             relativePositionInMeasure /= this.activeRhythm.Rhythm.RealValue;
           }
           let handeled: boolean = false;
-          if (this.repetitionInstructionReader !== undefined) {
+          if (this.repetitionInstructionReader) {
             handeled = this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols( directionTypeNode,
                                                                                                         relativePositionInMeasure);
           }
@@ -478,8 +478,8 @@ export class InstrumentReader {
            if (staffIndex < this.expressionReaders.length) {
              expressionReader = this.expressionReaders[staffIndex];
            }
-           if (expressionReader !== undefined) {
-             if (directionTypeNode.element("octave-shift") !== undefined) {
+           if (expressionReader) {
+             if (directionTypeNode.element("octave-shift")) {
                expressionReader.readExpressionParameters(
                  xmlNode, this.instrument, this.divisions, currentFraction, previousFraction, this.currentMeasure.MeasureNumber, true
                );
@@ -492,7 +492,7 @@ export class InstrumentReader {
            }
           }
         } else if (xmlNode.name === "barline") {
-          if (this.repetitionInstructionReader !== undefined) {
+          if (this.repetitionInstructionReader) {
            const measureEndsSystem: boolean = this.repetitionInstructionReader.handleLineRepetitionInstructions(xmlNode);
            if (measureEndsSystem) {
              this.currentMeasure.HasEndLine = true;
@@ -533,7 +533,7 @@ export class InstrumentReader {
 
         for (let i: number = 0; i < this.expressionReaders.length; i++) {
          const reader: ExpressionReader = this.expressionReaders[i];
-         if (reader !== undefined) {
+         if (reader) {
            reader.checkForOpenExpressions(this.currentMeasure, currentFraction);
           }
         }
@@ -594,13 +594,13 @@ export class InstrumentReader {
   private getOrCreateVoiceGenerator(voiceId: number, staffId: number): VoiceGenerator {
     const staff: Staff = this.instrument.Staves[staffId];
     let voiceGenerator: VoiceGenerator = this.voiceGeneratorsDict[voiceId];
-    if (voiceGenerator !== undefined) {
+    if (voiceGenerator) {
       if (staff.Voices.indexOf(voiceGenerator.GetVoice) === -1) {
         staff.Voices.push(voiceGenerator.GetVoice);
       }
     } else {
       const mainVoiceGenerator: VoiceGenerator = this.staffMainVoiceGeneratorDict[staffId];
-      if (mainVoiceGenerator !== undefined) {
+      if (mainVoiceGenerator) {
         voiceGenerator = new VoiceGenerator(this.instrument, voiceId, this.slurReader, mainVoiceGenerator.GetVoice);
         staff.Voices.push(voiceGenerator.GetVoice);
         this.voiceGeneratorsDict[voiceId] = voiceGenerator;
@@ -730,7 +730,7 @@ export class InstrumentReader {
    */
   private getNoteDurationFromTypeNode(xmlNode: IXmlElement): Fraction {
     const typeNode: IXmlElement = xmlNode.element("type");
-    if (typeNode !== undefined) {
+    if (typeNode) {
       const type: string = typeNode.value;
       return this.currentVoiceGenerator.getNoteDurationFromType(type);
     }
@@ -743,15 +743,15 @@ export class InstrumentReader {
    * @param guitarPro
    */
   private addAbstractInstruction(node: IXmlElement, guitarPro: boolean): void {
-    if (node.element("divisions") !== undefined) {
+    if (node.element("divisions")) {
       if (node.elements().length === 1) {
         return;
       }
     }
     const transposeNode: IXmlElement = node.element("transpose");
-    if (transposeNode !== undefined) {
+    if (transposeNode) {
       const chromaticNode: IXmlElement = transposeNode.element("chromatic");
-      if (chromaticNode !== undefined) {
+      if (chromaticNode) {
         this.instrument.PlaybackTranspose = parseInt(chromaticNode.value, 10);
       }
     }
@@ -765,7 +765,7 @@ export class InstrumentReader {
         let staffNumber: number = 1;
         let clefOctaveOffset: number = 0;
         const lineNode: IXmlElement = nodeList.element("line");
-        if (lineNode !== undefined) {
+        if (lineNode) {
           try {
             line = parseInt(lineNode.value, 10);
           } catch (ex) {
@@ -780,7 +780,7 @@ export class InstrumentReader {
 
         }
         const signNode: IXmlElement = nodeList.element("sign");
-        if (signNode !== undefined) {
+        if (signNode) {
           try {
             clefEnum = ClefEnum[signNode.value];
             if (!ClefInstruction.isSupportedClef(clefEnum)) {
@@ -808,7 +808,7 @@ export class InstrumentReader {
 
         }
         const clefOctaveNode: IXmlElement = nodeList.element("clef-octave-change");
-        if (clefOctaveNode !== undefined) {
+        if (clefOctaveNode) {
           try {
             clefOctaveOffset = parseInt(clefOctaveNode.value, 10);
           } catch (e) {
@@ -846,7 +846,7 @@ export class InstrumentReader {
     if (node.element("key") !== undefined && this.instrument.MidiInstrumentId !== MidiInstrument.Percussion) {
       let key: number = 0;
       const keyNode: IXmlElement = node.element("key").element("fifths");
-      if (keyNode !== undefined) {
+      if (keyNode) {
         try {
           key = parseInt(keyNode.value, 10);
         } catch (ex) {
@@ -862,10 +862,10 @@ export class InstrumentReader {
       }
       let keyEnum: KeyEnum = KeyEnum.none;
       let modeNode: IXmlElement = node.element("key");
-      if (modeNode !== undefined) {
+      if (modeNode) {
         modeNode = modeNode.element("mode");
       }
-      if (modeNode !== undefined) {
+      if (modeNode) {
         try {
           keyEnum = KeyEnum[modeNode.value];
         } catch (ex) {
@@ -881,7 +881,7 @@ export class InstrumentReader {
       const keyInstruction: KeyInstruction = new KeyInstruction(undefined, key, keyEnum);
       this.abstractInstructions.push([1, keyInstruction]);
     }
-    if (node.element("time") !== undefined) {
+    if (node.element("time")) {
       const timeNode: IXmlElement = node.element("time");
       let symbolEnum: RhythmSymbolEnum = RhythmSymbolEnum.NONE;
       let timePrintObject: boolean = true;
@@ -905,7 +905,7 @@ export class InstrumentReader {
 
       let num: number = 0;
       let denom: number = 0;
-      const senzaMisura: boolean = (timeNode !== undefined && timeNode.element("senza-misura") !== undefined);
+      const senzaMisura: boolean = (timeNode && timeNode.element("senza-misura") !== undefined);
       const timeList: IXmlElement[] = node.elements("time");
       const beatsList: IXmlElement[] = [];
       const typeList: IXmlElement[] = [];
@@ -990,7 +990,7 @@ export class InstrumentReader {
             this.abstractInstructions.splice(i, 1);
           } else if (beginOfMeasure) {
             let firstStaffEntry: SourceStaffEntry;
-            if (this.currentMeasure !== undefined) {
+            if (this.currentMeasure) {
               const newClefInstruction: ClefInstruction = clefInstruction;
               const sseIndex: number = this.inSourceMeasureInstrumentIndex + key - 1;
               const firstSse: SourceStaffEntry = this.currentMeasure.FirstInstructionsStaffEntries[sseIndex];
@@ -1056,7 +1056,7 @@ export class InstrumentReader {
           } else {
             sourceMeasure = this.currentMeasure;
           }
-          if (sourceMeasure !== undefined) {
+          if (sourceMeasure) {
             for (let j: number = this.inSourceMeasureInstrumentIndex; j < this.inSourceMeasureInstrumentIndex + numberOfStaves; j++) {
               const newKeyInstruction: KeyInstruction = keyInstruction;
               if (sourceMeasure.FirstInstructionsStaffEntries[j] === undefined) {
@@ -1089,7 +1089,7 @@ export class InstrumentReader {
         if (this.activeRhythm === undefined || this.activeRhythm !== rhythmInstruction) {
           this.activeRhythm = rhythmInstruction;
           this.abstractInstructions.splice(i, 1);
-          if (this.currentMeasure !== undefined) {
+          if (this.currentMeasure) {
             for (let j: number = this.inSourceMeasureInstrumentIndex; j < this.inSourceMeasureInstrumentIndex + numberOfStaves; j++) {
               const newRhythmInstruction: RhythmInstruction = rhythmInstruction;
               let firstStaffEntry: SourceStaffEntry;
@@ -1146,13 +1146,13 @@ export class InstrumentReader {
   private getNoteDurationForTuplet(xmlNode: IXmlElement): Fraction {
     let duration: Fraction = new Fraction(0, 1);
     const typeDuration: Fraction = this.getNoteDurationFromTypeNode(xmlNode);
-    if (xmlNode.element("time-modification") !== undefined) {
+    if (xmlNode.element("time-modification")) {
       const time: IXmlElement = xmlNode.element("time-modification");
-      if (time !== undefined) {
-        if (time.element("actual-notes") !== undefined && time.element("normal-notes") !== undefined) {
+      if (time) {
+        if (time.element("actual-notes") !== undefined && time.element("normal-notes")) {
           const actualNotes: IXmlElement = time.element("actual-notes");
           const normalNotes: IXmlElement = time.element("normal-notes");
-          if (actualNotes !== undefined && normalNotes !== undefined) {
+          if (actualNotes !== undefined && normalNotes) {
             const actual: number = parseInt(actualNotes.value, 10);
             const normal: number = parseInt(normalNotes.value, 10);
             duration = new Fraction(normal * typeDuration.Numerator, actual * typeDuration.Denominator);
@@ -1165,9 +1165,9 @@ export class InstrumentReader {
 
   private readExpressionStaffNumber(xmlNode: IXmlElement): number {
    let directionStaffNumber: number = 1;
-   if (xmlNode.element("staff") !== undefined) {
+   if (xmlNode.element("staff")) {
      const staffNode: IXmlElement = xmlNode.element("staff");
-     if (staffNode !== undefined) {
+     if (staffNode) {
        try {
          directionStaffNumber = parseInt(staffNode.value, 10);
        } catch (ex) {
@@ -1203,7 +1203,7 @@ export class InstrumentReader {
         if (xmlNode.name === "note" && xmlNode.element("time-modification") === undefined) {
           const durationNode: IXmlElement = xmlNode.element("duration");
           const typeNode: IXmlElement = xmlNode.element("type");
-          if (durationNode !== undefined && typeNode !== undefined) {
+          if (durationNode !== undefined && typeNode) {
             const type: string = typeNode.value;
             let noteDuration: number = 0;
             try {

+ 32 - 32
src/MusicalScore/ScoreIO/MusicSheetReader.ts

@@ -92,15 +92,15 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     //}
     //public ReadMusicSheetParameters(sheetObject: MusicSheetParameterObject, root: IXmlElement, path: string): MusicSheetParameterObject {
     //  this.musicSheet = new MusicSheet();
-    //  if (root !== undefined) {
+    //  if (root) {
     //    this.pushSheetLabels(root, path);
-    //    if (this.musicSheet.Title !== undefined) {
+    //    if (this.musicSheet.Title) {
     //      sheetObject.Title = this.musicSheet.Title.text;
     //    }
-    //    if (this.musicSheet.Composer !== undefined) {
+    //    if (this.musicSheet.Composer) {
     //      sheetObject.Composer = this.musicSheet.Composer.text;
     //    }
-    //    if (this.musicSheet.Lyricist !== undefined) {
+    //    if (this.musicSheet.Lyricist) {
     //      sheetObject.Lyricist = this.musicSheet.Lyricist.text;
     //    }
     //    let partlistNode: IXmlElement = root.element("part-list");
@@ -136,10 +136,10 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         this.currentFraction = new Fraction(0, 1);
         let guitarPro: boolean = false;
         let encoding: IXmlElement = root.element("identification");
-        if (encoding !== undefined) {
+        if (encoding) {
             encoding = encoding.element("encoding");
         }
-        if (encoding !== undefined) {
+        if (encoding) {
             encoding = encoding.element("software");
         }
         if (encoding !== undefined && encoding.value === "Guitar Pro 5") {
@@ -173,9 +173,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             }
         }
 
-        if (this.repetitionInstructionReader !== undefined) {
+        if (this.repetitionInstructionReader) {
             this.repetitionInstructionReader.removeRedundantInstructions();
-            if (this.repetitionCalculator !== undefined) {
+            if (this.repetitionCalculator) {
                 this.repetitionCalculator.calculateRepetitions(this.musicSheet, this.repetitionInstructionReader.repetitionInstructions);
             }
         }
@@ -222,7 +222,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
 
                 currentInstrument.createStaves(instrumentNumberOfStaves);
                 instrumentReaders.push(new InstrumentReader(this.repetitionInstructionReader, xmlMeasureList, currentInstrument));
-                if (this.repetitionInstructionReader !== undefined) {
+                if (this.repetitionInstructionReader) {
                     this.repetitionInstructionReader.xmlMeasureList[counter] = xmlMeasureList;
                 }
                 counter++;
@@ -240,7 +240,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     private checkIfRhythmInstructionsAreSetAndEqual(instrumentReaders: InstrumentReader[]): void {
         const rhythmInstructions: RhythmInstruction[] = [];
         for (let i: number = 0; i < this.completeNumberOfStaves; i++) {
-            if (this.currentMeasure.FirstInstructionsStaffEntries[i] !== undefined) {
+            if (this.currentMeasure.FirstInstructionsStaffEntries[i]) {
                 const last: AbstractNotationInstruction = this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions[
                 this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions.length - 1
                     ];
@@ -418,7 +418,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         if (this.previousMeasure === undefined && maxInstrumentDuration.lt(activeRhythm)) {
             return true;
         }
-        if (this.previousMeasure !== undefined) {
+        if (this.previousMeasure) {
             return Fraction.plus(this.previousMeasure.Duration, maxInstrumentDuration).Equals(activeRhythm);
         }
         return false;
@@ -459,7 +459,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         for (let i: number = this.currentMeasure.VerticalSourceStaffEntryContainers.length - 1; i >= 0; i--) {
             for (let j: number = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries.length - 1; j >= 0; j--) {
                 const sourceStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[j];
-                if (sourceStaffEntry !== undefined) {
+                if (sourceStaffEntry) {
                     for (let k: number = sourceStaffEntry.VoiceEntries.length - 1; k >= 0; k--) {
                         const voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[k];
                         if (voiceEntry.Notes.length === 0) {
@@ -528,7 +528,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
 
     private readComposer(root: IXmlElement): void {
         const identificationNode: IXmlElement = root.element("identification");
-        if (identificationNode !== undefined) {
+        if (identificationNode) {
             const creators: IXmlElement[] = identificationNode.elements("creator");
             for (let idx: number = 0, len: number = creators.length; idx < len; ++idx) {
                 const creator: IXmlElement = creators[idx];
@@ -563,7 +563,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             }
             if (credit.attribute("page").value === "1") {
                 let creditChild: IXmlElement = undefined;
-                if (credit !== undefined) {
+                if (credit) {
                     creditChild = credit.element("credit-words");
                     if (!creditChild.attribute("justify")) {
                         break;
@@ -593,7 +593,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                                 }
                             }
                         }
-                        if (!(this.musicSheet.Composer !== undefined && this.musicSheet.Lyricist !== undefined)) {
+                        if (!(this.musicSheet.Composer !== undefined && this.musicSheet.Lyricist)) {
                             switch (creditJustify) {
                                 case "right":
                                     this.musicSheet.Composer = new Label(this.trimString(creditChild.value));
@@ -636,11 +636,11 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             const measures: IXmlElement[] = parts[idx].elements("measure");
             for (let idx2: number = 0, len2: number = measures.length; idx2 < len2; ++idx2) {
                 const measure: IXmlElement = measures[idx2];
-                if (measure.element("print") !== undefined) {
+                if (measure.element("print")) {
                     const systemLayouts: IXmlElement[] = measure.element("print").elements("system-layout");
                     for (let idx3: number = 0, len3: number = systemLayouts.length; idx3 < len3; ++idx3) {
                         const syslab: IXmlElement = systemLayouts[idx3];
-                        if (syslab.element("top-system-distance") !== undefined) {
+                        if (syslab.element("top-system-distance")) {
                             const topSystemDistanceString: string = syslab.element("top-system-distance").value;
                             topSystemDistance = parseFloat(topSystemDistanceString);
                             found = true;
@@ -654,9 +654,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 break;
             }
         }
-        if (root.element("defaults").element("system-layout") !== undefined) {
+        if (root.element("defaults").element("system-layout")) {
             const syslay: IXmlElement = root.element("defaults").element("system-layout");
-            if (syslay.element("top-system-distance") !== undefined) {
+            if (syslay.element("top-system-distance")) {
                 const topSystemDistanceString: string = root.element("defaults").element("system-layout").element("top-system-distance").value;
                 topSystemDistance = parseFloat(topSystemDistanceString);
             }
@@ -670,7 +670,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     private readTitle(root: IXmlElement): void {
         const titleNode: IXmlElement = root.element("work");
         let titleNodeChild: IXmlElement = undefined;
-        if (titleNode !== undefined) {
+        if (titleNode) {
             titleNodeChild = titleNode.element("work-title");
             if (titleNodeChild !== undefined && titleNodeChild.value) {
                 this.musicSheet.Title = new Label(this.trimString(titleNodeChild.value));
@@ -678,16 +678,16 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         }
         const movementNode: IXmlElement = root.element("movement-title");
         let finalSubTitle: string = "";
-        if (movementNode !== undefined) {
+        if (movementNode) {
             if (this.musicSheet.Title === undefined) {
                 this.musicSheet.Title = new Label(this.trimString(movementNode.value));
             } else {
                 finalSubTitle = this.trimString(movementNode.value);
             }
         }
-        if (titleNode !== undefined) {
+        if (titleNode) {
             const subtitleNodeChild: IXmlElement = titleNode.element("work-number");
-            if (subtitleNodeChild !== undefined) {
+            if (subtitleNodeChild) {
                 const workNumber: string = subtitleNodeChild.value;
                 if (workNumber) {
                     if (finalSubTitle === "") {
@@ -734,7 +734,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                                 subInstrument.idString = partElement.firstAttribute.value;
                                 instrument.SubInstruments.push(subInstrument);
                                 const subElement: IXmlElement = partElement.element("instrument-name");
-                                if (subElement !== undefined) {
+                                if (subElement) {
                                     subInstrument.name = subElement.value;
                                     subInstrument.setMidiInstrument(subElement.value);
                                 }
@@ -794,7 +794,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                         instrument.SubInstruments.push(subInstrument);
                     }
                     instrumentDict[instrIdString] = instrument;
-                    if (currentGroup !== undefined) {
+                    if (currentGroup) {
                         currentGroup.InstrumentalGroups.push(instrument);
                         this.musicSheet.Instruments.push(instrument);
                     } else {
@@ -804,7 +804,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 } else {
                     if ((node.name === "part-group") && (node.attribute("type").value === "start")) {
                         const iG: InstrumentalGroup = new InstrumentalGroup("group", this.musicSheet, currentGroup);
-                        if (currentGroup !== undefined) {
+                        if (currentGroup) {
                             currentGroup.InstrumentalGroups.push(iG);
                         } else {
                             this.musicSheet.InstrumentalGroups.push(iG);
@@ -812,10 +812,10 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                         currentGroup = iG;
                     } else {
                         if ((node.name === "part-group") && (node.attribute("type").value === "stop")) {
-                            if (currentGroup !== undefined) {
+                            if (currentGroup) {
                                 if (currentGroup.InstrumentalGroups.length === 1) {
                                     const instr: InstrumentalGroup = currentGroup.InstrumentalGroups[0];
-                                    if (currentGroup.Parent !== undefined) {
+                                    if (currentGroup.Parent) {
                                         currentGroup.Parent.InstrumentalGroups.push(instr);
                                         this._removeFromArray(currentGroup.Parent.InstrumentalGroups, currentGroup);
                                     } else {
@@ -856,9 +856,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             const xmlMeasureList: IXmlElement[] = partNode.elements("measure");
             if (xmlMeasureList.length > 0) {
                 const xmlMeasure: IXmlElement = xmlMeasureList[0];
-                if (xmlMeasure !== undefined) {
+                if (xmlMeasure) {
                     let stavesNode: IXmlElement = xmlMeasure.element("attributes");
-                    if (stavesNode !== undefined) {
+                    if (stavesNode) {
                         stavesNode = stavesNode.element("staves");
                     }
                     if (stavesNode === undefined) {
@@ -886,10 +886,10 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     private getInstrumentNumberOfStavesFromXml(partNode: IXmlElement): number {
         let num: number = 0;
         const xmlMeasure: IXmlElement = partNode.element("measure");
-        if (xmlMeasure !== undefined) {
+        if (xmlMeasure) {
             const attributes: IXmlElement = xmlMeasure.element("attributes");
             let staves: IXmlElement = undefined;
-            if (attributes !== undefined) {
+            if (attributes) {
                 staves = attributes.element("staves");
             }
             if (attributes === undefined || staves === undefined) {

+ 8 - 8
src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts

@@ -80,7 +80,7 @@ export class ArticulationReader {
   public addFermata(xmlNode: IXmlElement, currentVoiceEntry: VoiceEntry): void {
     // fermata appears as separate tag in XML
     let articulationEnum: ArticulationEnum = ArticulationEnum.fermata;
-    if (xmlNode.attributes().length > 0 && xmlNode.attribute("type") !== undefined) {
+    if (xmlNode.attributes().length > 0 && xmlNode.attribute("type")) {
       if (xmlNode.attribute("type").value === "inverted") {
         articulationEnum = ArticulationEnum.invertedfermata;
       }
@@ -113,7 +113,7 @@ export class ArticulationReader {
       }
       const articulationEnum: ArticulationEnum = xmlElementToArticulationEnum[xmlArticulation];
       const node: IXmlElement = xmlNode.element(xmlArticulation);
-      if (node !== undefined) {
+      if (node) {
         if (currentVoiceEntry.Articulations.indexOf(articulationEnum) === -1) {
           currentVoiceEntry.Articulations.push(articulationEnum);
         }
@@ -121,7 +121,7 @@ export class ArticulationReader {
     }
 
     const nodeFingering: IXmlElement = xmlNode.element("fingering");
-    if (nodeFingering !== undefined) {
+    if (nodeFingering) {
       const currentTechnicalInstruction: TechnicalInstruction = new TechnicalInstruction();
       currentTechnicalInstruction.type = TechnicalInstructionType.Fingering;
       currentTechnicalInstruction.value = nodeFingering.value;
@@ -155,7 +155,7 @@ export class ArticulationReader {
    * @param currentVoiceEntry
    */
   public addOrnament(ornamentsNode: IXmlElement, currentVoiceEntry: VoiceEntry): void {
-    if (ornamentsNode !== undefined) {
+    if (ornamentsNode) {
       let ornament: OrnamentContainer = undefined;
 
       interface XMLElementToOrnamentEnum {
@@ -177,13 +177,13 @@ export class ArticulationReader {
           continue;
         }
         const node: IXmlElement = ornamentsNode.element(ornamentElement);
-        if (node !== undefined) {
+        if (node) {
           ornament = new OrnamentContainer(elementToOrnamentEnum[ornamentElement]);
         }
       }
-      if (ornament !== undefined) {
+      if (ornament) {
         const accidentalsList: IXmlElement[] = ornamentsNode.elements("accidental-mark");
-        if (accidentalsList !== undefined) {
+        if (accidentalsList) {
           let placement: PlacementEnum = PlacementEnum.Below;
           let accidental: AccidentalEnum = AccidentalEnum.NONE;
           const accidentalsListArr: IXmlElement[] = accidentalsList;
@@ -192,7 +192,7 @@ export class ArticulationReader {
             let text: string = accidentalNode.value;
             accidental = this.getAccEnumFromString(text);
             const placementAttr: IXmlAttribute = accidentalNode.attribute("placement");
-            if (accidentalNode.hasAttributes && placementAttr !== undefined) {
+            if (accidentalNode.hasAttributes && placementAttr) {
               text = placementAttr.value;
               if (text === "above") {
                 placement = PlacementEnum.Above;

+ 5 - 5
src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts

@@ -37,7 +37,7 @@ export class ChordSymbolReader {
 
         // an alteration value isn't necessary
         let rootAlteration: AccidentalEnum = AccidentalEnum.NONE;
-        if (rootAlter !== undefined) {
+        if (rootAlter) {
             try {
                 rootAlteration = Pitch.AccidentalFromHalfTones(parseInt(rootAlter.value, undefined));
             } catch (ex) {
@@ -76,11 +76,11 @@ export class ChordSymbolReader {
         // bass is optional
         let bassPitch: Pitch = undefined;
         const bass: IXmlElement = xmlNode.element("bass");
-        if (bass !== undefined) {
+        if (bass) {
             const bassStep: IXmlElement = bass.element("bass-step");
             const bassAlter: IXmlElement = bass.element("bass-alter");
             let bassNote: NoteEnum = NoteEnum.C;
-            if (bassStep !== undefined) {
+            if (bassStep) {
                 try {
                     bassNote = NoteEnum[bassStep.value.trim()];
                 } catch (ex) {
@@ -92,7 +92,7 @@ export class ChordSymbolReader {
                 }
             }
             let bassAlteration: AccidentalEnum = AccidentalEnum.NONE;
-            if (bassAlter !== undefined) {
+            if (bassAlter) {
                 try {
                     bassAlteration = Pitch.AccidentalFromHalfTones(parseInt(bassAlter.value, undefined));
                 } catch (ex) {
@@ -108,7 +108,7 @@ export class ChordSymbolReader {
         // degree is optional
         let degree: Degree = undefined;
         const degreeNode: IXmlElement = xmlNode.element("degree");
-        if (degreeNode !== undefined) {
+        if (degreeNode) {
             const degreeValue: IXmlElement = degreeNode.element("degree-value");
             const degreeAlter: IXmlElement = degreeNode.element("degree-alter");
             const degreeType: IXmlElement = degreeNode.element("degree-type");

+ 24 - 24
src/MusicalScore/ScoreIO/MusicSymbolModules/ExpressionReader.ts

@@ -91,23 +91,23 @@ export class ExpressionReader {
         if (this.placement === PlacementEnum.NotYetDefined) {
             try {
                 const directionTypeNode: IXmlElement = xmlNode.element("direction-type");
-                if (directionTypeNode !== undefined) {
+                if (directionTypeNode) {
                     const dynamicsNode: IXmlElement = directionTypeNode.element("dynamics");
-                    if (dynamicsNode !== undefined) {
+                    if (dynamicsNode) {
                         const defAttr: IXmlAttribute = dynamicsNode.attribute("default-y");
                         if (defAttr !== undefined && defAttr !== null) {
                             this.readExpressionPlacement(defAttr, "read dynamics y pos");
                         }
                     }
                     const wedgeNode: IXmlElement = directionTypeNode.element("wedge");
-                    if (wedgeNode !== undefined) {
+                    if (wedgeNode) {
                         const defAttr: IXmlAttribute = wedgeNode.attribute("default-y");
                         if (defAttr !== undefined && defAttr !== null) {
                             this.readExpressionPlacement(defAttr, "read wedge y pos");
                         }
                     }
                     const wordsNode: IXmlElement = directionTypeNode.element("words");
-                    if (wordsNode !== undefined) {
+                    if (wordsNode) {
                         const defAttr: IXmlAttribute = wordsNode.attribute("default-y");
                         if (defAttr !== undefined && defAttr !== null) {
                             this.readExpressionPlacement(defAttr, "read words y pos");
@@ -135,7 +135,7 @@ export class ExpressionReader {
         let isTempoInstruction: boolean = false;
         let isDynamicInstruction: boolean = false;
         const n: IXmlElement = directionNode.element("sound");
-        if (n !== undefined) {
+        if (n) {
             const tempoAttr: IXmlAttribute = n.attribute("tempo");
             const dynAttr: IXmlAttribute = n.attribute("dynamics");
             if (tempoAttr) {
@@ -156,12 +156,12 @@ export class ExpressionReader {
             return;
         }
         let dirContentNode: IXmlElement = dirNode.element("metronome");
-        if (dirContentNode !== undefined) {
+        if (dirContentNode) {
             const beatUnit: IXmlElement = dirContentNode.element("beat-unit");
             const dotted: boolean = dirContentNode.element("beat-unit-dot") !== undefined;
             const bpm: IXmlElement = dirContentNode.element("per-minute");
             // TODO check print-object = false -> don't render invisible metronome mark
-            if (beatUnit !== undefined && bpm !== undefined) {
+            if (beatUnit !== undefined && bpm) {
                 const useCurrentFractionForPositioning: boolean = (dirContentNode.hasAttributes && dirContentNode.attribute("default-x") !== undefined);
                 if (useCurrentFractionForPositioning) {
                     this.directionTimestamp = Fraction.createFromFraction(inSourceMeasureCurrentFraction);
@@ -187,14 +187,14 @@ export class ExpressionReader {
         }
 
         dirContentNode = dirNode.element("dynamics");
-        if (dirContentNode !== undefined) {
+        if (dirContentNode) {
             const fromNotation: boolean = directionNode.element("notations") !== undefined;
             this.interpretInstantaneousDynamics(dirContentNode, currentMeasure, inSourceMeasureCurrentFraction, fromNotation);
             return;
         }
 
         dirContentNode = dirNode.element("words");
-        if (dirContentNode !== undefined) {
+        if (dirContentNode) {
             if (isTempoInstruction) {
                 this.createNewTempoExpressionIfNeeded(currentMeasure);
                 this.currentMultiTempoExpression.CombinedExpressionsText = dirContentNode.value;
@@ -208,24 +208,24 @@ export class ExpressionReader {
         }
 
         dirContentNode = dirNode.element("wedge");
-        if (dirContentNode !== undefined) {
+        if (dirContentNode) {
             this.interpretWedge(dirContentNode, currentMeasure, inSourceMeasureCurrentFraction, currentMeasure.MeasureNumber);
             return;
         }
     }
     public checkForOpenExpressions(sourceMeasure: SourceMeasure, timestamp: Fraction): void {
-        if (this.openContinuousDynamicExpression !== undefined) {
+        if (this.openContinuousDynamicExpression) {
             this.createNewMultiExpressionIfNeeded(sourceMeasure, timestamp);
             this.closeOpenContinuousDynamic();
         }
-        if (this.openContinuousTempoExpression !== undefined) {
+        if (this.openContinuousTempoExpression) {
             this.closeOpenContinuousTempo(Fraction.plus(sourceMeasure.AbsoluteTimestamp, timestamp));
         }
     }
     public addOctaveShift(directionNode: IXmlElement, currentMeasure: SourceMeasure, endTimestamp: Fraction): void {
         let octaveStaffNumber: number = 1;
         const staffNode: IXmlElement = directionNode.element("staff");
-        if (staffNode !== undefined) {
+        if (staffNode) {
             try {
                 octaveStaffNumber = parseInt(staffNode.value, 10);
             } catch (ex) {
@@ -237,11 +237,11 @@ export class ExpressionReader {
             }
         }
         const directionTypeNode: IXmlElement = directionNode.element("direction-type");
-        if (directionTypeNode !== undefined) {
+        if (directionTypeNode) {
             const octaveShiftNode: IXmlElement = directionTypeNode.element("octave-shift");
             if (octaveShiftNode !== undefined && octaveShiftNode.hasAttributes) {
                 try {
-                    if (octaveShiftNode.attribute("size") !== undefined) {
+                    if (octaveShiftNode.attribute("size")) {
                         const size: number = parseInt(octaveShiftNode.attribute("size").value, 10);
                         let octave: number = 0;
                         if (size === 8) {
@@ -249,7 +249,7 @@ export class ExpressionReader {
                         } else if (size === 15) {
                             octave = 2;
                              }
-                        if (octaveShiftNode.attribute("type") !== undefined) {
+                        if (octaveShiftNode.attribute("type")) {
                             const type: string = octaveShiftNode.attribute("type").value;
                             if (type === "up" || type === "down") {
                                 const octaveShift: OctaveShift = new OctaveShift(type, octave);
@@ -259,7 +259,7 @@ export class ExpressionReader {
                                 octaveShift.ParentStartMultiExpression = this.getMultiExpression;
                                 this.openOctaveShift = octaveShift;
                             } else if (type === "stop") {
-                                if (this.openOctaveShift !== undefined) {
+                                if (this.openOctaveShift) {
                                     this.createNewMultiExpressionIfNeeded(currentMeasure, endTimestamp);
                                     this.getMultiExpression.OctaveShiftEnd = this.openOctaveShift;
                                     this.openOctaveShift.ParentEndMultiExpression = this.getMultiExpression;
@@ -300,14 +300,14 @@ export class ExpressionReader {
                                            inSourceMeasureCurrentFraction: Fraction,
                                            fromNotation: boolean): void {
         if (dynamicsNode.hasElements) {
-            if (dynamicsNode.hasAttributes && dynamicsNode.attribute("default-x") !== undefined) {
+            if (dynamicsNode.hasAttributes && dynamicsNode.attribute("default-x")) {
                 this.directionTimestamp = Fraction.createFromFraction(inSourceMeasureCurrentFraction);
             }
             let expressionText: string = dynamicsNode.elements()[0].name;
             if (expressionText === "other-dynamics") {
                 expressionText = dynamicsNode.elements()[0].value;
             }
-            if (expressionText !== undefined) {
+            if (expressionText) {
                 // // ToDo: add doublettes recognition again as a afterReadingModule, as we can't check here if there is a repetition:
                 // // Make here a comparison with the active dynamic expression and only add it, if there is a change in dynamic
                 // // Exception is when there starts a repetition, where this might be different when repeating.
@@ -338,7 +338,7 @@ export class ExpressionReader {
                         currentMeasure);
                 this.getMultiExpression.addExpression(instantaneousDynamicExpression, "");
                 this.initialize();
-                if (this.activeInstantaneousDynamic !== undefined) {
+                if (this.activeInstantaneousDynamic) {
                     this.activeInstantaneousDynamic.DynEnum = instantaneousDynamicExpression.DynEnum;
                 } else {
                     this.activeInstantaneousDynamic = new InstantaneousDynamicExpression(expressionText, 0, PlacementEnum.NotYetDefined, 1, currentMeasure);
@@ -350,7 +350,7 @@ export class ExpressionReader {
     private interpretWords(wordsNode: IXmlElement, currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction: Fraction): void {
         const text: string = wordsNode.value;
         if (text.length > 0) {
-            if (wordsNode.hasAttributes && wordsNode.attribute("default-x") !== undefined) {
+            if (wordsNode.hasAttributes && wordsNode.attribute("default-x")) {
                 this.directionTimestamp = Fraction.createFromFraction(inSourceMeasureCurrentFraction);
             }
             if (this.checkIfWordsNodeIsRepetitionInstruction(text)) {
@@ -361,7 +361,7 @@ export class ExpressionReader {
         }
     }
     private interpretWedge(wedgeNode: IXmlElement, currentMeasure: SourceMeasure, inSourceMeasureCurrentFraction: Fraction, currentMeasureIndex: number): void {
-        if (wedgeNode !== undefined && wedgeNode.hasAttributes && wedgeNode.attribute("default-x") !== undefined) {
+        if (wedgeNode !== undefined && wedgeNode.hasAttributes && wedgeNode.attribute("default-x")) {
             this.directionTimestamp = Fraction.createFromFraction(inSourceMeasureCurrentFraction);
         }
         this.createNewMultiExpressionIfNeeded(currentMeasure);
@@ -400,7 +400,7 @@ export class ExpressionReader {
                             this.placement,
                             this.staffNumber,
                             currentMeasure);
-                    if (this.openContinuousDynamicExpression !== undefined) {
+                    if (this.openContinuousDynamicExpression) {
                         this.closeOpenContinuousDynamic();
                     }
                     this.openContinuousDynamicExpression = continuousDynamicExpression;
@@ -411,7 +411,7 @@ export class ExpressionReader {
                         this.activeInstantaneousDynamic = undefined;
                     }
                 } else if (type === "stop") {
-                    if (this.openContinuousDynamicExpression !== undefined) {
+                    if (this.openContinuousDynamicExpression) {
                         this.closeOpenContinuousDynamic();
                     }
                 }

+ 12 - 12
src/MusicalScore/ScoreIO/MusicSymbolModules/LyricsReader.ts

@@ -19,18 +19,18 @@ export class LyricsReader {
      * @param {VoiceEntry} currentVoiceEntry
      */
     public addLyricEntry(lyricNodeList: IXmlElement[], currentVoiceEntry: VoiceEntry): void {
-        if (lyricNodeList !== undefined) {
+        if (lyricNodeList) {
             const lyricNodeListArr: IXmlElement[] = lyricNodeList;
             for (let idx: number = 0, len: number = lyricNodeListArr.length; idx < len; ++idx) {
                 const lyricNode: IXmlElement = lyricNodeListArr[idx];
                 try {
                     let syllabic: string = "single"; // Single as default
-                    if (lyricNode.element("text") !== undefined) {
+                    if (lyricNode.element("text")) {
                         let textNode: IXmlElement = lyricNode.element("text");
-                        if (lyricNode.element("syllabic") !== undefined) {
+                        if (lyricNode.element("syllabic")) {
                             syllabic = lyricNode.element("syllabic").value;
                         }
-                        if (textNode !== undefined) {
+                        if (textNode) {
                             const text: string = textNode.value;
                             // <elision> separates Multiple syllabels on a single LyricNote
                             // "-" text indicating separated syllabel should be ignored
@@ -59,14 +59,14 @@ export class LyricsReader {
                                         }
                                     }
                                 }
-                                if (nextText !== undefined && nextSyllabic !== undefined) {
+                                if (nextText !== undefined && nextSyllabic) {
                                     textNode = nextText;
                                     syllabic = "middle";
                                 }
                             }
                             let currentLyricVerseNumber: number = 1;
                             let errorNumberParse1: boolean = false;
-                            if (lyricNode.attributes() !== undefined && lyricNode.attribute("number") !== undefined) {
+                            if (lyricNode.attributes() !== undefined && lyricNode.attribute("number")) {
                                 try {
                                     currentLyricVerseNumber = parseInt(lyricNode.attribute("number").value, 10); // usually doesn't throw error, but returns NaN
                                 } catch (err) {
@@ -89,7 +89,7 @@ export class LyricsReader {
                             }
                             let lyricsEntry: LyricsEntry = undefined;
                             if (syllabic === "single" || syllabic === "end") {
-                                if (this.openLyricWords[currentLyricVerseNumber] !== undefined) { // word end given or some word still open
+                                if (this.openLyricWords[currentLyricVerseNumber]) { // word end given or some word still open
                                     this.currentLyricWord = this.openLyricWords[currentLyricVerseNumber];
                                     const syllableNumber: number = this.currentLyricWord.Syllables.length;
                                     lyricsEntry = new LyricsEntry(text, currentLyricVerseNumber, this.currentLyricWord, currentVoiceEntry, syllableNumber);
@@ -101,7 +101,7 @@ export class LyricsReader {
                                 }
                                 lyricsEntry.extend = lyricNode.element("extend") !== undefined;
                             } else if (syllabic === "begin") { // first finishing, if a word already is open (can only happen, when wrongly given)
-                                if (this.openLyricWords[currentLyricVerseNumber] !== undefined) {
+                                if (this.openLyricWords[currentLyricVerseNumber]) {
                                     delete this.openLyricWords[currentLyricVerseNumber];
                                     this.currentLyricWord = undefined;
                                 }
@@ -110,7 +110,7 @@ export class LyricsReader {
                                 lyricsEntry = new LyricsEntry(text, currentLyricVerseNumber, this.currentLyricWord, currentVoiceEntry, 0);
                                 this.currentLyricWord.Syllables.push(lyricsEntry);
                             } else if (syllabic === "middle") {
-                                if (this.openLyricWords[currentLyricVerseNumber] !== undefined) {
+                                if (this.openLyricWords[currentLyricVerseNumber]) {
                                     this.currentLyricWord = this.openLyricWords[currentLyricVerseNumber];
                                     const syllableNumber: number = this.currentLyricWord.Syllables.length;
                                     lyricsEntry = new LyricsEntry(text, currentLyricVerseNumber, this.currentLyricWord, currentVoiceEntry, syllableNumber);
@@ -121,13 +121,13 @@ export class LyricsReader {
                                 }
                             }
                             // add each LyricEntry to currentVoiceEntry
-                            if (lyricsEntry !== undefined) {
+                            if (lyricsEntry) {
                                 // only add the lyric entry if not another entry has already been given:
-                                if (!currentVoiceEntry.LyricsEntries[currentLyricVerseNumber] !== undefined) {
+                                if (!currentVoiceEntry.LyricsEntries[currentLyricVerseNumber]) {
                                     currentVoiceEntry.LyricsEntries.setValue(currentLyricVerseNumber, lyricsEntry);
                                 }
                                 // save in currentInstrument the verseNumber (only once)
-                                if (!currentVoiceEntry.ParentVoice.Parent.LyricVersesNumbers[currentLyricVerseNumber] !== undefined) {
+                                if (!currentVoiceEntry.ParentVoice.Parent.LyricVersesNumbers[currentLyricVerseNumber]) {
                                     currentVoiceEntry.ParentVoice.Parent.LyricVersesNumbers.push(currentLyricVerseNumber);
                                 }
                             }

+ 6 - 6
src/MusicalScore/ScoreIO/MusicSymbolModules/RepetitionInstructionReader.ts

@@ -42,10 +42,10 @@ export class RepetitionInstructionReader {
       const styleNode: IXmlElement = barlineNode.element("bar-style");
 
       // if location is ommited in Xml, right is implied (from documentation)
-      if (styleNode !== undefined) {
+      if (styleNode) {
         style = styleNode.value;
       }
-      if (barlineNode.attributes().length > 0 && barlineNode.attribute("location") !== undefined) {
+      if (barlineNode.attributes().length > 0 && barlineNode.attribute("location")) {
         location = barlineNode.attribute("location").value;
       } else {
         location = "right";
@@ -59,7 +59,7 @@ export class RepetitionInstructionReader {
           hasRepeat = true;
           direction = childNode.attribute("direction").value;
         } else if ( "ending" === childNode.name && childNode.hasAttributes &&
-                    childNode.attribute("type") !== undefined && childNode.attribute("number") !== undefined) {
+                    childNode.attribute("type") !== undefined && childNode.attribute("number")) {
           type = childNode.attribute("type").value;
           const num: string = childNode.attribute("number").value;
 
@@ -121,7 +121,7 @@ export class RepetitionInstructionReader {
 
   public handleRepetitionInstructionsFromWordsOrSymbols(directionTypeNode: IXmlElement, relativeMeasurePosition: number): boolean {
     const wordsNode: IXmlElement = directionTypeNode.element("words");
-    if (wordsNode !== undefined) {
+    if (wordsNode) {
       const dsRegEx: string = "d\\s?\\.s\\."; // Input for new RegExp(). TS eliminates the first \
       // must Trim string and ToLower before compare
       const innerText: string = wordsNode.value.trim().toLowerCase();
@@ -219,7 +219,7 @@ export class RepetitionInstructionReader {
         this.addInstruction(this.repetitionInstructions, newInstruction);
         return true;
       }
-    } else if (directionTypeNode.element("segno") !== undefined) {
+    } else if (directionTypeNode.element("segno")) {
       let measureIndex: number = this.currentMeasureIndex;
       if (relativeMeasurePosition > 0.5) {
         measureIndex++;
@@ -227,7 +227,7 @@ export class RepetitionInstructionReader {
       const newInstruction: RepetitionInstruction = new RepetitionInstruction(measureIndex, RepetitionInstructionEnum.Segno);
       this.addInstruction(this.repetitionInstructions, newInstruction);
       return true;
-    } else if (directionTypeNode.element("coda") !== undefined) {
+    } else if (directionTypeNode.element("coda")) {
       let measureIndex: number = this.currentMeasureIndex;
       if (relativeMeasurePosition > 0.5) {
         measureIndex++;

+ 2 - 2
src/MusicalScore/ScoreIO/MusicSymbolModules/SlurReader.ts

@@ -13,7 +13,7 @@ export class SlurReader {
     }
     public addSlur(slurNodes: IXmlElement[], currentNote: Note): void {
         try {
-            if (slurNodes !== undefined) {
+            if (slurNodes) {
                 for (const slurNode of slurNodes) {
                     if (slurNode.attributes().length > 0) {
                         const type: string = slurNode.attribute("type").value;
@@ -36,7 +36,7 @@ export class SlurReader {
                             slur.StartNote = currentNote;
                         } else if (type === "stop") {
                             const slur: Slur = this.openSlurDict[slurNumber];
-                            if (slur !== undefined) {
+                            if (slur) {
                                 slur.EndNote = currentNote;
                                 // check if not already a slur with same notes has been given:
                                 if (!currentNote.checkForDoubleSlur(slur)) {

+ 37 - 37
src/MusicalScore/ScoreIO/VoiceGenerator.ts

@@ -34,7 +34,7 @@ export class VoiceGenerator {
   constructor(instrument: Instrument, voiceId: number, slurReader: SlurReader, mainVoice: Voice = undefined) {
     this.musicSheet = instrument.GetMusicSheet;
     this.slurReader = slurReader;
-    if (mainVoice !== undefined) {
+    if (mainVoice) {
       this.voice = new LinkedVoice(instrument, voiceId, mainVoice);
     } else {
       this.voice = new Voice(instrument, voiceId);
@@ -120,15 +120,15 @@ export class VoiceGenerator {
                              printObject, isCueNote, stemDirectionXml, tremoloStrokes, stemColorXml, noteheadColorXml);
       // read lyrics
       const lyricElements: IXmlElement[] = noteNode.elements("lyric");
-      if (this.lyricsReader !== undefined && lyricElements !== undefined) {
+      if (this.lyricsReader !== undefined && lyricElements) {
         this.lyricsReader.addLyricEntry(lyricElements, this.currentVoiceEntry);
         this.voice.Parent.HasLyrics = true;
       }
       let hasTupletCommand: boolean = false;
       const notationNode: IXmlElement = noteNode.element("notations");
-      if (notationNode !== undefined) {
+      if (notationNode) {
         // read articulations
-        if (this.articulationReader !== undefined) {
+        if (this.articulationReader) {
           this.readArticulations(notationNode, this.currentVoiceEntry);
         }
         // read slurs
@@ -148,12 +148,12 @@ export class VoiceGenerator {
         const arpeggioNode: IXmlElement = notationNode.element("arpeggiate");
         if (arpeggioNode !== undefined && !this.currentVoiceEntry.IsGrace) {
           let currentArpeggio: Arpeggio;
-          if (this.currentVoiceEntry.Arpeggio !== undefined) { // add note to existing Arpeggio
+          if (this.currentVoiceEntry.Arpeggio) { // add note to existing Arpeggio
             currentArpeggio = this.currentVoiceEntry.Arpeggio;
           } else { // create new Arpeggio
             let arpeggioAlreadyExists: boolean = false;
             for (const voiceEntry of this.currentStaffEntry.VoiceEntries) {
-              if (voiceEntry.Arpeggio !== undefined) {
+              if (voiceEntry.Arpeggio) {
                 arpeggioAlreadyExists = true;
                 currentArpeggio = voiceEntry.Arpeggio;
                 // TODO handle multiple arpeggios across multiple voices at same timestamp
@@ -245,7 +245,7 @@ export class VoiceGenerator {
   }
 
   public checkForOpenBeam(): void {
-    if (this.openBeam !== undefined && this.currentNote !== undefined) {
+    if (this.openBeam !== undefined && this.currentNote) {
       this.handleOpenBeam();
     }
   }
@@ -314,19 +314,19 @@ export class VoiceGenerator {
 
   private readArticulations(notationNode: IXmlElement, currentVoiceEntry: VoiceEntry): void {
     const articNode: IXmlElement = notationNode.element("articulations");
-    if (articNode !== undefined) {
+    if (articNode) {
       this.articulationReader.addArticulationExpression(articNode, currentVoiceEntry);
     }
     const fermaNode: IXmlElement = notationNode.element("fermata");
-    if (fermaNode !== undefined) {
+    if (fermaNode) {
       this.articulationReader.addFermata(fermaNode, currentVoiceEntry);
     }
     const tecNode: IXmlElement = notationNode.element("technical");
-    if (tecNode !== undefined) {
+    if (tecNode) {
       this.articulationReader.addTechnicalArticulations(tecNode, currentVoiceEntry);
     }
     const ornaNode: IXmlElement = notationNode.element("ornaments");
-    if (ornaNode !== undefined) {
+    if (ornaNode) {
       this.articulationReader.addOrnament(ornaNode, currentVoiceEntry);
       // const tremoloNode: IXmlElement = ornaNode.element("tremolo");
       // tremolo should be and is added per note, not per VoiceEntry. see addSingleNote()
@@ -409,18 +409,18 @@ export class VoiceGenerator {
           }
         } else if (noteElement.name === "unpitched") {
           const displayStep: IXmlElement = noteElement.element("display-step");
-          if (displayStep !== undefined) {
+          if (displayStep) {
             noteStep = NoteEnum[displayStep.value.toUpperCase()];
           }
           const octave: IXmlElement = noteElement.element("display-octave");
-          if (octave !== undefined) {
+          if (octave) {
             noteOctave = parseInt(octave.value, 10);
             if (guitarPro) {
               noteOctave += 1;
             }
           }
         } else if (noteElement.name === "instrument") {
-          if (noteElement.firstAttribute !== undefined) {
+          if (noteElement.firstAttribute) {
             playbackInstrumentId = noteElement.firstAttribute.value;
           }
         } else if (noteElement.name === "notehead") {
@@ -442,15 +442,15 @@ export class VoiceGenerator {
     let fretNumber: number = -1;
     // check for guitar tabs:
     const notationNode: IXmlElement = node.element("notations");
-    if (notationNode !== undefined) {
+    if (notationNode) {
       const technicalNode: IXmlElement = notationNode.element("technical");
-      if (technicalNode !== undefined) {
+      if (technicalNode) {
         const stringNode: IXmlElement = technicalNode.element("string");
-        if (stringNode !== undefined) {
+        if (stringNode) {
           stringNumber = parseInt(stringNode.value, 10);
         }
         const fretNode: IXmlElement = technicalNode.element("fret");
-        if (fretNode !== undefined) {
+        if (fretNode) {
           fretNumber = parseInt(fretNode.value, 10);
         }
       }
@@ -505,7 +505,7 @@ export class VoiceGenerator {
     restNote.NoteheadColorXml = noteheadColorXml;
     restNote.NoteheadColor = noteheadColorXml;
     this.currentVoiceEntry.Notes.push(restNote);
-    if (this.openBeam !== undefined) {
+    if (this.openBeam) {
       this.openBeam.ExtendedNoteList.push(restNote);
     }
     return restNote;
@@ -523,13 +523,13 @@ export class VoiceGenerator {
       if (beamNode !== undefined && beamNode.hasAttributes) {
         beamAttr = beamNode.attribute("number");
       }
-      if (beamAttr !== undefined) {
+      if (beamAttr) {
         const beamNumber: number = parseInt(beamAttr.value, 10);
         const mainBeamNode: IXmlElement[] = node.elements("beam");
         const currentBeamTag: string = mainBeamNode[0].value;
-        if (beamNumber === 1 && mainBeamNode !== undefined) {
+        if (beamNumber === 1 && mainBeamNode) {
           if (currentBeamTag === "begin" && this.lastBeamTag !== currentBeamTag) {
-              if (this.openBeam !== undefined) {
+              if (this.openBeam) {
                 this.handleOpenBeam();
               }
               this.openBeam = new Beam();
@@ -584,7 +584,7 @@ export class VoiceGenerator {
         const nextStaffEntry: SourceStaffEntry = this.currentMeasure
           .VerticalSourceStaffEntryContainers[horizontalIndex + 1]
           .StaffEntries[verticalIndex];
-        if (nextStaffEntry !== undefined) {
+        if (nextStaffEntry) {
           for (let idx: number = 0, len: number = nextStaffEntry.VoiceEntries.length; idx < len; ++idx) {
             const voiceEntry: VoiceEntry = nextStaffEntry.VoiceEntries[idx];
             if (voiceEntry.ParentVoice === this.voice) {
@@ -614,7 +614,7 @@ export class VoiceGenerator {
     let bracketed: boolean = false; // xml bracket attribute value
     if (tupletNodeList !== undefined && tupletNodeList.length > 1) {
       let timeModNode: IXmlElement = node.element("time-modification");
-      if (timeModNode !== undefined) {
+      if (timeModNode) {
         timeModNode = timeModNode.element("actual-notes");
       }
       const tupletNodeListArr: IXmlElement[] = tupletNodeList;
@@ -632,7 +632,7 @@ export class VoiceGenerator {
               tupletNumber = parseInt(tupletNode.attribute("number").value, 10);
             }
             let tupletLabelNumber: number = 0;
-            if (timeModNode !== undefined) {
+            if (timeModNode) {
               tupletLabelNumber = parseInt(timeModNode.value, 10);
               if (isNaN(tupletLabelNumber)) {
                 const errorMsg: string = ITextTranslation.translateText(
@@ -644,7 +644,7 @@ export class VoiceGenerator {
 
             }
             const tuplet: Tuplet = new Tuplet(tupletLabelNumber, bracketed);
-            if (this.tupletDict[tupletNumber] !== undefined) {
+            if (this.tupletDict[tupletNumber]) {
               delete this.tupletDict[tupletNumber];
               if (Object.keys(this.tupletDict).length === 0) {
                 this.openTupletNumber = 0;
@@ -665,7 +665,7 @@ export class VoiceGenerator {
               tupletNumber = parseInt(tupletNode.attribute("number").value, 10);
             }
             const tuplet: Tuplet = this.tupletDict[tupletNumber];
-            if (tuplet !== undefined) {
+            if (tuplet) {
               const subnotelist: Note[] = [];
               subnotelist.push(this.currentNote);
               tuplet.Notes.push(subnotelist);
@@ -681,7 +681,7 @@ export class VoiceGenerator {
           }
         }
       }
-    } else if (tupletNodeList[0] !== undefined) {
+    } else if (tupletNodeList[0]) {
       const n: IXmlElement = tupletNodeList[0];
       if (n.hasAttributes) {
         const type: string = n.attribute("type").value;
@@ -699,10 +699,10 @@ export class VoiceGenerator {
         if (type === "start") {
           let tupletLabelNumber: number = 0;
           let timeModNode: IXmlElement = node.element("time-modification");
-          if (timeModNode !== undefined) {
+          if (timeModNode) {
             timeModNode = timeModNode.element("actual-notes");
           }
-          if (timeModNode !== undefined) {
+          if (timeModNode) {
             tupletLabelNumber = parseInt(timeModNode.value, 10);
             if (isNaN(tupletLabelNumber)) {
               const errorMsg: string = ITextTranslation.translateText(
@@ -732,7 +732,7 @@ export class VoiceGenerator {
             tupletnumber = this.openTupletNumber;
           }
           const tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
-          if (tuplet !== undefined) {
+          if (tuplet) {
             const subnotelist: Note[] = [];
             subnotelist.push(this.currentNote);
             tuplet.Notes.push(subnotelist);
@@ -756,7 +756,7 @@ export class VoiceGenerator {
    * @param noteNode
    */
   private handleTimeModificationNode(noteNode: IXmlElement): void {
-    if (this.tupletDict[this.openTupletNumber] !== undefined) {
+    if (this.tupletDict[this.openTupletNumber]) {
       try {
         // Tuplet should already be created
         const tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
@@ -782,7 +782,7 @@ export class VoiceGenerator {
 
     } else if (this.currentVoiceEntry.Notes.length > 0) {
       const firstNote: Note = this.currentVoiceEntry.Notes[0];
-      if (firstNote.NoteTuplet !== undefined) {
+      if (firstNote.NoteTuplet) {
         const tuplet: Tuplet = firstNote.NoteTuplet;
         const notes: Note[] = CollectionUtil.last(tuplet.Notes);
         notes.push(this.currentNote);
@@ -792,7 +792,7 @@ export class VoiceGenerator {
   }
 
   private addTie(tieNodeList: IXmlElement[], measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction): void {
-    if (tieNodeList !== undefined) {
+    if (tieNodeList) {
       if (tieNodeList.length === 1) {
         const tieNode: IXmlElement = tieNodeList[0];
         if (tieNode !== undefined && tieNode.attributes()) {
@@ -809,7 +809,7 @@ export class VoiceGenerator {
             } else if (type === "stop") {
               const tieNumber: number = this.findCurrentNoteInTieDict(this.currentNote);
               const tie: Tie = this.openTieDict[tieNumber];
-              if (tie !== undefined) {
+              if (tie) {
                 tie.AddNote(this.currentNote);
                 if (maxTieNoteFraction.lt(Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length))) {
                   maxTieNoteFraction = Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length);
@@ -878,9 +878,9 @@ export class VoiceGenerator {
    * @returns {any}
    */
   private getTupletNoteDurationFromType(xmlNode: IXmlElement): Fraction {
-    if (xmlNode.element("type") !== undefined) {
+    if (xmlNode.element("type")) {
       const typeNode: IXmlElement = xmlNode.element("type");
-      if (typeNode !== undefined) {
+      if (typeNode) {
         const type: string = typeNode.value;
         try {
           return this.getNoteDurationFromType(type);

+ 1 - 1
src/MusicalScore/VoiceData/Beam.ts

@@ -26,7 +26,7 @@ export class Beam {
      * @param note
      */
     public addNoteToBeam(note: Note): void {
-        if (note !== undefined) {
+        if (note) {
             note.NoteBeam = this;
             this.notes.push(note);
             this.extendedNoteList.push(note);

+ 4 - 4
src/MusicalScore/VoiceData/ChordSymbolContainer.ts

@@ -38,7 +38,7 @@ export class ChordSymbolContainer {
     public static calculateChordText(chordSymbol: ChordSymbolContainer, transposeHalftones: number, keyInstruction: KeyInstruction): string {
         let transposedRootPitch: Pitch = chordSymbol.RootPitch;
 
-        if (MusicSheetCalculator.transposeCalculator !== undefined) {
+        if (MusicSheetCalculator.transposeCalculator) {
             transposedRootPitch = MusicSheetCalculator.transposeCalculator.transposePitch(
                 chordSymbol.RootPitch,
                 keyInstruction,
@@ -54,7 +54,7 @@ export class ChordSymbolContainer {
         // chord kind text
         text += chordSymbol.getTextFromChordKindEnum(chordSymbol.ChordKind);
         // degree
-        if (chordSymbol.ChordDegree !== undefined) {
+        if (chordSymbol.ChordDegree) {
             switch (chordSymbol.ChordDegree.text) {
                 case ChordDegreeText.add:
                     text += "add";
@@ -75,9 +75,9 @@ export class ChordSymbolContainer {
             }
         }
         // bass
-        if (chordSymbol.BassPitch !== undefined) {
+        if (chordSymbol.BassPitch) {
             let transposedBassPitch: Pitch = chordSymbol.BassPitch;
-            if (MusicSheetCalculator.transposeCalculator !== undefined) {
+            if (MusicSheetCalculator.transposeCalculator) {
                 transposedBassPitch = MusicSheetCalculator.transposeCalculator.transposePitch(
                     chordSymbol.BassPitch,
                     keyInstruction,

+ 1 - 1
src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/ContinuousDynamicExpression.ts

@@ -88,7 +88,7 @@ export class ContinuousDynamicExpression extends AbstractExpression {
     public getInterpolatedDynamic(currentAbsoluteTimestamp: Fraction): number {
         const continuousAbsoluteStartTimestamp: Fraction = this.StartMultiExpression.AbsoluteTimestamp;
         let continuousAbsoluteEndTimestamp: Fraction;
-        if (this.EndMultiExpression !== undefined) {
+        if (this.EndMultiExpression) {
             continuousAbsoluteEndTimestamp = this.EndMultiExpression.AbsoluteTimestamp;
         } else {
             continuousAbsoluteEndTimestamp = Fraction.plus(

+ 1 - 1
src/MusicalScore/VoiceData/Expressions/MultiExpression.ts

@@ -142,7 +142,7 @@ export class MultiExpression {
     //}
     public addExpression(abstractExpression: AbstractExpression, prefix: string): void {
         if (abstractExpression instanceof InstantaneousDynamicExpression) {
-            if (this.instantaneousDynamic !== undefined) {
+            if (this.instantaneousDynamic) {
                 this.removeExpressionFromEntryList(this.InstantaneousDynamic);
             }
             this.instantaneousDynamic = <InstantaneousDynamicExpression>abstractExpression;

+ 2 - 2
src/MusicalScore/VoiceData/HelperObjects/DynamicsContainer.ts

@@ -17,10 +17,10 @@ export class DynamicsContainer /*implements IComparable<DynamicsContainer>*/ {
     public staffNumber: number;
 
     public parMultiExpression(): MultiExpression {
-        if (this.continuousDynamicExpression !== undefined) {
+        if (this.continuousDynamicExpression) {
             return this.continuousDynamicExpression.StartMultiExpression;
         }
-        if (this.instantaneousDynamicExpression !== undefined) {
+        if (this.instantaneousDynamicExpression) {
             return this.instantaneousDynamicExpression.ParentMultiExpression;
         }
         return undefined;

+ 2 - 2
src/MusicalScore/VoiceData/Instructions/RepetitionInstruction.ts

@@ -2,7 +2,7 @@ import {Repetition} from "../../MusicSource/Repetition";
 
 export class RepetitionInstructionComparer /*implements IComparer<RepetitionInstruction>*/ {
     public static Compare(x: RepetitionInstruction, y: RepetitionInstruction): number {
-        if (x.parentRepetition !== undefined && y.parentRepetition !== undefined) {
+        if (x.parentRepetition !== undefined && y.parentRepetition) {
             if (x.alignment === AlignmentType.End && y.alignment === AlignmentType.End) {
                 if (x.parentRepetition.StartIndex < y.parentRepetition.StartIndex) {
                     return 1;
@@ -44,7 +44,7 @@ export class RepetitionInstruction /*implements IComparable*/ {
     constructor(measureIndex: number, type: RepetitionInstructionEnum, alignment: AlignmentType = AlignmentType.End,
                 parentRepetition: Repetition = undefined, endingIndices: number[] = undefined) {
         this.measureIndex = measureIndex;
-        if (endingIndices !== undefined) {
+        if (endingIndices) {
             this.endingIndices = endingIndices.slice(); // slice=arrayCopy
         }
         this.type = type;

+ 2 - 2
src/MusicalScore/VoiceData/Note.ts

@@ -22,7 +22,7 @@ export class Note {
         this.parentStaffEntry = parentStaffEntry;
         this.length = length;
         this.pitch = pitch;
-        if (pitch !== undefined) {
+        if (pitch) {
             this.halfTone = pitch.getHalfTone();
         } else {
           this.halfTone = 0;
@@ -229,7 +229,7 @@ export class Note {
     }
 
     public ToString(): string {
-        if (this.pitch !== undefined) {
+        if (this.pitch) {
             return this.Pitch.ToString() + ", length: " + this.length.toString();
         } else {
           return "rest note, length: " + this.length.toString();

+ 6 - 6
src/MusicalScore/VoiceData/SourceMeasure.ts

@@ -211,8 +211,8 @@ export class SourceMeasure {
                 break;
             }
         }
-        if (existingVerticalSourceStaffEntryContainer !== undefined) {
-            if (existingVerticalSourceStaffEntryContainer.StaffEntries[inSourceMeasureStaffIndex] !== undefined) {
+        if (existingVerticalSourceStaffEntryContainer) {
+            if (existingVerticalSourceStaffEntryContainer.StaffEntries[inSourceMeasureStaffIndex]) {
                 staffEntry = existingVerticalSourceStaffEntryContainer.StaffEntries[inSourceMeasureStaffIndex];
             } else {
                 staffEntry = new SourceStaffEntry(existingVerticalSourceStaffEntryContainer, staff);
@@ -289,7 +289,7 @@ export class SourceMeasure {
      */
     public getPreviousSourceStaffEntryFromIndex(verticalIndex: number, horizontalIndex: number): SourceStaffEntry {
         for (let i: number = horizontalIndex - 1; i >= 0; i--) {
-            if (this.verticalSourceStaffEntryContainers[i][verticalIndex] !== undefined) {
+            if (this.verticalSourceStaffEntryContainers[i][verticalIndex]) {
                 return this.verticalSourceStaffEntryContainers[i][verticalIndex];
             }
         }
@@ -396,7 +396,7 @@ export class SourceMeasure {
             const inSourceMeasureInstrumentIndex: number = musicSheet.getGlobalStaffIndexOfFirstStaff(musicSheet.Instruments[i]);
             for (let j: number = 0; j < musicSheet.Instruments[i].Staves.length; j++) {
                 const lastStaffEntry: SourceStaffEntry = this.getLastSourceStaffEntryForInstrument(inSourceMeasureInstrumentIndex + j);
-                if (lastStaffEntry !== undefined && lastStaffEntry.Timestamp !== undefined) {
+                if (lastStaffEntry !== undefined && lastStaffEntry.Timestamp) {
                     if (instrumentDuration.lt(Fraction.plus(lastStaffEntry.Timestamp, lastStaffEntry.calculateMaxNoteLength()))) {
                         instrumentDuration = Fraction.plus(lastStaffEntry.Timestamp, lastStaffEntry.calculateMaxNoteLength());
                     }
@@ -414,7 +414,7 @@ export class SourceMeasure {
         const sourceStaffEntries: SourceStaffEntry[] = [];
         for (const container of this.VerticalSourceStaffEntryContainers) {
             const sse: SourceStaffEntry = container.StaffEntries[staffIndex];
-            if (sse !== undefined) {
+            if (sse) {
                 sourceStaffEntries.push(sse);
             }
         }
@@ -539,7 +539,7 @@ export class SourceMeasure {
     }
 
     public getKeyInstruction(staffIndex: number): KeyInstruction {
-        if (this.FirstInstructionsStaffEntries[staffIndex] !== undefined) {
+        if (this.FirstInstructionsStaffEntries[staffIndex]) {
             const sourceStaffEntry: SourceStaffEntry = this.FirstInstructionsStaffEntries[staffIndex];
             for (let idx: number = 0, len: number = sourceStaffEntry.Instructions.length; idx < len; ++idx) {
                 const abstractNotationInstruction: AbstractNotationInstruction = sourceStaffEntry.Instructions[idx];

+ 3 - 3
src/MusicalScore/VoiceData/SourceStaffEntry.ts

@@ -35,14 +35,14 @@ export class SourceStaffEntry {
     }
 
     public get Timestamp(): Fraction {
-        if (this.VerticalContainerParent !== undefined) {
+        if (this.VerticalContainerParent) {
             return this.VerticalContainerParent.Timestamp;
         }
         return undefined;
     }
 
     public get AbsoluteTimestamp(): Fraction {
-        if (this.VerticalContainerParent !== undefined) {
+        if (this.VerticalContainerParent) {
             return Fraction.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp, this.VerticalContainerParent.Timestamp);
         }
         return undefined;
@@ -211,7 +211,7 @@ export class SourceStaffEntry {
             const voiceEntry: VoiceEntry = this.VoiceEntries[idx];
             for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
                 const note: Note = voiceEntry.Notes[idx2];
-                if (note.NoteTie !== undefined) {
+                if (note.NoteTie) {
                     // only add notes from this and after this sse!!
                     const tieRestDuration: Fraction = Fraction.createFromFraction(note.Length);
                     let addFollowingNotes: boolean = false;

+ 1 - 1
src/MusicalScore/VoiceData/VoiceEntry.ts

@@ -180,7 +180,7 @@ export class VoiceEntry {
     public hasTie(): boolean {
         for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
             const note: Note = this.Notes[idx];
-            if (note.NoteTie !== undefined) { return true; }
+            if (note.NoteTie) { return true; }
         }
         return false;
     }