Skip to content

Commit

Permalink
Change params union method
Browse files Browse the repository at this point in the history
  • Loading branch information
Machi3mfl committed Sep 13, 2023
1 parent 96aa7f6 commit d5f3d2c
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ const getAllOptionalsMacos = (
['serverAddress', 'wazuhPassword', 'agentGroups', 'agentName', 'protocol'];

if (!optionals) return '';
return Object.entries(paramNameOrderList).reduce(
(acc, [key, value]) => {
if (optionals[value]) {
acc += `${optionals[value]}`;
}

const paramsValueList = []

if (Number.parseInt(key) + 1 < Object.entries(optionals).length) {
acc += ` && `;
}
paramNameOrderList.forEach( paramName => {
if(optionals[paramName] && optionals[paramName] !== ''){
paramsValueList.push(optionals[paramName]);
}
})

return acc;
},
'',
);
if(paramsValueList.length){
return paramsValueList.join(' && ');
}

return '';
};

/******* DEB *******/
Expand Down

0 comments on commit d5f3d2c

Please sign in to comment.