Comparing version 2.0.0 to 2.0.1
@@ -23,10 +23,11 @@ | ||
var out = this.out; | ||
var title = name + ' x ' + iterations; | ||
[ | ||
' '+yellow(name), | ||
'------------------', | ||
'Iterations: ' + magenta(iterations), | ||
'Result: ' + cyan(result / 1e6 + ' ms'), | ||
'', | ||
yellow(name) + ' x ' + iterations, | ||
repeat('-', title.length).join(''), | ||
'Total: ' + cyan(result / 1e6 + ' ms'), | ||
// 'Average: ' + cyan(result / iterations + ' ns') | ||
].forEach(function(line) { | ||
out.write(line + '\n'); | ||
out.write(' ' + line + '\n'); | ||
}); | ||
@@ -36,2 +37,16 @@ }; | ||
/** | ||
* Repeat | ||
* | ||
* @param {Any} l | ||
* @param {Number} i | ||
* @returns {Array} | ||
*/ | ||
function repeat(l, i){ | ||
var res = []; | ||
while (i--) res.push(l); | ||
return res; | ||
}; | ||
/** | ||
* Yellow | ||
@@ -38,0 +53,0 @@ * |
{ | ||
"name": "b" | ||
, "version": "2.0.0" | ||
, "version": "2.0.1" | ||
, "description": "Benchmarks for Node.js." | ||
@@ -5,0 +5,0 @@ , "keywords": ["benchmarks", "benchmarking"] |
@@ -1,7 +0,1 @@ | ||
/*! | ||
* B - Benchmarks for Node.js. | ||
* | ||
* Veselin Todorov <hi@vesln.com> | ||
* MIT License. | ||
*/ | ||
@@ -11,2 +5,3 @@ /** | ||
*/ | ||
var should = require('chai').should(); | ||
@@ -16,5 +11,4 @@ | ||
* Benchmark | ||
* | ||
* @type {Function} | ||
*/ | ||
var Benchmark = require('../lib/benchmark'); | ||
@@ -24,5 +18,4 @@ | ||
* Reporter | ||
* | ||
* @type {Function} | ||
*/ | ||
var Reporter = require('../lib/reporters/cli'); | ||
@@ -32,5 +25,4 @@ | ||
* Subject | ||
* | ||
* @type {Function} | ||
*/ | ||
var b = require('..'); | ||
@@ -37,0 +29,0 @@ |
@@ -1,7 +0,1 @@ | ||
/*! | ||
* B - Benchmarks for Node.js. | ||
* | ||
* Veselin Todorov <hi@vesln.com> | ||
* MIT License. | ||
*/ | ||
@@ -11,2 +5,3 @@ /** | ||
*/ | ||
var should = require('chai').should(); | ||
@@ -16,5 +11,4 @@ | ||
* Test Reporter | ||
* | ||
* @type {Function} | ||
*/ | ||
var TestReporter = require('./support/test_reporter'); | ||
@@ -24,5 +18,4 @@ | ||
* Subject | ||
* | ||
* @type {Function} | ||
*/ | ||
var Benchmark = require('..'); | ||
@@ -29,0 +22,0 @@ |
@@ -1,7 +0,1 @@ | ||
/*! | ||
* B - Benchmarks for Node.js. | ||
* | ||
* Veselin Todorov <hi@vesln.com> | ||
* MIT License. | ||
*/ | ||
@@ -11,16 +5,15 @@ /** | ||
*/ | ||
var should = require('chai').should(); | ||
/** | ||
* Fake Stream | ||
* | ||
* @type {Function} | ||
* Fake Stream. | ||
*/ | ||
var FakeStream = require('./support/fake_stream'); | ||
/** | ||
* Subject | ||
* | ||
* @type {Function} | ||
* Subject. | ||
*/ | ||
var Reporter = require('../lib/reporters/cli'); | ||
@@ -56,6 +49,7 @@ | ||
reporter.report('Test benchmark', 1000000, 100); | ||
stream.out[0].should.eq('Test benchmark'); | ||
stream.out[2].should.eq('Iterations: 100'); | ||
stream.out[3].should.eq('Result: 1 ms'); | ||
var buf = stream.out.join(''); | ||
buf.should.include('Test benchmark'); | ||
buf.should.include('x 100'); | ||
buf.should.match(/Total: +1 ms/); | ||
}); | ||
}); |
@@ -1,7 +0,1 @@ | ||
/*! | ||
* B - Benchmarks for Node.js. | ||
* | ||
* Veselin Todorov <hi@vesln.com> | ||
* MIT License. | ||
*/ | ||
@@ -11,4 +5,5 @@ /** | ||
* | ||
* @api public | ||
* @constructor | ||
*/ | ||
function FakeStream() { | ||
@@ -24,2 +19,3 @@ this.out = []; | ||
*/ | ||
FakeStream.prototype.write = function(input) { | ||
@@ -39,2 +35,3 @@ this.out.push(normalize(input)); | ||
*/ | ||
function normalize(string) { | ||
@@ -50,2 +47,3 @@ return string.replace(/\x1B\[[0-9;]*[mK]/g, '') | ||
*/ | ||
module.exports = FakeStream; |
@@ -1,7 +0,1 @@ | ||
/*! | ||
* B - Benchmarks for Node.js. | ||
* | ||
* Veselin Todorov <hi@vesln.com> | ||
* MIT License. | ||
*/ | ||
@@ -13,2 +7,3 @@ /** | ||
*/ | ||
function TestReporter() {}; | ||
@@ -24,2 +19,3 @@ | ||
*/ | ||
TestReporter.prototype.report = function(name, result, iterations) { | ||
@@ -34,2 +30,3 @@ this.name = name; | ||
*/ | ||
module.exports = TestReporter; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14477
465
1