-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasicfilters.js
36 lines (35 loc) · 1.3 KB
/
basicfilters.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
var filters = [
/* [function nullFilter(s) {
return s;
}, "Does not filter"],
[function first50(s) {
return s.substring(0, 50)
}, "Strips after 50 Characters"],
[function first100(s) {
return s.substring(0, 100)
}, "Strips after 100 Characters"], */
[function use_escape(s) {
return escape(s);
}, "uses JavaScript escape()"],
[function urlencode(s) {
return encodeURIComponent(s);
}, "uses encodeURIComponent"],
[function replaceAngles(s) {
return s.replace(/>/g, ">").replace(/</g, "<");
}, "Replaces < and > with entities"],
[function stripAngles(s) {
return s.replace(/>/g, "").replace(/</g, "");
}, "Strips < and >"],
[function replaceAnglesandDoubleQuote(s) {
return s.replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
}, "Replaces < and > with entities"],
[function stripAnglesandDoubleQuote(s) {
return s.replace(/>/g, "").replace(/</g, "").replace(/"/g, "");
}, "Strips < and >"],
[function replaceQuotesandAngles(s) {
return s.replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """).replace(/'/g, "");
}, "Replaces <,> ' and \" with entities"],
[function stripQuotesandAngles(s) {
return s.replace(/>/g, "").replace(/</g, "").replace(/"/g, "").replace(/'/g, "");
}, "Strips <,> ' and \""],
];