<commit_before>'use strict';

const groupBy = require('lodash.groupby');

module.exports = {
  formatMetric(name, metric, multiple, inMs) {
      if (metric === undefined)
          return null;
      function fmt(value) {
          if (inMs) {
            if (value < 1000) {
              return value + 'ms';
            }
            else {
              return (value / 1000).toFixed(2).replace(/.0+$/, '') + 's';
            }
          }
          else return value;
      }

      let formatted = `${name}: ${fmt(metric.mean)}`;
      if (multiple) {
          formatted += ` (±${fmt(metric.mdev.toFixed(2))})`;
      }
      return formatted;
  },
  getResultLogLine(result) {
    let totalSize = 0;
    let requests = '';<commit_msg>Fix formatting of summary metrics cli output.<commit_after>'use strict';

const groupBy = require('lodash.groupby');

module.exports = {
  formatMetric(name, metric, multiple, inMs) {
      if (metric === undefined)
          return null;
      function fmt(value) {
          if (inMs) {
            if (value < 1000) {
              return value + 'ms';
            }
            else {
              return (value / 1000).toFixed(2).replace(/\.0+$/, '') + 's';
            }
          }
          else return value;
      }

      let formatted = `${name}: ${fmt(metric.mean)}`;
      if (multiple) {
          formatted += ` (±${fmt(metric.mdev.toFixed(2))})`;
      }
      return formatted;
  },
  getResultLogLine(result) {
    let totalSize = 0;
    let requests = '';
{'fraction_non_alphanumeric': 0.15404871626069783, 'fraction_numerical': 0.015799868334430547, 'mean_word_length': 1.7486437613019892, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3470762', 'n_tokens_mistral': 482, 'n_tokens_neox': 452, 'n_words': 104}