From 1e677ac2cea8f3594ee275bb3ba30190b136065f Mon Sep 17 00:00:00 2001 From: lzzfnc Date: Fri, 19 Nov 2021 00:13:02 +0100 Subject: [PATCH] dynamic and multiple outputs --- api/function/controllers/function.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/function/controllers/function.js b/api/function/controllers/function.js index 481d237..9785852 100644 --- a/api/function/controllers/function.js +++ b/api/function/controllers/function.js @@ -32,8 +32,14 @@ module.exports = { ); }); }; - let output = await script(); - return output; + + let result = await script(); + let message = {}; + entity.output.forEach((out, index) => { + message[out.name] = result[index]; + }); + + return message; } return entity;