Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getSymbolForDataset = (type, dataset) => {
const datasetMeta: any = dataset.hasOwnProperty('_meta') ? Object.values(dataset._meta)[0] : null;
const elementType = Optional.of(datasetMeta, 'type').orElse(type);
switch (elementType) {
case 'line':
return `
<div style="width: 5px; height: 2px; background-color: ${dataset.backgroundColor}; border-top-left-radius: 2px; border-bottom-left-radius: 2px; margin-right: 2px"></div>
<div style="width: 10px; height: 10px; background-color: ${dataset.backgroundColor}; border-radius: 50%;"></div>
<div style="width: 5px; height: 2px; background-color: ${dataset.backgroundColor}; border-top-right-radius: 2px; border-bottom-right-radius: 2px; margin-left: 2px; margin-right: 8px"></div>
`;
default:
return `<div style="width: 14px; height: 14px; border-radius: 2px; background-color: ${dataset.backgroundColor}; margin-right: 8px"></div>`;
}
};