clone msg more correctly for CSV node multiple line output

This commit is contained in:
dceejay 2015-02-22 21:56:52 +00:00
parent 339e6039e1
commit 51421ce657
1 changed files with 6 additions and 4 deletions

View File

@ -124,8 +124,9 @@ module.exports = function(RED) {
} }
if (JSON.stringify(o) !== "{}") { // don't send empty objects if (JSON.stringify(o) !== "{}") { // don't send empty objects
if (node.multi === "one") { if (node.multi === "one") {
msg.payload = o; var newMessage = RED.util.cloneMessage(msg);
node.send(msg); // either send newMessage.payload = o;
node.send(newMessage); // either send
} }
else { a.push(o); } // or add to the array else { a.push(o); } // or add to the array
} }
@ -148,8 +149,9 @@ module.exports = function(RED) {
} }
if (JSON.stringify(o) !== "{}") { // don't send empty objects if (JSON.stringify(o) !== "{}") { // don't send empty objects
if (node.multi === "one") { if (node.multi === "one") {
msg.payload = o; var newMessage = RED.util.cloneMessage(msg);
node.send(msg); // either send newMessage.payload = o;
node.send(newMessage); // either send
} }
else { a.push(o); } // or add to the aray else { a.push(o); } // or add to the aray
} }