benchmarked
Advanced tools
Comparing version 0.1.1 to 0.1.2
19
index.js
@@ -8,2 +8,3 @@ 'use strict'; | ||
var read = require('file-reader'); | ||
var hasValue = require('has-value'); | ||
var forOwn = require('for-own'); | ||
@@ -104,3 +105,3 @@ var Benchmark = require('benchmark'); | ||
onStart: function () { | ||
console.log(chalk.gray('\n#%s: %s'), ++i, name, lead); | ||
console.log(chalk.gray('#%s: %s'), ++i, name, lead); | ||
}, | ||
@@ -113,4 +114,2 @@ onComplete: function () { | ||
forOwn(add, function (fn, fnName) { | ||
benchmark | ||
@@ -124,6 +123,12 @@ .add(fnName, { | ||
onComplete: function () { | ||
if (options.expected) { | ||
console.log(' expected: [' + chalk.bold(fn.apply(null, args)) + ']'); | ||
if (options.result) { | ||
var res = fn.apply(null, args); | ||
var msg = chalk.bold('%j'); | ||
if (!hasValue(res)) { | ||
msg = chalk.red('%j'); | ||
} | ||
console.log(chalk.gray(' result: ') + msg, res); | ||
} else { | ||
cursor.write('\n'); | ||
} | ||
cursor.write('\n'); | ||
}, | ||
@@ -137,3 +142,3 @@ fn: function () { | ||
if (options.sample) { | ||
console.log('> ' + fnName + ':\n %j', fn(options.sample)); | ||
console.log('> ' + fnName + ':\n %j', fn.apply(null, options.sample)); | ||
} | ||
@@ -140,0 +145,0 @@ }); |
{ | ||
"name": "benchmarked", | ||
"description": "Easily generate benchmarks from a glob of files.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/jonschlinkert/benchmarked", | ||
@@ -42,4 +42,5 @@ "author": { | ||
"file-reader": "^0.1.0", | ||
"for-own": "^0.1.2" | ||
"for-own": "^0.1.2", | ||
"has-value": "^0.1.0" | ||
} | ||
} |
@@ -105,2 +105,2 @@ # benchmarked [![NPM version](https://badge.fury.io/js/benchmarked.svg)](http://badge.fury.io/js/benchmarked) | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 17, 2014._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 20, 2014._ |
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
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
17052
270
7
+ Addedhas-value@^0.1.0
+ Addedhas-value@0.1.0(transitive)