Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 14x 14x 10x | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'ishSanitize', pure: true })
export class SanitizePipe implements PipeTransform {
transform(value: string): string {
return value !== undefined
? value
.replace(/[^a-zA-Z0-9-]/g, '_')
.replace(/_+/g, '_')
.replace(/^_+/g, '')
.replace(/_+$/g, '')
: 'undefined';
}
}
|