Skip to content

Commit

Permalink
fix(Input): force the value to a string before sanitization attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
deanterm authored and benjamincharity committed Feb 21, 2020
1 parent 4e2f7e6 commit 4dfe810
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions terminus-ui/input/src/input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,10 @@ export class TsInputComponent implements
return value;
}
// If the unmask regex is a function, invoke it to get the plain regex
// Note: There is a potential the value won't be a string during runtime. It is possible
// a form control could contain a primitive value like a number instead. Make sure it's a string.
const finalRegex: RegExp = isFunction(regex) ? regex() : regex;
return finalRegex && value ? value.replace(new RegExp(finalRegex), '') : value;

return finalRegex && value ? value.toString().replace(new RegExp(finalRegex), '') : value;
}


Expand Down

0 comments on commit 4dfe810

Please sign in to comment.