I'm just wanting to repeat the payload regardless of topic so I've simplified it down to this
which gets generated to this
if ((msg['payload']) == 'RePeAt') {
if ((context.get('repeat')) != null) {
msg['payload'] = (context.get('repeat'));
node.send([msg]);
}
} else {
context.set('repeat', (msg['payload']));
node.send([msg]);
}