Fix change node to return boolean if asked

to fix #4372
This commit is contained in:
Dave Conway-Jones 2024-01-14 12:56:25 +00:00
parent 918943816f
commit dd3c75d298
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643

View File

@ -233,7 +233,9 @@ module.exports = function(RED) {
// only replace if they match exactly
RED.util.setMessageProperty(msg,property,value);
} else {
current = current.replace(fromRE,value);
// if target is boolean then just replace it
if (rule.tot === "bool") { current = value; }
else { current = current.replace(fromRE,value); }
RED.util.setMessageProperty(msg,property,current);
}
} else if ((typeof current === 'number' || current instanceof Number) && fromType === 'num') {