add trim pipe

This commit is contained in:
Jesse Lucas 2020-04-11 22:49:45 -04:00
parent fbef856a97
commit 48efea99e5
3 changed files with 22 additions and 0 deletions

View File

@ -35,6 +35,7 @@ import { ChartComponent } from './charts/chart/chart.component';
import { FolderListComponent } from './lists/folder-list/folder-list.component';
import { DialogComponent } from './dialog/dialog.component';
import { CardComponent, CardTitleComponent, CardContentComponent } from './card/card.component';
import { TrimPipe } from './trim.pipe';
@NgModule({
declarations: [
@ -51,6 +52,7 @@ import { CardComponent, CardTitleComponent, CardContentComponent } from './card/
CardComponent,
CardTitleComponent,
CardContentComponent,
TrimPipe,
],
imports: [
BrowserModule,

View File

@ -0,0 +1,8 @@
import { TrimPipe } from './trim.pipe';
describe('TrimPipe', () => {
it('create an instance', () => {
const pipe = new TrimPipe();
expect(pipe).toBeTruthy();
});
});

12
src/app/trim.pipe.ts Normal file
View File

@ -0,0 +1,12 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'trim'
})
export class TrimPipe implements PipeTransform {
transform(value: string, ...args: string[]): string {
return value.trim();
}
}