Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getRunsDelta = runs => runs.reduce((aggregator, run, index) => {
const deltaInfo = {};
if (index > 0) {
deltaInfo.delta = getDelta(runs[index - 1], run);
deltaInfo.displayDelta = formatDelta(deltaInfo.delta);
}
return [
...aggregator,
merge(
run,
deltaInfo,
),
];
}, []);
const getRunsDelta = runs => runs.reduce((aggregator, run, index) => {
const deltaInfo = {};
if (index < runs.length - 1) {
deltaInfo.delta = getDelta(runs[index + 1], run);
deltaInfo.displayDelta = formatDelta(deltaInfo.delta);
}
return [
...aggregator,
merge(
run,
deltaInfo,
),
];
}, []);
export const SummaryItem = ({
className, size, id, data, loading, showBaselineValue, showDelta, showMetricDescription,
}) => {
const { baseline, current } = data || { baseline: 0, current: 0 };
const metric = getMetricType(id);
const diff = getDelta({ value: baseline }, { value: current });
const rootClassName = cx(
css.root,
className,
css[size],
showMetricDescription && css.showMetricDescription,
showBaselineValue && css.showBaselineValue,
);
return (
<div>
<h3>
{metric.label}
</h3>
{!loading ? (</div>