updated swearfilter to work with latest badwords npm (v0.3)

This commit is contained in:
Dave C-J 2013-11-20 10:23:09 +00:00
parent ea398f9e66
commit 631dea47b7
1 changed files with 3 additions and 3 deletions

View File

@ -15,14 +15,14 @@
**/
var RED = require(process.env.NODE_RED_HOME+"/red/red");
var badwords = require('badwords');
var badwordsRegExp = require('badwords/regexp');
function BadwordsNode(n) {
RED.nodes.createNode(this,n);
var node = this;
this.on("input", function(msg) {
if (typeof msg.payload == "string") {
if (badwords.ok(msg.payload)) { node.send(msg); }
if (typeof msg.payload === "string") {
if ( !badwordsRegExp.test(msg.payload) ) { node.send(msg); }
}
});
}