Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit d630c26

Browse files
fantoinefknop
authored andcommitted
Allow empty strings on replace pipe parameters (#66)
1 parent 8640947 commit d630c26

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/string/replace.pipe.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Pipe, PipeTransform } from '@angular/core';
2-
import { isString } from '../utils/utils';
2+
import { isString, isUndefined } from '../utils/utils';
33

44
@Pipe({
55
name: 'replace'
@@ -8,10 +8,10 @@ export class ReplacePipe implements PipeTransform {
88

99
transform (input: any, pattern: any, replacement: any): any {
1010

11-
if (!isString(input) || !pattern || !replacement) {
11+
if (!isString(input) || isUndefined(pattern) || isUndefined(replacement)) {
1212
return input;
1313
}
1414

1515
return input.replace(pattern, replacement);
1616
}
17-
}
17+
}

0 commit comments

Comments
 (0)