code: function benchmark2json(b) {
    if (b.error) {
      return {error: b.error};
    } else {
      return {
        hz: b.hz,
        rme: b.stats.rme,
        samples: b.stats.sample.length,
      };
    }
  }
docs: function time(filename, expected) { const results = exec(filename).toString(); const lines = results.split('\n'); const timingsLine = lines.pop();  const time = timingsLine.match(/([\d.]+) total/)[1];  if (expected != null) { const resultString = lines.join('\n').trim(); if (expected !== resultString) { throw new Error("unexpected output for benchmark file ", filename); } }  return JSON.parse(time); }