diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/pipes')
-rw-r--r-- | vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.spec.ts | 8 | ||||
-rw-r--r-- | vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.ts | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.spec.ts b/vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.spec.ts new file mode 100644 index 000000000..96e9b6cc6 --- /dev/null +++ b/vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.spec.ts @@ -0,0 +1,8 @@ +import { SpaceToUnderscorePipe } from './space-to-underscore.pipe'; + +describe('SpaceToUnderscorePipe', () => { + it('create an instance', () => { + const pipe = new SpaceToUnderscorePipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.ts b/vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.ts new file mode 100644 index 000000000..b82b28bc1 --- /dev/null +++ b/vid-webpack-master/src/app/shared/pipes/spaceToUnderscore/space-to-underscore.pipe.ts @@ -0,0 +1,17 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'spaceToUnderscore' +}) +export class SpaceToUnderscorePipe implements PipeTransform { + + transform(text: string): string { + if (text) { + // @ts-ignore + text = text.replaceAll(' ', '_'); + return text; + } + return text; + } + +} |