Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function spreadArguments(method, args) {
const domainStr = method.split('.')[0];
const eventStr = method.split('.')[1];
const paramsArr = [];
if (Object.keys(args).length > 0) {
const domain = js_protocol.domains.find(d => d.domain === domainStr);
const parameters = domain.events.find(c => c.name === eventStr).parameters;
parameters.forEach(param => {
paramsArr.push(args[param.name]);
});
}
return paramsArr;
}
}