Sindarius / npm_gcodeviewer

Found some unnecessary nested blocks JS-0072
Anti-pattern
Minor
3 months agoa year old
Block is redundant
 833                  break;
 834               }
 835               case 'M600':
 836                  { 837                     try { 838                        this.currentTool++; 839                        if (this.currentTool >= this.tools.length) { 840                           this.currentTool = 0; 841                        } 842                        if (this.colorMode !== ColorMode.Feed) { 843                           this.currentColor = this.tools[this.currentTool].color.clone(); 844                        } 845                     } catch (ex) { 846                        console.log(ex); 847                     } 848                  } 849                  break;
 850            }
 851            this.lastCommand = commands;
Block is redundant
 818                  break;
 819               case 'M3':
 820               case 'M4':
 821                  { 822                     const tokens = tokenString.split(/(?=[SM])/); 823                     let spindleSpeed = tokens.filter((speed) => speed.startsWith('S')); 824                     spindleSpeed = spindleSpeed[0] ? Number(spindleSpeed[0].substring(1)) : 0; 825                     if (spindleSpeed > 0) { 826                        this.hasSpindle = true; 827                     } 828                  } 829                  break;
 830               case 'M567': {
 831                  this.hasMixing = true;
Block is redundant
 230      switch (renderQuality) {
 231         //SBC Quality - Pi 3B+
 232         case 1:
 233            { 234               renderStartIndex = 2; 235               this.refreshTime = 30000; 236               maxLines = 25000; 237               maxNRow = 50; 238               this.renderTravels = false; 239            } 240            break;
 241         //Low Quality
 242         case 2:
Block is redundant
 264            break;
 265         //Ultra
 266         case 5:
 267            { 268               maxLines = 25000000; 269            } 270            break;
 271         //Max
 272         default: {
Block is redundant
 257            break;
 258         //High Quality
 259         case 4:
 260            { 261               maxLines = 15000000; 262               maxNRow = 2; 263            } 264            break;
 265         //Ultra
 266         case 5: