Comparing version 1.0.1 to 1.0.2
14
index.js
@@ -1,4 +0,4 @@ | ||
var S = 'seconds'; | ||
var MS = 'milliseconds'; | ||
var NS = 'nanoseconds'; | ||
var S = 's'; | ||
var MS = 'ms'; | ||
var NS = 'ns'; | ||
@@ -8,9 +8,9 @@ function hirestime() { | ||
return function(unit) { | ||
return function (unit) { | ||
var elapsed = process.hrtime(start); | ||
var time; | ||
if(unit === S) time = elapsed[0] + elapsed[1] / 1e9; | ||
else if(unit === NS) time = elapsed[0] * 1e9 + elapsed[1]; | ||
else if(unit === MS || !unit || !time) time = elapsed[0] * 1e3 + elapsed[1] / 1e6; | ||
if (unit === S) time = elapsed[0] + elapsed[1] / 1e9; | ||
else if (unit === NS) time = elapsed[0] * 1e9 + elapsed[1]; | ||
else if (unit === MS || !unit || !time) time = elapsed[0] * 1e3 + elapsed[1] / 1e6; | ||
@@ -17,0 +17,0 @@ return parseInt(time * 100, 10) / 100; |
{ | ||
"name": "hirestime", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "thin wrapper around process.hrtime", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
5379