mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
updated swearfilter to work with latest badwords npm (v0.3)
This commit is contained in:
parent
ea398f9e66
commit
631dea47b7
@ -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); }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user