transform keys and text service
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {KeyPipe} from './key.pipe';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [KeyPipe],
|
||||
exports: [
|
||||
KeyPipe
|
||||
],
|
||||
imports: [
|
||||
CommonModule
|
||||
]
|
||||
})
|
||||
export class KeyTranslatorModule {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import {KeyPipe} from './key.pipe';
|
||||
|
||||
describe('KeyPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new KeyPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
13
src/app/widget-modules/pipes/key-translator/key.pipe.ts
Normal file
13
src/app/widget-modules/pipes/key-translator/key.pipe.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import {scaleMapping} from '../../../modules/songs/services/key.helper';
|
||||
|
||||
@Pipe({
|
||||
name: 'key'
|
||||
})
|
||||
export class KeyPipe implements PipeTransform {
|
||||
|
||||
transform(key: string): string {
|
||||
return scaleMapping[key];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user