Skip to content

Commit

Permalink
feat: support number and string variable value in loop data block (Au…
Browse files Browse the repository at this point in the history
  • Loading branch information
Kholid060 committed Feb 6, 2024
1 parent 1332572 commit 55250c8
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/workflowEngine/blocksHandler/handlerLoopData.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,29 @@ async function loopData({ data, id }, { refData }) {
'data-columns': () => refData.table,
'google-sheets': () => refData.googleSheets[data.referenceKey],
variable: () => {
const variableVal = objectPath.get(
let variableVal = objectPath.get(
refData.variables,
data.variableName
);

if (Array.isArray(variableVal)) return variableVal;

return parseJSON(variableVal, variableVal);
variableVal = parseJSON(variableVal, variableVal);

switch (typeof variableVal) {
case 'string':
variableVal = variableVal.split('');
break;
case 'number':
variableVal = Array.from(
{ length: variableVal },
(_, index) => index + 1
);
break;
default:
}

return variableVal;
},
elements: async () => {
const findBy = isXPath(data.elementSelector)
Expand Down

0 comments on commit 55250c8

Please sign in to comment.