Comparing version 1.1.0 to 1.1.2
27
index.js
@@ -1,2 +0,2 @@ | ||
/*jslint node, white, this, for */ | ||
/* eslint no-param-reassign:0 */ | ||
@@ -13,12 +13,11 @@ /** | ||
* // some heavy stuff here... | ||
* console.log(perfy.end('loop-test').summary); | ||
* console.log(perfy.end('loop-test').time); | ||
*/ | ||
module.exports = (function () { | ||
'use strict'; | ||
// See https://nodejs.org/api/process.html#process_process_hrtime | ||
//--------------------------------- | ||
// -------------------------------- | ||
// CLASS: PerfyItem | ||
//--------------------------------- | ||
// -------------------------------- | ||
@@ -64,5 +63,5 @@ function PerfyItem(name) { | ||
}; | ||
o.time = parseFloat(o.seconds + '.' + Math.round(o.milliseconds)); | ||
o.time = Number(((o.seconds * 1000 + o.milliseconds) / 1000).toFixed(3)); | ||
var n = this.name ? this.name + ': ' : ''; | ||
o.summary = n + o.time.toFixed(3) + ' sec.'; | ||
o.summary = n + o.time + ' sec.'; | ||
this.result = o; | ||
@@ -72,5 +71,5 @@ return o; | ||
//--------------------------------- | ||
// -------------------------------- | ||
// CLASS: perfy | ||
//--------------------------------- | ||
// -------------------------------- | ||
@@ -89,3 +88,3 @@ // storage for PerfyItem instances | ||
name = String(name); | ||
autoDestroy = autoDestroy === undefined ? true : autoDestroy; | ||
autoDestroy = typeof autoDestroy === 'undefined' ? true : autoDestroy; | ||
perfList[name] = new PerfyItem(name); | ||
@@ -121,3 +120,3 @@ perfList[name].autoDestroy = autoDestroy; | ||
if (!name) { throw new Error(ERR.NAME); } | ||
return !!perfList[name]; | ||
return Boolean(perfList[name]); | ||
}; | ||
@@ -180,8 +179,8 @@ | ||
//--------------------------------- | ||
// -------------------------------- | ||
// EXPORT | ||
//--------------------------------- | ||
// -------------------------------- | ||
return perfy; | ||
}()); | ||
}()); |
{ | ||
"name": "perfy", | ||
"version": "1.1.0", | ||
"version": "1.1.2", | ||
"description": "A simple, light-weight NodeJS utility for measuring code execution in high-resolution real times.", | ||
@@ -12,3 +12,4 @@ "author": { | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "grunt", | ||
"lint": "eslint index.js test" | ||
}, | ||
@@ -38,2 +39,3 @@ "repository": { | ||
"devDependencies": { | ||
"eslint": "^2.4.0", | ||
"grunt": "^0.4.5", | ||
@@ -40,0 +42,0 @@ "grunt-jasmine-nodejs": "^1.4.3" |
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
0
6777
3
3
1
0