Skip to content

Commit 2944b07

Browse files
committed
use nonnull operator to avoid repetition
1 parent d8f9ce9 commit 2944b07

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/timesignature.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,13 @@ export class TimeSignature extends StaveModifier {
6262

6363
protected timeSpec: string = '4/4';
6464
protected line: number = 0;
65-
protected glyph: Glyph;
65+
protected glyph!: Glyph;
6666
protected is_numeric: boolean = true;
6767
protected validate_args: boolean;
6868

6969
constructor(timeSpec: string = '4/4', customPadding = 15, validate_args = true) {
7070
super();
7171
this.validate_args = validate_args;
72-
this.timeSpec = timeSpec;
7372

7473
const padding = customPadding;
7574

@@ -81,13 +80,7 @@ export class TimeSignature extends StaveModifier {
8180
this.topLine = 2 + fontLineShift;
8281
this.bottomLine = 4 + fontLineShift;
8382
this.setPosition(StaveModifierPosition.BEGIN);
84-
85-
// violates DRY w/ setTimeSig(timeSpec) but needed to convince TypeScript that all is well.
86-
const info = this.parseTimeSpec(timeSpec);
87-
this.glyph = info.glyph;
88-
this.is_numeric = info.num;
89-
this.line = info.line;
90-
83+
this.setTimeSig(timeSpec);
9184
this.setWidth(defined(this.glyph.getMetrics().width));
9285
this.setPadding(padding);
9386
}

0 commit comments

Comments
 (0)