From d2d33210e8d45f46ad85cf35997d2742cbb8482a Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Fri, 7 Aug 2015 15:19:09 -0700 Subject: [PATCH] Fixes `add()` without a name --- index.js | 1 + test.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/index.js b/index.js index 7e1e1d1..a1c42ef 100644 --- a/index.js +++ b/index.js @@ -27,6 +27,7 @@ console.log('') function add(bench) { exports.store.push(bench) + var id = bench.id; var len = (bench.name || (Number.isNaN(id) ? id : '')).length name_maxlen = len > name_maxlen ? len : name_maxlen var ops = bench.hz.toFixed(bench.hz < 100 ? 2 : 0) diff --git a/test.js b/test.js index 002247b..eb2faf1 100644 --- a/test.js +++ b/test.js @@ -37,6 +37,9 @@ suite.add('current', function() { .add('random blaaaah', function() { return ~getSlowRandom() ? false: true }) +.add(function() { + return ~getRandom() ? false: true +}) .on('cycle', function(event) { benchmarks.add(event.target) })