Skip to content

Commit 4baad94

Browse files
authored
Update badword.ts
1 parent e0b4bee commit 4baad94

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

badword.ts

-20
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,6 @@ function escapeRegExp(strings: string): string {
2323
return new RegExp(data.join("|")).source;
2424
}
2525

26-
function validateInput(type: string, value: string): boolean {
27-
let regex: RegExp;
28-
29-
switch (type) {
30-
case 'email':
31-
regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.(com|net|org|edu|gov|mil|co|info|io|biz|id|us|uk|ca|au|de|fr|es|it|jp|cn|br|in|ru|mx|kr|za|nl|se|no|fi|dk|pl|pt|ar|ch|hk|sg|my|th|vn|ae|at|be|cz|hu|ro|bg|gr|lt|lv|sk|si|ee|cy)(\.[a-zA-Z]{2,})?$/;
32-
break;
33-
case 'phone':
34-
regex = /^(?:\+?(\d{1,3}))?[-. ]?(\(?\d{1,4}?\)?)[-.\s]?(\d{1,4})[-.\s]?(\d{1,4})[-.\s]?(\d{1,9})$/;
35-
break;
36-
case 'url':
37-
regex = /^(https?:\/\/)?(www\.)?([a-zA-Z0-9-]+\.[a-zA-Z]{2,})(\/[^\s]*)?$/;
38-
break;
39-
default:
40-
return false; // Invalid type
41-
}
42-
43-
return regex.test(value);
44-
}
45-
4626
class FilterBadWord {
4727
protected _text: string; // Changed to protected to allow access in subclasses
4828
protected _filt: RegExp; // Changed to protected

0 commit comments

Comments
 (0)