How to use the @bundle-stats/utils.getDelta function in @bundle-stats/utils

To help you get started, we’ve selected a few @bundle-stats/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github relative-ci / bundle-stats / packages / web-compare / src / utils / compute-delta.js View on Github external
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,
    ),
  ];
}, []);
github relative-ci / bundle-stats / packages / ui / src / utils / compute-delta.js View on Github external
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,
    ),
  ];
}, []);
github relative-ci / bundle-stats / packages / ui / src / components / summary-item / summary-item.jsx View on Github external
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>