Removed excess debugging from change node (sorry)

This commit is contained in:
Dave C-J 2013-12-24 16:54:19 +00:00
parent 6b2e666600
commit dafb2f1d38
1 changed files with 5 additions and 6 deletions

View File

@ -22,8 +22,7 @@ function ChangeNode(n) {
this.property = n.property || "";
this.from = n.from || " ";
this.to = n.to || " ";
this.reg = n.reg || true;
console.log("Type=",this.reg);
this.reg = n.reg;
var node = this;
var makeNew = function( stem, path, value ) {
@ -37,14 +36,14 @@ function ChangeNode(n) {
this.on('input', function (msg) {
if (node.action == "change") {
var from = node.from;
if (node.reg === false) {
this.from = this.from.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
from = from.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
//console.log("Regex is:",this.from);
try {
node.re = new RegExp(this.from, "g");
node.re = new RegExp(from, "g");
} catch (e) {
node.error("Invalid regex: "+this.from);
node.error("Invalid regex: "+from);
}
if (typeof msg[node.property] === "string") {
msg[node.property] = (msg[node.property]).replace(node.re, node.to);