From 5e6a30d0e41d307ce19745647f9f0ded8e04ff31 Mon Sep 17 00:00:00 2001 From: smuddyx Date: Mon, 16 Mar 2020 21:08:32 +0100 Subject: [PATCH] reformat code --- src/app/modules/shows/show/song/song.component.ts | 10 +++++----- .../modules/songs/services/text-rendering.service.ts | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/app/modules/shows/show/song/song.component.ts b/src/app/modules/shows/show/song/song.component.ts index 189f6f3..02ff304 100644 --- a/src/app/modules/shows/show/song/song.component.ts +++ b/src/app/modules/shows/show/song/song.component.ts @@ -24,6 +24,11 @@ export class SongComponent implements OnInit { public faDown = faCaretDown; public keyFormControl: FormControl; + constructor( + private showSongService: ShowSongService, + ) { + } + public _song: Song; @Input() @@ -32,11 +37,6 @@ export class SongComponent implements OnInit { this.keys = !!song ? getScale(song.key) : []; }; - constructor( - private showSongService: ShowSongService, - ) { - } - public ngOnInit(): void { this.keyFormControl = new FormControl(this.showSong.key); this.keyFormControl.valueChanges.subscribe(async value => { diff --git a/src/app/modules/songs/services/text-rendering.service.ts b/src/app/modules/songs/services/text-rendering.service.ts index d017904..73a02b2 100644 --- a/src/app/modules/songs/services/text-rendering.service.ts +++ b/src/app/modules/songs/services/text-rendering.service.ts @@ -28,15 +28,15 @@ export interface Section { }) export class TextRenderingService { - constructor() { - } - private regexSection = /(Strophe|Refrain|Bridge)/; private regexChords = /\b([CDEFGAHBcdefgahb](#|##|b|bb|sus|maj|maj7|min|aug|\d+|\/[CDEFGAHBcdefgahb])?\b)/; + constructor() { + } + public parse(text: string): Section[] { const arrayOfLines = text.split(/\r?\n/).filter(_ => _); - const sections = arrayOfLines.reduce((array, line) => { + return arrayOfLines.reduce((array, line) => { if (line.match(this.regexSection)) return [...array, { type: this.getSectionTypeOfLine(line), number: -1, @@ -45,8 +45,6 @@ export class TextRenderingService { array[array.length - 1].lines.push(this.getLineOfLineText(line)); return array; }, [] as Section[]); - - return sections; } private getLineOfLineText(text: string): Line {