# Zip node - a Suggestion

**URL:** https://discourse.nodered.org/t/zip-node-a-suggestion/2148
**Category:** Share Your Nodes
**Created:** [8 August 2018 09:29 UTC](https://discourse.nodered.org/t/zip-node-a-suggestion/2148 "2018-08-08T09:29:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![placerda](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@placerda](https://discourse.nodered.org/u/placerda)
#### Post date: [8 August 2018 09:29 UTC](https://discourse.nodered.org/t/zip-node-a-suggestion/2148/1 "2018-08-08T09:29:12Z")

</div>

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 ([http://reactivex.io/documentation/operators/zip.html](http://reactivex.io/documentation/operators/zip.html)) 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){
    node.send(msgAux);
} 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 [http://reactivex.io/documentation/operators/combinelatest.html](http://reactivex.io/documentation/operators/combinelatest.html) to see another way that different inputs can be merged together.

Cheers  
Pedro

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [8 August 2018 09:52 UTC](https://discourse.nodered.org/t/zip-node-a-suggestion/2148/2 "2018-08-08T09:52:31Z")

</div>

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