mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Removed excess debugging from change node (sorry)
This commit is contained in:
parent
6b2e666600
commit
dafb2f1d38
@ -22,8 +22,7 @@ function ChangeNode(n) {
|
|||||||
this.property = n.property || "";
|
this.property = n.property || "";
|
||||||
this.from = n.from || " ";
|
this.from = n.from || " ";
|
||||||
this.to = n.to || " ";
|
this.to = n.to || " ";
|
||||||
this.reg = n.reg || true;
|
this.reg = n.reg;
|
||||||
console.log("Type=",this.reg);
|
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
var makeNew = function( stem, path, value ) {
|
var makeNew = function( stem, path, value ) {
|
||||||
@ -37,14 +36,14 @@ function ChangeNode(n) {
|
|||||||
|
|
||||||
this.on('input', function (msg) {
|
this.on('input', function (msg) {
|
||||||
if (node.action == "change") {
|
if (node.action == "change") {
|
||||||
|
var from = node.from;
|
||||||
if (node.reg === false) {
|
if (node.reg === false) {
|
||||||
this.from = this.from.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
from = from.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||||
}
|
}
|
||||||
//console.log("Regex is:",this.from);
|
|
||||||
try {
|
try {
|
||||||
node.re = new RegExp(this.from, "g");
|
node.re = new RegExp(from, "g");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
node.error("Invalid regex: "+this.from);
|
node.error("Invalid regex: "+from);
|
||||||
}
|
}
|
||||||
if (typeof msg[node.property] === "string") {
|
if (typeof msg[node.property] === "string") {
|
||||||
msg[node.property] = (msg[node.property]).replace(node.re, node.to);
|
msg[node.property] = (msg[node.property]).replace(node.re, node.to);
|
||||||
|
Loading…
Reference in New Issue
Block a user