I have a function node that takes in an array and spits out each object as a seperate message. This works 100% like it should:
for (var i = 0; i < msg.payload.length; i++) {
var newMsg = {};
newMsg.payload = msg.payload[i];
node.send(newMsg);
}
return null;
Up until this point the message with the array of objects has a msg.prefix that is removed when the message passes through the function node. The value of msg.prefix is dynamic and can vary with each message.
I want to re-add msg.prefix as part of the function so that each separate message includes msg.prefix with the correct value when it comes back out of the function node.
So take the input and re-add it inside. Anyone know how?