Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (13 sloc) 429 Bytes
import { Pipe, PipeTransform } from '@angular/core';
import { isString, isUndefined } from '../utils/utils';
@Pipe({
name: 'replace'
})
export class ReplacePipe implements PipeTransform {
transform (input: any, pattern: any, replacement: any): any {
if (!isString(input) || isUndefined(pattern) || isUndefined(replacement)) {
return input;
}
return input.replace(pattern, replacement);
}
}
You can’t perform that action at this time.