-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter.js
125 lines (114 loc) · 2.07 KB
/
filter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
let dictionnary={
"arse":"",
"arsehead":"",
"arsehole":"",
"ass":"",
"asshole":"",
"bastard":"",
"bitch":"",
"bloody":"",
"bollocks":"",
"brotherfucker":"",
"bugger":"",
"bullshit":"",
"child-fucker":"",
"Christ on a bike":"",
"Christ on a cracker":"",
"cock":"",
"cocksucker":"",
"crap":"",
"cunt":"",
"damn":"",
"damn it":"",
"dick":"",
"dickhead":"",
"dyke":"",
"fatherfucker":"",
"frigger":"",
"fuck":"",
"goddamn":"",
"godsdamn":"",
"hell":"",
"holy shit":"",
"horseshit":"",
"in shit":"",
"jesus christ":"",
"jesus fuck":"",
"jesus h. Christ":"",
"jesus harold christ":"",
"jesus mary and joseph":"",
"jesus wept":"",
"kike":"",
"motherfucker":"",
"nigga":"",
"nigra":"",
"pigfucker":"",
"piss":"",
"prick":"",
"pussy":"",
"shit":"",
"shit ass":"",
"shite":"",
"sisterfucker":"",
"slut":"",
"son of a whore":"",
"son of a bitch":"",
"spastic":"",
"sweet jesus":"",
"turd":"",
"twat":"",
"wanker":"",
}
function clearup(s){
let result='';let ok=0;
for(let k in s){
if(s[k]==' '&&!ok){
ok=1;result+=' ';
}
else if(s[k]!=' '&&ok){
ok=0;
}
if(s[k]==' ')continue;
result+=s[k];
}ok=0;
let end='',lastc=0;
for(let k in result){
if(result[k]==' '&&!ok){continue;
}
else{
ok=1;lastc=k;
}
if(ok)end+=result[k];
}
if(lastc!=-1){
end=end.substring(0,lastc+1);
}
return end
}
function forbid(message){
for(let k in message){
if(message[k]=='*')continue;
let begin=k,end=-1;let submessage=''
for(let j=k;j<message.length;j++){
submessage+=message[j].toLowerCase();
if(dictionnary.hasOwnProperty(submessage))
if(j<message.length-1){
if(message[j+1]==' ')end=j;
}
else end=j;
}
if(end!=-1){let nextmessage=''
nextmessage=message.substring(0,begin);
for(let b=begin;b<=end;b++){
nextmessage+='*';
}
nextmessage+=message.substring(end+1,);
message=nextmessage;}
}
return message
}
let o={'h':"bro"};
console.log(o.hasOwnProperty('h'))
delete o['h']
console.log(o.hasOwnProperty('h'))
module.exports={dictionnary,clearup,forbid}