Created
December 4, 2016 11:17
-
-
Save gsans/795578c4f3c9e3444601adad59ae831a to your computer and use it in GitHub Desktop.
capitalisePipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Pipe, PipeTransform} from '@angular/core'; | |
@Pipe({ | |
name: 'capitalise' | |
}) | |
export class CapitalisePipe implements PipeTransform { | |
transform(value: string): string { | |
if (typeof value !== 'string') { | |
throw new Error('Requires a String as input'); | |
} | |
return value.toUpperCase(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment