Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getPayloadOfTooltip = (el, type, nameKey) => {
const { payload } = el;
if (type === 'node') {
return [
{
payload: el,
name: getValueByDataKey(payload, nameKey, ''),
value: getValueByDataKey(payload, 'value')
}
];
}
if (payload.source && payload.target) {
const sourceName = getValueByDataKey(payload.source, nameKey, '');
const targetName = getValueByDataKey(payload.target, nameKey, '');
return [
{
payload: el,
name: `${sourceName} - ${targetName}`,
value: getValueByDataKey(payload, 'value')
}
];
}
return [];
};
const getPayloadOfTooltip = (el, type, nameKey) => {
const { payload } = el;
if (type === 'node') {
return [
{
payload: el,
name: getValueByDataKey(payload, nameKey, ''),
value: getValueByDataKey(payload, 'value')
}
];
}
if (payload.source && payload.target) {
const sourceName = getValueByDataKey(payload.source, nameKey, '');
const targetName = getValueByDataKey(payload.target, nameKey, '');
return [
{
payload: el,
name: `${sourceName} - ${targetName}`,
value: getValueByDataKey(payload, 'value')
}
];
}
const getPayloadOfTooltip = (el, type, nameKey) => {
const { payload } = el;
if (type === 'node') {
return [
{
payload: el,
name: getValueByDataKey(payload, nameKey, ''),
value: getValueByDataKey(payload, 'value')
}
];
}
if (payload.source && payload.target) {
const sourceName = getValueByDataKey(payload.source, nameKey, '');
const targetName = getValueByDataKey(payload.target, nameKey, '');
return [
{
payload: el,
name: `${sourceName} - ${targetName}`,
value: getValueByDataKey(payload, 'value')
}
];
}
return [];
};
const getPayloadOfTooltip = (el, type, nameKey) => {
const { payload } = el;
if (type === 'node') {
return [
{
payload: el,
name: getValueByDataKey(payload, nameKey, ''),
value: getValueByDataKey(payload, 'value')
}
];
}
if (payload.source && payload.target) {
const sourceName = getValueByDataKey(payload.source, nameKey, '');
const targetName = getValueByDataKey(payload.target, nameKey, '');
return [
{
payload: el,
name: `${sourceName} - ${targetName}`,
value: getValueByDataKey(payload, 'value')
}
];
}