Zip node - a Suggestion


Hey guys,

I worked with Bonsai framework before (check it out!) that relies a lot on the reactive. So I looked for a node that would do the same a the zip on the reactive framework ( but I couldn't find it (if there is and I didn't find let me know please!). My goal was to blend together the output stdout and return code of the exec node. So I came up with this prototype which is a function node with the inputs of stdout and return code of the exec node and this is the inside of the function node:

let underscore = global.get('underscore');

if( underscore.has( msg.payload, 'code' )){
context.set('code', msg.payload.code.toString() );
} else{
context.set('msg', msg);
var code = context.get('code')||null;
var msgAux = context.get('msg')||null;

if(code && msgAux ){
context.set('code', null);
context.set('msg', null);

if(parseInt(code) === 0){
} else{
    node.error('some error msg', msgAux);


return null;

I'm sure it can be made much better. And I know that in recent versions of NR the msg is actually passed through the return code output of the exec node (it wasn't a few month ago). But my point is that this kind of response that depend on several inputs can (and should) be available in a much more generic way as in "nodes to merge inputs together". I can also take a look as to see another way that different inputs can be merged together.




You can use the Join node set to combine message contents into key/value pairs to achieve the merging.