Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
senderTransportParams.forEach(function(leg, index) {
const destination_host = get(
leg,
'destination_host'
);
setJSON.set(
patchData,
`/$staged/transport_params/${index}/source_host`,
destination_host,
true
);
const destination_port = get(
leg,
'destination_port'
);
setJSON.set(
patchData,
`/$staged/transport_params/${index}/source_port`,
destination_port,
true
);
});
break;
senderTransportParams.forEach(function(leg, index) {
const destination_host = get(
leg,
'destination_host'
);
setJSON.set(
patchData,
`/$staged/transport_params/${index}/source_host`,
destination_host,
true
);
const destination_port = get(
leg,
'destination_port'
);
setJSON.set(
patchData,
`/$staged/transport_params/${index}/source_port`,
destination_port,
true
);
});
senderToReceiver.forEach(function(param) {
const lhs = get(leg, param);
if (lhs !== undefined) {
setJSON.set(
patchData,
`/$staged/transport_params/${index}/${param}`,
lhs,
true
);
}
});
});
rhs: Number(d.rhs),
});
} else {
differences.push(d);
}
}
}
let patchData = { transport_params: [] };
const legs = get(params, 'data.$staged.transport_params').length;
for (let i = 0; i < legs; i++) {
patchData.transport_params.push({});
}
for (const d of differences) {
setJSON.set(patchData, `/${d.path.join('/')}`, d.rhs, true);
}
if (patchData.hasOwnProperty('transport_file')) {
if (get(patchData, 'transport_file.data') === null) {
set(patchData, 'transport_file.type', null);
} else {
set(patchData, 'transport_file.type', 'application/sdp');
}
}
const options = {
method: 'PATCH',
body: JSON.stringify(patchData),
};
return {
url: concatUrl(params.data.$connectionAPI, '/staged'),
senderTransportParams.forEach(function(leg, index) {
const destination_ip = get(leg, 'destination_ip');
if (isMulticast(destination_ip)) {
setJSON.set(
patchData,
`/$staged/transport_params/${index}/multicast_ip`,
destination_ip,
true
);
} else {
setJSON.set(
patchData,
`/$staged/transport_params/${index}/interface_ip`,
destination_ip,
true
);
}
});
break;