Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bleach

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bleach - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

.npmignore

48

lib/bleach.js

@@ -8,3 +8,3 @@ /*

var fs = require('fs'),
ent = require('ent');
he = require('he');

@@ -45,3 +45,3 @@ var bleach = {

name: attr_name,
value: attr_val
value: attr_val
};

@@ -60,3 +60,3 @@ if (!attr.value) delete attr.value;

}
return matches;

@@ -99,3 +99,3 @@ },

if ( options.encode_entities ) html = ent.encode( html );
if ( options.encode_entities ) html = he.encode( html );

@@ -105,3 +105,3 @@ return html;

filter: function(html, filters) {
filterSync: function(html, filters) {
html = String(html) || '';

@@ -139,3 +139,41 @@

} else return html;
},
filter: function(html, filters, callback) {
if (typeof(callback) != 'function') {
return bleach.filterSync(html, filters);
}
html = String(html) || '';
if (!filters) callback('no filters provided', undefined);
var available = fs.readdir(__dirname + '/../filters', function() {
if (Array.isArray(filters)) {
for (var i in filters) {
if (typeof filters[i] == 'function') {
html = filters[i](html);
} else {
var file = filters[i] + '.js';
for (var j in available) {
if (file == available[j]) {
html = require('../filters/' + file)(html);
}
}
}
}
return html;
} else if (typeof filters == 'string') {
var file = filters + '.js';
for (var i in available) {
if (file == available[i]) {
html = require('../filters/' + file)(html);
callback(undefined, html);
}
}
} else if (typeof filters == 'function') {
html = filters(undefined, html);
callback(undefined, html);
} else callback(undefined, html);
});
}

@@ -142,0 +180,0 @@

4

package.json

@@ -5,3 +5,3 @@ {

"description": "A minimalistic HTML sanitizer",
"version": "0.2.1",
"version": "0.3.0",
"homepage": "https://github.com/ecto/bleach/issues",

@@ -17,3 +17,3 @@ "repository": {

"dependencies": {
"ent": "0.0.x"
"he": "0.4.x"
},

@@ -20,0 +20,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc