n8n-nodes-while-loop 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -78,8 +78,18 @@ class WhileLoop {
|
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
80
|
try {
|
|
81
|
-
const
|
|
81
|
+
const originalLoop = items[i].json?.$loop;
|
|
82
|
+
items[i].json = items[i].json || {};
|
|
83
|
+
items[i].json.$loop = { iteration };
|
|
84
|
+
const exprResult = this.evaluateExpression(conditionExpression, i, items);
|
|
82
85
|
shouldContinue = Boolean(exprResult) && iteration < maxIterations;
|
|
86
|
+
// restore
|
|
87
|
+
if (originalLoop === undefined) {
|
|
88
|
+
delete items[i].json.$loop;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
items[i].json.$loop = originalLoop;
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
94
|
catch (error) {
|
|
85
95
|
throw new NodeApiError(this.getNode(), error);
|
package/package.json
CHANGED
|
File without changes
|