node-red-contrib-flow-combine
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -31,5 +31,11 @@ /** | ||
} | ||
msg.__combineId.unshift(id); | ||
msg.__combineId.unshift({ | ||
id : id | ||
}); | ||
} | ||
function injectOrder(msg,i) { | ||
msg.__combineId[0].order = i; | ||
} | ||
function CombineStartNode(n) { | ||
@@ -41,2 +47,3 @@ var node = this; | ||
this.waitArray = n.waitArray; | ||
this.iterateArray = n.iterateArray; | ||
@@ -52,3 +59,12 @@ | ||
counters[id] = msg.payload.length; | ||
node.send(msg); | ||
if ( node.iterateArray ) { | ||
for ( var i=0;i<msg.payload.length;i++ ) { | ||
var msgCopy = RED.util.cloneMessage(msg); | ||
injectOrder(msgCopy,i); | ||
msgCopy.payload = msg.payload[i]; | ||
node.send(msgCopy); | ||
} | ||
} else { | ||
node.send(msg); | ||
} | ||
} | ||
@@ -72,5 +88,10 @@ } else { | ||
if (Array.isArray(msg.__combineId)) { | ||
var id = msg.__combineId[0]; | ||
if (node.saveOutput) { | ||
outputs[id].push(msg.payload); | ||
var id = msg.__combineId[0].id; | ||
var order = msg.__combineId[0].order || false; | ||
if ( node.saveOutput ) { | ||
if ( order ) { | ||
outputs[id][order] = msg.payload; | ||
} else { | ||
outputs[id].push(msg.payload); | ||
} | ||
} | ||
@@ -77,0 +98,0 @@ if (0 >= --counters[id]) { |
{ | ||
"name": "node-red-contrib-flow-combine", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Combine multiple flows into one waiting until a number (static or dynamic) of iterations are made.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Node-red Flow Combine | ||
======================== | ||
[![RedConnect Approved](https://img.shields.io/badge/RedConnect-Approved-brightgreen.svg?style=flat)](https://www.redconnect.io/addons/flow-combine/) | ||
@@ -27,3 +28,4 @@ Install | ||
**The Node doesn't split the Array in multiple messages, you need to use the Node Splitter for this** | ||
### Iterate over the Array | ||
Split the Array on multiple messages. | ||
@@ -45,1 +47,2 @@ | ||
If this property is checked, then the node collects in an Array, data from each iteration and at the end provides that in the payload. | ||
If on the start node is enabled *Iterate over the Array* the elements of the result Array have the same order as in the input Array. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23549
98
47