Toggle navigation
P3X GitList Snapshot
GitHub
Repo
Changelog
To do
Releases
Themes
Change log
Loading change log ...
To do ...
Loading todo ...
browsing:
fb6c20b9abb916d4a0607806de86db06a218aa40
Branches
0.1
0.2
html-sanitizer
html-sanitizer-and-mocha-specs
master
sanitize-oversight
Tags
v0.11.2
v0.11.0
v0.9.2
v0.9.0
v0.8.2
v0.6.2
v0.6.1
v0.6.0
v0.5.1
v0.5.0
v0.4.0
v0.3.2
v0.3.1
v0.3.0
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
Files
Commits
Log
Graph
Stats
xml2json.git
lib
sanitize.js
RSS
Git
Fetch origin
Download
ZIP
TAR
Clone
Raw
View
History
Clone
SSH
HTTPS
Blames found: 8
Mode: javascript
Binary: false
Hang on, we reloading big blames...
1af71b6c
/** * Simple sanitization. It is not intended to sanitize * malicious element values. * * character | escaped * < < * > > * ( ( * ) ) * # # * & & * " " * ' ' */ var chars = {
617ebf47
'&': '&',
8504b1bc
'#': '#',
1af71b6c
'<': '<', '>': '>', '(': '(', ')': ')', '"': '"', "'": ''' };
da94d5df
function escapeRegExp(string) { return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); }
1af71b6c
exports.sanitize = function sanitize(value) { if (typeof value !== 'string') { return value; } Object.keys(chars).forEach(function(key) {
da94d5df
value = value.replace(new RegExp(escapeRegExp(key), 'g'), chars[key]);
1af71b6c
}); return value; }