-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy path5-6-8 반복문 Iteration.txt
More file actions
1 lines (1 loc) · 2.92 KB
/
5-6-8 반복문 Iteration.txt
File metadata and controls
1 lines (1 loc) · 2.92 KB
1
[{"id":"377856fa.64711a","type":"subflow","name":"Iterate","in":[{"x":220,"y":219,"wires":[{"id":"9aae9ea2.18832"}]}],"out":[{"x":454,"y":174,"wires":[{"id":"9aae9ea2.18832","port":0}]},{"x":455,"y":259,"wires":[{"id":"9aae9ea2.18832","port":1}]}]},{"id":"9aae9ea2.18832","type":"function","z":"377856fa.64711a","name":"Iterate","func":"//Node has 2 outputs - 1 for itteration and 1 for completion\nvar nextObj, out;\nvar itt = msg.iterationInfo;\n\n\n//If the iterating has not yet begun set up the iteration metadata in the msg\nif (typeof itt === 'undefined') {\n //Make sure payload is an array\n if( Object.prototype.toString.call(msg.payload) !== '[object Array]' ) {\n msg.payload = [msg.payload];\n }\n\n msg.iterationInfo = itt = {};\n itt.index = -1;\n itt.inArray = msg.payload;\n itt.outArray = [];\n\n//Otherwise just push the input to the output array\n} else {\n itt.outArray.push(msg.payload)\n}\n\n//Goto next object\nitt.index ++;\n\n//If there are stil objects left to iterate goto the next one in the original array\nif (itt.index < itt.inArray.length) {\n nextObj = msg;\n msg.payload = itt.inArray[itt.index];\n\n//otherwise pass the out array as the payload\n} else {\n out = msg;\n msg.payload = itt.outArray;\n delete msg.iterationInfo;\n}\n\nreturn [nextObj, out];","outputs":"2","noerr":0,"x":347,"y":220,"wires":[[],[]]},{"id":"778284ff.6ef43c","type":"subflow:377856fa.64711a","z":"25087686.f9aa3a","name":"Iterate","env":[],"x":438.9340171813965,"y":158.0104217529297,"wires":[["43734aad.548f44"],["d312fa83.359958"]]},{"id":"54bb5e1e.2bb9f","type":"inject","z":"25087686.f9aa3a","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":141,"y":161.8437991142273,"wires":[["c62dbbca.62b388"]]},{"id":"c62dbbca.62b388","type":"function","z":"25087686.f9aa3a","name":"¹è¿","func":"var newMsg={};\nnewMsg.payload=[1,2,3,4,5];\nreturn newMsg;","outputs":1,"noerr":0,"x":279.9896469116211,"y":160.63544607162476,"wires":[["778284ff.6ef43c","7b2d05d7.1eceac"]]},{"id":"d312fa83.359958","type":"debug","z":"25087686.f9aa3a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":615.9999961853027,"y":164.99311327934265,"wires":[]},{"id":"43734aad.548f44","type":"function","z":"25087686.f9aa3a","name":"","func":"msg.payload += 5;\nreturn msg;","outputs":1,"noerr":0,"x":439.99999237060547,"y":88.62849187850952,"wires":[["778284ff.6ef43c"]]},{"id":"7b2d05d7.1eceac","type":"function","z":"25087686.f9aa3a","name":"for ¹®","func":"var i;\nfor(i=0; i<msg.payload.length ; i++)\n msg.payload[i] = i+5;\nreturn msg;","outputs":1,"noerr":0,"x":442.98963928222656,"y":215.63897466659546,"wires":[["f75d9d9e.104"]]},{"id":"f75d9d9e.104","type":"debug","z":"25087686.f9aa3a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":605.9896011352539,"y":215.00350522994995,"wires":[]}]