gumbo-sanitize
v0.1.0
Published
Gumbo Sanitize is a loose port of the [Ruby Sanitize library][sanitize] by Ryan Grove based on [Google's Gumbo parser][gumbo]. This module differs from [Sanitize.js][sanitize.js] in that it only supports nodejs and a subset of the Ruby Sanitize API.
Downloads
5
Readme
gumbo-sanitize
Gumbo Sanitize is a loose port of the Ruby Sanitize library by Ryan Grove based on Google's Gumbo parser. This module differs from Sanitize.js in that it only supports nodejs and a subset of the Ruby Sanitize API.
Install
npm install --save gumbo-sanitize
Usage
var sanitize = require("gumbo-sanitize");
console.log(sanitize("<img src=javascript:alert('XSS')>", sanitize.RELAXED));
// prints <img>
Alternatively, you may also use the Sanitize
class directly:
var Sanitize = require("gumbo-sanitize");
var s = new Sanitize(Sanitize.RELAXED);
console.log(s.sanitize("<img src=javascript:alert('XSS')>"));
Documentation
For now, please see the source code for documentation. Open to contributions :)
License
MIT